Image: Ammar Askar
Independent security researcher Ammar Askar recently published a startling full disclosure report about web-based code editors. Specifically, his findings expose a dangerous GitHub token stealing bug targeting the popular browser platform. Consequently, this loophole allows malicious actors to exfiltrate highly privileged credentials with one mouse click. Therefore, developers must understand this vulnerability to safeguard their private code repositories.
The Architecture of Github.dev
Many software developers frequently use the specialized browser interface at github.dev to examine source repositories. This native web application runs an entire browser instance of the Visual Studio Code framework. To allow changes, the main platform passes powerful access credentials to the web application workspace. As explained in the report, “This functionality is achieved by github.com POSTing over an OAuth token to github.dev that allows it to interact with GitHub on your behalf”.
However, this access setup creates a massive target for web application security researchers. This token grants broad permissions across all code storage areas. Specifically, the access token is not restricted to a single project or directory. Furthermore, it has full access to every other repository that the active user can access. Consequently, an attacker who steals this token gains immediate power to rewrite proprietary codebases.
Dissecting the VSCode Webview Security Model
To isolate untrusted data, the platform relies heavily on a specialized VSCode webview security model. This system sandboxes complex interactive contents like Markdown previews or Jupyter notebooks. For instance, it executes custom scripts inside an isolated frame with a completely different origin. This choice prevents malicious code from calling internal system commands directly. Thus, the core application remains protected from unauthorized data modifications.
there is a UI/UX balance here that needs to be struck with security concerns, the main application window must still interact with the preview frame to update content dynamically. Because standard cross-origin restrictions block direct script calls, the pages must communicate using specialized browser APIs. Specifically, they pass objects back and forth using the Window.postMessage() framework. Therefore, this bridge handles basic operational tasks like text selection and live document rendering.
Weaponizing Simulated Keypress Events
Unfortunately, this communication bridge introduces a critical logic vulnerability regarding shortcut configurations. To maintain a smooth user experience, the default webview handlers listen for keyboard actions. For example, when a user clicks inside the preview panel, a handler captures keypress details. Subsequently, the system passes a customized event called did-keydown back to the host window.
However, the validation mechanism entirely fails to verify the authentic source of these message triggers. An untrusted script running inside the frame can easily forge these message parameters. For instance, the script can simulate administrative keys to open the command palette. In reality, typing raw text is difficult because “the command palette widget just uses an HTML tag”. Yet, an attacker can still execute built-in commands by triggering specific default shortcut commands.
Bypassing Publisher Trust Controls
To achieve code execution, the exploit payload weaponizes local workspace configurations. Normally, installing an external utility triggers a warning because of the publisher trust system. However, trusted workspaces can install extensions directly from the local directory. The researcher noted that “Local workspace extensions probably weren’t well tested with the web version of VSCode”.
Therefore, the attacker places a malicious payload file inside the workspace folder. Subsequently, the script simulates specific keyboard commands to execute the local installation workflow. This maneuver allows the malicious script to bypass publisher validation checks completely. Once active, the extension accesses the internal storage keys to complete the theft.
Impact and Defensive Mitigations
This sophisticated GitHub token stealing bug creates an immense risk of widespread software supply chain attacks. Fortunately, the flaw requires specific activation steps to run successfully on the desktop version. However, browser users remain highly vulnerable because any malicious link can trigger the automated redirect sequence.
To minimize immediate exposure, developers should clean their temporary browser application storage blocks. Specifically, you should navigate to your browser settings and purge all saved data for the github.dev domain. Implementing this step forces the platform to request fresh explicit sign-in permissions. Ultimately, practicing comprehensive credential monitoring will keep your active engineering workflows perfectly safe.
Support Our Threat Intelligence
If you find our CVE report and cybersecurity news helpful, consider supporting our work.