Skip to content
Info disclosure Write-up Intermediate

CVE-2022-0337 System environment variables leak on Google Chrome, Microsoft Edge and Opera

A vulnerability in Chromium's File System Access API allowed a website to read system environment variables by suggesting a filename containing an environment variable placeholder. An attacker could leak secrets such as cloud keys or tokens stored in environment variables.

Maciej Pulikowski Follow

Published on github.com

Bounty$10,000total stated by author View original

BranchesTags

Maciej Pulikowski (@pulik_io), on github.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The File System Access API did not sanitise environment variable placeholders in the suggested filename, allowing them to be expanded when the save dialog was shown.

Impact

An attacker could leak secrets stored in environment variables, such as cloud access keys or API tokens, but only on Windows and only if the user interacts with the save dialog.

What the attacker needed

Windows operating system; Vulnerable browser version (Chrome/Edge 92-96, Opera 78-82); Victim visits a malicious website; Victim interacts with the save file dialog

The fix

The issue was fixed in Chromium 97 by sanitising the suggested filename, for example by replacing the percent character.

How it was found

  1. Open the browser's developer tools console.
  2. Call the file save picker with a suggested name containing an environment variable placeholder.
  3. Save the file.
  4. Observe that the returned filename contains the expanded environment variable value.

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 write-up has not been written yet. The Original tab links to the source.

When you save a file, the browser suggests a name. In some versions of Chrome, Edge, and Opera on Windows, that suggested name could include special placeholders like %USERNAME%, and the browser would replace them with the actual value from your computer's environment variables. This meant a malicious website could trick you into saving a file and then read those values, which might include passwords or API keys.

What is Info disclosure?

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

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.