CVE-2023-46246
Medium · 4.0CVSS
4.0
EPSS
0.4%
Published
Oct 27, 2023
CISA due date
—
Cloudanix analysis
A flaw in the Vim text editor can cause it to crash when a user enters a specially crafted command, potentially losing unsaved work.
- Exploitation
- Local Privilege
- Attacker needs
- Local User
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Application
- Class
- Use After Free
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap-use-after-free triggered when an oversized argument to the :history command causes an integer overflow in ga_grow_inner (alloc.c:748), the allocation is freed in do_cmdline (ex_docmd.c:1010), and the dangling pointer is later dereferenced in cmdhist.c:759.
Why it matters to the business
Local users editing files with Vim may experience editor crashes, leading to lost work and interrupted editing sessions; widespread use of Vim in developer and operations environments amplifies operational friction but does not enable remote code execution or data theft.
How an attack unfolds
An attacker with local access supplies a specially crafted numeric argument to the :history command that overflows the accepted size, resulting in the use-after-free condition and a crash; no remote vector or privilege escalation is involved.
How to fix it
Upgrade vim/vim to commit 9198c1f2b1ddecde22af918541e0de2a32f0f45a or later; rebuild from source or obtain a package containing the fix; until updated, avoid using the :history command with untrusted numeric arguments.
How to confirm the fix worked
Confirm the installed Vim reports version 9.0.2068 or newer (or contains commit 9198c1f2b1ddecde22af918541e0de2a32f0f45a); attempt the :history command with a large numeric argument and verify no crash occurs.
Typical attack path
- Obtain local shell access to a system running an affected Vim build
- Invoke vim and enter command-line mode
- Execute :history with an integer argument large enough to trigger the overflow
- Observe editor crash due to the dangling pointer dereference
How to detect it
Review system logs and crash reports for Vim segmentation faults occurring immediately after :history command usage; correlate with user shell history files containing suspicious :history invocations.
What your security team should do
- Prioritize patching developer workstations and build servers that use Vim
- Add Vim to the organization's patch-management inventory with the fixed commit as the target
- Monitor upstream Vim releases for any follow-on corrections
The record
Vim is an improved version of the good old UNIX editor Vi. Heap-use-after-free in memory allocated in the function `ga_grow_inner` in in the file `src/alloc.c` at line 748, which is freed in the file `src/ex_docmd.c` in the function `do_cmdline` at line 1010 and then used again in `src/cmdhist.c` at line 759. When using the `:history` command, it's possible that the provided argument overflows the accepted value. Causing an Integer Overflow and potentially later an use-after-free. This vulnerability has been patched in version 9.0.2068.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | vim | 0 | No fix |
| Debian:12 | vim | 0 | No fix |
| Debian:13 | vim | 0 | 2:9.0.2087-1 |
| Mageia:8 | vim | 0 | 9.0.2087-1.mga8 |
| Mageia:9 | vim | 0 | 9.0.2087-1.mga9 |
| SUSE:Enterprise Storage 7.1 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Micro 5.1 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Micro 5.2 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Micro 5.3 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Micro 5.4 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Micro 5.5 | vim | 0 | 9.0.2103-150500.20.6.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP4 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | vim | 0 | 9.0.2103-150500.20.6.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP4 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP5 | vim | 0 | 9.0.2103-150500.20.6.1 |
| SUSE:Linux Enterprise Server 12 SP5 | vim | 0 | 9.0.2103-17.26.1 |
| SUSE:Linux Enterprise Server 15 SP1-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | vim | 0 | 9.0.2103-17.26.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | vim | 0 | 9.0.2103-150000.5.57.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | vim | 0 | 9.0.2103-150000.5.57.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:24.04:LTS | vim | 0 | 2:9.1.0-1ubuntu1 |
| 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+esm22 |
| Ubuntu:Pro:18.04:LTS | vim | 0 | 2:8.0.1453-1ubuntu1.13+esm7 |
| openSUSE:Leap 15.4 | vim | 0 | 9.0.2103-150000.5.57.1 |
| openSUSE:Leap 15.5 | vim | 0 | 9.0.2103-150500.20.6.1 |
| openSUSE:Leap Micro 5.3 | vim | 0 | 9.0.2103-150000.5.57.1 |
| openSUSE:Leap Micro 5.4 | vim | 0 | 9.0.2103-150000.5.57.1 |
Related vulnerabilities
- CVE-2025-29768 Vim, a text editor, is vulnerable to potential data loss with zip.vim and special crafted… Also affects vim
- CVE-2025-27423 Vim is an open source, command line text editor. Also affects vim
- CVE-2025-24014 Vim is an open source, command line text editor. Also affects vim
- CVE-2025-22134 When switching to other buffers using the :all command and visual mode still being… Also affects vim
- CVE-2024-47814 Vim is an open source, command line text editor. Also affects vim
- CVE-2024-43802 Vim is an improved version of the unix vi text editor. Also affects vim
- CVE-2024-43374 The UNIX editor Vim prior to version 9.1.0678 has a use-after-free error in argument list… Also affects vim
- CVE-2024-22667 Vim before 9.0.2142 has a stack-based buffer overflow because did_set_langmap in map.c… Also affects vim