CVE-2022-24770: Gradio Improper Neutralization Of Formula Elements Vulnerability

HIGH
Advisory Identifier: GHSA-f8xq-q7px-wg8c
CVSS 8.8
CWE-1236
Published
Advisory Summary

CVE-2022-24770 is a HIGH (CVSS 8.8) improper neutralization of formula elements vulnerability (CWE-1236: Improper Neutralization of Formula Elements in a CSV File) affecting Gradio libraries in the PyPI ecosystem. The issue involves improper neutralization of formula elements in a csv file in gradio flagging. Remediation is available by upgrading affected packages to version 2.8.11.

CVE-2022-24770 at a Glance

CVE Identifier CVE-2022-24770
GHSA Identifier GHSA-f8xq-q7px-wg8c
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-1236: Improper Neutralization of Formula Elements in a CSV File
Affected Product Gradio
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-24770

To remediate this vulnerability, upgrade all affected Gradio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

gradio fixed: 2.8.11
pip install gradio>=2.8.11
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show gradio

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-24770, inspect your installed packages using pip:

pip show gradio

Analyze the terminal output to locate any version of Gradio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.11), your application is affected.

Note: The pip show gradio command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1236: Improper Neutralization of Formula Elements in a CSV File, where the product saves user-provided information into a comma-separated value (csv) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product. In Gradio, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2022-24770 Affected Gradio Versions

1 component(s)
Fixed Versions:
2.8.11
Product / Package Ecosystem Affected Versions Fixed Version
gradio
PyPI
< 2.8.11
2.8.11

References

Frequently Asked Questions

What is CVE-2022-24770?
CVE-2022-24770 is a security vulnerability in Gradio involving Improper Neutralization of Formula Elements in a CSV File in Gradio Flagging under CWE-1236: Improper Neutralization of Formula Elements in a CSV File.
Which Gradio versions are affected?
Affected versions include releases prior to 2.8.11 across affected packages: gradio.
What version fixes CVE-2022-24770?
Upgrading to 2.8.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gradio affected?
Yes, gradio is affected in releases prior to 2.8.11. Upgrade your dependency to 2.8.11 or later.
What is the CVSS score of CVE-2022-24770?
CVE-2022-24770 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-24770?
CVE-2022-24770 is classified under CWE-1236: Improper Neutralization of Formula Elements in a CSV File (The product saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product.).
How can I check PyPI dependencies for CVE-2022-24770?
Run the dependency tree command: 'pip show gradio'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-f8xq-q7px-wg8c",
  "modified" : "2022-03-18T23:11:43Z",
  "published" : "2022-03-18T23:11:43Z",
  "aliases" : [ "CVE-2022-24770" ],
  "summary" : "Improper Neutralization of Formula Elements in a CSV File in Gradio Flagging",
  "details" : "### Impact\nThe `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.\n\n### Patches\nThe problem has been patched as of `2.8.11`, which escapes the data saved to the csv with single quotes.\n\n### Workarounds\nIf you are using an older version of `gradio`, don't open csv files generated by `gradio` with Excel or similar spreadsheet programs.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "gradio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gradio-app/gradio/security/advisories/GHSA-f8xq-q7px-wg8c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24770"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gradio-app/gradio/pull/817"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gradio-app/gradio/commit/80fea89117358ee105973453fdc402398ae20239"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gradio-app/gradio"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/gradio/PYSEC-2022-229.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1236" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-18T23:11:43Z",
    "nvd_published_at" : "2022-03-17T21:15:00Z"
  }
}