GHSA-432c-wxpg-m4q3: Xml2rfc Xml2rfc Has File Inclusion Irregularities Vulnerability

MODERATE
CWE-22
Published
Advisory Summary

GHSA-432c-wxpg-m4q3 is a MODERATE xml2rfc has file inclusion irregularities vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Xml2rfc libraries in the PyPI ecosystem. The issue involves xml2rfc has file inclusion irregularities. Remediation is available by upgrading affected packages to version 3.27.0.

GHSA-432c-wxpg-m4q3 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-432c-wxpg-m4q3
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Xml2rfc
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-432c-wxpg-m4q3

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

xml2rfc fixed: 3.27.0
pip install xml2rfc>=3.27.0
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 xml2rfc

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-432c-wxpg-m4q3, inspect your installed packages using pip:

pip show xml2rfc

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Xml2rfc, 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

Version [3.12.0](https://github.com/ietf-tools/xml2rfc/blob/main/CHANGELOG.md#3120---2021-12-08) changed `xml2rfc` so that it would not access local files without the presence of its new `--allow-local-file-access` flag. This prevented XML External Entity (XXE) injection attacks with `xinclude` and XML entity references. It was discovered that `xml2rfc` does not respect `--allow-local-file-access` when a local file is specified as `src` in `artwork` or `sourcecode` elements. Furthermore, XML entity references can include any file inside the source dir and below without using the `--allow-local-file-access` flag. The `xml2rfc <= 3.26.0` behaviour: | | `xinclude` | XML entity reference | `artwork src=` | `sourcecode src=` | |---|---|---|---|---| | without `--allow-local-file-access` flag | No filesystem access | Any file in xml2rfc templates dir and below, any file in source directory and below | Access source directory and below | Access source directory and below | | with `--allow-local-file-access` flag | Access any file on filesystem[^1] | Access any file on filesystem[^1] | Access source directory and below | Access source directory and below | Access source directory and below | [^1]: Access any file of the filesystem with the permissions of the user running `xml2rfc` can access. ### Impact Anyone running `xml2rfc` as a service that accepts input from external users is impacted by this issue. Specifying a file in `src` attribute in `artwork` or `sourcecode` elements will cause the contents of that file to appear in xml2rfc’s output results. But that file has to be inside the same directory as the XML input source file. For `artwork` and `sourcecode`, `xml2rfc` will not look above the source file directory. ### The proposed new behaviour - Generalize file access checks. - Only allow access to files within src dir and below. (xml entity include can access templates dir). - Always allow access to `templates_dir` for XML entity includes. New behaviour: | | `xinclude` | XML entity reference | `artwork src=` | `sourcecode src=` | |---|---|---|---|---| | without `--allow-local-file-access` flag | No filesystem access | No filesystem access _(except for `templates_dir`)_ | No filesystem access | No filesystem access | | with `--allow-local-file-access` flag | Access source directory and below | Access source directory and below _(Can access`templates_dir`)._ | Access source directory and below | Access source directory and below | ### Workarounds Use a secure temporary directory to process un-trusted XML files, and do not reuse it for processing other XML documents.

GHSA-432c-wxpg-m4q3 Affected Xml2rfc Versions

1 component(s)
Fixed Versions:
3.27.0
Product / Package Ecosystem Affected Versions Fixed Version
xml2rfc
PyPI
≥ 3.12.0
< 3.27.0
3.27.0

References

Frequently Asked Questions

What is GHSA-432c-wxpg-m4q3?
GHSA-432c-wxpg-m4q3 is a security vulnerability in Xml2rfc involving xml2rfc has file inclusion irregularities under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Xml2rfc versions are affected?
Affected versions include releases prior to 3.27.0 across affected packages: xml2rfc.
What version fixes GHSA-432c-wxpg-m4q3?
Upgrading to 3.27.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xml2rfc affected?
Yes, xml2rfc is affected in releases prior to 3.27.0. Upgrade your dependency to 3.27.0 or later.
What CWE is associated with GHSA-432c-wxpg-m4q3?
GHSA-432c-wxpg-m4q3 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for GHSA-432c-wxpg-m4q3?
Run the dependency tree command: 'pip show xml2rfc'. 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-432c-wxpg-m4q3",
  "modified" : "2025-02-07T20:32:27Z",
  "published" : "2025-02-07T20:32:27Z",
  "aliases" : [ ],
  "summary" : "xml2rfc has file inclusion irregularities",
  "details" : "Version [3.12.0](https://github.com/ietf-tools/xml2rfc/blob/main/CHANGELOG.md#3120---2021-12-08) changed `xml2rfc` so that it would not access local files without the presence of its new `--allow-local-file-access` flag.\nThis prevented XML External Entity (XXE) injection attacks with `xinclude` and XML entity references.\n\nIt was discovered that `xml2rfc` does not respect `--allow-local-file-access` when a local file is specified as `src` in `artwork` or `sourcecode` elements. Furthermore, XML entity references can include any file inside the source dir and below without using the `--allow-local-file-access` flag. \n\nThe `xml2rfc <= 3.26.0` behaviour:\n\n|  | `xinclude` | XML entity reference | `artwork src=` | `sourcecode src=` |\n|---|---|---|---|---|\n| without `--allow-local-file-access` flag | No filesystem access | Any file in xml2rfc templates dir and below, any file in source directory and below | Access source directory and below | Access source directory and below |\n| with `--allow-local-file-access` flag | Access any file on filesystem[^1] | Access any file on filesystem[^1] | Access source directory and below | Access source directory and below | Access source directory and below |\n\n  [^1]: Access any file of the filesystem with the permissions of the user running `xml2rfc` can access.\n\n### Impact\n\nAnyone running `xml2rfc` as a service that accepts input from external users is impacted by this issue.\nSpecifying a file in `src` attribute in `artwork` or `sourcecode` elements will cause the contents of that file to appear in xml2rfc’s output results.\nBut that file has to be inside the same directory as the XML input source file.\nFor `artwork` and `sourcecode`, `xml2rfc` will not look above the source file directory.\n\n### The proposed new behaviour\n- Generalize file access checks.\n- Only allow access to files within src dir and below. (xml entity include can access templates dir).\n- Always allow access to `templates_dir` for XML entity includes.\n\nNew behaviour:\n\n|  | `xinclude` | XML entity reference | `artwork src=` | `sourcecode src=` |\n|---|---|---|---|---|\n| without `--allow-local-file-access` flag | No filesystem access | No filesystem access _(except for `templates_dir`)_ | No filesystem access | No filesystem access |\n| with `--allow-local-file-access` flag | Access source directory and below | Access source directory and below _(Can access`templates_dir`)._ | Access source directory and below | Access source directory and below |\n\n### Workarounds\n\nUse a secure temporary directory to process un-trusted XML files, and do not reuse it for processing other XML documents.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "xml2rfc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.12.0"
      }, {
        "fixed" : "3.27.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ietf-tools/xml2rfc/security/advisories/GHSA-432c-wxpg-m4q3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ietf-tools/xml2rfc/commit/ec98f9cb4b9a8658222117df037dda473ca3f4e4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ietf-tools/xml2rfc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-07T20:32:27Z",
    "nvd_published_at" : null
  }
}