CVE-2022-1897
High · 7.8CVSS
7.8
EPSS
1.5%
Published
May 27, 2022
CISA due date
—
Cloudanix analysis
A problem in the Vim text editor could let someone take over a computer if a user opens a specially crafted file.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Application
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Out-of-bounds write in Vim allows memory corruption that can lead to arbitrary code execution on the local system when a crafted input is processed.
Why it matters to the business
Attackers could achieve code execution on developer or administrator workstations running vulnerable Vim versions, risking data theft or persistence; the issue has been public for over four years with an exploit available but remains low-probability in the wild.
How an attack unfolds
An attacker crafts a malicious file or input that triggers insufficient bounds checking during parsing in Vim; when a user opens the file locally, the out-of-bounds write corrupts memory structures, enabling shellcode execution without elevated privileges.
How to fix it
Upgrade vim/vim to a build containing commit 98056533b96b6b5d8849641de93185dd7bcadc44 or later; rebuild from source or obtain a patched package from the distribution.
How to confirm the fix worked
Verify the installed Vim binary or source tree includes commit 98056533b96b6b5d8849641de93185dd7bcadc44; test with known triggering inputs to confirm absence of the write.
Typical attack path
- Identify or create a file that triggers the out-of-bounds write condition in vulnerable Vim
- Deliver the file to the target via email, download, or shared storage
- Convince the user to open the file in Vim (requires user interaction)
- Exploit the resulting memory corruption to execute arbitrary code
How to detect it
Search process creation logs and file-access telemetry for Vim instances handling unexpected or newly created files; monitor for Vim crashes or unexpected child processes that may indicate successful memory corruption.
What your security team should do
- Prioritize patching Vim across all developer and operations systems
- Disable automatic opening of untrusted files in Vim where possible
- Review endpoint detection rules for anomalous Vim child processes or crashes
The record
Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | vim-X11 | 0 | 2:8.0.1763-19.el8_6.4 |
| AlmaLinux:8 | vim-common | 0 | 2:8.0.1763-19.el8_6.4 |
| AlmaLinux:8 | vim-enhanced | 0 | 2:8.0.1763-19.el8_6.4 |
| AlmaLinux:8 | vim-filesystem | 0 | 2:8.0.1763-19.el8_6.4 |
| AlmaLinux:8 | vim-minimal | 0 | 2:8.0.1763-19.el8_6.4 |
| AlmaLinux:9 | vim-X11 | 0 | 2:8.2.2637-16.el9_0.3 |
| AlmaLinux:9 | vim-common | 0 | 2:8.2.2637-16.el9_0.3 |
| AlmaLinux:9 | vim-enhanced | 0 | 2:8.2.2637-16.el9_0.3 |
| AlmaLinux:9 | vim-filesystem | 0 | 2:8.2.2637-16.el9_0.3 |
| AlmaLinux:9 | vim-minimal | 0 | 2:8.2.2637-16.el9_0.3 |
| Debian:10 | vim | 0 | 2:8.1.0875-5+deb10u4 |
| Debian:11 | vim | 0 | No fix |
| Debian:11 | vim | 0 | 2:8.2.2434-3+deb11u2 |
| Debian:12 | vim | 0 | 2:9.0.0135-1 |
| Debian:13 | vim | 0 | 2:9.0.0135-1 |
| Mageia:8 | vim | 0 | 8.2.5052-1.mga8 |
| Red Hat:enterprise_linux:8::appstream | vim | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-X11 | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-X11-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-common | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-common-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-debugsource | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-filesystem | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-X11 | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-X11-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-common | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-common-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-debugsource | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-filesystem | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:enterprise_linux:9::appstream | vim | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-X11 | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-X11-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-common | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-common-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-debugsource | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-enhanced | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-enhanced-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-filesystem | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-minimal | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::appstream | vim-minimal-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-X11 | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-X11-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-common | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-common-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-debugsource | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-enhanced | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-enhanced-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-filesystem | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-minimal | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:enterprise_linux:9::baseos | vim-minimal-debuginfo | 0 | 2:8.2.2637-16.el9_0.3 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-X11 | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-X11-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-common | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-common-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-debugsource | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-enhanced | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-enhanced-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-filesystem | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-minimal | 0 | 2:8.0.1763-19.el8_6.4 |
| Red Hat:rhev_hypervisor:4.4::el8 | vim-minimal-debuginfo | 0 | 2:8.0.1763-19.el8_6.4 |
| Rocky Linux:8 | vim | 0 | 2:8.0.1763-19.el8_6.4 |
| Rocky Linux:9 | vim | 0 | 2:8.2.2637-16.el9_0.3 |
| SUSE:Enterprise Storage 6 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Enterprise Storage 7 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15-ESPOS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise High Performance Computing 15-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Micro 5.1 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Micro 5.2 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP3 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP4 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP3 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP4 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server 12 SP2-BCL | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server 12 SP3-BCL | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server 12 SP4-LTSS | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server 12 SP5 | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server 15 SP1-BCL | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server 15 SP1-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server 15 SP2-BCL | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server 15-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Manager Proxy 4.1 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Manager Retail Branch Server 4.1 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Manager Server 4.1 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:OpenStack Cloud 9 | vim | 0 | 9.0.0814-17.9.1 |
| SUSE:OpenStack Cloud Crowbar 9 | vim | 0 | 9.0.0814-17.9.1 |
| Ubuntu:20.04:LTS | vim | 0 | 2:8.1.2269-1ubuntu5.21 |
| Ubuntu:22.04:LTS | vim | 0 | 2:8.2.3995-1ubuntu2.15 |
| Ubuntu:23.10 | vim | 0 | 2:9.0.1672-1ubuntu2.2 |
| Ubuntu:Pro:14.04:LTS | vim | 0 | 2:7.4.052-1ubuntu3.1+esm15 |
| Ubuntu:Pro:16.04:LTS | vim | 0 | 2:7.4.1689-3ubuntu1.5+esm10 |
| Ubuntu:Pro:16.04:LTS | vim | 0 | 2:7.4.1689-3ubuntu1.5+esm22 |
| Ubuntu:Pro:18.04:LTS | vim | 0 | 2:8.0.1453-1ubuntu1.13+esm7 |
| openSUSE:Leap 15.3 | vim | 0 | 8.2.5038-150000.5.21.1 |
| openSUSE:Leap 15.4 | vim | 0 | 8.2.5038-150000.5.21.1 |
| openSUSE:Tumbleweed | vim | 0 | 9.0.0453-2.1 |
Related vulnerabilities
- CVE-2022-1927 Buffer Over-read in GitHub repository vim/vim prior to 8.2. Also affects vim-X11
- CVE-2022-1785 Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.4977. Also affects vim-X11
- CVE-2022-0318 Heap-based Buffer Overflow in vim/vim prior to 8.2. Also affects vim-X11
- CVE-2022-0261 Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2. Also affects vim-X11
- CVE-2021-4019 vim is vulnerable to Heap-based Buffer Overflow Also affects vim-X11
- CVE-2023-4752 Use After Free in GitHub repository vim/vim prior to 9.0.1858. Also affects vim-X11
- CVE-2022-1420 Use of Out-of-range Pointer Offset in GitHub repository vim/vim prior to 8.2.4774. Also affects vim-X11
- CVE-2022-0554 Use of Out-of-range Pointer Offset in GitHub repository vim/vim prior to 8.2. Also affects vim-X11