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

Source: https://junglewise.ai/threats/xml-crypto-hmac-sha1-signature-validation-bypass-via-key-confusion-f0996137  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2020-10-27. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: info · Published 2020-10-27

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.

Technologies: [xml-crypto (npm)](https://junglewise.ai/threats/technologies/xml-crypto). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Informational severity, published 27 October 2020.

**Which products and versions are affected?** xml-crypto (npm) SEMVER:introduced=0,fixed=2.0.0.

**Is there a fix for This vulnerability?** Yes. xml-crypto (npm): upgrade to 2.0.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run xml-crypto (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- xml-crypto (npm): upgrade to 2.0.0 or later

  ```sh
  npm install xml-crypto@2.0.0
  ```


## 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

- [https://github.com/yaronn/xml-crypto/security/advisories/GHSA-c27r-x354-4m68](https://github.com/yaronn/xml-crypto/security/advisories/GHSA-c27r-x354-4m68)
- [https://github.com/yaronn/xml-crypto/commit/3d9db712e6232c765cd2ad6bd2902b88a0d22100](https://github.com/yaronn/xml-crypto/commit/3d9db712e6232c765cd2ad6bd2902b88a0d22100)

## Related threats

- [xml-crypto XML Signature Verification Bypass via DigestValue Comment](https://junglewise.ai/threats/cve-2025-29775-xml-crypto-xml-signature-verification-bypass-via-digestvalue)
- [xml-crypto XML signature verification bypass via multiple SignedInfo references](https://junglewise.ai/threats/cve-2025-29774-xml-crypto-xml-signature-verification-bypass-via-multiple)
- [node-saml xml-crypto XML signature verification bypass](https://junglewise.ai/threats/cve-2024-32962-node-saml-xml-crypto-xml-signature-verification-bypass)
