CVE-2022-0318
Critical · 9.8CVSS
9.8
EPSS
2.0%
Published
Jan 21, 2022
CISA due date
—
Cloudanix analysis
A flaw in the popular Vim text editor can let attackers take over your computer if you open a specially made file with it.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Application
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap-based buffer overflow in Vim allowing out-of-bounds writes that can corrupt memory and lead to arbitrary code execution.
Why it matters to the business
Attackers can gain full control of systems running vulnerable Vim versions when users open malicious files, potentially leading to data theft, ransomware deployment, or lateral movement in environments where Vim is used for editing or log review.
How an attack unfolds
An attacker creates a specially crafted file that triggers the heap overflow during parsing. When a victim opens the file with a vulnerable Vim version, the overflow overwrites heap memory, enabling shellcode execution. Public exploits are available and can be adapted for targeted attacks against developers or administrators who routinely handle untrusted text or configuration files.
How to fix it
Upgrade Vim to the fixed commit 98056533b96b6b5d8849641de93185dd7bcadc44 or later release. Rebuild from source or obtain updated packages from distribution maintainers. Disable modelines and avoid opening untrusted files until patched.
How to confirm the fix worked
Confirm Vim version reports the fixed commit or 8.2+. Test with known proof-of-concept files in an isolated environment to verify no crash or unexpected behavior occurs. Review build logs for the corrected commit hash.
Typical attack path
- Craft malicious file exploiting the buffer overflow condition
- Deliver file via email, download link, or shared repository
- Victim opens file using vulnerable Vim instance
- Overflow corrupts heap structures and redirects execution flow
- Attacker payload executes with privileges of the Vim process
How to detect it
Review system and application logs for Vim crashes or segmentation faults when processing files. Correlate with file access timestamps from untrusted sources. Examine process execution following Vim launches for unexpected child processes or network activity.
What your security team should do
- Immediately update all Vim installations to the fixed commit across developer workstations and servers
- Restrict opening of files from untrusted sources until patches are deployed
- Monitor for new public exploits and update detection rules accordingly
- Consider replacing Vim with hardened alternatives or sandboxed editors in high-risk environments
The record
Heap-based Buffer Overflow in vim/vim prior to 8.2.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | vim-X11 | 0 | 2:8.0.1763-16.el8_5.12 |
| AlmaLinux:8 | vim-X11 | 0 | 2:8.0.1763-16.el8_5.13 |
| AlmaLinux:8 | vim-common | 0 | 2:8.0.1763-16.el8_5.12 |
| AlmaLinux:8 | vim-common | 0 | 2:8.0.1763-16.el8_5.13 |
| AlmaLinux:8 | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.12 |
| AlmaLinux:8 | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.13 |
| AlmaLinux:8 | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.12 |
| AlmaLinux:8 | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.13 |
| AlmaLinux:8 | vim-minimal | 0 | 2:8.0.1763-16.el8_5.13 |
| Debian:10 | vim | 0 | 2:8.1.0875-5+deb10u4 |
| Debian:11 | vim | 0 | No fix |
| Debian:12 | vim | 0 | 2:8.2.4659-1 |
| Debian:13 | vim | 0 | 2:8.2.4659-1 |
| Mageia:8 | vim | 0 | 8.2.4975-1.mga8 |
| Red Hat:enterprise_linux:8::appstream | vim | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-X11 | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-X11-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-common | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-common-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-debugsource | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-X11 | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-X11-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-common | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-common-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-debugsource | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal | 0 | 2:8.0.1763-16.el8_5.12 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal-debuginfo | 0 | 2:8.0.1763-16.el8_5.12 |
| Rocky Linux:8 | vim | 0 | 2:8.0.1763-16.el8_5.12 |
| SUSE:Enterprise Storage 6 | vim | 0 | 8.0.1568-5.17.1 |
| SUSE:Enterprise Storage 6 | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Enterprise Storage 7 | vim | 0 | 8.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.1 |
| SUSE:Linux Enterprise High Performance Computing 15-LTSS | vim | 0 | 8.2.5038-150000.5.21.1 |
| SUSE:Linux Enterprise Micro 5.0 | vim | 0 | 8.0.1568-5.17.1 |
| SUSE:Linux Enterprise Micro 5.1 | vim | 0 | 8.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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 Real Time 15 SP2 | vim | 0 | 8.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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.0.1568-5.17.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:18.04:LTS | vim | 0 | 2:8.0.1453-1ubuntu1.13 |
| Ubuntu:20.04:LTS | vim | 0 | 2:8.1.2269-1ubuntu5.14 |
| Ubuntu:22.04:LTS | vim | 0 | 2:8.2.3995-1ubuntu2.7 |
| Ubuntu:Pro:14.04:LTS | vim | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | vim | 0 | 2:7.4.052-1ubuntu3.1+esm9 |
| Ubuntu:Pro:16.04:LTS | vim | 0 | 2:7.4.1689-3ubuntu1.5+esm4 |
| openSUSE:Leap 15.3 | vim | 0 | 8.2.5038-150000.5.21.1 |
| openSUSE:Leap 15.3 | vim | 0 | 8.0.1568-5.17.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-1897 Out-of-bounds Write 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-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-4781 Heap-based Buffer Overflow in GitHub repository vim/vim prior to 9.0.1873. Also affects vim
- CVE-2023-4752 Use After Free in GitHub repository vim/vim prior to 9.0.1858. Also affects vim
- CVE-2023-2610 Integer Overflow or Wraparound in GitHub repository vim/vim prior to 9.0.1532. Also affects vim