Public-suffix cookie injection when libpsl is disabled
When curl is built without libpsl, it accepts cookies with a Domain attribute set to a public suffix such as .co.uk. A malicious server can then plant a cookie that curl later sends to unrelated sibling domains that share the same cookie jar.
- Disclosed after 3 days
Summary: When libcurl is built without libpsl, Domain attribute validation accepts public suffixes like .co.uk, allowing a malicious host to plant cookies that are later sent to unrelated sibling domains using the same cookie jar. AI assistance was used to draft this report.
Steps to Reproduce:
- Build curl without libpsl (e.g.,
./configure --disable-shared --without-libpsl && make -j; confirmcurl --versionlists no PSL feature). - Run a local HTTP server that sets
Set-Cookie: sess=attack; Domain=.co.uk; Path=/when the Host header starts with attacker.co.uk (example:/tmp/curl/cookie_server.py 8000 <logpath>). - Store cookies:
/tmp/curl/src/curl -v --resolve attacker.co.uk:8000:127.0.0.1 http://attacker.co.uk:8000/ -c /tmp/cjar2. - Reuse the cookie jar on a different host:
/tmp/curl/src/curl -v --resolve victim.co.uk:8000:127.0.0.1 http://victim.co.uk:8000/ -b /tmp/cjar2. - Observe
Cookie: sess=attacksent to victim.co.uk and.co.ukstored in the jar (seeartifacts/cookie_server.logandartifacts/cookie_jar_public_suffix.txt).
Impact: A malicious server can inject cookies scoped to public suffixes and have them sent to unrelated domains, enabling session fixation or request poisoning in applications that reuse a shared cookie jar across multiple domains.
Impact
Look at original report impact
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 curl's cookie Domain validation relies on libpsl to reject public suffixes, and when built without libpsl it accepts them.
Impact
A malicious server could inject cookies scoped to public suffixes and have them sent to unrelated domains, enabling session fixation or request poisoning in applications that reuse a shared cookie jar across multiple domains.
What the attacker needed
Curl built without libpsl; attacker controls a host under the public suffix; victim reuses the same cookie jar across domains
How it was found
- Build curl without libpsl and confirm the version output has no PSL feature.
- Run a local HTTP server that sets a cookie with Domain .co.uk when the Host header starts with attacker.co.uk.
- Use curl to request attacker.co.uk and save the cookies to a jar file.
- Reuse the same cookie jar to request victim.co.uk.
- Observe that the cookie is sent to victim.co.uk and the public-suffix cookie is stored in the jar.
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 cookie is a small piece of data a website asks your browser or tool to store and send back later. Normally a site can only set cookies for its own domain, but here curl was built without a list of public suffixes (like .co.uk) and so it wrongly allowed a cookie for the whole suffix. That meant a bad site could plant a cookie that curl would later hand to a completely different site.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.