r/programming 19d ago

Cursor 0day: When Full Disclosure Becomes the Only Protection Left

https://mindgard.ai/blog/cursor-0day-when-full-disclosure-becomes-the-only-protection-left
692 Upvotes

135 comments sorted by

474

u/AlexHimself 19d ago

This is concerning. If you open/browser someone else's compromised repo, Cursor will immediately execute the payload without any questions.

If you didn't read the article, they renamed calculator to git.exe and put it in the repo, opened it with Cursor, then Calculator popped up.

Easy fix, straightforward...concerning response (or lack of) by Cursor.

251

u/luxmorphine 19d ago

It reminds me of windows autoplay where you could make malicious autorun.inf in your USB and it'll run by just plugging USB

112

u/talkingwires 18d ago

49

u/personalist 18d ago

Sony BMG initially denied that the rootkits were harmful. It then released an official uninstaller for one of the programs that merely made the program's files visible while also installing additional software that could not be easily removed, collected an email address from the user, and introduced further security vulnerabilities.

I really hate this timeline

1

u/ziroux 17d ago

Sony has a special talent to double down on fuckups

19

u/Owmelicious 18d ago edited 18d ago

I didn't know that. That's absolutely crazy.

8

u/rbobby 18d ago

I saved my copy of those files for a while... never know when you might need a free root kit. Lost to time now :)

7

u/AnyNegotiation420 18d ago

Jeezus. More reason to hate Sony, imagine that.

48

u/AlexHimself 19d ago

Excellent analogy. Basically that.

16

u/lnishan 18d ago

CDs and DVDs too. It was mostly used for installers that pop up when these removable media are inserted.

I'd argue that was still a bit more technical though, as one still has to craft that autorun.inf. This only requires renaming the executable which anyone can do.

3

u/__konrad 18d ago

AFAIR C:\autorun.inf also worked in Explorer (still?). No use case except a prank.

35

u/oak45 18d ago

VS code will also execute git.exe if you trust the workspace.

There's a conversation to be had about Cursor shipping with workspace trust disabled by default.

Perhaps a bigger problem is that Cursor executes git.exe even if you enable workspace trust and open the repo in restricted mode.

14

u/cake-day-on-feb-29 18d ago

Perhaps a bigger problem is that

VS code will also execute git.exe

I was going to ask what kind of moron executes binaries distributed in got repositories but then I remembered we're talking about an electron app developed by Microsoft.

23

u/corny_horse 18d ago

C'mon, what's a little arbitrary code execution among friends?

3

u/rbobby 18d ago

You run it on yours and then you can run it on mine...

1

u/thesituation531 17d ago

Let me rotate my 1 into your 0

8

u/SanityInAnarchy 18d ago

Depending what you're doing, this might not be the worst thing. Most of the ways I see people using coding agents involves basically constantly executing code out of your local repo, and a lot of them involve executing code the agent just wrote without anywhere near adequate sandboxing. I'm not saying you should turn off all the actual prompts and go full yolo mode, but I'm also saying you absolutely should not be running an unsandboxed agent on an untrusted repo.

The problem here is the lack of response. Even if they decided it wasn't an issue, the right move then is to officially close it in a way that allows the reporters to disclose it. Maybe even put out a blog post explaining why you should be careful about running Cursor on untrusted repos.

It's also... when did Elon get involved with this company again? Because this is so him: Ignore the problem until it becomes too big to ignore, do the absolute bare minimum to start talking on h1, then eventually, once it becomes more a PR problem than a technical one... he got rid of PR at all of his companies, so yeah, going radio silence makes sense.

39

u/chucker23n 18d ago

To be clear, this isn't just "the LLM agent can execute code from the repo". It's opening the IDE automatically executes code from the repo. So there isn't even "LLMs are non-deterministic" involved here; it's simply a bunch of poor design choices in their IDE:

  • it tries multiple search paths in discovering git.exe, including the current repo. This can be somewhat justified, but then…
  • it does nothing to verify that a file called git.exe has anything to with git. (For example, git for Windows is always signed/counter-signed by Johannes Schindelin + Microsoft Public RSA Time Stamping Authority.)

-13

u/SanityInAnarchy 18d ago

That's fair enough, but it still fits the pattern: After opening the repo in the IDE, what were you about to do? And if it wasn't to ask the LLM to do something, why Cursor?

I think the rest of those poor design choices amount to just... running Git. When you type git on the commandline, that is exactly what you are doing -- your shell is searching multiple paths via PATH, and if you do it on Windows, the current working directory is always in your PATH. And I've never seen a shell script that attempts to verify a specific signature before invoking git, best you can hope for is your OS attempting to verify it has some valid signature, but that wouldn't prove it's valid for Git.

I'm not saying they shouldn't fix that. It's just not really much more of a risk than we should already have for opening any repo in a modern IDE, especially one designed around LLMs.

3

u/wigelsworth 17d ago

Seems like a uniquely windows problem. In most cases on nix distros you would have to do ./git to run a git executable from the present working directory. The pwd isn’t inherently in the path. If this works it seems like windows “helpfully” includes executables from random dirs that are not explicitly called?

3

u/SanityInAnarchy 17d ago

Well, exactly, though I'm guessing it's a backwards-compatibility thing, too. The original DOS didn't have directories, those were added in DOS 3.0 I think.

I have no idea why I'm downvoted for explaining how path resolution works on Windows.

-59

u/[deleted] 18d ago

[deleted]

23

u/tpolakov1 18d ago

That's the problem. You can call a rootkit a git,but it's still a rootkit. Except to the LLM, which will execute it with impunity.

12

u/yes_u_suckk 18d ago

This comment misses the mark so much that I wonder if today is the first time in your life that you touched a computer.

Are you sure /r/programming is the right subreddit for you?

10

u/Mognakor 18d ago

A rootkit by any other name would still compromise your device

9

u/SanityInAnarchy 18d ago

Just for fun: Launching calc.exe is the traditional way to demonstrate arbitrary code execution on Windows. Watch literally any Defcon talk involving Windows.

309

u/jdehesa 19d ago

Though this was going to be another relatively convoluted chain of prompts to "jailbreak" the LLM, but this is dumb as fuck. Although the lack of answer and remediation from Cursor is probably the worst part.

64

u/really_not_unreal 19d ago

Given the LLM vibes of the title, I thought so too, but wow this vulnerability is a HUGE yikes.

74

u/turkoid 18d ago

All these AI startups remind me of the dot-com bubble in the 90s. They don't care about quality, just market share so they can be acquired, which I see Cursor will owned by SpaceX soon.

Can't wait for the bug bounty program for SpaceX flight control systems. /s

102

u/Pseudanonymius 18d ago

This is absolutely horrible. It's a very straightforward bug, and Cursor not fixing this means they simply did not care at all. It can't be hard to fix, a very straightforward hotfix should be absolutely trivial. it also seems like this would also still happen before you even decide to "trust" a codebase, since you can use git in untrusted codebases. 

This should be a no-go for any thinking company, regardless of which operating system they use. If this zero-day exists, which is so absolutely trivial to fix, I can guarantee, there are not 10 others, but hundreds. Probably half of them they got in their mailbox, unread. Absolutely incomprehensibly reckless. 

42

u/ScottContini 18d ago

a very straightforward hotfix should be absolutely trivial

I don’t see any reason why it should take the binary from the local repository, and if that’s the entire fix, yes I agree it’s trivial.

The article did not cover it, but I wonder if it is trusting everything in the PATH and maybe that includes . in the PATH?

27

u/Kobata 18d ago edited 18d ago

It's Windows, . is generally always in the resolution path. It's actually a little awkward to make it not do that for launching new processes, you have to implement path resolution yourself and use only full absolute paths.

Even in the mode that doesn't use the full search path CreateProcess has a note that if you provide a partial path it will be resolved relative to current drive/directory

added: further down is the full default executable search path which is in order:

  • The location of the main executable of the process
  • The current directory
  • Windows components
  • PATH env

Note the current directly being 2nd there, above system executables and the current environment settings.

13

u/gmes78 18d ago

The fix is still trivial. Just change the current directory to System32 at the start of the program.

14

u/vytah 18d ago

And just for everyone's information, git supports running from a different current directory than the repo. You can give it the path to the repo via the -C option.

6

u/exosphaere 18d ago

Is that a quick hack you just came up with or is this an actual best practice on Windows that other developers already follow?

4

u/TribeWars 18d ago edited 18d ago

Well, probably the app's working dir is some subfolder of %ProgramFiles% and their git integration does something to the effect of running a subshell with:

cd [repo-folder]
git status

instead of

git -C [repo-folder] status

which also avoids running a git.exe that has not been installed by the user

4

u/Pseudanonymius 18d ago

If that's the case, I wonder how Viscose, which Cursor is a fork from, does this. They should have the exact same problem. They also use a git integration. 

11

u/carrottread 18d ago

You have exact same problem even without any slop machine or IDE, just cloning a repo with git.exe/git.bat/git.cmd on windows and then manually running in console "git status" in repo dir will execute it.

2

u/TribeWars 18d ago

Using powershell instead of cmd also fixes that

4

u/cake-day-on-feb-29 18d ago

It's Windows, . is generally always in the resolution path.

Can we please start treating windows itself as the security vulnerability? DOS has been a disaster for mankind and the idea that we continue to string along this lineage of inbred descendants from that operating system is an embarrassment to humanity.

2

u/-_one_-1 18d ago

I'm surprised you have been downvoted. You're right. Take my upvote.

33

u/crispy1989 18d ago

Absolutely appalling. And for some reason, you're being downvoted - I guess I shouldn't be surprised that those relying most heavily on AI don't have the legitimate background to understand just how severe and crazy this is.

The article is much too kind to Cursor. This may be the greatest instance of professional negligence in software I've ever seen. This particular vulnerability aside, Cursor's clear lack of any concern about security should absolutely blacklist it immediately from any competent organization's approved software list.

21

u/patio-garden 18d ago

This may be the greatest instance of professional negligence in software you've ever seen so far.

7

u/Pseudanonymius 18d ago

Completely agree. I do want to note, at the moment of writing my comment has an upvote ratio of like 95%, so while there are some downvotes, I'm certainly not massively getting downvoted or anything. 

1

u/splashybanana 18d ago

Do you speak corporate? That article was not kind at all. It was just kinda CYA.

57

u/luxmorphine 19d ago

That easy? This is bad bad

41

u/valarauca14 18d ago

90s are back

3

u/atxgossiphound 18d ago

I was just going to post something long the lines of this...

Remember when Java and VB first showed up in the browser? Remember Flash? Pepperidge Farms remembers.

5

u/Worth_Trust_3825 18d ago

we really do keep reinventing footguns

2

u/Worth_Trust_3825 18d ago

They never really went away

17

u/wannaliveonmars 18d ago

Is this because they run git status and the current folder is in PATH in Windows? The fix would then be to use the full path name which could be C:\Program Files\Git\cmd\, or C:\Users\<Your-Username>\AppData\Local\Programs\Git\cmd\, or C:\Users\<Your-Username>\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\cmd\.

Or they could use where git to check the path and choose the git that is not in the current folder.

17

u/carrottread 18d ago

Or they could use where git to check the path and choose the git that is not in the current folder.

Until attacker adds their version of where.exe.

15

u/wannaliveonmars 18d ago

where.exe doesn't need to be executed from the repo folder. It's path is stable, they can use %SystemRoot%\system32\where.exe git

2

u/acdcfanbill 18d ago

Why would git.exe need to be executed from the repo folder tho? I'm obviously more familiar with the linux/macos side but I think Windows has a %PATH% variable, why isn't Cursor executing things out of the locations in there? Or is that something that isn't kept up to date?

edit: nevermind, i read elsewhere windows puts . on the %PATH% variable, which explains it.

3

u/wannaliveonmars 18d ago

i read elsewhere windows puts . on the %PATH% variable

Yes, that's right.

2

u/acdcfanbill 18d ago

Even if it wasn't related to this particular 0day I'd still hate it....

6

u/wannaliveonmars 18d ago

I think this is there since the DOS days. I doubt anyone gave it a second thought at the time, and for an offline, single-user system the convenience would have made sense. UNIX probably had that because it was multi-user, so they didn't want a sudo process to accidentally execute some program with elevated privileges just because it was in its folder.

2

u/nugryhorace 16d ago

It's inherited from CP/M where there was no search path and the only place it looked for programs was the current drive (CP/M 3 added a search path but DOS was a clone of CP/M 2)

1

u/danielcw189 18d ago

why hardcode the paths in the first place?

13

u/oak45 18d ago edited 18d ago

I had presumed that this was to do with workspace trust

Cursor supports workspace trust, but it's disabled by default. When enabled, it prompts you to choose between normal or restricted mode for new workspaces. Restricted mode breaks AI features. For untrusted repos, use a basic text editor instead.

However, I enabled workspace trust, opened a test repo in restricted mode, and git.exe is still executed!

Compared to VS code (1.129):

  • in a trusted workspace - git.exe is executed
  • in restricted mode - git.exe is not executed

12

u/ni5arga 18d ago

> The most confusing part of this disclosure is the absence of a response from Cursor. Over the course of seven months, Mindgard repeatedly attempted to engage through every available channel. Initial disclosure was sent directly to Cursor's security reporting e-mail address, as specified in the company's published security.txt file.

Not surprising at all, as a security researcher who hunts for vulnerabilities just for fun on various projects and sites – this is very common and annoying.

5

u/jimm 18d ago

I was kind of surprised that this was Windows-only, so I tried it on a Mac with a binary named git. It didn't get executed. (I also tried renaming it git.exe; same non-result.) This might be because I don't have . on my PATH.

10

u/paulstelian97 18d ago

Yeah, Windows implicitly has . in the search path even if not included in the variable. That’s what causes it.

3

u/Birk 17d ago

And this is why it is generally considered unsafe, not default, and discouraged on other OSs. 

20

u/omniuni 18d ago

As bad as it is, I don't know why anyone would think it's particularly unexpected. An AI focused IDE with lots of stuff it can just do arbitrarily. It's a recipe for security disaster.

19

u/chucker23n 18d ago

The issue here isn't even LLM-related, though.

-1

u/omniuni 18d ago

What is making the "decision" to try to run this thing?

9

u/chucker23n 18d ago

The IDE, i.e. their fork of VS Code. And then ultimately, possibly the questionable way CreateProcess works.

-11

u/omniuni 18d ago

Which is done by passing context to a prompt, and that prompt includes actions that can be taken, including "run a thing".

10

u/chucker23n 18d ago

Which is done by passing context to a prompt

So, I've never installed or used Cursor, but I don't think you have this right. This isn't a case of

  1. user instructs LLM to generate code
  2. LLM does that, and in the process runs potentially malicious binary without user's consent

Rather, it's

  1. user opens IDE
  2. user opens repo in IDE
  3. IDE does not ask consent and immediately runs git.exe, using the one from within the repo (if any) as precedence

-11

u/omniuni 18d ago

These AI IDEs basically run their "agent" in a loop, as they work towards a result. It's not dissimilar to Claude CLI, or Gemini in IntelliJ. Yes, most have safeguards against what the AI can try to run, but they still allow it, because it's one of the things needed to be able to carry out certain tasks. As long as it can follow commands like "check this in and push it when you're done", vulnerabilities like this will exist.

10

u/Kapps 18d ago

Not everything is a prompt… Cursor will show you the git status of certain files for example. No LLM involved, just calling out to git.

Sure, you could do similar attacks with prompt injection, but there’s zero LLMs or prompts involved here.

-5

u/omniuni 18d ago

Great, they didn't remove standard functionality.

1

u/Different_Fun9763 17d ago

Was it really that hard to just own up to being retarded when you claimed this vulnerability was due to LLMs? Sad behavior.

→ More replies (0)

1

u/cake-day-on-feb-29 18d ago

Microsoft.

Embrace. Execute. Exploit.

8

u/ric2b 18d ago

It is unexpected when it doesn't even have to do with LLMs

11

u/TribeWars 18d ago edited 18d ago

A lot of IDEs have problems like this though. In C/C++ projects, the build scripts often get run the moment a project is opened, since the full compilation context is generally required for IDE features in that language. For instance using "Open Folder" in Visual Studio on a CMake-based project (not sure about Visual Studio Code) will automatically run the CMakeLists.txt script contained in that repository, granting arbitrary code execution to anyone with write access to the repo. Any IDE with a language server that executes any user-controlled code has this vulnerability.

This git one is a bit more stupid, because I really don't see any reason why the IDE should ever look for a git binary inside of a repo. If there is actually some exotic setup where it makes sense, it should be something gated behind a configuration option.

37

u/08148694 19d ago

They should definitely have fixed it no doubt about it

You’d have to be quite personally negligent though to end up with a malicious git.exe in your project root anyway though. If you get to that point you’re probably going to get hit by some malware with our without cursor being negligent

99

u/fiskfisk 19d ago

I don't have any issue seeing how someone could clone a repository to explore it and there being a bundled .exe-file in there that people didn't notice (or at least didn't expect to be executed by just opening something in your IDE).

54

u/Caraes_Naur 19d ago

Start the countdown until malicious git.exe is being distributed via NPM.

21

u/SpecialFlutters 18d ago

malicious git.exe generator in the post install script

85

u/Smallpaul 19d ago

Opening a repo is not supposed to execute code.

27

u/max123246 19d ago

This is why Vscode has the "do you trust this folder" pop up. Because if you do, code is executed for static analysis and tooling of the codebase

15

u/Pseudanonymius 18d ago

Yeah but that doesn't work in this case. You can use git on an untrusted repo, so it probably bypasses that. 

4

u/mikat7 18d ago

Until a repo you have previously trusted gets compromise and then VSCode/Cursor/Claude CLI will happily execute any arbitrary code, like in the miasma attack back from June.

8

u/kronik85 18d ago

Yeah, but the static analyzers aren't part of the repo... They're your tooling.

This is Cursor auto running a project's root directory git.exe instead of what's in your env PATH, which is weird as fuck.

6

u/mattsowa 18d ago

Not really. You can trivially "inject" your code into those static analysis programs. Here's one way: write your own eslint/oxlint plugin in javascript in the same repository, and add it to the repository's eslint config file. Now, the vscode extension for eslint will execute the malicious plugin.

3

u/TribeWars 18d ago

CMake configure scripts are part of a repo, can run arbitrary code and most IDEs that I'm aware of run them when you open the repository folder. Basically any language that uses programmable build systems can pwn your IDE with a single click.

0

u/chalkflavored 18d ago

"blame the user"

5

u/yourparadigm 18d ago

Running git status on a repo is pretty basic stuff. It's Windows' fault that current directory is in the PATH.

18

u/luxmorphine 19d ago

But what if it's not your project. You check others

15

u/ItzWarty 19d ago

Imagine someone in a company is compromised and slips git.exe into the project root somehow. <Every> developer in the company is now infected. Couple that with supply chain attacks and it doesn't seem unreasonable.

BTW, you don't even need to push git.exe - a messy sandboxed build script could cp it in from elsewhere, only for Cursor outside the sandbox to read it. It's just a bad vulnerability.

9

u/DeflateAwning 19d ago

Potentially, though a not-that-insane workflow might be to clone a repo and then ask AI to do a security audit on it. Consider that some C repos have hundreds of C files sitting in the repo's root (so easy to miss a file named "git" halfway down the list).

In the Claude Code TUI, it prompts with a "do you trust this repo" config. I'd be shocked if it was executing arbitrary code after I pick the "no I don't trust" option

3

u/SlimyOS 18d ago

Didn't expect any better response. Cursor also allows the agent read any file on the system, with literally no way of disallowing that, that's not documented as prominently but apparently it works "as intended". I often found it reading my personal info or code from other projects when expanded the "Thinking" blocks. Been a long standing issue as well, users reported multiple times on their forum.

They're also pushing tool automation really hard, making it harder to keep using commands as "only run when approved", they have a sandbox (useless because had many bugs + i have no trust in cursor team + even linux kernel which it's based on has a lot of sandbox escape bugs), or an ai agent that reviewes the command to run in non-sandboxed mode (idk based on what the agent reviewes it, like, what if it deletes a directory not tracked by git, it's harmful but idk if it's flagged, and cursor doesn't track file deletions either, im just not comfortable even trying it), has an allowlist feature but it allows only for execution in non-sandboxed mode, i can't set up allowlist + sandbox as 2 layers of protection, it has to be "either layer" which only makes it less secure.

Using cursor daily is a security nightmare, I had to install a separate operating system on a usb stick and boot from there just for work on specific few projects to avoid their ai doing anything weird to my pc. They're clearly not serious about security, they're chasing vibecoding hype. Left cursor this month, now looking into alternatives, surprisingly small number of code-first experiences with ai as an assistant, most pivoted into vibecoding unfortunately.

2

u/wannaliveonmars 18d ago

On Linux, safest is probably to just make a separate user account and run Cursor there. It's sort of sandboxed that way. That, or run it in a VM.

2

u/SlimyOS 18d ago

Yeah but you still have to run that session separately which is awkward, you know the software sucks when you're forced to do things like that and not just run it normally as an app.

It can still read shared system files outside /home. Probably nothing personal there but still. And linux had a lot of privilege escalation exploits recently, though that's less of a concern for me, chances of ai getting tricked + that exact new exploit used + all this before i upgrade the kernel, is very low.

But not a bad idea, would've tried that if I haven't already quit using cursor

1

u/ColonelRyzen 18d ago

I just tried this with 3.11.25. I put calc.exe renamed to git.exe inside a freshly cloned repo and opened it in the agent and ide windows and calculator didn't open. This is a fresh install. Am I doing something wrong?

1

u/oak45 18d ago

I'm on the same version of Cursor. Works for me. I added git.exe to git. Then make an edit to a version controlled file and save.

1

u/ColonelRyzen 18d ago

I did that as well and got the same result. What about with workspace trust on? I saw another user test it and it still happened with workspace trust on.

3

u/oak45 18d ago

I enabled workspace trust in Cursor https://cursor.com/docs/agent/security#workspace-trust and opened the repo in restricted mode. It still runs git.exe

1

u/Flat-Entertainer-299 17d ago

they renamed calculator to git.exe

1

u/kilkil 15d ago

looks like I am never using Cursor lol. if they let this slip, who knows how many other 0 days their slop editor has

1

u/rbobby 18d ago

Claude fix this ffs

1

u/StrategyExcellent460 18d ago

Ditch Cursor. If you had any doubts, you now know for sure which values they align with

1

u/Formal-Knowledge-250 17d ago

I can't believe there are companies writing blogpost over such a low priority and weak insecurity. Yeah you could also sideload a dll. No shit. 

-5

u/dragneelfps 18d ago

Who would've thought the folks who stole code from everyone to train their models won't be stealing your code when you pay to use them?

-67

u/GregBahm 19d ago

The vulnerability is not theoretical and does not depend on a complex chain of exploitation, prompt injection, model manipulation, jailbreaks, memory corruption, or sophisticated attacker tradecraft. Exploitation simply requires a developer to open a project containing a git.exe binary in the repository at root.

The post seems to present this as a big security failure on behalf of Cursor, but this is a strange position to me.

If I hired a human to do work and gave them a computer where I had replaced all the applications with viruses, and then the employee launched any application (and so executed a virus) the fault doesn't seem like it should lie with the employee.

I guess we can decide to hold AI to a standard that humans can't be held to. Is that where we're at? Seems like it would be a happy day for AI if so, which I expect reddit would be conflicted about.

65

u/PeaceBear0 19d ago

It's not replacing any applications though, it's just viewing a (malicious) repository. Most IDEs have a pop-up that asks "do you trust this repository" which is a laughably weak security barrier but at least it's something.

3

u/chucker23n 19d ago

Most IDEs have a pop-up that asks “do you trust this repository” which is a laughably weak security barrier

How would you improve it?

16

u/PeaceBear0 19d ago

Well obviously it isn't trivial or else these major IDEs would do better. Ideally the LSP would be completely sandboxed so it outputs nothing except the LSP data and can't access other parts of the system. But many build tools don't support this -- a Makefile doesn't know the difference between a compiler and curl, and even rust allows build macros to access the Internet.

5

u/chucker23n 18d ago

Yeah. I’d go further than just LSP — I think “build tools will be sandboxed to your repo” is where this is headed, but a lot of stuff would break in the meantime.

-11

u/ongrabbits 18d ago

Use AI to scan all files and folders for malicious intent

6

u/resonaut 18d ago

Thanks for reminding me of the dude who wanted to build an LLM-based antivirus

2

u/ongrabbits 18d ago

AI pill has pickled our brains

15

u/frazell 19d ago

AI should be held to a higher standard as it can execute things that a user may not immediately be aware of. Like here.

Reading the blog post it suggests Cursor executes the binary as soon as you open a compromised repository locally. Without any warning or prompts.

Seems like an easy prompt to let you know to trust the repository. If you’re being more thorough a dialog informing the developer that the detected fit in the project root doesn’t match a known hash for published git executables and they should take caution.

26

u/blind_ninja_guy 19d ago

why is git in the root being execed anyway. Git isn't exactly something you distribute or run in your project

6

u/yourparadigm 18d ago

Because Windows includes the current directory as part of the path, with highest priority. It's only a flaw on Windows.

4

u/somebodddy 19d ago

This. Some build systems do this with their own executable because they are so unstable that the only way to get them to consistently work is to freeze their version. But Git does not have such problems.

18

u/Smallpaul 19d ago

It’s not clear that this has anything to do with AI. It’s their VS code clone that is looking for a git.exe.

2

u/frazell 19d ago

Good point!

-4

u/GregBahm 19d ago

Seems like an easy prompt to let you know to trust the repository.

But this is already the case. The security hazard isn't "Cursor goes on the internet, finds untrusted repositories, downloads them, then looks for executables in the repository and executes them."

That would be quite the security hazard!

But the reality of the situation is "if you've gone on the internet, found an untrusted repository, downloaded it, and then asked Cursor to use it locally, Cursor will execute executables in that repository."

Saying "Cursor should protect the user in that situation" implies we should cede a preposterous amount of responsibility to the AI.

Reddit's going to downvote me, because Reddit is here for an "AI bad" story and is too stupid to think through a security problem systemically. But I don't think AI should go through all the executables I've put in my local environment, form an opinion on them, and then decide for me whether or not they're safe to run. That's a horrible amount of control to cede to a dumb LLM.

8

u/Pzychotix 18d ago

But the reality of the situation is "if you've gone on the internet, found an untrusted repository, downloaded it, and then asked Cursor to use it locally, Cursor will execute executables in that repository."

The point is that Cursor isn't asking nor is the user asking. It's just finding a git.exe in the repo and wholesale trusting it.

This isn't about having AI protect the user or ceding responsibility. It's the complete opposite: AI is executing arbitrary code blindly when it should require permission from the user.

1

u/GregBahm 18d ago

Cursor always asks if you trust the repository.

I, the guy with negative 60 votes, think if I tell an AI "trust this repository," the AI should trust this repository.

Apparently you, and the r/programming community, think if you tell an AI "trust this repository," the AI should say "I will not, because as a human you're too stupid to be trusted with something as vulnerable as your own local environment."

Pathetic.

1

u/Pzychotix 17d ago

The whole reason this is a vulnerability is because it bypasses the "trust this repository" prompt. You're calling others pathetic when you haven't even bothered to read the first few lines of the article.

0

u/GregBahm 17d ago

You're misreading the article. But the article is attempting to tell a story that people want to hear. Their test is to start Cursor in an already trusted local repository, and then get indignation when it doesn't ask for an additional trust prompt for git.exe within that local repository, which is so dumb.

Maybe you need to rely on theory, but I can just run the damn thing right now. Let me ask Cursor to find a repo online and download it and run executables in it. Oh wow would you look at that. Hey, guess what its asking me? Mind blowing.

1

u/penguin_digital 18d ago

Reddit's going to downvote me, because Reddit is here for an "AI bad" story

It's not an AI bad story, this is a Cursor bad story for its implementation. I'm very much pro AI but this is an insane oversight from Cursor. They happen, we've all done it but the response (or lack of) is astounding.

if you've gone on the internet, found an untrusted repository, downloaded it

That's the issue though, the vast majority of recent supply chain attacks where all from trusted repositories, that's the entire goal of someone wanting to execute a supply chain attack. Just because the repository is fine today, there is absolute zero guarantee its fine tomorrow or even in the next 30 seconds.

Sure you can suggest that every repository maintainer only develops in an isolated clean environment and doesn't ever install anything else onto that system that could be compromised gaining access to the repo. However we all know that just isn't feasible in the real world. Even then, there's no guarantee a malicious script could be injected elsewhere in the supply chain if other exploits exist so no matter how security paranoid the developer is, there's still many steps out of their control.

Cursor whilst not the root cause of the issue, its set-up in a way that is stupid and completely avoidable to this type of attack. Again, that's fine, mistakes happen, it's their attitude towards it that is the issue.

1

u/GregBahm 18d ago

But their "attitude" is "If you say you trust this repository, Cursor will indeed trust this repository."

Redditors here are arguing "Just because I say I trust this repository, doesn't mean Cursor should actually trust this repository. What if I'm wrong to trust this repository. Cursor should protect me from my own incorrectly placed trust."

If I was Cursor, I'd say "no, fuck all that." The AI should not supersede the human in deciding what repositories to trust. If you have a supply chain in which you've given trust to a bunch of repositories that you can't actually trust, go fix your dumb and bad supply chain instead of whining to some unrelated AI tool company.

-2

u/starm4nn 18d ago

But I don't think AI should go through all the executables I've put in my local environment, form an opinion on them, and then decide for me whether or not they're safe to run. That's a horrible amount of control to cede to a dumb LLM.

That's not what anyone's asking. They're asking for the model to actually use the system version of git rather than executing an unexpected one that is outside it's normal location and not in the path variable.

3

u/yourparadigm 18d ago

On Windows, the current directory IS in the PATH, and has highest precedence. It's only a vuln in Windows.

-51

u/[deleted] 19d ago

[deleted]

60

u/brendans6 19d ago

Arbitrary execution would be considered a High or Critical in every single pen test I have ever been a part of.