CVE-2021-3928
📋 TL;DR
CVE-2021-3928 is a use-after-free vulnerability in Vim's undo functionality that occurs when handling specially crafted files. This vulnerability could allow an attacker to execute arbitrary code or cause a denial of service by tricking a user into opening a malicious file. All users running vulnerable versions of Vim are affected.
💻 Affected Systems
- Vim
- Neovim (potentially)
- Applications embedding Vim
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
Fedora by Fedoraproject
Vim by Vim
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution with the privileges of the Vim user, potentially leading to full system compromise.
Likely Case
Application crash (denial of service) when opening malicious files, with potential for limited code execution.
If Mitigated
No impact if patched versions are used or if users avoid opening untrusted files.
🎯 Exploit Status
Exploitation requires user interaction to open a malicious file. Proof-of-concept code is available in public references.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Vim 8.2.3489 and later
Vendor Advisory: https://www.vim.org/vim-patches.php
Restart Required: No
Instructions:
1. Update Vim using your system package manager (apt-get upgrade vim, yum update vim, etc.) 2. Alternatively, compile from source using the patched version from the official Vim repository.
🔧 Temporary Workarounds
Disable modelines
allPrevents execution of modeline commands which could be used in exploitation
Add 'set nomodeline' to your .vimrc file
Use secure mode
allRun Vim in restricted mode that disables dangerous features
vim -Z (or --restricted)
🧯 If You Can't Patch
- Restrict user permissions to minimize impact of potential code execution
- Implement application whitelisting to prevent unauthorized Vim execution
🔍 How to Verify
Check if Vulnerable:
Check Vim version with 'vim --version' and compare to vulnerable range (before 8.2.3489)
Check Version:
vim --version | head -1
Verify Fix Applied:
Verify version is 8.2.3489 or later using 'vim --version | head -1'
📡 Detection & Monitoring
Log Indicators:
- Vim crash logs
- Abnormal process termination of Vim
Network Indicators:
- Unusual file transfers to systems running Vim
SIEM Query:
Process:Name=vim AND EventID=1000 (for Windows) OR auth.log entries showing vim crashes (for Linux)
🔗 References
- http://www.openwall.com/lists/oss-security/2022/01/15/1
- https://github.com/vim/vim/commit/15d9890eee53afc61eb0a03b878a19cb5672f732
- https://huntr.dev/bounties/29c3ebd2-d601-481c-bf96-76975369d0cd
- https://lists.debian.org/debian-lts-announce/2022/03/msg00018.html
- https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BCQWPEY2AEYBELCMJYHYWYCD3PZVD2H7/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FNXY7T5OORA7UJIMGSJBGHFMU6UZWS6P/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PGW56Z6IN4UVM3E5RXXF4G7LGGTRBI5C/
- https://security.gentoo.org/glsa/202208-32
- http://www.openwall.com/lists/oss-security/2022/01/15/1
- https://github.com/vim/vim/commit/15d9890eee53afc61eb0a03b878a19cb5672f732
- https://huntr.dev/bounties/29c3ebd2-d601-481c-bf96-76975369d0cd
- https://lists.debian.org/debian-lts-announce/2022/03/msg00018.html
- https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BCQWPEY2AEYBELCMJYHYWYCD3PZVD2H7/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FNXY7T5OORA7UJIMGSJBGHFMU6UZWS6P/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PGW56Z6IN4UVM3E5RXXF4G7LGGTRBI5C/
- https://security.gentoo.org/glsa/202208-32