Junglewise Threat Intelligence

xml-crypto HMAC-SHA1 signature validation bypass via key confusion

Severity: info · Published 2020-10-27

Technologies: Node-Saml Xml-Crypto. Vendors: npm.

Executive brief

xml-crypto is a Node.js library used to create and validate XML digital signatures, a critical component for securing XML-based data exchanges in applications like SAML authentication and financial systems. An attacker can craft a valid HMAC-SHA1 signature using only knowledge of the public key, allowing them to forge signatures and bypass validation checks that protect data integrity and authentication.

Technical details

The vulnerability arises from a key confusion flaw where both HMAC and RSA-based signature algorithms use the same key variable, and the choice of algorithm is controlled by user input. An attacker can inject an HMAC-SHA1 signature that validates correctly using the RSA public key alone, without possession of the private key. This breaks the cryptographic assumption that HMAC validation requires knowledge of a secret key. The vulnerability affects xml-crypto versions up to and including 1.5.3; the fix in version 2.0.0 disables HMAC signature methods by default and requires explicit re-enablement via SignedXml.enableHMAC().

Affected products

  • node-saml xml-crypto < 2.0.0

Timeline

  • 2020-10-26: disclosed: Advisory GHSA-c27r-x354-4m68 published
  • 2020: patched: Fix released in version 2.0.0 with HMAC methods disabled by default

References

Related threats