CVE-2019-12735

VEX

Public on

Last modified: UTC

ImportantImportant severityWhat does this mean?

Insights vulnerability analysis

View exposed systems

Description

It was found that the `:source!` command was not restricted by the sandbox mode. If modeline was explicitly enabled, opening a specially crafted text file in vim could result in arbitrary command execution.

It was found that the :source! command was not restricted by the sandbox mode. If modeline was explicitly enabled, opening a specially crafted text file in vim could result in arbitrary command execution.

Statement

To be successfully and automatically triggered when a specially crafted file is opened, this vulnerability requires 3 parts : 1) The `source!` command inability to check if it is running in sandbox mode (the fix commit prevents this) 2) The `modeline` to be enabled (by default, modeline is disabled when running with root permission. See `Mitigation` steps to disable the modeline) 3) A function, to be inserted in the modeline, that can be used to trigger the `source!` command (e.g.: `assert_fail()` in the public reproducer). To the best of our knowledge, no such functions were found in the default installation of Red Hat Enterprise Linux versions 5, 6 and 7 at the time of the flaw. However, Red Hat Enterprise Linux version 8 contains `assert_fail()`. Without part 2 or 3, it would be required for an attacker to be able to craft the command line used to open the crafted file, in order to trigger the vulnerability.

To be successfully and automatically triggered when a specially crafted file is opened, this vulnerability requires 3 parts :

  1. The source! command inability to check if it is running in sandbox mode (the fix commit prevents this)

  2. The modeline to be enabled (by default, modeline is disabled when running with root permission. See Mitigation steps to disable the modeline)

  3. A function, to be inserted in the modeline, that can be used to trigger the source! command (e.g.: assert_fail() in the public reproducer). To the best of our knowledge, no such functions were found in the default installation of Red Hat Enterprise Linux versions 5, 6 and 7 at the time of the flaw. However, Red Hat Enterprise Linux version 8 contains assert_fail().

Without part 2 or 3, it would be required for an attacker to be able to craft the command line used to open the crafted file, in order to trigger the vulnerability.

Mitigation

The vulnerability can be triggered only if `modeline` is enabled. You can check whether `modeline` is enabled within vim via the command `:set modeline?`
It can be turned off explicitly by adding `set nomodeline` in a vimrc file.

Additional information

  • Bugzilla 1718308: vim/neovim: ': source!' command allows arbitrary command execution via modelines
  • CWE-94: Improper Control of Generation of Code ('Code Injection')
  • FAQ: Frequently asked questions about CVE-2019-12735

Common Vulnerability Scoring System (CVSS) Score Details

Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

CVSS v3 Score Breakdown
Red HatNVD

CVSS v3 Base Score

5.3

8.6

Attack Vector

Local

Local

Attack Complexity

Low

Low

Privileges Required

None

None

User Interaction

Required

Required

Scope

Unchanged

Changed

Confidentiality Impact

Low

High

Integrity Impact

Low

High

Availability Impact

Low

High

CVSS v3 Vector

Red Hat: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L

NVD: CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

Understanding the Weakness (CWE)

CWE-94

Access Control

Technical Impact:Bypass Protection Mechanism

In some cases, injectable code controls authentication; this may lead to a remote vulnerability.

Access Control

Technical Impact:Gain Privileges or Assume Identity

Injected code can access resources that the attacker is directly prevented from accessing.

Integrity,Confidentiality,Availability

Technical Impact:Execute Unauthorized Code or Commands

When a product allows a user's input to contain code syntax, it might be possible for an attacker to craft the code in such a way that it will alter the intended control flow of the product. As a result, code injection can often result in the execution of arbitrary code. Code injection attacks can also lead to loss of data integrity in nearly all cases, since the control-plane data injected is always incidental to data recall or writing.

Non-Repudiation

Technical Impact:Hide Activities

Often the actions performed by injected control code are unlogged.

Frequently Asked Questions

Why is Red Hat's CVSS v3 score or Impact different from other vendors?

My product is listed as "Under investigation" or "Affected", when will Red Hat release a fix for this vulnerability?

What can I do if my product is listed as "Will not fix"?

What can I do if my product is listed as "Fix deferred"?

What is a mitigation?

I have a Red Hat product but it is not in the above list, is it affected?

Why is my security scanner reporting my product as vulnerable to this vulnerability even though my product version is fixed or not affected?

My product is listed as "Out of Support Scope". What does this mean?

Want to get errata notifications? Sign up here.