CVE-2022-36313: file-type vulnerable to Infinite Loop via malformed MKV file

file-type Updated 02 Oct 2025

Summary

22/07/2022
Yes i
High
7.5

CVE-2022-36313: file-type vulnerable to Infinite Loop via malformed MKV file. Affects file-type across 2 version ranges.

>= 13.0.0, < 16.5.4 >= 17.0.0, < 17.1.3

Fixed in 16.5.4 or 17.1.3, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The file-type package is an npm package used in Node.js applications to detect the file type of a given file. It provides functionality to identify the file type based on its content and file extension. This package is widely used in web servers and other applications that handle file uploads and processing. However, versions 13.0.0 until 16.5.4 and 17.x before 17.1.3 of the file-type package are vulnerable to an issue that can cause an infinite loop when processing a malformed MKV file. This vulnerability can lead to the application becoming unresponsive and potentially be exploited for a denial-of-service (DoS) attack on a web server.

Vulnerability Detail

The vulnerability in the file-type package arises from a flaw in the file type detector when handling malformed MKV (Matroska) files. When a malformed MKV file is encountered, the file type detector gets caught in an infinite loop, causing the application to become unresponsive. This vulnerability can be exploited by an attacker to launch a DoS attack on a web server by uploading a specially crafted MKV file. The impact of this vulnerability is a loss of service availability. The Common Vulnerability Scoring System (CVSS) score for this vulnerability is 7.5, indicating a high severity.

How To Fix

Latest published version: 22.2.0 as of 23 Oct 2026

npm install file-type@22.2.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 13.0.0, < 16.5.4 16.5.4
    npm install file-type@16.5.4
  • >= 17.0.0, < 17.1.3 17.1.3
    npm install file-type@17.1.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, if updating the file-type package is not immediately feasible, it is recommended to implement file type validation and filtering on the server-side before processing any uploaded files. This can be done by checking the file extension and using other file type detection mechanisms to ensure that only valid files are processed. By implementing this workaround, the risk of encountering a malformed MKV file and triggering the vulnerability can be mitigated.

Conclusion

The file-type package in versions 13.0.0 until 16.5.4 and 17.x before 17.1.3 is vulnerable to an infinite loop issue when processing malformed MKV files. This can lead to the application becoming unresponsive and potentially be exploited for a denial-of-service attack. To mitigate this vulnerability, it is recommended to update the file-type package to the fixed versions. Implementing file type validation and filtering on the server-side can also provide a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for file-type →

Share this vulnerability

FAQ

The file-type package is an npm package used in Node.js applications to detect the file type of a given file.

The impact of this vulnerability is a loss of service availability, as the application becomes unresponsive when processing a malformed MKV file.

To fix this vulnerability, update the file-type package to version 16.5.4 or higher (for versions 13.0.0 until 16.5.4) or version 17.1.3 or higher (for versions 17.x).

Yes, a temporary workaround is to implement file type validation and filtering on the server-side to mitigate the risk of encountering a malformed MKV file.

The CVSS score for this vulnerability is 7.5, indicating a high severity.

Related vulnerabilities

Recent vulnerabilities recorded for file-type.

How To Fix

Latest published version: 22.2.0 as of 23 Oct 2026

npm install file-type@22.2.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 13.0.0, < 16.5.4 16.5.4
    npm install file-type@16.5.4
  • >= 17.0.0, < 17.1.3 17.1.3
    npm install file-type@17.1.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback