GitHub Advisoryadvisory · Packagist
GHSA-ww7x-3gxh-qm6r Validation of SignedInfo
HIGH
Official page ↗
- Aliases
- CVE-2023-49087
- Ecosystem
- Packagist
- Packages
- simplesamlphp/xml-security, simplesamlphp/saml2
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- Weaknesses
- CWE-345
- Reviewed
- 2023-11-28
Affected packages
• Packagist simplesamlphp/xml-security: >= 1.6.11, < 1.6.12 → fixed in 1.6.12
• Packagist simplesamlphp/saml2: >= 5.0.0-alpha.12, < 5.0.0-alpha.13 → fixed in 5.0.0-alpha.13
Description
Validation of an XML Signature requires verification that the hash value of the related XML-document (after any optional transformations and/or normalizations) matches a specific DigestValue-value, but also that the cryptografic signature on the SignedInfo-tree (the one that contains the DigestValue) verifies and matches a trusted public key.
Within the simpleSAMLphp/xml-security library (https://github.com/simplesamlphp/xml-security), the hash is being validated using SignedElementTrait::validateReference, and the signature is being verified in SignedElementTrait::verifyInternal
https://github.com/simplesamlphp/xml-security/blob/master/src/XML/SignedElementTrait.php:
What stands out is that the signature is being calculated over the canonical version of the SignedInfo-tree. The validateReference method, however, uses the original non-canonicalized version of SignedInfo.
Impact
If an attacker somehow (i.e. by exploiting a bug in PHP's canonicalization function) manages to manipulate the canonicalized version's DigestValue, it would be potentially be possible to forge the signature. No possibilities to exploit this were found during the investigation.
Related
Alias · CVE (1)
- CVE-2023-49087 xml-security is a library that implements XML signatures and encryption. vulnerability
Weakness · CWE (1)
- CWE-345 Insufficient Verification of Data Authenticity weakness
References
- https://github.com/simplesamlphp/xml-security/security/advisories/GHSA-ww7x-3gxh-qm6r web
- https://nvd.nist.gov/vuln/detail/CVE-2023-49087 advisory
- https://github.com/simplesamlphp/xml-security/commit/f509e3083dd7870cce5880c804b5122317287581 web
- https://github.com/simplesamlphp/xml-security package
- https://github.com/simplesamlphp/xml-security/blob/master/src/XML/SignedElementTrait.php web