CVE-2021-4019
High · 7.8CVSS
7.8
EPSS
1.9%
Published
Dec 1, 2021
CISA due date
—
Cloudanix analysis
A problem in the vim text editor could let attackers take over a computer if a person opens a specially made file with it.
- 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
Heap-based buffer overflow in vim allowing memory corruption that can lead to arbitrary code execution or denial of service when processing specially crafted input.
Why it matters to the business
Attackers could gain control of developer or administrator workstations that use vim, leading to theft of source code, credentials, or lateral movement; the issue has been public for years with public exploits available and a modest ongoing rise in exploitation probability.
How an attack unfolds
An attacker crafts a malicious file that triggers the heap overflow during parsing in vim; the victim opens the file locally or via a script, causing the overflow to overwrite memory and execute attacker-supplied code. Public exploits have been available since disclosure.
How to fix it
Upgrade vim to the commit bd228fd097b41a798f90944b5d1245eddd484142 or later; rebuild from source or install a patched package from your distribution if available.
How to confirm the fix worked
Run 'vim --version' and confirm the build includes commit bd228fd097b41a798f90944b5d1245eddd484142 or a later one; test with known triggering inputs in a sandbox to verify the crash no longer occurs.
Typical attack path
- Attacker creates a specially crafted file designed to overflow a heap buffer in vim's parser
- Malicious file is delivered to the target via email, download, or shared storage
- Victim opens the file with an affected vim binary
- Overflow corrupts memory allowing shellcode execution or crash
- Attacker obtains code execution on the victim system
How to detect it
Review system logs and process execution history for unexpected vim crashes or abnormal memory usage when editing files; correlate with file creation timestamps of recently opened documents.
What your security team should do
- Immediately update all vim installations to the fixed commit across developer and server fleets
- Block or sandbox execution of untrusted files with vim until patches are deployed
- Monitor EPSS trend and any new public exploit releases for increased urgency
The record
vim is vulnerable to Heap-based Buffer Overflow
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| 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.13 |
| 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.13 |
| AlmaLinux:8 | vim-minimal | 0 | 2:8.0.1763-16.el8_5.13 |
| Alpine:v3.12 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.13 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.14 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.15 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.16 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.17 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.18 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.19 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.20 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.21 | vim | 0 | 8.2.3779-r0 |
| Alpine:v3.22 | vim | 0 | 8.2.3779-r0 |
| Debian:10 | vim | 0 | 2:8.1.0875-5+deb10u3 |
| Debian:11 | vim | 0 | No fix |
| Debian:11 | vim | 0 | 2:8.2.2434-3+deb11u2 |
| Debian:12 | vim | 0 | 2:8.2.3995-1 |
| Debian:13 | vim | 0 | 2:8.2.3995-1 |
| Debian:9 | vim | 0 | 2:8.0.0197-4+deb9u5 |
| Mageia:8 | vim | 0 | 8.2.3717-1.mga8 |
| Red Hat:enterprise_linux:8::appstream | vim | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-X11 | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-X11-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-common | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-common-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-debugsource | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-enhanced-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::appstream | vim-minimal-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-X11 | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-X11-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-common | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-common-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-debugsource | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-enhanced-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-filesystem | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal | 0 | 2:8.0.1763-16.el8_5.4 |
| Red Hat:enterprise_linux:8::baseos | vim-minimal-debuginfo | 0 | 2:8.0.1763-16.el8_5.4 |
| Rocky Linux:8 | vim | 0 | 2:8.0.1763-16.el8_5.4 |
| 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.8 |
| Ubuntu:20.04:LTS | vim | 0 | 2:8.1.2269-1ubuntu5.6 |
| Ubuntu:22.04:LTS | vim | 0 | 2:8.2.3995-1ubuntu2.1 |
| Ubuntu:Pro:14.04:LTS | vim | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | vim | 0 | 2:7.4.052-1ubuntu3.1+esm17 |
| 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 |
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-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-2017-5953 vim before patch 8.0.0322 does not properly validate values for tree length when handling… Also affects vim
- CVE-2016-1248 vim before patch 8.0.0056 does not properly validate values for the 'filetype', 'syntax'… Also affects vim
- CVE-2023-5535 Use After Free in GitHub repository vim/vim prior to v9.0.2010. Also affects vim