# CVE-2022-39299: Signature bypass via multiple root elements in Passport-SAML

> Remote attackers can bypass SAML authentication in Passport-SAML by exploiting signature validation flaws involving multiple root elements.

- **Severity:** High 7.4 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Oct 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-m974-647v-whv7

## What is CVE-2022-39299?

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

### Official description

Passport-SAML is a SAML 2.0 authentication provider for Passport, the Node.js authentication library. 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 passport-saml version 3.2.2 or newer. The issue was also present in the beta releases of `node-saml` before version 4.0.0-beta.5. If you cannot upgrade, disabling SAML authentication may be done as a workaround.

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

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

8 open source packages ship an affected version, including @node-saml/passport-saml, @node-saml/node-saml and node-saml. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@node-saml/passport-saml` | npm | All versions | 4.0.0-beta.3 |
| `@node-saml/passport-saml` | npm | All versions | 4.0.0-beta.3 |
| `@node-saml/node-saml` | npm | All versions | 4.0.0-beta.5 |
| `@node-saml/node-saml` | npm | All versions | 4.0.0-beta.5 |
| `node-saml` | npm | All versions | 4.0.0-beta.5 |
| `node-saml` | npm | All versions | 4.0.0-beta.5 |
| `passport-saml` | npm | All versions | 3.2.2 |
| `passport-saml` | npm | All versions | 3.2.2 |

Products: Passport-Saml Project Passport-Saml.

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

Upgrade @node-saml/passport-saml to 4.0.0-beta.3 or later.

## Is CVE-2022-39299 being exploited?

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

Public exploit code:

- A Simple CVE-2022-39299 PoC exploit generator to bypass authentication in SAML SSO Integrations using vulnerable versions of passport-saml (github_poc): https://github.com/doyensec/CVE-2022-39299_PoC_Generator

## Other vulnerabilities in node-saml passport-saml

- [CVE-2021-39171](https://insights.sbomify.com/CVE-2021-39171/): Unlimited transforms allowed for signed nodes (medium 5.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-39299 is a high-severity authentication bypass vulnerability in node-saml passport-saml, published on 12 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-39299 in the wild and no public exploit code.

Affected packages and fixed versions:
- @node-saml/passport-saml (npm): affected all versions; fixed in 4.0.0-beta.3
- @node-saml/passport-saml (npm): affected all versions; fixed in 4.0.0-beta.3
- @node-saml/node-saml (npm): affected all versions; fixed in 4.0.0-beta.5
- @node-saml/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
- node-saml (npm): affected all versions; fixed in 4.0.0-beta.5
- passport-saml (npm): affected all versions; fixed in 3.2.2
- passport-saml (npm): affected all versions; fixed in 3.2.2

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

## Sources

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

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