Improper Verification of Cryptographic Signature Affecting xml-crypto package, versions >=4.0.0 <6.0.0


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.04% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-XMLCRYPTO-6751737
  • published 2 May 2024
  • disclosed 2 May 2024
  • credit Unknown

How to fix?

Upgrade xml-crypto to version 6.0.0 or higher.

Overview

xml-crypto is a xml digital signature and encryption library for Node.js.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to the default configuration not checking the authorization of the signer but only the validity of the signature. This oversight allows a malicious actor to re-sign an XML document and insert the certificate in a <KeyInfo /> element. Consequently, any certificate provided via a digitally signed XML document's <KeyInfo /> is trusted by default, even if the library was configured to use a specific certificate (publicCert) for signature verification purposes. An attacker can manipulate the XML document by replacing the existing signature with one generated with a malicious private key and attaching that private key's certificate to the <KeyInfo /> element.

Workaround

This vulnerability in versions 4.x and 5.x can be mitigated by checking the certificate extracted via getCertFromKeyInfo against trusted certificates before accepting the results of the validation or setting xml-crypto's getCertFromKeyInfo to () => undefined, forcing xml-crypto to use an explicitly configured publicCert or privateKey for signature verification.

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
10 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    None