# CVE-2015-9235: Verification Bypass in jsonwebtoken

> Attackers can bypass JWT signature verification by switching algorithm types, allowing unauthorized access in applications using the jsonwebtoken library.

- **Severity:** Critical 9.8 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 May 2018
- **Updated:** 16 Sep 2024
- **Also known as:** CLSA-2026-1774657373, GHSA-c7hr-j4mj-j2w6, ROOT-APP-NPM-CVE-2015-9235

## What is CVE-2015-9235?

CVE-2015-9235 is a critical vulnerability in HackerOne jsonwebtoken node module, published on 29 May 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In jsonwebtoken node module before 4.2.2 it is possible for an attacker to bypass verification when a token digitally signed with an asymmetric key (RS/ES family) of algorithms but instead the attacker send a token digitally signed with a symmetric algorithm (HS* family).

Weakness: CWE-327 (Use of a Broken or Risky Cryptographic Algorithm), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2015-9235?

2 open source packages ship an affected version, including jsonwebtoken. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `jsonwebtoken` | npm | All versions | 4.2.2 |
| `jsonwebtoken` | npm | All versions | 4.2.2 |

Products: Auth0 Jsonwebtoken.

## How do I fix CVE-2015-9235?

Upgrade jsonwebtoken to 4.2.2 or later.

## Is CVE-2015-9235 being exploited?

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

Public exploit code:

- 针对JWT渗透开发的漏洞验证/密钥爆破工具，针对CVE-2015-9235/空白密钥/未验证签名攻击/CVE-2016-10555/CVE-2018-0114/CVE-2020-28042的结果生成用于FUZZ，也可使用字典/字符枚举(包括JJWT)的方式进行爆破(JWT Crack) (github_poc): https://github.com/z-bool/Venom-JWT
- automate CVE-2015-9235 exploitation (github_poc): https://github.com/Nxvh1337/CVE-2015-9235_JWT_key_confusion
- JWT Key Confusion PoC (CVE-2015-9235) Written for the Hack the Box challenge - Under Construction (github_poc): https://github.com/aalex954/jwt-key-confusion-poc
- Demo of the algorithm confusion attack on various JWT libraries (github_poc): https://github.com/tierChampion/POC_CVE-2015-9235

## Other vulnerabilities in HackerOne jsonwebtoken node module

- [CVE-2022-23540](https://insights.sbomify.com/CVE-2022-23540/): jsonwebtoken vulnerable to signature validation bypass due to insecure default algorithm in jwt.verify() (medium 6.4)
- [CVE-2022-23539](https://insights.sbomify.com/CVE-2022-23539/): jsonwebtoken unrestricted key type could lead to legacy keys usage (medium 5.9)
- [CVE-2022-23541](https://insights.sbomify.com/CVE-2022-23541/): jsonwebtoken's insecure implementation of key retrieval function could lead to Forgeable Public/Private Tokens from RSA to HMAC (medium 5.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2015-9235 and fix it if it is affected.

What it is: CVE-2015-9235 is a critical vulnerability in HackerOne jsonwebtoken node module, published on 29 May 2018. 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-2015-9235 in the wild and no public exploit code.

Affected packages and fixed versions:
- jsonwebtoken (npm): affected all versions; fixed in 4.2.2
- jsonwebtoken (npm): affected all versions; fixed in 4.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-2015-9235/ (Markdown: https://insights.sbomify.com/CVE-2015-9235/index.md)
```

## Sources

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

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