# CVE-2022-39300: Signature bypass via multiple root elements in node-SAML

> Remote attackers can bypass SAML authentication in node-saml by exploiting signature validation flaws with multiple root elements.

- **Severity:** High 7.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Oct 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-5p8w-2mvw-38pv

## What is CVE-2022-39300?

CVE-2022-39300 is a high-severity authentication bypass vulnerability in node-saml, published on 13 Oct 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

node SAML is a SAML 2.0 library based on the SAML implementation of passport-saml. A remote attacker may be able to bypass SAML authentication on a website using passport-saml. A successful attack requires that the attacker is in possession of an arbitrary IDP signed XML element. Depending on the IDP used, fully unauthenticated attacks (e.g without access to a valid user) might also be feasible if generation of a signed message can be triggered. Users should upgrade to node-saml version 4.0.0-beta5 or newer. Disabling SAML authentication may be done as a workaround.

Weakness: CWE-347 (Improper Verification of Cryptographic Signature)

## Which versions are affected by CVE-2022-39300?

2 open source packages ship an affected version, including node-saml. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `node-saml` | npm | All versions | 4.0.0-beta.5 |
| `node-saml` | npm | All versions | 4.0.0-beta.5 |

Products: Node Saml Project Node Saml.

## How do I fix CVE-2022-39300?

Upgrade node-saml to 4.0.0-beta.5 or later.

## Is CVE-2022-39300 being exploited?

There is no known exploitation of CVE-2022-39300 in the wild and no public exploit code.

## Other vulnerabilities in node-saml

- [CVE-2023-40178](https://insights.sbomify.com/CVE-2023-40178/): @node-saml/node-saml's validatePostRequestAsync does not include checkTimestampsValidityError (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-39300 and fix it if it is affected.

What it is: CVE-2022-39300 is a high-severity authentication bypass vulnerability in node-saml, published on 13 Oct 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-39300 in the wild and no public exploit code.

Affected packages and fixed versions:
- node-saml (npm): affected all versions; fixed in 4.0.0-beta.5
- node-saml (npm): affected all versions; fixed in 4.0.0-beta.5

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/CVE-2022-39300/ (Markdown: https://insights.sbomify.com/CVE-2022-39300/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-39300
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-39300
- OSV: https://osv.dev/vulnerability/CVE-2022-39300

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-39300/
Summaries are generated and may contain mistakes; the official description above is the record.
