Skip to content

Crawler header names for BenchmarkTest00654, 00655 and 00658 to 00660 are not valid HTTP header names #9

Open

Description

@amarcalfaria

Five entries in data/benchmark-crawler-http.xml put the payload in a header name that HTTP can't carry:

<header name="http://localhost:5000/" value="BenchmarkTest00654"/>
<header name="http://localhost:5000/" value="BenchmarkTest00655"/>
<header name="name: safe data&#10;text: act like this is conf data" value="BenchmarkTest00658"/>
<header name="name: safe data&#10;text: act like this is conf data" value="BenchmarkTest00659"/>
<header name="name: safe data&#10;text: act like this is conf data" value="BenchmarkTest00660"/>

Header names are RFC 9110 tokens, so :, / and a newline aren't allowed in them. The crawler writes the line as is (addHeader in ServletTestCaseRequest.buildHeaders doesn't validate), and the server then splits at the first colon. Under gunicorn, BenchmarkTest00654 sees a header named Http, so request.headers.keys() yields Http and the handler ends up calling flask.redirect("Http") rather than redirecting to the URL the crawler meant. A bare newline inside the name, as in 00658 to 00660, isn't a valid header line either.

The same payloads work fine as form parameter names (BenchmarkTest00417 to 00420 and 00433 to 00435) because a form body can encode them. It's only the header slot that can't.

The Java crawler uses a benign token name for this family, for example whatever on BenchmarkTest00010, and has no non-token header names at all. Doing the same here would let the five cases run their intended path:

<header name="whatever" value="BenchmarkTest00654"/>

Related: #3 covered the underscore name on BenchmarkTest00656.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions