CVE-2016-1248
High · 7.8CVSS
7.8
EPSS
25.3%
Published
Nov 23, 2016
CISA due date
—
Cloudanix analysis
A text editor can be tricked into running harmful code when someone opens a specially prepared document, giving attackers a way to take over the computer.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Application
- Class
- Improper Input Validation
- Remediation
- Patch
- Effort
- Low
- Patch risk
- Low
What it actually does
Improper validation of 'filetype', 'syntax', and 'keymap' modeline options permits arbitrary code execution upon opening a crafted file in the editor.
Why it matters to the business
Users editing untrusted files risk local code execution that can lead to data theft, malware installation, or full system compromise on developer and operations workstations.
How an attack unfolds
An attacker embeds a malicious modeline in a text file that abuses the unvalidated options to load and execute attacker-controlled code; the file is then sent to a target who opens it with an affected Vim or Neovim build, triggering execution.
How to fix it
Upgrade Vim to commit d0b5138ba4bccff8a744c99836041ef6322ed39a or Neovim to commit 4fad66fbe637818b6b3d6bc5d21923ba72795040. As a temporary mitigation, set nomodeline in editor configuration or run with --noplugin.
How to confirm the fix worked
Verify editor version or source commit matches or exceeds the listed fixed revisions; attempt to open a test file containing a modeline that would previously have triggered code execution and confirm no execution occurs.
Typical attack path
- Create text file containing malicious modeline setting filetype/syntax/keymap to trigger code execution
- Deliver the file via email, repository, or shared storage to the victim
- Victim opens the file in a vulnerable editor instance
- Editor processes the modeline and executes the embedded payload
How to detect it
Review shell history and process trees for unexpected child processes launched shortly after Vim or Neovim execution; inspect recently opened files for suspicious modeline strings in user home directories and shared repositories.
What your security team should do
- Immediately update all Vim and Neovim installations to the fixed commits
- Disable modeline processing by default across the organization
- Add editor version checks to developer workstation and CI image baselines
The record
vim before patch 8.0.0056 does not properly validate values for the 'filetype', 'syntax' and 'keymap' options, which may result in the execution of arbitrary code if a file with a specially crafted modeline is opened.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.10 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.11 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.12 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.13 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.14 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.15 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.16 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.17 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.18 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.19 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.2 | vim | 0 | 7.4.712-r1 |
| Alpine:v3.20 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.21 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.22 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.3 | vim | 0 | 7.4.943-r4 |
| Alpine:v3.4 | vim | 0 | 7.4.1831-r2 |
| Alpine:v3.5 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.6 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.7 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.8 | vim | 0 | 8.0.0056-r0 |
| Alpine:v3.9 | vim | 0 | 8.0.0056-r0 |
| Debian:11 | neovim | 0 | 0.1.6-4 |
| Debian:11 | vim | 0 | 2:8.0.0095-1 |
| Debian:12 | neovim | 0 | 0.1.6-4 |
| Debian:12 | vim | 0 | 2:8.0.0095-1 |
| Debian:13 | neovim | 0 | 0.1.6-4 |
| Debian:13 | vim | 0 | 2:8.0.0095-1 |
| Debian:7 | vim | 0 | 2:7.3.547-7+deb7u1 |
| Debian:8 | vim | 0 | 2:7.4.488-7+deb8u1 |
| Mageia:5 | vim | 0 | 7.4.430-7.1.mga5 |
| Red Hat:enterprise_linux:6::client | vim | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-X11 | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-common | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-debuginfo | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-enhanced | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-filesystem | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::client | vim-minimal | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-X11 | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-common | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-debuginfo | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-enhanced | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-filesystem | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::computenode | vim-minimal | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-X11 | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-common | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-debuginfo | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-enhanced | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-filesystem | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::server | vim-minimal | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-X11 | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-common | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-debuginfo | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-enhanced | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-filesystem | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:6::workstation | vim-minimal | 0 | 2:7.4.629-5.el6_8.1 |
| Red Hat:enterprise_linux:7::client | vim | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-X11 | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-common | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-debuginfo | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-enhanced | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-filesystem | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::client | vim-minimal | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-X11 | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-common | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-debuginfo | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-enhanced | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-filesystem | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::computenode | vim-minimal | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-X11 | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-common | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-debuginfo | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-enhanced | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-filesystem | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::server | vim-minimal | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-X11 | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-common | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-debuginfo | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-enhanced | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-filesystem | 0 | 2:7.4.160-1.el7_3.1 |
| Red Hat:enterprise_linux:7::workstation | vim-minimal | 0 | 2:7.4.160-1.el7_3.1 |
| SUSE:Linux Enterprise Desktop 12 SP1 | vim | 0 | 7.4.326-7.1 |
| SUSE:Linux Enterprise Desktop 12 SP2 | vim | 0 | 7.4.326-7.1 |
| SUSE:Linux Enterprise Server 11 SP4 | vim | 0 | 7.2-8.17.1 |
| SUSE:Linux Enterprise Server 12 SP1 | vim | 0 | 7.4.326-7.1 |
| SUSE:Linux Enterprise Server 12 SP2 | vim | 0 | 7.4.326-7.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 for Raspberry Pi 12 SP2 | vim | 0 | 7.4.326-7.1 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | vim | 0 | 7.2-8.17.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | vim | 0 | 7.4.326-7.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | vim | 0 | 7.4.326-7.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: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:14.04:LTS | vim | 0 | 2:7.4.052-1ubuntu3.1 |
| Ubuntu:16.04:LTS | vim | 0 | 2:7.4.1689-3ubuntu1.2 |
Related vulnerabilities
- CVE-2017-5953 vim before patch 8.0.0322 does not properly validate values for tree length when handling… Also affects vim
- CVE-2021-4019 vim is vulnerable to Heap-based Buffer Overflow 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