Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertRequiredHeaders() is easy to bypass #9

Open
brightbyte opened this issue Jun 18, 2024 · 0 comments
Open

assertRequiredHeaders() is easy to bypass #9

brightbyte opened this issue Jun 18, 2024 · 0 comments

Comments

@brightbyte
Copy link

assertRequiredHeaders() will only complain about unsigned headers if they are actually present in the request:

        $requestHeaders = array_keys($request->getHeaders());
        $required = array_intersect($this->getRequiredHeaders($method), $requestHeaders);

        $missing = array_diff($required, $headers);

This allows requests to be accepted from sloppy clients that omit cricial information. Requests from such clients can be intercepted, manipulated, and re-played. E.g. a post request without a digest header would succeed even if the digest header was required for post requests. Such a request can be intercepted, the body manipulated, and then resent unnoticed.

Note that $request->getHeaders() will return the header names in whatever form the client sent them, not norlaized to lower-case. If the required headers a all lower case, and the client sends all upper-case headers, none of the headers will be considered "required".

Also note that the current behavior makes it impossible to effectively require (request-target), since that is never present as a header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant