VYPR
Unrated severityNVD Advisory· Published May 27, 2022· Updated Nov 3, 2025

Out-of-bounds Write in vim/vim

CVE-2022-1897

Description

An out-of-bounds write vulnerability in Vim prior to 8.2 could allow arbitrary code execution via a crafted buffer.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

An out-of-bounds write vulnerability in Vim prior to 8.2 could allow arbitrary code execution via a crafted buffer.

Vulnerability

An out-of-bounds write vulnerability exists in Vim versions prior to patch 8.2.5023 (before Vim 8.2). The issue occurs in the substitute command when a maliciously crafted buffer causes the substitute function to overwrite an already allocated buffer, leading to memory corruption. The affected code path is triggered when the text_locked() state is not checked before performing certain substitute operations. The commit 338f1fc in the Vim repository introduces a check_text_locked function to prevent this [2].

Exploitation

To exploit this vulnerability, an attacker must provide a specially crafted file or text that, when opened and processed by Vim's substitute functionality, triggers the out-of-bounds write. No special authentication or network position is required beyond the ability to deliver the malicious file to the victim. The exploit relies on the user performing a substitute operation on the crafted buffer.

Impact

Successful exploitation could lead to arbitrary code execution with the privileges of the user running Vim. This is a critical impact as it may allow an attacker to execute code, install programs, or take other malicious actions. The vulnerability is listed as having a high severity. Apple's advisory confirms that processing a maliciously crafted image (though in this context, a file handled by Vim) could lead to arbitrary code execution [1].

Mitigation

The fix was applied in Vim patch 8.2.5023, which is included in Vim 8.2 release. Users should update to Vim version 8.2 or later. Apple addresses this vulnerability in macOS Ventura 13, released on October 24, 2022 [1]. Affected users should ensure their Vim installation is updated. Official package managers and distributions have released patched versions.

AI Insight generated on May 25, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

43

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

11

News mentions

0

No linked articles in our index yet.