Skip to content
RCE Advisory Intermediate CVE-2019-0728

Visual Studio Code Remote Code Execution Vulnerability (CVE-2019-0728)

Visual Studio Code mishandled environment variables when a project was opened, so a malicious repository could run arbitrary code. An attacker who convinced a target to clone and open such a repository could execute code as that user once the integrated terminal was opened.

Sven Nobis Follow

Originally disclosed on Microsoft

Description

A remote code execution vulnerability exists in Visual Studio Code when it process environment variables after opening a project. An attacker who successfully exploited the vulnerability could run arbitrary code in the context of the current user. If the current user is logged on with administrative user rights, an attacker could take control of the affected system. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights. To exploit this vulnerability, an attacker would need to convince a target to clone a repository and open it in Visual Studio Code. Attacker-specified code would execute when the target opened the integrated terminal. The update address the vulnerability by modifying the way Visual Studio Code handles environment variables.

Visual Studio

Visual Studio

The original report as published on the Microsoft Security Response Center, by Sven Nobis of ERNW GmbH. Images and videos are our own copies; raw HTML is shown as text. View it on Microsoft Security Response Center.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, Visual Studio Code processed environment variables supplied by the opened project without treating them as untrusted input, allowing attacker-controlled values to influence command execution.

Impact

An attacker could run arbitrary code as the current user, and if that user had administrative rights, could take control of the system, install programs, view, change or delete data, or create accounts with full rights.

What the attacker needed

Victim clones a malicious repository; victim opens it in Visual Studio Code; victim opens the integrated terminal

How it was found

  1. Convince the target to clone a malicious repository.
  2. Have the target open that repository in Visual Studio Code.
  3. Wait for the target to open the integrated terminal, at which point the attacker's code runs.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Visual Studio Code is a popular code editor. When you open a project, it reads settings from files inside that project, and here it trusted some of those settings too much. So a booby-trapped project could make the editor run the attacker's commands on your computer, with your permissions, as soon as you opened its built-in terminal.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.