CVE-2022-39299: Passport saml Signature Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-m974-647v-whv7
CVSS 8.1
CWE-347
Published
Advisory Summary

CVE-2022-39299 is a HIGH (CVSS 8.1) signature bypass vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Passport saml libraries in the npm ecosystem. The issue involves signature bypass via multiple root elements. Remediation is available by upgrading affected packages to version 3.2.2, 4.0.0-beta.5, 4.0.0-beta.3.

CVE-2022-39299 at a Glance

CVE Identifier CVE-2022-39299
GHSA Identifier GHSA-m974-647v-whv7
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product Passport saml
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-39299

To remediate this vulnerability, upgrade all affected Passport saml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

passport-saml fixed: 3.2.2
npm install passport-saml@3.2.2
node-saml fixed: 4.0.0-beta.5
npm install node-saml@4.0.0-beta.5
@node-saml/node-saml fixed: 4.0.0-beta.5
npm install @node-saml/node-saml@4.0.0-beta.5
@node-saml/passport-saml fixed: 4.0.0-beta.3
npm install @node-saml/passport-saml@4.0.0-beta.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls passport-saml

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-39299, inspect your project dependencies using npm:

npm ls passport-saml

Analyze the terminal output to locate any version of Passport saml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.2), your application is affected.

Note: The npm ls passport-saml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In Passport saml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. ### Patches Users should upgrade to passport-saml 3.2.2 or newer. The issue was also present in the beta releases of `node-saml` before v4.0.0-beta.5. ### Workarounds Disable SAML authentication. ### References _Are there any links users can visit to find out more?_ ### For more information If you have any questions or comments about this advisory: * Open a discussion in the [node-saml repo](https://github.com/node-saml/node-saml/discussions) ### Credits * Felix Wilhelm of Google Project Zero

CVE-2022-39299 Affected Passport saml Versions

4 component(s)
Fixed Versions:
3.2.24.0.0-beta.54.0.0-beta.3
Product / Package Ecosystem Affected Versions Fixed Version
passport-saml
npm
< 3.2.2
3.2.2
node-saml
npm
< 4.0.0-beta.5
4.0.0-beta.5
@node-saml/node-saml
npm
< 4.0.0-beta.5
4.0.0-beta.5
@node-saml/passport-saml
npm
< 4.0.0-beta.3
4.0.0-beta.3

References

Frequently Asked Questions

What is CVE-2022-39299?
CVE-2022-39299 is a security vulnerability in Passport saml involving Signature bypass via multiple root elements under CWE-347: Improper Verification of Cryptographic Signature.
Which Passport saml versions are affected?
Affected versions include releases prior to 3.2.2, 4.0.0-beta.5, 4.0.0-beta.3 across affected packages: passport-saml, node-saml, @node-saml/node-saml, @node-saml/passport-saml.
What version fixes CVE-2022-39299?
Upgrading to 3.2.2, 4.0.0-beta.5, 4.0.0-beta.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is passport-saml affected?
Yes, passport-saml is affected in releases prior to 3.2.2. Upgrade your dependency to 3.2.2 or later.
Is node-saml affected?
Yes, node-saml is affected in releases prior to 4.0.0-beta.5. Upgrade your dependency to 4.0.0-beta.5 or later.
What is the CVSS score of CVE-2022-39299?
CVE-2022-39299 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-39299?
CVE-2022-39299 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check npm dependencies for CVE-2022-39299?
Run the dependency tree command: 'npm ls passport-saml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m974-647v-whv7",
  "modified" : "2022-10-18T03:11:22Z",
  "published" : "2022-10-12T22:05:41Z",
  "aliases" : [ "CVE-2022-39299" ],
  "summary" : "Signature bypass via multiple root elements",
  "details" : "### Impact\n\nA 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.\n\n### Patches\n\nUsers should upgrade to passport-saml 3.2.2 or newer. The issue was also present in the beta releases of `node-saml` before v4.0.0-beta.5.\n\n### Workarounds\n\nDisable SAML authentication.\n\n### References\n_Are there any links users can visit to find out more?_\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a discussion in the [node-saml repo](https://github.com/node-saml/node-saml/discussions)\n\n### Credits\n\n* Felix Wilhelm of Google Project Zero\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "passport-saml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-saml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-beta.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@node-saml/node-saml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-beta.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@node-saml/passport-saml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-beta.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/node-saml/passport-saml/security/advisories/GHSA-m974-647v-whv7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39299"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-saml/passport-saml/commit/8b7e3f5a91c8e5ac7e890a0c90bc7491ce33155e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/node-saml/passport-saml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-saml/passport-saml/releases/tag/v3.2.2"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/169826/Node-saml-Root-Element-Signature-Bypass.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-12T22:05:41Z",
    "nvd_published_at" : "2022-10-12T21:15:00Z"
  }
}