GHSA-432c-wxpg-m4q3
JSON

medium

xml2rfc has file inclusion irregularities

Severity
medium CVSS:4.0 by GitHub
Published
Last changed

Description

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:

xincludeXML entity referenceartwork src=sourcecode src=
without --allow-local-file-access flagNo filesystem accessAny file in xml2rfc templates dir and below, any file in source directory and belowAccess source directory and belowAccess source directory and below
with --allow-local-file-access flagAccess any file on filesystem1Access any file on filesystem1Access source directory and belowAccess source directory and below
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:

xincludeXML entity referenceartwork src=sourcecode src=
without --allow-local-file-access flagNo filesystem accessNo filesystem access (except for templates_dir)No filesystem accessNo filesystem access
with --allow-local-file-access flagAccess source directory and belowAccess source directory and below (Can accesstemplates_dir).Access source directory and belowAccess 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.

Footnotes

  1. Access any file of the filesystem with the permissions of the user running xml2rfc can access. ↩ ↩2

Affected

Product or packageVersionsReported by
xml2rfc (PyPI)from 3.12.0 before 3.27.0GitHub Advisory Database

Classification

References

Sources

SourceRecordLicence
GitHub Advisory DatabaseGHSA-432c-wxpg-m4q3 changed 2025-02-07CC-BY-4.0