Skip to content
Info disclosure Disclosed report Intermediate CVE-2022-32207

CVE-2022-32207: Unpreserved file permissions

When curl saved cookies, alt-svc and hsts data to local files, the atomic rename could widen the file permissions, leaving the updated file accessible to more users than intended. An attacker could potentially read sensitive data such as cookies from the file.

nyymi Follow

Originally disclosed on HackerOne

Bounty$2,400 Medium View original
  • Fixed in 13 hours
  • Paid in 13 hours
  • Disclosed after 13 hours

Summary by the program

CVE-2022-32207: Unpreserved file permissions Project curl Security Advisory, June 27th 2022

VULNERABILITY When curl saves cookies, alt-svc and hsts data to local files, it makes the operation atomic by finalizing the operation with a rename from a temporary name to the final target file name.

In that rename operation, it might accidentally widen the permissions for the target file, leaving the updated file accessible to more users than intended.

We are not aware of any exploit of this flaw.

INFO CVE-2022-32207 was introduced in commit b834890a3fa3f52, shipped in curl 7.69.0.

This problem can be worked-around by using a strict umask.

CWE-281: Improper Preservation of Permissions

Severity: Medium

AFFECTED VERSIONS Affected versions: curl 7.69.0 to and including 7.83.1 Not affected versions: curl < 7.69.0 and curl >= 7.84.0 libcurl is used by many applications, but not always advertised as such!

THE SOLUTION A fix for CVE-2022-32207

RECOMMENDATIONS A - Upgrade curl to version 7.84.0

B - Apply the patch to your local version

C - Make extra precautions to protect saved files (ie strict umask)

TIMELINE This issue was reported to the curl project on May 17, 2022. We contacted distros@openwall on June 20.

libcurl 7.84.0 was released on June 27 2022, coordinated with the publication of this advisory.

CREDITS This issue was reported by Harry Sintonen. Patched by Daniel Stenberg.

Thanks a lot!

Security Advisory: https://curl.se/docs/CVE-2022-32207.html

The report

When curl saves cookies, alt-svc and hsts data to local files, it makes the operation atomic by finalizing the operation with a rename from a temporary name to the final target file name.

In that rename operation, it might accidentally widen the permissions for the target file, leaving the updated file accessible to more users than intended.

Impact

Information disclosure (cookie file in specific)

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 rename operation did not preserve the original file's permissions, so the new file inherited broader default permissions.

Impact

The updated file could become accessible to more users than intended, potentially disclosing information such as cookies; the advisory states no exploit is known.

What the attacker needed

Local access to the same machine; curl saves cookies/alt-svc/hsts to a file

The fix

The issue was fixed in curl 7.84.0; a workaround is to use a strict umask.

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.

curl is a tool that downloads and saves data, including cookies that can contain login sessions. When it updates a saved file, it briefly creates a temporary file and renames it; a mistake in that step could make the final file readable by other users on the same computer. That means someone else on the machine might see your cookies.

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 Internet Bug Bounty

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.