Heap-Based Buffer Overflow in File Package: CVE-2019-18218

file Updated 02 Oct 2025

Summary

21/10/2019
N/A
Yes i
High
7.8

ALPINE-CVE-2019-18218: cdf_read_property_info in cdf.c in file through 5.37 does not restrict the number of CDF_VECTOR elements, which allows a heap-based buffer overflow (4-byte out-of-bounds write). Affects file versions < 5.37-r1. Fixed in 5.37-r1. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The 'file' package is a widely used utility in Unix-like operating systems that determines the type of a file based on its content rather than its name. It is essential for various applications, including file management and data processing. However, the package has been found to have a vulnerability that could lead to severe security issues if not addressed promptly.

Vulnerability Detail

The vulnerability identified as CVE-2019-18218 is rooted in the 'cdf_read_property_info' function within the 'cdf.c' file of the 'file' package, specifically versions up to 5.37. This flaw allows an attacker to exploit a heap-based buffer overflow due to the lack of restrictions on the number of CDF_VECTOR elements. The consequences of this vulnerability include potential arbitrary code execution, data corruption, and system crashes, making it critical for users to apply the necessary fixes.

How To Fix

Minimum fixed version

5.37-r1

This is the first release that contains the fix.

sudo apk add --upgrade file

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can limit the input files processed by the 'file' command to avoid triggering the vulnerability until the package is updated. However, this is not a permanent solution and updating the package is strongly recommended.

Conclusion

The CVE-2019-18218 vulnerability in the 'file' package poses a significant risk due to its potential for heap-based buffer overflow. Users are strongly advised to update to the patched version 5.37-r1 to secure their systems. For ongoing monitoring of vulnerabilities, consider using Vulert, which provides real-time alerts based on your manifest files.

See every vulnerability recorded for file →

Share this vulnerability

FAQ

CVE-2019-18218 is a vulnerability in the 'file' package that allows for a heap-based buffer overflow due to improper handling of CDF_VECTOR elements.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which analyzes your manifest file for vulnerabilities.

The risks include potential arbitrary code execution, data corruption, and system instability, which can lead to significant security breaches.

Yes, a patch is available in version 5.37-r1 of the 'file' package. Users should update to this version or later to mitigate the risk.

If immediate updating is not possible, limit the use of the 'file' command on untrusted files as a temporary workaround until the package can be updated.

Related vulnerabilities

Recent vulnerabilities recorded for file.

How To Fix

Minimum fixed version

5.37-r1

This is the first release that contains the fix.

sudo apk add --upgrade file

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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