Skip to content

fastcgi: do not pass client Proxy header as HTTP_PROXY - #4367

Open
Ramya-9353 wants to merge 1 commit into
zalando:masterfrom
Ramya-9353:fastcgi-drop-http-proxy
Open

Ramya-9353 wants to merge 1 commit into
zalando:masterfrom
Ramya-9353:fastcgi-drop-http-proxy

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

Regression test against master, go test ./proxy/fastcgi -run TestFastCgiDropsProxyHeader:

fastcgi_test.go:107: Proxy header passed to FastCGI application as HTTP_PROXY: "http://attacker.example:3128"
--- FAIL: TestFastCgiDropsProxyHeader (0.00s)

Expected: a client supplied Proxy header never reaches the FastCGI application. Actual: gofast.MapHeader maps it to HTTP_PROXY, which PHP getenv("HTTP_PROXY") and CGI-unaware HTTP clients read as the outbound proxy, so any client can route the application's outgoing requests through a host it controls (httpoxy, CVE-2016-5385 class). Proxy is not in the proxy's hop header list, so nothing strips it earlier.

Fix: delete HTTP_PROXY in the existing param middleware in NewRoundTripper, next to the REQUEST_SCHEME cleanup. This matches what Go's net/http/cgi, nginx and Apache do. The test passes with the patch; go vet and staticcheck are clean for the package.

Signed-off-by: Ramya Eliger <ramya@digiscrypt.com>
@szuecs szuecs added the bugfix Bug fixes and patches label Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fixes and patches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants