CVE-2026-31808: File type File-type Affected By Infinite Loop Vulnerability
MODERATECVE-2026-31808 is a MODERATE (CVSS 5.3) file-type affected by infinite loop vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting File type libraries in the npm ecosystem. The issue involves file-type affected by infinite loop in asf parser on malformed input with zero-size sub-header. Remediation is available by upgrading affected packages to version 21.3.1.
CVE-2026-31808 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2026-31808
To remediate this vulnerability, upgrade all affected File type dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install file-type@21.3.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls file-type
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-31808, inspect your project dependencies using npm:
npm ls file-type
Analyze the terminal output to locate any version of File type in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 21.3.1), your application is affected.
Note: The npm ls file-type command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In File type, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-31808 Affected File type Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
file-type
|
npm |
≥ 13.0.0
< 21.3.1
|
21.3.1
|
References
Frequently Asked Questions
What is CVE-2026-31808?
Which File type versions are affected?
What version fixes CVE-2026-31808?
Is file-type affected?
What is the CVSS score of CVE-2026-31808?
What CWE is associated with CVE-2026-31808?
How can I check npm dependencies for CVE-2026-31808?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5v7r-6r5c-r473",
"modified" : "2026-03-10T23:57:09Z",
"published" : "2026-03-10T23:57:09Z",
"aliases" : [ "CVE-2026-31808" ],
"summary" : "file-type affected by infinite loop in ASF parser on malformed input with zero-size sub-header",
"details" : "### Impact\nA 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.\n\nAny 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.\n\n### Patches\nFixed in version 21.3.1. Users should upgrade to >= 21.3.1.\n\n### Workarounds\nValidate or limit the size of input buffers before passing them to `file-type`, or run file type detection in a worker thread with a timeout.\n\n### References\n- Fix commit: 319abf871b50ba2fa221b4a7050059f1ae096f4f\n\n### Reporter\n\ncrnkovic@lokvica.com",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "file-type"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "13.0.0"
}, {
"fixed" : "21.3.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sindresorhus/file-type/security/advisories/GHSA-5v7r-6r5c-r473"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-31808"
}, {
"type" : "WEB",
"url" : "https://github.com/sindresorhus/file-type/commit/319abf871b50ba2fa221b4a7050059f1ae096f4f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sindresorhus/file-type"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-835" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-10T23:57:09Z",
"nvd_published_at" : "2026-03-10T21:16:50Z"
}
}