Remember that Cursor git.exe bug? It's in VSCode too

CVSSv3: 7.3 AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

CVE: None

The Cursor Bug is in VSCode

Earlier this week, a potential vulnerability was disclosed in Cursor, the AI-enabled development platform that is a fork of VSCode. This vulnerability is a file called git.exe in the root of a repo or any project folder will be automatically executed without user interaction. That was viewed as a potential flaw in the software, but apparently Cursor was told about it in December and has really had no response at all to it.

Fast forward to today, when IFIN discovered that that vulnerability isn’t in Cursor. It’s actually in VSCode itself. Let’s walk through an example.

Example Case

First, for safety’s sake, I copied calc.exe, renamed it git.exe, and dropped it in a private repo that I have for testing.

Then I opened VS Code and selected the open workspace from the folder option after I had pulled the repo to my local machine. calc.exe was indeed executed.

In fact, it’s executed every time you interact with VS Code as long as that file is in that directory.

As it turns out, this is behavior by design in Windows, and likely neither Cursor nor Microsoft views this as an actionable vulnerability. There are parts of pipelines that probably require this functionality, but it clearly can be used very easily to trick developers into running malware on local machines. VSCode does warn you not to open untrusted repos, but how many people just click through that? I know I have.

Remediation options

As far as options on remediation, it’s very clear that at the corporate level you can’t prevent git.exe from running on Windows workstations. However, you can probably put in rules to prevent it from being run from unexpected file paths, and that is the best you’re going to be able to do right now. If you’ve got better ideas, please drop them in the comments because I think this is a discussion topic worth going over. I see this as potentially something that could be used for a real attack.

3 Likes

Great write up Sempf! Wish I could say I was surprised haha

1 Like

I think you’re exactly right about mitigations. A detection on git executing from non-standard locations would likely be high fidelity.

1 Like

I’d be curious, how is your VSC configured/what additional plugins are you running? I seem to recall some plugins causing similar behaviour in the past & I am currently unable to reproduce it with a clean VSC (even with trusted folders).

Starting to test here. In a brand new folder, not even a Git repo, git.exe was triggered immediately upon exiting Restricted Mode.

A fresh relaunch immediately opens them as well. This is on an existing VS Code install. I’ll be doing a clean VM next.

1 Like

Maybe taking one step back & quickly talking about the original Cursor vulnerability: By the looks of it the Cursor one may be limited to a specific git command & not a general thing.

In my case ( nyanbinary: "@mttaggart @ajn142 @wdormann @Sempf @ifin decided…" - Infosec Exchange ) it only happened 2x over a ~25min run (exactly 10min apart), both on git rev-parse --show-toplevel, the rest was “proper” git.exes. The mindgard writeup mentions that same command. Will Dormann doesn’t mention the specific commandline for the local git.exe execution but he mentions it only triggering after 30min ( Will Dormann: "@nyanbinary @mttaggart @ajn142 @Sempf @ifin OK, …" - Infosec Exchange ).

For those that got the VSCode one to trigger:

  1. Are you able to check if this is the same pattern (i.e. only on specific commands, especially rev-parse?
  2. Can you let me know which version of VSCode you replicated this on? Not that we got a sneaky patch here & we are just talking past each other.

Edit: it’s not just that one command, it’s a bunch more, to be added.

VM tests:

Starting conditions

  • Windows 11 Enterprise 22H2
  • Folder in C:\Downloads/gittest with copied calc.exe to git.exe
  • User with local admin

1. Clean VM, new VSC from code.visualstudio.com/Cursor from Download

VS Code

No calc upon opening the folder, nor upon entering Trusted mode. in VSC. clicking the source control icon does nothing either. I note a prompt to “Download Git for Windows.”

Cursor

God this app is awful.

No launch under the same conditions.

2. Installed Git for Windows

I’m installing with default params

I notice this during install:

Launching VSC doesn’t kick off git.exe but I do see a new prompt:

Clicking “Initialize repository” indeed does run git init, yet does not launch calc. Presumably the correct git was found in PATH.

Closing and reopening VSC still doesn’t trigger.

Cursor, same situation.

Now the system where I got this to trigger had the following extensions:

  • WSL
  • Python
  • Pylance
  • Dracula Theme
  • Rust-Analyzer
  • PowerShell

Not a long list! But perhaps one of those could be responsible? I didn’t install any Git-specific things. I did however sign in to GitHub…

Build (identical to test):

Version: 1.129.0 (user setup)
Commit: 125df4672b8a6a34975303c6b0baa124e560a4f7
Date: 2026-07-15T00:08:44Z
Electron: 42.6.0
ElectronBuildId: 14623276
Chromium: 148.0.7778.280
Node.js: 24.18.0
V8: 14.8.178.38-electron.0
OS: Windows_NT x64 10.0.22621

2. This time, with extensions

I have installed all the extensions I have on my calc-ing machine, and still nothing. I’ve installed PowerShell 7, which I also have on there.

Time to go back to ProcMon on the calc-ing box and see what precedes the launch.

Seems like once we figure out the trigger, additional extensions might work?

ProcMon showed one interesting thing prior to calc popping: auth to GitHub.

Internal logs are consistent with this timing. Indeed, through all visible logs, the only logged events concurrent with popping calc are GitHub authentication.

As it turns out, I am not signed in to GitHub on my calc-popping machine. I did sign in on the test. What happens if I sign out?

Uh so I couldn’t figure out how to sign out, but signing in to GitHub Copilot popped Calc.

And even signing out doesn’t stop it. Now, what about Cursor? If I sign in to GitHub through Cursor (no idea how this even works), will I pop Calc?


As I was writing this, @wdormann, who does have an account here :stuck_out_tongue: discovered that the actual trigger is Copilot Chat’s “Enable AI Features” setting.

I have reproduced this finding, with additional details.

Clicking on this button will trigger the GitHub auth pipeline, which will also kick off the local git.exe.


At long last, I also got Cursor to pop! Just had to wait 10 minutes from launch.

Interestingly, after calc popped. the “GitHub Authentication” log which correlated with the VS Code entries is also present in Cursor. It wasn’t before.

So while the “AI Features” seem to be where the code lives, I have a strong suspicion that the mechanism is also related to getting GitHub sessions.


I’m reasonably confident the culprit is here:

In which, if Git is not found in some expected places, git.exe is executed locally.

istg, they silently patched this…
will check in detail after dinner

edit: nvm

Thank you all for digging into this. I got tied up.

1 Like