Inappropriate implementation in Downloads (CVE-2024-5843)
Chrome's download file-type metadata did not classify Python zip-archive files (.pyz and .pyzw) as dangerous, even though they are executable. An attacker could deliver such a file and it would download without the warning Chrome shows for other Python file types.
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Security Bug
Important: Please do not change the component of this bug manually.
Please READ THIS FAQ before filing a bug: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/security/faq.md
Please see the following link for instructions on filing security bugs: https://www.chromium.org/Home/chromium-security/reporting-security-bugs
Reports may be eligible for reward payments under the Chrome VRP: https://g.co/chrome/vrp
NOTE: Security bugs are normally made public once a fix has been widely deployed.
VULNERABILITY DETAILS Please provide a brief explanation of the security issue.
VERSION Chrome Version: 123.0.6312.123 Operating System: windows
REPRODUCTION CASE The metadata describe file-type download behavior in Chrome stored in download_file_types.asciipb:
We can see python related file marked as ALLOW_ON_USER_GESTURE : py/pyc/pyd/pyo/pyw. But pyz and pyzw files are also dangerous, they are executable python zip archives:
https://docs.python.org/3.9/library/zipapp.html
I have uploaded app.pyz and app.pyzw, they can pop a calc on windows. And as you can see in screenshot.png, I get a warning when download py file in edge but no warning when download pyzw.
Context
Chrome decides what to do with a downloaded file partly from a metadata table that maps file extensions to a download behaviour. That table lives in the Chromium source tree as download_file_types.asciipb, under the Safe Browsing component resources. The behaviour assigned to an extension determines whether Chrome lets the file through silently, warns the user, or blocks it.
The report concerns the handling of Python-related file types in that table. The researcher's claim is that two dangerous Python extensions are missing from the list of extensions that require a user gesture, so Chrome treats them as harmless downloads.
Setup
The researcher tested on:
- Chrome version 123.0.6312.123
- Windows
No accounts, roles or special tooling are described. The only artefacts mentioned are two files the researcher uploaded, app.pyz and app.pyzw, plus a screenshot named screenshot.png.
Finding it
The starting point is the metadata file itself:
https://source.chromium.org/chromium/chromium/src/+/main:components/safe_browsing/content/resources/download_file_types.asciipb
In that table, the Python-related extensions py, pyc, pyd, pyo and pyw are marked ALLOW_ON_USER_GESTURE. That marking means Chrome does not simply allow the download; it applies the user-gesture condition associated with that behaviour.
The researcher points out that pyz and pyzw are also dangerous: they are executable Python zip archives, as documented in the Python standard library:
https://docs.python.org/3.9/library/zipapp.html
Because pyz and pyzw are absent from the ALLOW_ON_USER_GESTURE group, Chrome does not apply the same treatment to them as to the other Python extensions. The researcher demonstrated the difference by downloading a .py file in Edge, which produced a warning, and downloading a .pyzw file, which produced no warning. The screenshot screenshot.png is cited as showing this contrast.
Exploitation
Step 1: Build executable Python zip archives
The researcher created two files, app.pyz and app.pyzw. Both are Python zip archives that, when executed, open the Windows calculator. The report does not include the contents of these files.
Step 2: Download them through Chrome
With Chrome 123.0.6312.123 on Windows, the researcher downloaded app.pyz and app.pyzw. The report states that both files can pop a calculator on Windows, and that no warning appears when downloading the pyzw file, in contrast to the warning seen for a py file in Edge.
Step 3: Compare with the warned case
The comparison case is a .py download in Edge, which shows a warning. The .pyzw download does not show a warning. This is the observable difference the report is built on.
Root cause
The metadata table download_file_types.asciipb lists py, pyc, pyd, pyo and pyw as ALLOW_ON_USER_GESTURE, but does not list pyz or pyzw. Since pyz and pyzw are executable Python zip archives, they belong in the same risk category as the extensions that are listed. The omission means Chrome's download handling does not apply the user-gesture restriction to them, so the download proceeds without the warning that the other Python extensions trigger.
The report does not describe any code change or additional defence beyond the metadata table. The existing defence, the extension-to-behaviour mapping, simply does not cover these two extensions.
Impact
An attacker who can get a victim to download a .pyz or .pyzw file through Chrome on Windows can deliver an executable Python zip archive without a warning. The researcher demonstrated the payload by having it open the calculator. The report does not describe any further exploitation, persistence or delivery mechanism, and does not state what the victim must do after the download for the archive to execute.
Fix
The change implied by the finding is to add pyz and pyzw to the ALLOW_ON_USER_GESTURE group in download_file_types.asciipb, alongside py, pyc, pyd, pyo and pyw, so that Chrome applies the same user-gesture restriction to them.
Variants to test
- Other executable archive formats that Python or similar runtimes can produce, such as additional zipapp extensions. A positive result is a download that completes without the warning shown for the equivalent listed extension.
- Other entries in
download_file_types.asciipbwhere a family of related extensions is only partially covered. A positive result is a sibling extension that behaves differently from the rest of its family. - The same comparison across browsers: download the same file in Chrome and in Edge and compare the warnings. A positive result is a warning in one browser and none in the other for the same file type.
Hunting notes
This kind of bug hides in static configuration tables that map file types, MIME types or extensions to security behaviour. The signal during recon is a table or list where a family of related extensions is enumerated and one or two members are missing. Comparing the table against the documentation of the runtime that produces those files is a quick way to spot the gap.
The researcher showed impact by producing working files (app.pyz and app.pyzw) that open the calculator on Windows, and by contrasting the warned .py case with the unwarned .pyzw case. That concrete demonstration, rather than a theoretical argument about the extension list, is what makes the omission a security issue rather than a documentation nit.
What happened, in plain words
When you download a file in Chrome, the browser does not treat every file the same way. For some file types it stays quiet and saves the file. For others it shows a warning, or refuses the download outright. Chrome decides which of these happens by looking up the file's extension (the letters after the last dot, like .pdf or .jpg) in a big reference table that ships with the browser.
That table is called download_file_types.asciipb. It is a plain text file that lives inside the Chrome source code, in the part of the browser responsible for Safe Browsing (Chrome's built-in protection against malicious sites and files). Each line in the table pairs a file extension with a behaviour, such as "allow silently", "warn the user" or "block".
The researcher who filed this report noticed that the table lists several Python-related extensions, py, pyc, pyd, pyo and pyw, and marks them ALLOW_ON_USER_GESTURE. That marking means Chrome does not just let the file through; it applies a condition based on whether the user did something deliberate (a "user gesture") to start the download.
But two other Python extensions, pyz and pyzw, are missing from that group. Those two are also dangerous: they are executable Python zip archives, meaning a single file that bundles Python code and runs it. Because they are not in that group, Chrome does not apply the same user-gesture condition to them.
The researcher built two files, app.pyz and app.pyzw, that open the Windows calculator when run, and compared a .py download in Edge (a warning appears) with a .pyzw download (no warning).
The background you need
A few ideas come up again and again in this report, so here they are from scratch.
File extension. The part of a file name after the final dot. Your computer and your browser use it as a hint about what kind of file it is and what should happen when you open it. It is only a label: anyone can rename a file, but the extension is what most software looks at first.
Metadata table. A list of facts stored in a structured form, used by a program to make decisions. Think of a restaurant's menu board: the kitchen does not invent a dish each time, it reads the board. Chrome reads download_file_types.asciipb the same way to decide how to handle a download.
Safe Browsing. A protection feature built into Chrome that tries to keep you away from dangerous sites and files. The table in this report sits in the Safe Browsing part of the browser's resources.
User gesture. An action a person takes on purpose, such as clicking a link or a download button, as opposed to something a web page does on its own. Security features often require a user gesture before allowing something risky, on the reasoning that a deliberate click is at least some evidence the person meant it. The everyday comparison: a bank teller will hand over cash if you ask at the counter, but will not post it to a stranger who phones in.
Python. A popular programming language. Programs written in it are usually run by a Python interpreter installed on the machine.
Python zip archive. A single file that packs Python code together with the information needed to run it. Python documents this format under the name "zipapp". The extensions .pyz and .pyzw are used for these archives. The everyday comparison: a zip archive is like a sealed envelope containing instructions; the .pyz extension tells Python "open this envelope and follow the instructions inside".
Executable. A file that, when opened in the right way, causes the computer to run code. The researcher's files are executable in the sense that running them opens the calculator.
Chromium source tree. The complete collection of source code files that make up the Chrome browser (and its open-source base, Chromium). It is public, so anyone can read the configuration files inside it.
Edge. Microsoft's web browser, which is built on the same underlying engine as Chrome. That shared engine is why comparing the two browsers is meaningful: they handle many file types in similar ways, so a difference in behaviour stands out.
What the researcher was testing
The test environment was:
- Chrome version 123.0.6312.123
- Windows
The report mentions no accounts, roles or special tools. The only artefacts are two files the researcher uploaded, app.pyz and app.pyzw, and a screenshot named screenshot.png.
Finding it
The starting point is the metadata file itself, which is public:
https://source.chromium.org/chromium/chromium/src/+/main:components/safe_browsing/content/resources/download_file_types.asciipb
This is a web address pointing at the file inside the public Chromium source code. Opening it shows the table Chrome uses to decide how to handle downloads. The researcher read it looking for Python-related entries.
In that table, the Python-related extensions py, pyc, pyd, pyo and pyw are marked ALLOW_ON_USER_GESTURE. That marking means Chrome does not simply allow the download; it applies the user-gesture condition associated with that behaviour.
The researcher then points out that pyz and pyzw are also dangerous, because they are executable Python zip archives. The evidence for that is the official Python documentation for the zipapp format:
https://docs.python.org/3.9/library/zipapp.html
This address leads to the Python documentation page that describes zipapp, the format behind .pyz files. The researcher cites it to show that these extensions are not obscure or harmless: they are a documented way of packaging runnable Python code.
Because pyz and pyzw are absent from the ALLOW_ON_USER_GESTURE group, Chrome does not apply the same treatment to them as to the other Python extensions. The researcher demonstrated the difference by downloading a .py file in Edge, which produced a warning, and downloading a .pyzw file, which produced no warning. The screenshot screenshot.png is cited as showing this contrast.
Reproducing it
Step 1: Build executable Python zip archives
The researcher created two files, app.pyz and app.pyzw. Both are Python zip archives that, when executed, open the Windows calculator. The report does not include the contents of these files.
Why this step matters: to show that the missing table entries are a real problem, the researcher needed files that actually do something visible when run. Opening the calculator is a harmless stand-in for whatever a real attacker might do. If the files did nothing, the report would only be an argument about a list; with working files, it is a demonstration.
Step 2: Download them through Chrome
With Chrome 123.0.6312.123 on Windows, the researcher downloaded app.pyz and app.pyzw. The report states that both files can pop a calculator on Windows, and that no warning appears when downloading the pyzw file, in contrast to the warning seen for a py file in Edge.
Why this step matters: the download is the moment where the missing table entry has its effect. Chrome is the browser under test, and the absence of a warning is the observable symptom.
Step 3: Compare with the warned case
The comparison case is a .py download in Edge, which shows a warning. The .pyzw download does not show a warning. This is the observable difference the report is built on.
Why this step matters: a single download with no warning could be explained away as normal behaviour. Showing that a closely related extension does produce a warning, in a browser built on the same engine, makes the gap in the table the obvious explanation.
Why it happens
The metadata table download_file_types.asciipb lists py, pyc, pyd, pyo and pyw as ALLOW_ON_USER_GESTURE, but does not list pyz or pyzw. Since pyz and pyzw are executable Python zip archives, they belong in the same risk category as the extensions that are listed. The omission means Chrome's download handling does not apply the user-gesture restriction to them, so the download proceeds without the warning that the other Python extensions trigger.
The report does not describe any code change or additional defence beyond the metadata table. The existing defence, the extension-to-behaviour mapping, simply does not cover these two extensions.
What an attacker could do with it
An attacker who can get a victim to download a .pyz or .pyzw file through Chrome on Windows can deliver an executable Python zip archive without a warning. The researcher demonstrated the payload by having it open the calculator. The report does not describe any further exploitation, persistence or delivery mechanism, and does not state what the victim must do after the download for the archive to execute.
In plain terms: the warning is a speed bump. It gives a person a moment to stop and think before opening a file that can run code. If the warning never appears for these two extensions, that moment is lost.
The fix
The change implied by the finding is to add pyz and pyzw to the ALLOW_ON_USER_GESTURE group in download_file_types.asciipb, alongside py, pyc, pyd, pyo and pyw, so that Chrome applies the same user-gesture restriction to them.
Other things worth testing
- Other executable archive formats that Python or similar runtimes can produce, such as additional zipapp extensions. A positive result is a download that completes without the warning shown for the equivalent listed extension.
- Other entries in
download_file_types.asciipbwhere a family of related extensions is only partially covered. A positive result is a sibling extension that behaves differently from the rest of its family. - The same comparison across browsers: download the same file in Chrome and in Edge and compare the warnings. A positive result is a warning in one browser and none in the other for the same file type.
How to look for this kind of bug yourself
This kind of bug hides in static configuration tables that map file types, MIME types or extensions to security behaviour. The signal during recon is a table or list where a family of related extensions is enumerated and one or two members are missing. Comparing the table against the documentation of the runtime that produces those files is a quick way to spot the gap.
The researcher showed impact by producing working files (app.pyz and app.pyzw) that open the calculator on Windows, and by contrasting the warned .py case with the unwarned .pyzw case. That concrete demonstration, rather than a theoretical argument about the extension list, is what makes the omission a security issue rather than a documentation nit.
Glossary
- ALLOW_ON_USER_GESTURE: a behaviour label in Chrome's download table meaning the download is subject to a condition based on a deliberate user action.
- Chrome: Google's web browser, the product this report concerns.
- Chromium source tree: the public collection of source code files that make up Chrome and its open-source base.
- Download behaviour: what Chrome does with a downloaded file, such as allowing it, warning about it or blocking it.
- Edge: Microsoft's web browser, used here as a comparison point because it shares an engine with Chrome.
- Executable: a file that causes code to run when opened in the right way.
- Extension: the part of a file name after the final dot, used as a hint about the file's type.
- File type: the category a file belongs to, often inferred from its extension.
- Metadata table: a structured list of facts a program reads to make decisions; here, the extension-to-behaviour mapping.
- MIME type: a standard label for the kind of content a file or response contains.
- Python: a programming language whose programs are usually run by an interpreter.
- Python zip archive: a single file bundling Python code and the information needed to run it; Python documents the format as zipapp, and
.pyzand.pyzware its extensions. - Safe Browsing: Chrome's built-in protection against dangerous sites and files.
- Screenshot: a captured image of a screen, here
screenshot.png, cited to show the warning contrast. - User gesture: a deliberate action by a person, such as a click, as opposed to something a page does automatically.
- Zipapp: the Python documentation name for the executable Python zip archive format.