NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Gradio

CVE-2022-24770: Improper Neutralization of Formula Elements in a CSV File in Gradio Flagging

highCVSS 3.1 8.8GHSA-f8xq-q7px-wg8c

Gradio's flagging feature, in versions before 2.8.11, writes user input and output to a CSV file without neutralizing spreadsheet formulas. Anyone using the app can plant a formula that runs when the developer opens the CSV in Excel or a similar program. Upgrade to gradio 2.8.11, which escapes the saved data with single quotes.

Published Mar 18, 2022 · Updated Jan 27, 2023 · Analysis Nov 2, 2026

What an attacker can do

Gradio apps can offer a Flag button. It saves the inputs and outputs of an interaction to a CSV file on the developer's computer. In affected versions the text was written as is. A user can submit a value that starts with a formula marker such as = and carries a command. When the developer later opens the file in MS Excel or a similar program, the spreadsheet can run the planted content, according to the advisory. This is CSV injection (CWE-1236).

The attacker needs only access to the app's input fields, so any publicly shared demo works. The victim is the person who reviews flagged data, usually the app's author or a data reviewer, and they must open the file in a spreadsheet. That is why the vector shows user interaction required, with high impact on confidentiality, integrity and availability on the opening computer.

The attack does not touch the Gradio server itself. It targets the reviewer's desktop. The credit goes to haby0.

Who is affected

pip package gradio older than 2.8.11, for apps that use the flagging feature and whose CSV output is opened in a spreadsheet program. Check:

pip show gradio

Apps that disable flagging, or whose flag files are only read by scripts, are not exposed to this attack.

gradio

Ecosystem
PyPI
Affected
< 2.8.11
Fixed in
2.8.11
Check
pip show gradio

How to fix it

Upgrade to gradio 2.8.11 or later:

pip install --upgrade "gradio>=2.8.11"

The fix escapes the data saved to the CSV with single quotes. If you cannot upgrade, the advisory's workaround is to not open CSV files generated by gradio with Excel or similar spreadsheet programs. Treat old flag files as untrusted and review them in a text editor or load them with a script.

How to tell if you were hit

Scan existing flag CSV files for cells that begin with =, +, - or @, which is the usual formula prefix. Check flagged logs for values that call system functions or contain DDE-style strings. On review machines, check whether Excel spawned child processes after opening a flag file.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

The gradio library has a flagging functionality which saves input/output data into a CSV file on the developer's computer. This can allow a user to save arbitrary text into the CSV file, such as commands. If a program like MS Excel opens such a file, then it automatically runs these commands, which could lead to arbitrary commands running on the user's computer.

Patches

The problem has been patched as of 2.8.11, which escapes the data saved to the csv with single quotes.

Workarounds

If you are using an older version of gradio, don't open csv files generated by gradio with Excel or similar spreadsheet programs.

Credited to haby0.

Questions

Does CVE-2022-24770 attack the server running Gradio?

No. The malicious content sits in a CSV file and runs on the computer of whoever opens it in a spreadsheet program. The server only stores the text.

What is the fix?

Gradio 2.8.11 escapes saved data with single quotes so spreadsheets do not read it as a formula.

Can I stay on an old version safely?

Only if nobody opens the generated CSV files in Excel or a similar program, which is the advisory's workaround. Upgrading is simpler.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Gradio vulnerabilities

All Gradio entries