David Dworken, a Google security researcher, presented a recent Defcon talk about how he found over 30 vulnerabilities in various Integrated Development Environments (IDEs) over the course of a few months of research.
Many believe that source code on its own is benign as long as you don’t compile and run it, but as Dworken proved, simply loading code into an IDE can cause infections. A popular example of this comes from North Korea where they asked security researchers to investigate a suppose exploit they made, and then sent the researcher an infected code package that could run malicious code simply by having it loaded in an IDE without the researcher running the code itself.
Visual Studio Code (VS Code) uses a scope for settings called Trusted Workspace settings. These settings come from inside the project itself and run when you open the project in VS Code. As an example of a security risk, the Python module in VS Code uses a feature called Flate8 to identify proper code. An attacker could exploit this feature by overwriting the Flate8 path to an executable in the folder. Therefor simply viewing the project, which calls Flate8, opens the executable in the project.
Dworken demonstrated the severity of the issue when he created a worm that infects the programmer’s computer using these exploits, then distributes itself to other repositories on their computer. With project update automation, an attack like this could quickly spread through an entire engineering department. We should treat untrusted code projects the same way we treat untrusted programs. Don’t open the project unless you have verified the source. If you can’t verify the source, carefully open the project in a VM.