GHSA-432c-wxpg-m4q3

Suggest an improvement
Source
https://github.com/advisories/GHSA-432c-wxpg-m4q3
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/02/GHSA-432c-wxpg-m4q3/GHSA-432c-wxpg-m4q3.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-432c-wxpg-m4q3
Published
2025-02-07T20:32:27Z
Modified
2025-02-07T20:36:32Z
Severity
  • 6.9 (Medium) CVSS_V4 - 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 CVSS Calculator
Summary
xml2rfc has file inclusion irregularities
Details

Version 3.12.0 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

[^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 accesstemplates_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.

Database specific
{
    "cwe_ids":  [
        "CWE-22"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2025-02-07T20:32:27Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

PyPI / xml2rfc

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.12.0
Fixed
3.27.0

Affected versions

3.*
3.12.0
3.12.1
3.12.2
3.12.3
3.12.4
3.12.5
3.12.6
3.12.7
3.12.8
3.12.9
3.12.10
3.13.0
3.13.1
3.14.0
3.14.1
3.14.2
3.15.0
3.15.1
3.15.2
3.15.3
3.16.0
3.17.0
3.17.1
3.17.2
3.17.3
3.17.4
3.17.5
3.18.0
3.18.1
3.18.2
3.19.0
3.19.1
3.19.2
3.19.3
3.19.4
3.20.0
3.20.1
3.21.0
3.22.0
3.23.0
3.23.1
3.23.2
3.24.0
3.25.0
3.26.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/02/GHSA-432c-wxpg-m4q3/GHSA-432c-wxpg-m4q3.json"