Heap-based Buffer Overflow Vulnerability in vim

vim Updated 02 Oct 2025

Summary

27/10/2021
N/A
Yes i
High
7.8

CVE-2021-3903: vim is vulnerable to Heap-based Buffer Overflow. Affects vim versions < 8.2.3567-r0. Fixed in 8.2.3567-r0. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

vim is a highly popular text editor known for its powerful features and extensive customization options. It is widely used by developers and system administrators for editing code and configuration files. However, the vim package is vulnerable to a heap-based buffer overflow, which can lead to arbitrary code execution or a denial of service attack.

Vulnerability Detail

The vulnerability (CVE-2021-3903) in vim arises from a heap-based buffer overflow. An attacker can exploit this vulnerability by crafting a malicious input that exceeds the bounds of a buffer in the program's memory. This can result in the corruption of adjacent data structures or the execution of arbitrary code. The impact of this vulnerability can range from a system crash to the complete compromise of the affected system.

How To Fix

Minimum fixed version

8.2.3567-r0

This is the first release that contains the fix.

sudo apk add --upgrade vim

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

Workaround

If updating the vim package is not immediately feasible, a possible workaround is to restrict the usage of vim to trusted files and directories. By limiting the exposure of vim to potentially malicious inputs, the risk of exploitation can be mitigated. However, this workaround is not a permanent solution and should be considered temporary until the package is updated.

Conclusion

The heap-based buffer overflow vulnerability in vim poses a significant risk to systems running vulnerable versions of the package. It is crucial to update the vim package to the latest version (8.2.3567-r0 or later) to mitigate the risk of exploitation. If you need further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for vim →

Share this vulnerability

FAQ

The impact of this vulnerability can range from a system crash to the complete compromise of the affected system. An attacker can potentially execute arbitrary code or launch a denial of service attack.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your system is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) and Vulert will provide real-time alerts for open-source vulnerabilities.

At the time of this report, there is no known public exploit for this vulnerability. However, it is crucial to update the vim package as soon as possible to prevent any potential exploitation.

A temporary mitigation is to restrict the usage of vim to trusted files and directories. This can help reduce the risk of exploitation until the package is updated. However, updating the package to the latest version is the recommended long-term solution.

You can find more information about this vulnerability, including technical details and the latest updates, in the official CVE-2021-3903 database entry: https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-3903.json

Related vulnerabilities

Recent vulnerabilities recorded for vim.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

8.2.3567-r0

This is the first release that contains the fix.

sudo apk add --upgrade vim

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