Explicit NO_PROXY /0 CIDR rules fail to bypass HTTP proxy for IP-literal requests
curl's NO_PROXY handling treats an explicit zero-bit CIDR rule ([redacted]/0 or ::/0) as an exact-address match rather than a match-all, so IP-literal requests are sent to the configured HTTP proxy instead of directly to the origin. The proxy can then see the request path and origin Basic credentials supplied with --user.
- Disclosed after 2 days
Summary:
With an HTTP proxy configured, I found that curl sends IPv4 address-literal requests through it with NO_PROXY=0.0.0.0/0, and IPv6 address-literal requests through it with NO_PROXY=::/0. A zero-bit CIDR prefix should match every address in its family, so those requests should bypass the proxy. A mixed rule such as NO_PROXY=0.0.0.0/0,::/0 lets a caller keep numeric destinations direct while continuing to proxy named hosts. In my local proof of concept, the proxy received an absolute-form HTTP request target including the /private path and a synthetic origin Authorization header, while /1 controls connected directly to the origins. I used AI assistance during the investigation and drafting, then reviewed the attached PoC and evidence myself.
Affected version
Reproduced with curl source tag curl-8_23_0 (commit 3163ec065643ba20709f190111f42c3e1fe95273) on macOS, Darwin 25.5.0, arm64. The local CMake build reports 8.23.0-DEV in its version banner; the checkout is the exact curl-8_23_0 tag.
$ /path/to/built/curl -V
curl 8.23.0-DEV (Darwin) libcurl/8.23.0-DEV OpenSSL/4.0.3 nghttp2/1.70.0
Steps To Reproduce:
-
Build curl from tag
curl-8_23_0, or use a curl 8.23.0 executable. Extract the attachedcurl-no-proxy-zero.zipwithunzip curl-no-proxy-zero.zipand enterpackage-no-proxy. -
From the extracted
package-no-proxydirectory, run the Python 3 standard-library PoC with the path to that curl executable:Shell python3 poc_no_proxy_zero.py /absolute/path/to/built/curl -
The script starts only local loopback origin and proxy listeners. It compares
NO_PROXY=0.0.0.0/0withNO_PROXY=0.0.0.0/1,NO_PROXY=::/0withNO_PROXY=::/1when IPv6 loopback is available, and the mixed0.0.0.0/0,::/0rule with a named-host control. It uses only the synthetic credentialdemo:secretand makes no external network request. -
Expected: the
/0rules send IP-literal requests directly to their origins, while the mixed rule still proxies the named host. Observed: both/0IP-literal requests reach the proxy with an absolute-form request target and origin Basic credentials; the/1controls reach their origins directly and the named host remains proxied. One local run included:Text NO_PROXY=0.0.0.0/0: reached proxy, including origin Basic credentials GET http://127.0.0.1:58653/private HTTP/1.1 Authorization: Basic ZGVtbzpzZWNyZXQ= NO_PROXY=0.0.0.0/1: reached origin directly (control) NO_PROXY=::/0: reached proxy, including origin Basic credentials NO_PROXY=::/1: reached IPv6 origin directly (control)
The source explains the result: lib/proxy.c:166,175-189 gives a bare address and an explicit /0 the same bits = 0 value; cidr4_match() at lines 72-86 treats zero as an exact-address comparison, and cidr6_match() at lines 101-103 changes zero to 128 bits. The ZIP includes the complete PoC, line-numbered source and documentation excerpts, and the captured local run.
Impact
Summary:
When a caller uses /0 to keep IP-literal destinations off a configured HTTP proxy while still proxying named hosts, curl can instead send the proxy an absolute-form HTTP request target including its path, plus origin Authorization credentials supplied with --user. The proxy or its logs can therefore receive paths and credentials intended only for the origin. This requires an explicit /0 rule, a configured proxy, and a sensitive plain-HTTP request; a conventional HTTPS CONNECT proxy does not see origin headers inside TLS without interception. Suggested severity: Low.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the CIDR matching code maps an explicit /0 prefix to the same zero-bit value used for a bare address, and the match functions then treat zero as an exact-address comparison (or, for IPv6, convert it to a full 128-bit match), so a match-all rule never matches.
Impact
Paths and origin credentials intended only for the origin could be exposed to the proxy or its logs, though this needs an explicit /0 rule, a configured proxy and a sensitive plain-HTTP request, and a conventional HTTPS CONNECT proxy does not see origin headers inside TLS without interception.
What the attacker needed
Explicit /0 NO_PROXY rule; an HTTP proxy configured; sensitive plain-HTTP request with --user
How it was found
- Build curl from the 8.23.0 tag or use a 8.23.0 executable and extract the attached PoC package.
- Run the Python standard-library PoC script, passing the path to the curl executable.
- The script starts local loopback origin and proxy listeners and compares /0 rules against /1 controls and a named-host control.
- Observe that the /0 IP-literal requests reach the proxy with an absolute-form target and origin Basic credentials, while the /1 controls connect directly.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A proxy is a middle server that fetches web pages on your behalf, and NO_PROXY is a setting that lists destinations curl should contact directly instead of via the proxy. A /0 rule is meant to mean 'every address', but curl compared it as if it were one specific address, so the request went to the proxy along with the login details meant only for the real server.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.