Heap-based Buffer Overflow in vim Package - CVE-2022-0158

vim Updated 02 Oct 2025

Summary

10/01/2022
N/A
Yes i
Low
3.3

ALPINE-CVE-2022-0158: vim is vulnerable to Heap-based Buffer Overflow. 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 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

The vim package is a widely used text editor that is known for its efficiency and versatility in handling various file types. It offers features such as syntax highlighting, multi-level undo, and a robust plugin system. However, it has been found to be vulnerable to a heap-based buffer overflow, which can compromise the integrity of the application and potentially allow for arbitrary code execution.

Vulnerability Detail

CVE-2022-0158 is a heap-based buffer overflow vulnerability in the vim package. This vulnerability arises from improper handling of memory allocation, which can lead to a situation where an attacker may exploit this flaw to execute arbitrary code. The ramifications of this vulnerability can be severe, including unauthorized access to system resources and potential data breaches. The vulnerability has a CVSS score of 3.3, indicating a moderate level of risk.

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

As a temporary workaround, users can avoid using features in vim that may trigger the buffer overflow until the package is updated. However, the best course of action is to apply the patch as soon as possible.

Conclusion

The vim package is vulnerable to a heap-based buffer overflow as identified in CVE-2022-0158. Users are strongly advised to update to the patched version 8.2.4173-r0 to mitigate risks associated with this vulnerability. Utilizing tools like Vulert can further enhance your ability to monitor and manage vulnerabilities in your software.

See every vulnerability recorded for vim →

Share this vulnerability

FAQ

CVE-2022-0158 is a vulnerability in the vim package that allows for a heap-based buffer overflow, potentially leading to arbitrary code execution.

You can check if your version of vim is affected by using the Vulert playground at Vulert Scanner, which allows you to monitor vulnerabilities in your software without requiring installation.

If you cannot update vim immediately, avoid using features that may trigger the vulnerability as a temporary workaround.

The potential consequences include unauthorized access to system resources, data breaches, and the execution of arbitrary code.

Vulert uses a manifest file like package-lock.json to monitor and alert in real-time for open-source vulnerabilities in your software, providing an easy way to stay informed.

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