# GHSA-c27r-x354-4m68: xml-crypto's HMAC-SHA1 signatures can bypass validation via key confusion

> Attackers can bypass XML signature validation by injecting HMAC-SHA1 signatures using only the RSA public key, compromising integrity checks.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Oct 2020

## What is GHSA-c27r-x354-4m68?

GHSA-c27r-x354-4m68 is a vulnerability in xml-crypto, published on 27 Oct 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact
An attacker can inject an HMAC-SHA1 signature that is valid using only knowledge of the RSA public key. This allows bypassing signature validation.

### Patches
Version 2.0.0 has the fix.

### Workarounds
The recommendation is to upgrade. In case that is not possible remove the 'http://www.w3.org/2000/09/xmldsig#hmac-sha1' entry from SignedXml.SignatureAlgorithms.

## Which versions are affected by GHSA-c27r-x354-4m68?

2 open source packages ship an affected version, including xml-crypto.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xml-crypto` | npm | All versions | 2.0.0 |
| `xml-crypto` | npm | All versions | 2.0.0 |

## How do I fix GHSA-c27r-x354-4m68?

Upgrade xml-crypto to 2.0.0 or later.

## Is GHSA-c27r-x354-4m68 being exploited?

There is no known exploitation of GHSA-c27r-x354-4m68 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-c27r-x354-4m68 and fix it if it is affected.

What it is: GHSA-c27r-x354-4m68 is a vulnerability in xml-crypto, published on 27 Oct 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-c27r-x354-4m68 in the wild and no public exploit code.

Affected packages and fixed versions:
- xml-crypto (npm): affected all versions; fixed in 2.0.0
- xml-crypto (npm): affected all versions; fixed in 2.0.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-c27r-x354-4m68/ (Markdown: https://insights.sbomify.com/GHSA-c27r-x354-4m68/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-c27r-x354-4m68

---
From sbomify Insights: https://insights.sbomify.com/GHSA-c27r-x354-4m68/
Summaries are generated and may contain mistakes; the official description above is the record.
