{"id":"CVE-2026-31808","aliases":["GHSA-5v7r-6r5c-r473"],"url":"https://o3.security/vulnerability/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","published":"2026-03-10T21:01:55.466Z","modified":"2026-08-12T03:51:43.398586840Z","cvss":{"score":5.3,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"},"epss":{"score":0.00325,"percentile":0.2537,"asOf":"2026-08-16"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"file-type","fixedVersion":"21.3.1"}],"fix":{"url":"https://github.com/sindresorhus/file-type/commit/319abf871b50ba2fa221b4a7050059f1ae096f4f","label":"sindresorhus/file-type@319abf8"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31808.json"},{"type":"ADVISORY","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":"FIX","url":"https://github.com/sindresorhus/file-type/commit/319abf871b50ba2fa221b4a7050059f1ae096f4f"},{"type":"PACKAGE","url":"https://github.com/sindresorhus/file-type"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:43.398586840Z"}}