@@ -2511,9 +2511,13 @@ run_http_header() {
25112511 # Quit on first empty line to catch 98% of the cases. Next pattern is there because the SEDs tested
25122512 # so far seem not to be fine with header containing x0d x0a (CRLF) which is the usual case.
25132513 # So we also trigger also on any sign on a single line which is not alphanumeric (plus _)
2514- sed -e '/^$/q' -e '/^[^a-zA-Z_0-9]$/q' $HEADERFILE >$HEADERFILE.tmp
2514+ #
2515+ # Also we use tr here to remove any crtl chars which the server side offers --> possible security problem
2516+ # Only allowed now is LF + CR. See #2337
2517+ # awk, see above, doesn't seem to care
2518+ sed -e '/^$/q' -e '/^[^a-zA-Z_0-9]$/q' $HEADERFILE | tr -d '\000-\011\013\014\016-\037' >$HEADERFILE.tmp
25152519 # Now to be more sure we delete from '<' or '{' maybe with a leading blank until the end
2516- sed -e '/^ *<.*$/d' -e '/^ *{.*$/d' $HEADERFILE.tmp >$HEADERFILE
2520+ sed -e '/^ *<.*$/d' -e '/^ *{.*$/d' $HEADERFILE.tmp >$HEADERFILE
25172521 debugme echo -e "---\n $(< $HEADERFILE) \n---"
25182522
25192523 HTTP_STATUS_CODE=$(awk '/^HTTP\// { print $2 }' $HEADERFILE 2>>$ERRFILE)
@@ -2588,7 +2592,7 @@ match_ipv4_httpheader() {
25882592
25892593 # Exclude some headers as they are mistakenly identified as ipv4 address. Issues #158, #323.
25902594 # Also facebook used to have a CSP rule for 127.0.0.1
2591- headers="$(grep -Evai "$excluded_header" $HEADERFILE)"
2595+ headers="$(grep -Evai "$excluded_header" $HEADERFILE 2>/dev/null )"
25922596 if [[ "$headers" =~ $ipv4address ]]; then
25932597 pr_bold " IPv4 address in header "
25942598 while read line; do
0 commit comments