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.
Originally disclosed on Microsoft
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
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
- Clone a malicious repository.
- 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.