{"id":"GHSA-5v7r-6r5c-r473","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 \u003e= 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","aliases":["CVE-2026-31808"],"modified":"2026-09-10T03:50:37.674187908Z","published":"2026-03-10T23:57:09Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-03-10T23:57:09Z","nvd_published_at":"2026-03-10T21:16:50Z","cwe_ids":["CWE-835"],"severity":"MODERATE"},"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"}],"affected":[{"package":{"name":"file-type","ecosystem":"npm","purl":"pkg:npm/file-type"},"ranges":[{"type":"SEMVER","events":[{"introduced":"13.0.0"},{"fixed":"21.3.1"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-5v7r-6r5c-r473/GHSA-5v7r-6r5c-r473.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"}]}