CVE-2026-31808

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

Published Mar 10, 2026 CVSS 3.1 · 5.3 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

The vulnerability resides in the ASF (WMV/WMA) file type detection parser of the file-type library. When an ASF sub‑header’s size field is set to zero, the parser enters an infinite loop. The loop decrements a payload counter to a negative value, causing the tokenizer to move read position backwards and continuously reread the same sub‑header, ultimately stalling the Node.js event loop. This denial of service flaw is an instance of CWE‑835 (Infinite Loop). This flaw can be triggered by a crafted 55‑byte payload and results in a denial of service, disrupting legitimate application processing of untrusted or attacker‑controlled data.

Affected Systems

The affected product is "sindresorhus:file-type" used in Node.js applications. Versions prior to 21.3.1 are impacted. Any code that calls file-type to examine user‑supplied files, streams, or raw data is vulnerable until the library is upgraded to 21.3.1 or later.

Risk and Exploitability

The CVSS score of 5.3 indicates a medium impact, while the EPSS score of less than 1% reflects a low probability of exploitation in the general population. The vulnerability is not listed in the CISA KEV catalog. Attackers who can supply crafted ASF content to an application that unconditionally passes data to file-type can cause the event loop to freeze, effectively denying service to all users of that instance. Even though exploitation requires an altered ASF file, the flaw can be triggered with a small, non‑malicious looking payload, implying a moderate ease of attack once the condition is met.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the file-type library to version 21.3.1 or higher.
  • If an upgrade cannot be performed immediately, remove or disable the ASF parsing capability in file-type (e.g., apply a local patch or configuration that turns off ASF support).
  • Avoid passing untrusted or attacker‑controlled data directly to file-type; instead, perform additional input validation or use an alternative file‑type detection mechanism until the library is fixed.

Generated by OpenCVE AI on April 16, 2026 at 09:25 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-5v7r-6r5c-r473 file-type affected by infinite loop in ASF parser on malformed input with zero-size sub-header
History
Type Values Removed Values Added
CPEs cpe:2.3:a:sindresorhus:file-type:*:*:*:*:*:node.js:*:*
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Sindresorhus
Sindresorhus file-type
Vendors & Products Sindresorhus
Sindresorhus file-type
Type Values Removed Values Added
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.
Title file-type affected by infinite loop in ASF parser on malformed input with zero-size sub-header
Weaknesses CWE-835
References
Metrics cvssV3_1

{'score': 5.3, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L'}

Weaknesses
  • CWE-835

    Loop with Unreachable Exit Condition ('Infinite Loop')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Mar 11, 2026, 4:00 PM
Reserved
Mar 9, 2026, 4:33 PM
Status
Analyzed
Published
Mar 10, 2026, 9:16 PM
Modified
Jun 17, 2026, 10:34 AM
Severity
Moderate
Public date
Mar 10, 2026, 9:01 PM