Microsoft Visual Studio Code mcp.json Command Injection Remote Code Execution Vulnerability
A malicious project could contain an mcp.json file whose user-supplied string was passed to a system call without proper validation. An attacker could therefore run arbitrary code as the current user when the victim opened the project.
Originally disclosed on Zero Day Initiative
This vulnerability allows remote attackers to execute arbitrary code on affected installations of Microsoft Visual Studio Code. User interaction is required to exploit this vulnerability in that the target open a malicious project.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
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, a value read from the project's mcp.json was passed into a system call without validation or sanitisation, allowing command injection.
Impact
An attacker could execute arbitrary code in the context of the current user, but the victim must first open a malicious project.
What the attacker needed
Victim opens a malicious project
The fix
Microsoft issued an update to correct the vulnerability.
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. It can read a project file called mcp.json to set up helper tools. The editor took text from that file and ran it as a system command without checking it, so a booby-trapped project could run the attacker's commands on your computer once you opened it.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.