# CVE-2021-29444: Padding Oracle Attack due to Observable Timing Discrepancy in jose-browser-runtime

> An attacker can decrypt data without the key by exploiting a timing side-channel in the jose-browser-runtime library's AES-CBC-HMAC decryption process.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/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:** 16 Apr 2021
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-94hh-pjjg-rwmr

## What is CVE-2021-29444?

CVE-2021-29444 is a medium-severity vulnerability in panva jose, published on 16 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

jose-browser-runtime is an npm package which provides a number of cryptographic functions. In versions prior to 3.11.4 the AES_CBC_HMAC_SHA2 Algorithm (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). 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`.

Weakness: CWE-203 (Observable Discrepancy)

## Which versions are affected by CVE-2021-29444?

2 open source packages ship an affected version, including jose-browser-runtime. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `jose-browser-runtime` | npm | All versions | 3.11.4 |
| `jose-browser-runtime` | npm | All versions | 3.11.4 |

Products: Jose-Node-Cjs-Runtime Project Jose-Node-Cjs-Runtime.

## How do I fix CVE-2021-29444?

Upgrade jose-browser-runtime to 3.11.4 or later.

## Is CVE-2021-29444 being exploited?

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

## Other vulnerabilities in panva jose

- [CVE-2021-29445](https://insights.sbomify.com/CVE-2021-29445/): Padding Oracle Attack due to Observable Timing Discrepancy in jose-node-esm-runtime (medium 5.9)
- [CVE-2021-29446](https://insights.sbomify.com/CVE-2021-29446/): Padding Oracle Attack due to Observable Timing Discrepancy in jose-node-cjs-runtime (medium 5.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-29444 and fix it if it is affected.

What it is: CVE-2021-29444 is a medium-severity vulnerability in panva jose, published on 16 Apr 2021. 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-2021-29444 in the wild and no public exploit code.

Affected packages and fixed versions:
- jose-browser-runtime (npm): affected all versions; fixed in 3.11.4
- jose-browser-runtime (npm): affected all versions; fixed in 3.11.4

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

## Sources

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

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