Skip to content

Fix CRLF injection in Net::HTTP CONNECT request line - #29

Merged
proxymesh merged 1 commit into
mainfrom
fix/net-http-connect-crlf
Sep 1, 2026
Merged

Fix CRLF injection in Net::HTTP CONNECT request line#29
proxymesh merged 1 commit into
mainfrom
fix/net-http-connect-crlf

Conversation

@cursor

@cursor cursor Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The Net::HTTP CONNECT patch interpolated conn_address, @address, and @port into the raw CONNECT request line without rejecting CR/LF/NUL. Extra CONNECT headers and Connection.connect already used that check; this path did not.

This lifts validate_connect_target! onto RubyProxyHeaders and runs it in connect_with_proxy_tunnel before any socket I/O. Specs cover host/port injection and assert that a rejected target writes no CONNECT bytes to the proxy.

bundle exec rspec — 29 examples, 0 failures (6 existing pending).

Open in Web View Automation 

Validate conn_address, @address, and @PORT for CR, LF, and NUL before
interpolating them into the raw CONNECT request. Extra CONNECT headers
and Connection.connect were already checked; the Net::HTTP patch was not.

Lift validate_connect_target! onto RubyProxyHeaders so both paths share
the same fail-fast check, and add specs that cover host/port injection
and that no CONNECT bytes are written on a rejected target.

Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
@proxymesh
proxymesh marked this pull request as ready for review September 1, 2026 17:16
@proxymesh
proxymesh merged commit 1149563 into main Sep 1, 2026
4 checks passed
@proxymesh
proxymesh deleted the fix/net-http-connect-crlf branch September 1, 2026 17:17
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.

2 participants