Skip to content
Info disclosure Disclosed report Intermediate

Cookie exposure due to unexpected file permission change

libcurl from version 7.72.0 onwards changes the permissions of an existing cookie jar file to be group and world readable, regardless of its previous permissions. An attacker with local access to the same system could then read confidential cookie data stored in that file.

nyymi Follow

Originally disclosed on HackerOne

Medium 4.0 View original
  • Disclosed after 5.0 years

Summary:

libcurl since 7.72.0 changes file specified in CURLOPT_COOKIEJAR to group and world readable, regardless of prior file permissions of an already existing file (assuming typical default umask of 022). This is unexpected as typically file permissions of an already existing file are not changed. Indeed, libcurl prior to this version keeps the original file permissions, as expected.

Steps To Reproduce:

  1. install -m 600 /dev/null cookie.jar
  2. ls -l cookie.jar
  3. curl -s -c cookie.jar https://www.google.com -o /dev/null
  4. ls -l cookie.jar

Supporting Material/References:

Impact

Leak of confidential information stored in the CURLOPT_COOKIEJAR (libcurl) or -c / --cookie-jar (curl command line tool) file.

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 cookie jar file is opened in a way that recreates or truncates it with default permissions rather than preserving the existing file's mode.

Impact

Confidential information stored in the cookie jar file could be leaked to other local users.

What the attacker needed

Local access to the same system; another user can read group/world files

How it was found

  1. Create an empty cookie jar file with owner-only permissions.
  2. Check the file's permissions.
  3. Run curl with the cookie jar option against a site.
  4. Check the permissions again and observe they changed.

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.

When a program writes a file, it normally keeps the permissions that file already had. Here, a library used to download things (libcurl) quietly made an existing cookie file readable by other users on the same machine. Cookies can hold login sessions, so anyone else on that computer could read them and possibly act as the user.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by nyymi

View all

51 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.