# CVE-2026-31808: file-type affected by infinite loop in ASF parser on malformed input with zero-size sub-header

> An attacker can cause a denial of service by providing a malformed ASF file that triggers an infinite loop in the file-type library.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Mar 2026
- **Updated:** 11 Mar 2026
- **Also known as:** CLSA-2026-1781744121, CLSA-2026-1791199964, GHSA-5v7r-6r5c-r473, MINI-48vg-6499-v62v, MINI-5p46-x4hr-j3g4, MINI-8pwr-phwr-rfgv, MINI-9799-cv2f-qq3v, MINI-9p47-q9v8-prh4, MINI-c963-hr2w-hmcm, MINI-gmc5-968c-j3q5, MINI-r4q3-fhj5-fxxf, MINI-rrrr-gvc8-f2c7, MINI-wmfc-hjhg-w668, ROOT-APP-NPM-CVE-2026-31808

## What is CVE-2026-31808?

CVE-2026-31808 is a medium-severity denial of service vulnerability in sindresorhus file-type, published on 10 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

file-type detects the file type of a file, stream, or data. Prior to 21.3.1, a denial of service vulnerability exists in the ASF (WMV/WMA) file type detection parser. When parsing a crafted input where an ASF sub-header has a size field of zero, the parser enters an infinite loop. The payload value becomes negative (-24), causing tokenizer.ignore(payload) to move the read position backwards, so the same sub-header is read repeatedly forever. Any application that uses file-type to detect the type of untrusted/attacker-controlled input is affected. An attacker can stall the Node.js event loop with a 55-byte payload. Fixed in version 21.3.1.

Weakness: CWE-835 (Loop with Unreachable Exit Condition)

## Which versions are affected by CVE-2026-31808?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `file-type` | npm | From 13.0.0 | 21.3.1 |
| `file-type` | npm | From 13.0.0 | 21.3.1 |

Products: Sindresorhus File-Type.

## How do I fix CVE-2026-31808?

Upgrade file-type to 21.3.1 or later.

## Is CVE-2026-31808 being exploited?

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

## Other vulnerabilities in sindresorhus file-type

- [CVE-2022-36313](https://insights.sbomify.com/CVE-2022-36313/): file-type vulnerable to Infinite Loop via malformed MKV file (medium 5.5)
- [CVE-2026-32630](https://insights.sbomify.com/CVE-2026-32630/): file-type affected by ZIP Decompression Bomb DoS via [Content_Types].xml entry (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-31808 and fix it if it is affected.

What it is: CVE-2026-31808 is a medium-severity denial of service vulnerability in sindresorhus file-type, published on 10 Mar 2026. 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-2026-31808 in the wild and no public exploit code.

Affected packages and fixed versions:
- file-type (npm): affected from 13.0.0; fixed in 21.3.1
- file-type (npm): affected from 13.0.0; fixed in 21.3.1

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

## Sources

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

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