CVE-2021-29446: Jose node cjs runtime Padding Oracle Attack Due To Vulnerability

MODERATE
Advisory Identifier: GHSA-rvcw-f68w-8h8h
CVSS 5.9
CWE-203 CWE-208 CWE-696
Published
Advisory Summary

CVE-2021-29446 is a MODERATE (CVSS 5.9) padding oracle attack due to vulnerability (CWE-203: Observable Discrepancy) affecting Jose node cjs runtime libraries in the npm ecosystem. The issue involves padding oracle attack due to observable timing discrepancy in jose-node-cjs-runtime. Remediation is available by upgrading affected packages to version 3.11.4.

CVE-2021-29446 at a Glance

CVE Identifier CVE-2021-29446
GHSA Identifier GHSA-rvcw-f68w-8h8h
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-203: Observable Discrepancy
Affected Product Jose node cjs runtime
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.9

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:N/A:N).

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 None (I:N)
Availability None (A:N)

How to Fix CVE-2021-29446

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

jose-node-cjs-runtime fixed: 3.11.4
npm install jose-node-cjs-runtime@3.11.4
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 jose-node-cjs-runtime

How to Check if You Are Affected

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

npm ls jose-node-cjs-runtime

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

Note: The npm ls jose-node-cjs-runtime 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-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Jose node cjs runtime, 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 [AES_CBC_HMAC_SHA2 Algorithm](https://tools.ietf.org/html/rfc7518#section-5.2) (A128CBC-HS256, A192CBC-HS384, A256CBC-HS512) decryption would always execute both HMAC tag verification and CBC decryption, if either failed `JWEDecryptionFailed` would be thrown. But a possibly observable difference in timing when padding error would occur while decrypting the ciphertext makes a padding oracle and an adversary might be able to make use of that oracle to decrypt data without knowing the decryption key by issuing on average 128*b calls to the padding oracle (where b is the number of bytes in the ciphertext block). ### Patches A patch was released which ensures the HMAC tag is verified before performing CBC decryption. The fixed versions are `>=3.11.4`. Users should upgrade to `^3.11.4`. ### Credits Thanks to Morgan Brown of Microsoft for bringing this up and Eva Sarafianou (@esarafianou) for helping to score this advisory.

CVE-2021-29446 Affected Jose node cjs runtime Versions

1 component(s)
Fixed Versions:
3.11.4
Product / Package Ecosystem Affected Versions Fixed Version
jose-node-cjs-runtime
npm
< 3.11.4
3.11.4

References

Frequently Asked Questions

What is CVE-2021-29446?
CVE-2021-29446 is a security vulnerability in Jose node cjs runtime involving Padding Oracle Attack due to Observable Timing Discrepancy in jose-node-cjs-runtime under CWE-203: Observable Discrepancy.
Which Jose node cjs runtime versions are affected?
Affected versions include releases prior to 3.11.4 across affected packages: jose-node-cjs-runtime.
What version fixes CVE-2021-29446?
Upgrading to 3.11.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jose-node-cjs-runtime affected?
Yes, jose-node-cjs-runtime is affected in releases prior to 3.11.4. Upgrade your dependency to 3.11.4 or later.
What is the CVSS score of CVE-2021-29446?
CVE-2021-29446 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-29446?
CVE-2021-29446 is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check npm dependencies for CVE-2021-29446?
Run the dependency tree command: 'npm ls jose-node-cjs-runtime'. 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-rvcw-f68w-8h8h",
  "modified" : "2023-03-17T17:49:57Z",
  "published" : "2021-04-19T15:00:05Z",
  "aliases" : [ "CVE-2021-29446" ],
  "summary" : "Padding Oracle Attack due to Observable Timing Discrepancy in jose-node-cjs-runtime",
  "details" : "### Impact\n\n[AES_CBC_HMAC_SHA2 Algorithm](https://tools.ietf.org/html/rfc7518#section-5.2) (A128CBC-HS256, A192CBC-HS384, A256CBC-HS512) decryption would always execute both HMAC tag verification and CBC decryption, if either failed `JWEDecryptionFailed` would be thrown. But a possibly observable difference in timing when padding error would occur while decrypting the ciphertext makes a padding oracle and an adversary might be able to make use of that oracle to decrypt data without knowing the decryption key by issuing on average 128*b calls to the padding oracle (where b is the number of bytes in the ciphertext block).\n\n### Patches\n\nA patch was released which ensures the HMAC tag is verified before performing CBC decryption. The fixed versions are `>=3.11.4`.\n\nUsers should upgrade to `^3.11.4`.\n\n### Credits\nThanks to Morgan Brown of Microsoft for bringing this up and Eva Sarafianou (@esarafianou) for helping to score this advisory.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jose-node-cjs-runtime"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.11.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/panva/jose/security/advisories/GHSA-rvcw-f68w-8h8h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29446"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/panva/jose"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/jose-node-cjs-runtime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203", "CWE-208", "CWE-696" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-16T22:57:33Z",
    "nvd_published_at" : "2021-04-16T22:15:00Z"
  }
}