Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0yeHAzLTU3cDctcWY0ds4AA7eK

xml-crypto vulnerable to XML signature verification bypass due improper verification of signature/signature spoofing

Summary

Default configuration does not check authorization of the signer, it only checks the validity of the signature per section 3.2.2 of https://www.w3.org/TR/2008/REC-xmldsig-core-20080610/#sec-CoreValidation. As such, without additional validation steps, the default configuration allows a malicious actor to re-sign an XML document, place the certificate in a <KeyInfo /> element, and pass xml-crypto default validation checks.

Details

Affected xml-crypto versions between versions >= 4.0.0 and < 6.0.0.

xml-crypto trusts by default any certificate provided via digitally signed XML document's <KeyInfo />.

xml-crypto prefers to use any certificate provided via digitally signed XML document's <KeyInfo /> even if library was configured to use specific certificate (publicCert) for signature verification purposes.

Attacker can spoof signature verification by modifying XML document and replacing existing signature with signature generated with malicious private key (created by attacker) and by attaching that private key's certificate to <KeyInfo /> element.

Vulnerability is combination of changes introduced to 4.0.0 at

Changes at PR provided default method to extract certificate from signed XML document.

and changes at PR prefer output of that method to be used as certificate for signature verification even in the case when library is configured to use specific/pre-configured signingCert

Name of the signingCert was changed later (but prior to 4.0.0 release) to publicCert:

Issue was fixed to 6.0.0 by disabling implicit usage of default getCertFromKeyInfo implementation:

Possible workarounds for versions 4.x and 5.x:

PoC

https://github.com/node-saml/xml-crypto/discussions/399

Impact

An untrusted certificate can be used to pass a malicious XML payload through an improperly configured installation of xml-crypto.

Permalink: https://github.com/advisories/GHSA-2xp3-57p7-qf4v
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yeHAzLTU3cDctcWY0ds4AA7eK
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: 7 months ago
Updated: 5 months ago


CVSS Score: 10.0
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N

Identifiers: GHSA-2xp3-57p7-qf4v, CVE-2024-32962
References: Repository: https://github.com/node-saml/xml-crypto
Blast Radius: 38.7

Affected Packages

npm:xml-crypto
Dependent packages: 307
Dependent repositories: 7,392
Downloads: 5,163,303 last month
Affected Version Ranges: >= 4.0.0, < 6.0.0
Fixed in: 6.0.0
All affected versions: 4.0.0, 4.0.1, 4.1.0, 5.0.0, 5.1.0, 5.1.1
All unaffected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.14, 0.0.15, 0.0.16, 0.0.17, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.1.24, 0.1.25, 0.1.26, 0.2.26, 0.3.26, 0.4.26, 0.5.26, 0.5.27, 0.6.0, 0.6.1, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.9.0, 0.10.0, 0.10.1, 1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.2.0, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 6.0.0