Visual Studio Code Remote Code Execution Vulnerability (CVE-2020-0604)
Visual Studio Code mishandled environment variables when a project was opened, allowing an attacker to run arbitrary code. An attacker could convince a victim to clone and open a malicious repository, and code would execute when the integrated terminal was opened.
Originally disclosed on Microsoft
Description
A remote code execution vulnerability exists in Visual Studio Code when it process environment variables 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. Attacker-specified code would execute when the target opened the integrated terminal. The update address the vulnerability by modifying the way Visual Studio Code handles environment variables.
Visual Studio
Visual Studio
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
Root cause
Likely, Visual Studio Code did not properly sanitise or restrict environment variable values from a project's configuration before using them to launch the integrated terminal.
Impact
An attacker could run arbitrary code with the victim's privileges, potentially taking control of the system if the user had administrative rights.
What the attacker needed
Victim clones a malicious repository; victim opens it in Visual Studio Code; victim opens the integrated terminal
How it was found
- Convince the target to clone a malicious repository.
- Have the target open the repository in Visual Studio Code.
- 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. When you open a project, it reads settings from files in that project, including environment variables (named values that programs use). The editor did not treat these safely, so a malicious project could make your computer run the attacker's code as soon as you opened the built-in terminal.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.