Skip to content
RCE Advisory Intermediate CVE-2020-16881

Visual Studio JSON Remote Code Execution Vulnerability (CVE-2020-16881)

Visual Studio Code would execute attacker-specified code when a user opened a malicious package.json file. An attacker could run arbitrary code in the context of the current user by convincing them to clone a repository and open it.

David Dworken Follow

Originally disclosed on Microsoft

High 7.8 View original

Description

A remote code execution vulnerability exists in Visual Studio Code when a user is tricked into opening a malicious 'package.json' file. 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 opens the malicious 'package.json' file. The update address the vulnerability by modifying the way Visual Studio Code handles JSON files.

Visual Studio

Visual Studio

Microsoft

Microsoft

The original report as published on the Microsoft Security Response Center, by David Dworken. 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 way Visual Studio Code handled JSON files allowed attacker-controlled content in package.json to be executed rather than treated as data.

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 or change data, or create accounts.

What the attacker needed

Victim clones a malicious repository; victim opens it in Visual Studio Code; victim opens the malicious package.json

How it was found

  1. Convince the target to clone a repository.
  2. Have the target open the repository in Visual Studio Code.
  3. The target opens the malicious package.json file.
  4. Attacker-specified code executes in the context of the current user.

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. A file called package.json is normally used to describe a software project, but here the editor could be tricked into running code from it. An attacker only needed the victim to open a repository containing that file, and then code would run on the victim's computer with their permissions.

What is RCE?

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

More by David Dworken

View all

15 more disclosed reports, best first.

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.