Vulnerabilities in pkg:pypi/petl

PACKAGE
Advisory Identifier: GHSA-f5gc-p5m3-v347
Advisory Summary

CVE-2020-29128 is a HIGH (CVSS 9.8) security vulnerability vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Petl libraries in the PyPI ecosystem. The issue involves xxe in petl. Remediation is available by upgrading affected packages to version 1.6.8.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/petl

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/petl. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-f5gc-p5m3-v347 CVE-2020-29128 HIGH XXE in petl
GHSA-69q2-p9xp-739v - CRITICAL Duplicate Advisory: XML Injection in petl

CVE-2020-29128 at a Glance

CVE Identifier CVE-2020-29128
GHSA Identifier GHSA-f5gc-p5m3-v347
Severity HIGH
CVSS v3.1 Base Score 9.8
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Petl
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.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:N/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 None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2020-29128

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

petl fixed: 1.6.8
pip install petl>=1.6.8
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 petl

How to Check if You Are Affected

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

pip show petl

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Petl, 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 Information Disclosure ### Summary [petl](https://github.com/petl-developers/petl) is a Python library that provides functions for extraction, transformation, and loading (ETL) of data. petl before 1.68, in some configurations, allows resolution of entities in XML input. An attacker who is able to submit XML input to an application using petl can disclose arbitrary files on the file system in the context of the user under which the application is running. ### Affected Applications Applications that: - accept attacker-supplied XML input that is processed using petl < 1.68 - return the response generated by petl back to the attacker - configure lxml as the underlying XML processing library used by petl - have read privileges in filesystem files with sensitive information ### Mitigation Update to petl >= 1.68 ### Workarounds - Assure there is no user/external access to the application using [petl](https://github.com/petl-developers/petl) - Assure your application is not using the function [fromxml()](https://petl.readthedocs.io/en/stable/io.html#petl.io.xml.fromxml) ### References - https://github.com/nvn1729/advisories/blob/master/cve-2020-29128.md - https://github.com/petl-developers/petl/pull/527 - https://github.com/petl-developers/petl/releases/tag/v1.6.8 - https://petl.readthedocs.io/en/stable/changes.html - https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing ### For more information If you have any questions or comments about this advisory: * Add a comment in the Github [issue](https://github.com/petl-developers/petl/pull/527) Thaks to Naveen Sunkavally.

CVE-2020-29128 Affected Petl Versions

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

References

Frequently Asked Questions

What is CVE-2020-29128?
CVE-2020-29128 is a security vulnerability in Petl involving XXE in petl under CWE-611: Improper Restriction of XML External Entity Reference.
Which Petl versions are affected?
Affected versions include releases prior to 1.6.8 across affected packages: petl.
What version fixes CVE-2020-29128?
Upgrading to 1.6.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is petl affected?
Yes, petl is affected in releases prior to 1.6.8. Upgrade your dependency to 1.6.8 or later.
What is the CVSS score of CVE-2020-29128?
CVE-2020-29128 has a CVSS v3.1 base score of 9.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-29128?
CVE-2020-29128 is classified under CWE-611: Improper Restriction of XML External Entity Reference (The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.).
How can I check PyPI dependencies for CVE-2020-29128?
Run the dependency tree command: 'pip show petl'. 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-f5gc-p5m3-v347",
  "modified" : "2024-10-09T20:55:04Z",
  "published" : "2020-12-02T18:28:30Z",
  "aliases" : [ "CVE-2020-29128" ],
  "summary" : "XXE in petl",
  "details" : "### Impact\nInformation Disclosure\n\n### Summary\n\n[petl](https://github.com/petl-developers/petl) is a Python library that provides functions for extraction, transformation, and loading (ETL) of data.\n\npetl before 1.68, in some configurations, allows resolution of entities in XML input.\n\nAn attacker who is able to submit XML input to an application using petl can disclose arbitrary files on the file system in the context of the user under which the application is running.\n\n### Affected Applications\n\nApplications that:\n\n- accept attacker-supplied XML input that is processed using petl < 1.68\n- return the response generated by petl back to the attacker\n- configure lxml as the underlying XML processing library used by petl\n- have read privileges in filesystem files with sensitive information\n\n### Mitigation\nUpdate to petl >= 1.68\n\n### Workarounds\n\n- Assure there is no user/external access to the application using [petl](https://github.com/petl-developers/petl)\n- Assure your application is not using the function [fromxml()](https://petl.readthedocs.io/en/stable/io.html#petl.io.xml.fromxml)\n\n### References\n- https://github.com/nvn1729/advisories/blob/master/cve-2020-29128.md\n- https://github.com/petl-developers/petl/pull/527\n- https://github.com/petl-developers/petl/releases/tag/v1.6.8\n- https://petl.readthedocs.io/en/stable/changes.html\n- https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Add a comment in the Github [issue](https://github.com/petl-developers/petl/pull/527)\n\nThaks to Naveen Sunkavally.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "petl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.6.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/security/advisories/GHSA-f5gc-p5m3-v347"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/issues/526"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/pull/527"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/commit/07420ef8463cc387aea84e2d6241cf556574e2a5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nvn1729/advisories/blob/master/cve-2020-29128.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/petl-developers/petl"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/compare/v1.6.7...v1.6.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/petl-developers/petl/releases/tag/v1.6.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/petl/PYSEC-2020-75.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing"
  }, {
    "type" : "WEB",
    "url" : "https://petl.readthedocs.io/en/stable/changes.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-12-02T02:29:45Z",
    "nvd_published_at" : null
  }
}