Skip to content

HTTP Request Method Parsing Error #278

@TUO-Wu

Description

@TUO-Wu

Summary

Hypercorn fails to correctly validate HTTP request methods, allowing attackers to exploit malformed methods for HTTP request smuggling attacks, bypassing frontend security measures and accessing backend resources.

Details

RFC 9112 says this:

The method token indicates the request method to be performed on the target resource. The request method is case-sensitive.

This implies that the request method must strictly adhere to the token definition—only specific characters are allowed and case sensitivity must be maintained. Hypercorn’s HTTP request method parser does not strictly enforce these RFC requirements when parsing request methods and accepts non-compliant methods.

Example

PoST / HTTP/1.1\r\n
Host: victim.com\r\n
\r\n

Suggested action
Strictly validate HTTP request methods according to RFC specifications and only accept methods that conform to the token definition. Any request with a non-compliant method should be rejected immediately with an appropriate error response.

PoC

The example request is embedded in the previous section. Send the request to the server, e.g. by echo -ne into nc.

Impact

This bug enables attackers to use HTTP request smuggling techniques to bypass front-end proxy security checks, thereby accessing sensitive resources that should remain protected. This can lead to sensitive data leakage and potentially serve as a gateway for further attacks, such as session hijacking or bypassing additional security measures.

The version we tested was 84d06b8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions