CVE-2022-2112: Inventree CSV Injection Vulnerability

HIGH
Advisory Identifier: GHSA-9hx5-jmxv-x44q
CVSS 8.8
CWE-1236
Published
Advisory Summary

CVE-2022-2112 is a HIGH (CVSS 8.8) csv injection vulnerability (CWE-1236: Improper Neutralization of Formula Elements in a CSV File) affecting Inventree libraries in the PyPI ecosystem. The issue involves csv injection in inventree. Remediation is available by upgrading affected packages to version 0.7.2.

CVE-2022-2112 at a Glance

CVE Identifier CVE-2022-2112
GHSA Identifier GHSA-9hx5-jmxv-x44q
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-1236: Improper Neutralization of Formula Elements in a CSV File
Affected Product Inventree
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-2112

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

inventree fixed: 0.7.2
pip install inventree>=0.7.2
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 inventree

How to Check if You Are Affected

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

pip show inventree

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

Note: The pip show inventree 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 Inventree, 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

Improper Neutralization of Formula Elements in a CSV File in GitHub repository inventree/inventree prior to 0.7.2.

CVE-2022-2112 Affected Inventree Versions

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

References

Frequently Asked Questions

What is CVE-2022-2112?
CVE-2022-2112 is a security vulnerability in Inventree involving CSV Injection in inventree under CWE-1236: Improper Neutralization of Formula Elements in a CSV File.
Which Inventree versions are affected?
Affected versions include releases prior to 0.7.2 across affected packages: inventree.
What version fixes CVE-2022-2112?
Upgrading to 0.7.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is inventree affected?
Yes, inventree is affected in releases prior to 0.7.2. Upgrade your dependency to 0.7.2 or later.
What is the CVSS score of CVE-2022-2112?
CVE-2022-2112 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-2112?
CVE-2022-2112 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-2112?
Run the dependency tree command: 'pip show inventree'. 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-9hx5-jmxv-x44q",
  "modified" : "2022-07-05T22:17:16Z",
  "published" : "2022-06-18T00:00:25Z",
  "aliases" : [ "CVE-2022-2112" ],
  "summary" : "CSV Injection in inventree",
  "details" : "Improper Neutralization of Formula Elements in a CSV File in GitHub repository inventree/inventree prior to 0.7.2.",
  "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" : "inventree"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-2112"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/inventree/inventree/commit/26bf51c20a1c9b3130ac5dd2e17649bece5ff84f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/inventree/InvenTree"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/e57c36e7-fa39-435f-944a-3a52ee066f73"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1236" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-05T22:17:16Z",
    "nvd_published_at" : "2022-06-17T13:15:00Z"
  }
}