CVE-2023-48706
Low · 3.6CVSS
3.6
EPSS
0.5%
Published
Nov 22, 2023
CISA due date
—
Cloudanix analysis
An old flaw in the Vim editor can let a specially crafted search-and-replace command crash the program or corrupt memory when run for the first time.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- High
- Impact
- Data Tampering
- Component
- Application
- Class
- Use After Free
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap use-after-free triggered when the first :s command uses a sub-replace-special atom that causes a recursive :s call to free memory later accessed by the original command.
Why it matters to the business
Local users can crash Vim or achieve limited memory corruption on affected systems; because the issue is over two years old and an exploit is publicly available, unpatched installations remain exposed until upgraded.
How an attack unfolds
An attacker supplies a crafted :s substitution containing a sub-replace-special atom, executes it as the very first :s command, and relies on the recursive call to free memory that the outer command subsequently accesses, potentially leading to a crash or controlled memory state.
How to fix it
Upgrade vim/vim to the commit 26c11c56888d01e298cd8044caf860f3c26f57bb (version 9.0.2121 or later). Rebuild and redeploy any packages that embed the vulnerable Vim source.
How to confirm the fix worked
Confirm the installed Vim binary reports version 9.0.2121 or later; attempt the original :s reproducer and verify it no longer triggers a use-after-free or crash.
Typical attack path
- Craft a :s command that includes a sub-replace-special atom
- Ensure it is the first :s command executed in the Vim session
- Trigger the recursive substitution path
- Observe or leverage the resulting use-after-free condition
How to detect it
Review system logs for Vim segmentation faults or heap-error messages during substitution operations; inspect command history files for unusual :s patterns on systems where Vim is used interactively.
What your security team should do
- Immediately update all Vim installations to the fixed commit
- Scan build pipelines and container images for the vulnerable vim source
- Monitor public exploit repositories for working PoCs given the ExploitAvailable maturity
- Restrict interactive Vim usage on high-value systems until patched
The record
Vim is a UNIX editor that, prior to version 9.0.2121, has a heap-use-after-free vulnerability. When executing a `:s` command for the very first time and using a sub-replace-special atom inside the substitution part, it is possible that the recursive `:s` call causes free-ing of memory which may later then be accessed by the initial `:s` command. The user must intentionally execute the payload and the whole process is a bit tricky to do since it seems to work only reliably for the very first :s command. It may also cause a crash of Vim. Version 9.0.2121 contains a fix for this issue.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.19 | vim | 0 | 9.0.2127-r0 |
| Alpine:v3.20 | vim | 0 | 9.0.2127-r0 |
| Alpine:v3.21 | vim | 0 | 9.0.2127-r0 |
| Alpine:v3.22 | vim | 0 | 9.0.2127-r0 |
| Debian:11 | vim | 0 | No fix |
| Debian:12 | vim | 0 | No fix |
| Debian:13 | vim | 0 | 2:9.0.2189-1 |
| Mageia:9 | vim | 0 | 9.0.2130-2.mga9 |
| SUSE:Enterprise Storage 7.1 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Micro 5.1 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Micro 5.2 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Micro 5.3 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Micro 5.4 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Micro 5.5 | vim | 0 | 9.1.0111-150500.20.9.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | vim | 0 | 9.1.0111-150500.20.9.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP5 | vim | 0 | 9.1.0111-150500.20.9.1 |
| SUSE:Linux Enterprise Server 12 SP5 | vim | 0 | 9.1.0111-17.29.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | vim | 0 | 9.1.0111-17.29.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Manager Proxy 4.3 | vim | 0 | 9.1.0111-150000.5.60.1 |
| SUSE:Manager Server 4.3 | vim | 0 | 9.1.0111-150000.5.60.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.0.2116-1ubuntu2 |
| 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.5 | vim | 0 | 9.1.0111-150500.20.9.1 |
| openSUSE:Leap Micro 5.3 | vim | 0 | 9.1.0111-150000.5.60.1 |
| openSUSE:Leap Micro 5.4 | vim | 0 | 9.1.0111-150000.5.60.1 |
Related vulnerabilities
- CVE-2023-48231 Vim is an open source command line text editor. Also affects vim
- CVE-2023-5535 Use After Free in GitHub repository vim/vim prior to v9.0.2010. Also affects vim
- CVE-2023-5344 Heap-based Buffer Overflow in GitHub repository vim/vim prior to 9.0.1969. Also affects vim
- 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-4750 Use After Free in GitHub repository vim/vim prior to 9.0.1857. Also affects vim
- CVE-2023-4733 Use After Free in GitHub repository vim/vim prior to 9.0.1840. Also affects vim
- CVE-2023-4735 Out-of-bounds Write in GitHub repository vim/vim prior to 9.0.1847. Also affects vim