Skip to content
RCE Advisory Intermediate CVE-2020-1171

Visual Studio Code Python Extension Remote Code Execution Vulnerability (CVE-2020-1171)

The Visual Studio Code Python extension loaded configuration files from an opened project in a way that let attacker-controlled code run. An attacker could convince a victim to clone a repository and open it, after which arbitrary code would execute when the integrated terminal was opened.

Chris Gavin Follow

Originally disclosed on Microsoft

Description

A remote code execution vulnerability exists in Visual Studio Code when the Python extension loads configuration files 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 with the Python extension installed. Attacker-specified code would execute when the target opened the integrated terminal. The update address the vulnerability by modifying the way Visual Studio Code Python extension handles environment variables.

Visual Studio Code

Visual Studio Code

Microsoft

Microsoft

Customer Action Required

Yes

The original report as published on the Microsoft Security Response Center, by Chris Gavin ( @chrisgavinme ). 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, the Python extension did not safely handle environment variables defined in project configuration files, allowing attacker-specified commands to be executed when the integrated terminal started.

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 user rights.

What the attacker needed

Victim clones a malicious repository; victim opens it in VS Code; Python extension installed; victim opens the integrated terminal

How it was found

  1. Convince the target to clone a repository.
  2. Have the target open the repository in Visual Studio Code with the Python extension installed.
  3. The target opens the integrated terminal, and attacker-specified code executes.

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 code editor, and its Python extension reads settings from a project folder. If those settings can include commands that the editor runs automatically, then opening a malicious project can run the attacker's code on your computer. The victim has to clone the project and open it in the editor with the extension installed.

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.