HexBrain

Internet Bug Bounty · Report #1565615

CVE-2022-27779: cookie for trailing dot TLD

Validstatus
mediumseverity
27upvotes
11 Jun 2022disclosed

Summary

cookie for trailing dot TLD

Project curl Security Advisory, May 11 2022 - Permalink

VULNERABILITY

libcurl wrongly allows cookies to be set for Top Level Domains (TLDs) if the host name is provided with a trailing dot.

curl can be told to receive and send cookies. curl's "cookie engine" can be built with or without Public Suffix List awareness. If PSL support not provided, a more rudimentary check exists to at least prevent cookies from being set on TLDs. This check was broken if the host name in the URL uses a trailing dot.

This can allow arbitrary sites to set cookies that then would get sent to a different and unrelated site or domain.

We are not aware of any exploit of this flaw.

INFO

This vulnerability only exists when curl is built without libpsl. Without this PSL support built-in, curl is also destined to possibly leak cookies cross sites simply due to how public suffixes work.

This flaw was introduced in commit b27ad8e1d3e68e, shipped in curl 7.83.0 when the treatment of trailing dot host names was changed.

This flaw is similar to CVE-2014-3620, although in 2014 curl did not have PSL support.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2022-27779 to this issue.

CWE-201: Information Exposure Through Sent Data

Severity: Medium

AFFECTED VERSIONS

libcurl is used by many applications, but not always advertised as such!

THE SOLUTION

A fix for CVE-2022-27779

RECOMMENDATIONS

A - Upgrade curl to version 7.83.1

B - Apply the patch to your local version

C - Build libcurl with libpsl support

D - Do not use cookies

TIMELINE

This issue was reported to the curl project on April 28, 2022. We contacted distros@openwall on May 5.

libcurl 7.83.1 was released on May 11 2022, coordinated with the publication of this advisory.

CREDITS

This issue was reported by Alex Chong. Patched by Daniel Stenberg.

LINK TO THE ADVISORY

https://curl.se/docs/CVE-2022-27779.html

Writeup at https://haxatron.gitbook.io/vulnerability-research/vr2

How it was found

Published Advisory: https://curl.se/docs/CVE-2022-27779.html

Original Report: https://hackerone.com/reports/1553301

Impact

This can allow arbitrary sites to set cookies that then would get sent to a different and unrelated site or domain. (ie. conduct session fixation attacks.)

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original