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

Medium 5.3 Published Updated

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

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

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

Which versions are affected by CVE-2026-31808?

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

PackageAffectedFixed in
file-type npmFrom 13.0.021.3.1
file-type npmFrom 13.0.021.3.1

Products include Sindresorhus File-Type.

How do I fix CVE-2026-31808?

Upgrade file-type to 21.3.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2026-31808 being exploited?

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

Sources

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 and 8 more.

Is CVE-2026-31808 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free