Use After Free Vulnerability in vim

vim Updated 02 Oct 2025

Summary

29/12/2021
N/A
Yes i
High
7.8

CVE-2021-4187: vim is vulnerable to Use After Free. Affects vim versions < 8.2.4173-r0. Fixed in 8.2.4173-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 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

vim is a popular text editor that is widely used for editing files in Unix-like operating systems. It provides a wide range of features and functionalities, making it a preferred choice for many developers and system administrators. However, the vim package in Alpine Linux versions 3.12 to 3.18 is vulnerable to a Use After Free vulnerability, which can lead to potential security risks.

Vulnerability Detail

The Use After Free vulnerability in vim occurs when the program continues to use a memory address after it has been freed. This can result in various issues, including crashes, memory corruption, and potential remote code execution. An attacker could exploit this vulnerability by crafting a malicious file or by tricking a user into opening a specially crafted file using vim. The impact of this vulnerability can be severe, allowing an attacker to gain unauthorized access to sensitive information or execute arbitrary code on the affected system.

How To Fix

Minimum fixed version

8.2.4173-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 possible, a temporary workaround is to avoid opening untrusted or unknown files using vim. Additionally, it is recommended to exercise caution when opening files from untrusted sources and to regularly update the software to the latest version once the fix becomes available.

Conclusion

The Use After Free vulnerability in vim can pose significant security risks, potentially leading to unauthorized access or arbitrary code execution. It is crucial to update the vim package to the latest version and exercise caution when handling files from untrusted sources. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for vim →

Share this vulnerability

FAQ

A Use After Free vulnerability occurs when a program continues to use a memory address after it has been freed. This can lead to various security issues and potential exploitation by attackers.

This vulnerability can be exploited by crafting a malicious file or by tricking a user into opening a specially crafted file using vim. The attacker can then potentially execute arbitrary code or gain unauthorized access to the system.

The impact of this vulnerability can be severe, including crashes, memory corruption, and potential remote code execution. An attacker could gain unauthorized access to sensitive information or take control of the affected system.

To fix this vulnerability, update the vim package to version 8.2.4173-r0 or later. This update includes the necessary patches and fixes to address the Use After Free vulnerability.

If updating the vim package is not immediately possible, it is recommended to avoid opening untrusted or unknown files using vim. Exercise caution when opening files from untrusted sources and regularly update the software once the fix becomes available.

Related vulnerabilities

Recent vulnerabilities recorded for vim.

How To Fix

Minimum fixed version

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