CVE-2024-52806
JSON

8.3high

SimpleSAMLphp SAML2 has an XXE in parsing SAML messages

Severity
8.3high CVSS:3.1 by GitHub_M
Exploit likelihood
0.43% (higher than 39% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-pxm4-r5ph-q2m2

Description

SimpleSAMLphp SAML2 library is a PHP library for SAML2 related functionality. When loading an (untrusted) XML document, for example the SAMLResponse, it's possible to induce an XXE. This vulnerability is fixed in 4.6.14 and 5.0.0-alpha.18.

Affected

Product or packageVersionsReported by
simplesamlphp saml2< 4.6.14, >= 5.0.0-alpha.1, < 5.0.0-alpha.18, before 4.6.14, up to 5.0.0-alpha.1, before 5.0.0-alpha.18CVE List
simplesamlphp/saml2 (Packagist)before 4.6.14GitHub Advisory Database
simplesamlphp/saml2-legacy (Packagist)before 4.6.14GitHub Advisory Database

All scores

GitHub_M8.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L
GitHub8.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:L

Classification

CWE-611

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

SimpleSAMLphp SAML2 library is a PHP library for SAML2 related functionality. When loading an (untrusted) XML document, for example the SAMLResponse, it's possible to induce an XXE. This vulnerability is fixed in 4.6.14 and 5.0.0-alpha.18.

GitHub Advisory Database

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/saml2/blob/717c0adc4877ebd58428637e5626345e59fa0109/src/SAML2/DOMDocumentFactory.php#L41 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/saml2/blob/717c0adc4877ebd58428637e5626345e59fa0109/src/SAML2/DOMDocumentFactory.php#L63-L69 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)

NVD (es)

La librería SAML2 SimpleSAMLphp es una librería PHP para funciones relacionadas con SAML2. Al cargar un documento XML (no confiable), por ejemplo, SAMLResponse, es posible inducir un XXE. Esta vulnerabilidad se solucionó en 4.6.14 y 5.0.0-alpha.18.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-52806 changed 2024-12-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-pxm4-r5ph-q2m2 changed 2024-12-13CC-BY-4.0
NVDCVE-2024-52806 changed 2026-06-17Public domain