Drag and Pwnd: Leverage ASCII characters to exploit VS Code
Executive Summary
A researcher demonstrated that Visual Studio Code’s use of node-pty to forward raw terminal bytes can be abused by inserting ASCII control characters—particularly SOH (\x01)—into run‑configuration arguments or file names. The control characters cause the shell to misinterpret input, enabling command injection that can launch arbitrary programs such as the calculator on macOS and Ubuntu. The issue was reproduced on both macOS and Ubuntu; Windows is less affected because the file system blocks control characters and PowerShell does not treat them as cursor movements. Defensive guidance includes sanitizing or escaping control characters before passing data to the shell, avoiding user‑controlled inputs that reach node‑pty, and using environments that do not interpret these bytes as terminal commands.
Original Overview
Control characters like SOH , STX , EOT and ETX were never meant to run your code - but in the world of modern terminal emulators, they sometimes do. In this post, I'll dive into the forgotten mechanics of ASCII’s transport control characters, how they shaped early computing, and how they're now being abused in real-world vulnerabilities affecting modern applications. Before GUI-based IDEs and fancy fonts, computers talked over serial lines - character by character. To keep those conversations structured, ASCII introduced a set of Communication Control Characters : invisible byte codes used to delimit and manage message flows between systems. A typical message followed a strict structure: [ \x01 ] SOH: Start of Header [ \x02 ] STX: Start of Text [ \x04 ] EOT: End of Transmission...