bin/contrib/rc-httpd{rc-httpd, handlers/error}: do some minimal sanitization on $SERVER_NAME before handing it off to select-handler. this prevents malformed Host: headers from retrieving arbitrary files from the file system. (thanks, Lightning)
This commit is contained in:
parent
4e454ff73b
commit
3a90e2da78
1 changed files with 5 additions and 0 deletions
|
|
@ -86,6 +86,11 @@ if(~ $#SERVER_NAME 2){
|
||||||
SERVER_PORT=$SERVER_NAME(2)
|
SERVER_PORT=$SERVER_NAME(2)
|
||||||
SERVER_NAME=$SERVER_NAME(1)
|
SERVER_NAME=$SERVER_NAME(1)
|
||||||
}
|
}
|
||||||
|
switch($SERVER_NAME){
|
||||||
|
case */* ..
|
||||||
|
error 400
|
||||||
|
exit
|
||||||
|
}
|
||||||
if(~ $REQUEST_METHOD (PUT POST)){
|
if(~ $REQUEST_METHOD (PUT POST)){
|
||||||
if(! ~ $"CONTENT_LENGTH '')
|
if(! ~ $"CONTENT_LENGTH '')
|
||||||
trim_input | exec $rc_httpd_dir/select-handler
|
trim_input | exec $rc_httpd_dir/select-handler
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue