GHSA-rm89-9g65-4ffr: Inventree Insufficient HTML Sanitization Vulnerability

HIGH
Published
Advisory Summary

GHSA-rm89-9g65-4ffr is a HIGH insufficient html sanitization vulnerability (General Security Weakness) affecting Inventree libraries in the PyPI ecosystem. The issue involves insufficient html sanitization. Remediation is available by upgrading affected packages to version 0.7.2.

GHSA-rm89-9g65-4ffr at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rm89-9g65-4ffr
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Inventree
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-rm89-9g65-4ffr

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 GHSA-rm89-9g65-4ffr, 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 General Security Weakness. 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

### Impact Affected versions can have malicious javascript code injected into the users browser by other authenticated users, as data fields retrieved from the database are not properly sanitized before displaying in various front-end views. The problem here stems from multiple issues: - Insufficient database sanitation on multiple fields allows injection of un-sanitized HTML - Lack of HTML escaping when rendering data on the front end The attack vector here is limited, as only authenticated users are able to write data to the database, for it to be subsequently rendered on the front-end. However, it is a vulnerability that the InvenTree development team takes seriously. ### Solution The proposed patch for this vulnerability is prevents injection of un-escaped fields into front-end UI elements. A future patch will also address sanitization of database fields on the "back end", however this will require a much larger effort to refactor multiple database tables. ### Patches - The issue is addressed in the upcoming `0.8.0` release - This fix will also be back-ported to the `0.7.x` branch, applied to the `0.7.2` release ### Workarounds There are no workarounds for this issue, users should upgrade to a patched version. ### References - https://huntr.dev/bounties/4cae8442-c042-43c2-ad89-6f666eaf3d57/ - https://huntr.dev/bounties/9d640ef2-c52c-4106-b043-f7497d577078/ - https://huntr.dev/bounties/b114e82f-6c02-485b-82ea-e242f89169c2/ - https://huntr.dev/bounties/22783cd3-1b2c-48fc-b31f-03b53c86da0b/ Thank you @saharshtapi for bringing this issue to our attention and giving pointers for fixing them. ### For more information If you have any questions or comments about this advisory: * Open an issue in [github](http://github.com/inventree/inventree) * Email us at [security@inventree.org](mailto:security@inventree.org)

GHSA-rm89-9g65-4ffr 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 GHSA-rm89-9g65-4ffr?
GHSA-rm89-9g65-4ffr is a security vulnerability in Inventree involving Insufficient HTML Sanitization under General Security Weakness.
Which Inventree versions are affected?
Affected versions include releases prior to 0.7.2 across affected packages: inventree.
What version fixes GHSA-rm89-9g65-4ffr?
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 CWE is associated with GHSA-rm89-9g65-4ffr?
GHSA-rm89-9g65-4ffr is classified under General Security Weakness.
How can I check PyPI dependencies for GHSA-rm89-9g65-4ffr?
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-rm89-9g65-4ffr",
  "modified" : "2022-06-17T01:16:36Z",
  "published" : "2022-06-17T01:16:36Z",
  "aliases" : [ ],
  "summary" : "Insufficient HTML Sanitization",
  "details" : "### Impact\n\nAffected versions can have malicious javascript code injected into the users browser by other authenticated users, as data fields retrieved from the database are not properly sanitized before displaying in various front-end views.\n\nThe problem here stems from multiple issues:\n\n- Insufficient database sanitation on multiple fields allows injection of un-sanitized HTML\n- Lack of HTML escaping when rendering data on the front end\n\nThe attack vector here is limited, as only authenticated users are able to write data to the database, for it to be subsequently rendered on the front-end. However, it is a vulnerability that the InvenTree development team takes seriously.\n\n### Solution\n\nThe proposed patch for this vulnerability is prevents injection of un-escaped fields into front-end UI elements.\n\nA future patch will also address sanitization of database fields on the \"back end\", however this will require a much larger effort to refactor multiple database tables.\n\n### Patches\n\n- The issue is addressed in the upcoming `0.8.0` release\n- This fix will also be back-ported to the `0.7.x` branch, applied to the `0.7.2` release\n\n### Workarounds\n\nThere are no workarounds for this issue, users should upgrade to a patched version.\n\n### References\n\n- https://huntr.dev/bounties/4cae8442-c042-43c2-ad89-6f666eaf3d57/\n- https://huntr.dev/bounties/9d640ef2-c52c-4106-b043-f7497d577078/\n- https://huntr.dev/bounties/b114e82f-6c02-485b-82ea-e242f89169c2/\n- https://huntr.dev/bounties/22783cd3-1b2c-48fc-b31f-03b53c86da0b/\n\nThank you @saharshtapi for bringing this issue to our attention and giving pointers for fixing them.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [github](http://github.com/inventree/inventree)\n* Email us at [security@inventree.org](mailto:security@inventree.org)\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "inventree"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/inventree/InvenTree/security/advisories/GHSA-rm89-9g65-4ffr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/inventree/inventree-python"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T01:16:36Z",
    "nvd_published_at" : null
  }
}