Skip to content

Validation of SignedInfo

Moderate
tvdijen published GHSA-ww7x-3gxh-qm6r Nov 27, 2023

Package

simplesamlphp/saml2 (PHP)

Affected versions

5.0.0-alpha.12

Patched versions

5.0.0-alpha.13
simplesamlphp/xml-security (PHP)
1.6.11
1.6.12

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:

afbeelding

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.

Patches

N/A

Workarounds

N/A

References

This potential vulnerability was found during a code review by Secura.com

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
None
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N

CVE ID

CVE-2023-49087

Weaknesses