CVE-2024-52806: Simplesamlphp/saml2 legacy SimpleSAMLphp SAML2 Has An XXE Vulnerability
MODERATECVE-2024-52806 is a MODERATE (CVSS 8.3) simplesamlphp saml2 has an xxe vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Simplesamlphp/saml2 legacy libraries in the Packagist ecosystem. The issue involves simplesamlphp saml2 has an xxe in parsing saml messages. Remediation is available by upgrading affected packages to version 4.6.14.
CVE-2024-52806 at a Glance
Security Impact
CVSS: 8.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L).
How to Fix CVE-2024-52806
To remediate this vulnerability, upgrade all affected Simplesamlphp/saml2 legacy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade simplesamlphp/saml2-legacy to 4.6.14
Upgrade simplesamlphp/saml2 to 4.6.14
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for simplesamlphp/saml2-legacy
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-52806, inspect your project dependencies for Simplesamlphp/saml2 legacy:
inspect dependencies for simplesamlphp/saml2-legacy
Analyze the terminal output to locate any version of Simplesamlphp/saml2 legacy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.14), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Simplesamlphp/saml2 legacy, 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
CVE-2024-52806 Affected Simplesamlphp/saml2 legacy Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
simplesamlphp/saml2-legacy
|
Packagist |
< 4.6.14
|
4.6.14
|
|
simplesamlphp/saml2
|
Packagist |
< 4.6.14
|
4.6.14
|
References
Frequently Asked Questions
What is CVE-2024-52806?
Which Simplesamlphp/saml2 legacy versions are affected?
What version fixes CVE-2024-52806?
Is simplesamlphp/saml2-legacy affected?
Is simplesamlphp/saml2 affected?
What is the CVSS score of CVE-2024-52806?
What CWE is associated with CVE-2024-52806?
How can I check Packagist dependencies for CVE-2024-52806?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pxm4-r5ph-q2m2",
"modified" : "2024-12-13T20:39:57Z",
"published" : "2024-12-02T17:25:43Z",
"aliases" : [ "CVE-2024-52806" ],
"summary" : "SimpleSAMLphp SAML2 has an XXE in parsing SAML messages",
"details" : "Summary\n\nWhen loading an (untrusted) XML document, for example the SAMLResponse, it's possible to induce an XXE.\n\n$options is defined as: https://github.com/simplesamlphp/saml2/blob/717c0adc4877ebd58428637e5626345e59fa0109/src/SAML2/DOMDocumentFactory.php#L41\nincluding the DTDLoad option, which allows an attacker to read file contents from local file system OR internal network.\n\nWhile there is the NONET option, an attacker can simply bypass if by using PHP filters:\nphp://filter/convert.base64-encode/resource=http://URL OR FILE\n\nFrom there an attacker can induce network connections and steal the targeted file OOB (haven't fully tested this).\n\nRCE may be possible with the php://expect or php://phar wrappers, but this hasn't been tested.\n\nNote:\nThe mitigation here:\nhttps://github.com/simplesamlphp/saml2/blob/717c0adc4877ebd58428637e5626345e59fa0109/src/SAML2/DOMDocumentFactory.php#L63-L69\nComes too late, as the XML has already been loaded into a document.\nMitigation:\n\nRemove the LIBXML_DTDLOAD | LIBXML_DTDATTR options.\nAdditionally, 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)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "simplesamlphp/saml2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.6.14"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "simplesamlphp/saml2-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.6.14"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/simplesamlphp/saml2/security/advisories/GHSA-pxm4-r5ph-q2m2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-52806"
}, {
"type" : "WEB",
"url" : "https://github.com/simplesamlphp/saml2/commit/5fd4ce4596656fb0c1278f15b8305825412e89f7"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/simplesamlphp/saml2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-02T17:25:43Z",
"nvd_published_at" : "2024-12-02T17:15:12Z"
}
}