# CVE-2016-10535: Timing Attack in csrf-lite

> An attacker can bypass CSRF protection in csrf-lite by exploiting a timing side-channel to guess the secret token efficiently.

- **Severity:** Medium 5.9 (`CVSS:3.0/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:** 31 May 2018
- **Updated:** 17 Sep 2024
- **Also known as:** GHSA-hjhr-r3gq-qvp6

## What is CVE-2016-10535?

CVE-2016-10535 is a medium-severity vulnerability in HackerOne csrf-lite node module, published on 31 May 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

csrf-lite is a cross-site request forgery protection library for framework-less node sites. csrf-lite uses `===`, a fail first string comparison, instead of a time constant string comparison This enables an attacker to guess the secret in no more than (16*18)288 guesses, instead of the 16^18 guesses required were the timing attack not present.

Weakness: CWE-310, CWE-208 (Observable Timing Discrepancy)

## Which versions are affected by CVE-2016-10535?

2 open source packages ship an affected version, including csrf-lite. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `csrf-lite` | npm | All versions | 0.1.2 |
| `csrf-lite` | npm | All versions | 0.1.2 |

Products: Csrf-Lite Project Csrf-Lite.

## How do I fix CVE-2016-10535?

Upgrade csrf-lite to 0.1.2 or later.

## Is CVE-2016-10535 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-10535 and fix it if it is affected.

What it is: CVE-2016-10535 is a medium-severity vulnerability in HackerOne csrf-lite node module, published on 31 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-2016-10535 in the wild and no public exploit code.

Affected packages and fixed versions:
- csrf-lite (npm): affected all versions; fixed in 0.1.2
- csrf-lite (npm): affected all versions; fixed in 0.1.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-2016-10535/ (Markdown: https://insights.sbomify.com/CVE-2016-10535/index.md)
```

## Sources

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

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