Skip to content
RCE Advisory Intermediate CVE-2021-26700

Visual Studio Code npm-script Extension Remote Code Execution Vulnerability (CVE-2021-26700)

A Visual Studio Code extension for running npm scripts failed to properly handle repository content, so opening a malicious cloned repository in the editor could run attacker-chosen code. An attacker could therefore execute code on a victim's machine if the victim cloned and viewed the repository.

Jack Adamson Follow

Originally disclosed on Microsoft

High 7.8 View original

FAQ

How could an attacker exploit this vulnerability? To exploit this vulnerability, an attacker would need to convince a targeted user to clone a malicious repository. Attacker-specified code would execute once the targeted user viewed contents of the repository in Visual Studio Code.

Visual Studio Code

Visual Studio Code

Microsoft

Microsoft

The original report as published on the Microsoft Security Response Center, by Jack Adamson ( @jadamson08 ). 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

What the attacker needed

Victim clones a malicious repository; victim opens it in Visual Studio Code; npm-script extension installed

How it was found

  1. Clone a malicious repository.
  2. View the contents of the repository in Visual Studio Code.

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, and extensions add features to it. This extension for running npm scripts (a way to run project commands) trusted what was inside a cloned project too much, so a booby-trapped project could make the editor run the attacker's code on your computer. You would have to clone that project and open it for this to happen.

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.