Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. simplesamlphp/xml-common
  4. ›
  5. CVE-2024-52596

CVE-2024-52596: SimpleSAMLphp xml-common XXE vulnerability

December 2, 2024 (updated December 12, 2024)

Summary

When loading an (untrusted) XML document, for example the SAMLResponse, it’s possible to induce an XXE.

$options is defined as: https://github.com/simplesamlphp/xml-common/blob/v1.19.0/src/DOMDocumentFactory.php#L39 including the DTDLoad option, which allows an attacker to read file contents from local file system OR internal network.

While there is the NONET option, an attacker can simply bypass if by using PHP filters: php://filter/convert.base64-encode/resource=http://URL OR FILE

From there an attacker can induce network connections and steal the targeted file OOB (haven’t fully tested this).

RCE may be possible with the php://expect or php://phar wrappers, but this hasn’t been tested.

Note: The mitigation here: https://github.com/simplesamlphp/xml-common/blob/v1.19.0/src/DOMDocumentFactory.php#L58 Comes too late, as the XML has already been loaded into a document. Mitigation:

Remove the LIBXML_DTDLOAD | LIBXML_DTDATTR options. Additionally, as a defense in depth measure, check if there is the string: <!DOCTYPE inside the XML before parsing it. (This is not a complete fix because someone may be able to exploit some parser differentials, to load a DOCTYPE, maybe through spacing like: <! DOCTYPE)

References

  • github.com/advisories/GHSA-2x65-fpch-2fcm
  • github.com/simplesamlphp/xml-common
  • github.com/simplesamlphp/xml-common/commit/fa4ade391c3194466acf5fbfd5d2ecdbf5e831f5
  • github.com/simplesamlphp/xml-common/security/advisories/GHSA-2x65-fpch-2fcm
  • lists.debian.org/debian-lts-announce/2024/12/msg00001.html
  • nvd.nist.gov/vuln/detail/CVE-2024-52596

Code Behaviors & Features

Detect and mitigate CVE-2024-52596 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 1.20.0

Fixed versions

  • 1.20.0

Solution

Upgrade to version 1.20.0 or above.

Weakness

  • CWE-611: Improper Restriction of XML External Entity Reference

Source file

packagist/simplesamlphp/xml-common/CVE-2024-52596.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:18 +0000.