Heap-based Buffer Overflow Vulnerability in vim

vim Updated 02 Oct 2025

Summary

15/10/2021
N/A
Yes i
Medium
5.5

CVE-2021-3875: vim is vulnerable to Heap-based Buffer Overflow. Affects vim versions < 8.2.3500-r0. Fixed in 8.2.3500-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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

vim is a popular text editor that is widely used for editing files on Unix-like operating systems. It provides a powerful and customizable editing experience for developers and system administrators. However, a vulnerability has been discovered in vim that allows for a heap-based buffer overflow.

Vulnerability Detail

The vulnerability, identified as CVE-2021-3875, occurs due to improper handling of certain input in vim. An attacker can exploit this vulnerability by crafting a malicious file or text that triggers the buffer overflow. If successful, the attacker can execute arbitrary code or crash the vim process, potentially leading to a denial-of-service (DoS) condition. The severity of this vulnerability is rated as moderate with a CVSS score of 5.5.

How To Fix

Minimum fixed version

8.2.3500-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

As a workaround, users can avoid opening or editing untrusted files with vim until the vulnerability is patched. Additionally, it is advisable to exercise caution when handling files from unknown or untrusted sources.

Conclusion

The heap-based buffer overflow vulnerability in vim can be mitigated by updating to the latest version of vim. It is important to promptly apply the necessary patches to ensure the security and stability of the vim installation. For further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for vim →

Share this vulnerability

FAQ

The vulnerability allows an attacker to execute arbitrary code or crash the vim process, potentially leading to a denial-of-service condition.

At the time of this report, there are no known public exploits targeting this vulnerability.

Yes, all versions of vim prior to 8.2.3500-r0 are affected by this vulnerability.

No, this vulnerability requires the attacker to have local access to the vulnerable vim installation.

Yes, a fix is available in vim version 8.2.3500-r0 and later.

Related vulnerabilities

Recent vulnerabilities recorded for vim.

How To Fix

Minimum fixed version

8.2.3500-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