CVE-2024-32962 (CVSS 10): Critical Vulnerability in XML-Crypto Affects Millions
A significant security flaw has been discovered in the widely used XML-Crypto npm package, a tool integral to the cryptographic security of XML documents. This vulnerability, identified as CVE-2024-32962, carries the highest severity score of 10 on the Common Vulnerability Scoring System (CVSS), indicating its critical nature. The issue stems from a fundamental oversight in the package’s default configuration, which fails to properly verify the authenticity of digital signatures, thereby allowing signature spoofing.
Overview of the Vulnerability
XML-Crypto, which garners nearly one million weekly downloads, is a cornerstone for developers needing to incorporate digital signatures and encryption into XML documents. The CVE-2024-32962 vulnerability specifically arises from the package’s handling of XML signature verification. By default, XML-Crypto does not verify the authorization of the signer—only the validity of the signature itself as outlined in Section 3.2.2 of the W3C recommendation for XML Signature Syntax and Processing.
The core of the problem lies in how XML-Crypto manages certificates within digitally signed XML documents. The package, in its flawed versions ranging from 4.0.0 to less than 6.0.0, trusts any certificate provided in the <KeyInfo />
element of a signed XML document. This default behavior can be exploited by an attacker who can re-sign an XML document with a malicious private key, attach the corresponding certificate to the <KeyInfo />
element, and thereby pass the altered XML through XML-Crypto’s validation checks.
Implications of the Exploit
The exploitation of this vulnerability allows attackers to spoof the signature verification process, making it possible to introduce malicious data into systems that rely on XML-Crypto for security. This could potentially lead to data breaches, unauthorized data manipulation, and a breakdown in the trust mechanism that many digital transactions and communications systems rely on.
Resolution and Mitigation
The issue has been addressed in the latest version of XML-Crypto, version 6.0.0, which disables the implicit use of the default getCertFromKeyInfo
implementation that contributed to the vulnerability. For users unable to immediately upgrade to version 6.0.0, developers have suggested workarounds for earlier versions:
- Certificate Validation: Manually check the certificate extracted via
getCertFromKeyInfo
against a list of trusted certificates before accepting the results of the validation. - Configuration Change: Set XML-Crypto’s
getCertFromKeyInfo
function to() => undefined
, which forces the use of an explicitly configuredpublicCert
orprivateKey
for signature verification, thereby bypassing the flawed default mechanism.
Recommendations for Developers and Businesses
Developers using XML-Crypto in applications that handle sensitive or valuable data should prioritize updating to version 6.0.0 to mitigate the risks associated with this vulnerability. Furthermore, until an update can be applied, implementing the suggested workarounds is critical to maintain the security integrity of applications.