Skip to content

reqs: remove trailing whitespace from header names - #624

Merged
rofl0r merged 2 commits into
tinyproxy:masterfrom
rofl0r:header_whitespace
Aug 30, 2026
Merged

rofl0r merged 2 commits into
tinyproxy:masterfrom
rofl0r:header_whitespace

Conversation

@rofl0r

@rofl0r rofl0r commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

a header line like "Content-Length : 42" was split into "Content-Length " and "42", leaving the trailing whitespace and allowing an attacker to forward multiple content-length or transfer-encoding headers, circumventing the existing request-smuggling guards.

closes #623

a header line like "Content-Length : 42" was split into
"Content-Length " and "42", leaving the trailing whitespace
and allowing an attacker to forward multiple content-length
or transfer-encoding headers, circumventing the existing
request-smuggling guards.

closes tinyproxy#623

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Tinyproxy’s request header parsing to prevent bypassing existing request-smuggling guards by inserting whitespace before the : in header lines (e.g., Content-Length : 42), addressing #623.

Changes:

  • Trims trailing SP/HTAB from the header name immediately before the colon so de-duplication matches Content-Length: and Content-Length :.
  • Simplifies header-line length handling by no longer recomputing len after splitting the header.
Suppressed comments (1)

src/reqs.c:662

  • This security-hardening path (normalizing whitespace before the colon so CL/TE de-dup works) doesn’t appear to be covered by the existing CI test suite. make test runs tests/scripts/run_tests.sh, which uses tests/scripts/webclient.pl; that client currently can’t send custom raw header lines (no option beyond method/version/entity), so there’s no regression test for the "Content-Length : 100" / "Transfer-Encoding : chunked" bypass described in #623.

Consider adding an integration regression test that sends headers containing whitespace before : and asserts they are normalized (or rejected) such that duplicates are not forwarded.

        /* prevent multiple CL/TE headers from being inserted */
        if (check_duplicate_header(hashofheaders, header, "content-length") ||
            check_duplicate_header(hashofheaders, header, "transfer-encoding"))
                return 0;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/reqs.c
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@rofl0r
rofl0r merged commit 5a522b6 into tinyproxy:master Aug 30, 2026
4 checks passed
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.

Space handling prior to colon allows bypass of CVE-2026-54388 fix

2 participants