Skip to content

fix: problematic parsing leniency in parsing chunk extensions#3327

Open
JeppW wants to merge 2 commits into
benoitc:masterfrom
JeppW:fix-chunk-extension-parsing
Open

fix: problematic parsing leniency in parsing chunk extensions#3327
JeppW wants to merge 2 commits into
benoitc:masterfrom
JeppW:fix-chunk-extension-parsing

Conversation

@JeppW

@JeppW JeppW commented Nov 24, 2024

Copy link
Copy Markdown

Stop allowing newline characters in chunk extensions. This can cause request smuggling issues with some reverse proxies.

Reference: https://grenfeldt.dev/2021/10/08/gunicorn-20.1.0-public-disclosure-of-request-smuggling/

@pajod

pajod commented Nov 24, 2024

Copy link
Copy Markdown
Contributor

Any thoughts on singling out just the newline, among multiple characters that could conceivably cause trouble behind a robustdangerous proxy?

@JeppW

JeppW commented Nov 24, 2024

Copy link
Copy Markdown
Author

AFAIK only the newline has ever been shown to be exploitable in practice. Perhaps we should disallow \r as well, it seems plausible that a proxy could misinterpret \rX as a line terminator. Other than that, I think further validation would just be unnecessary overhead.

@JeppW

JeppW commented Nov 26, 2024

Copy link
Copy Markdown
Author

I added the \r as we agreed.

@benoitc

benoitc commented Jan 15, 2025

Copy link
Copy Markdown
Owner

On hwich specification is based this change?

@pajod

pajod commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

@benoitc You can reference the 2022 one. Control chars were never supposed to appear in chunk extensions:
https://datatracker.ietf.org/doc/html/rfc2068#section-3.6
https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1
https://datatracker.ietf.org/doc/html/rfc7230#section-4.1.1
https://datatracker.ietf.org/doc/html/rfc9112#section-7.1.1

The choice of \r\n (and possibly \0) is arbitrary and based on bugs in real-world software, but similar considerations as in rfc9110 section 5.5 apply.

@pajod

pajod commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

(only) CR rejected since bdb2ebd

@benoitc benoitc closed this Mar 27, 2026
@benoitc benoitc reopened this Mar 27, 2026
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

Successfully merging this pull request may close these issues.

3 participants