Cursor 0-Day Vulnerability: Opening a Repository Silently Executes Malicious Code — Developers Beware

Opening a malicious repo in Cursor silently executes attacker code via a PATH hijacking flaw.
A 0-day vulnerability in the Cursor AI code editor allows malicious code to execute automatically the moment a user opens a compromised Git repository — no interaction required. The attack exploits PATH hijacking by placing a fake `git.exe` in the repo root. Combined with supply chain risks via NPM or PyPI, the threat is significant. Cursor has yet to respond or issue a fix.
A Ridiculous Yet Deadly Vulnerability
Recently, a 0-day vulnerability targeting the AI code editor Cursor has sparked widespread discussion across technical communities including Reddit. A zero-day vulnerability refers to a security flaw that the software vendor is either unaware of, or aware of but has yet to patch — the "0" in "0-day" signifies that the vendor has zero days to respond, as the vulnerability is already being exploited in the wild while defenders are completely unprepared. Cursor, as a next-generation AI code editor built on large language models (LLMs), deeply integrates features like code completion, automated refactoring, and repository analysis. While these capabilities dramatically improve developer productivity, they also significantly expand the tool's interaction surface with the local file system and processes — introducing new attack vectors that simply don't exist in traditional IDEs.
Unlike the elaborate "jailbreak" prompt injection attacks many might expect, the mechanics of this vulnerability are shockingly simple. As one security researcher put it: "I expected some convoluted prompt to jailbreak the LLM. Turns out it's dumber than that."
The core issue is this: when a user opens or browses a Git repository containing a malicious payload, Cursor immediately executes the malicious program without any confirmation prompt. In other words, simply "opening" a project is enough to run an attacker's code on your machine.
What outraged the community even more wasn't just the vulnerability itself, but Cursor's prolonged silence — no response, no fix timeline. This is precisely why the security researcher ultimately chose Full Disclosure: when official channels fail, publicly revealing the details becomes the only means of protection.
Proof of Concept: Disguising a Calculator as git.exe
The reproduction steps are disturbingly simple. The researcher's demo involved just four steps:
Attack Steps
- Rename the system's calculator application to
git.exe; - Place this renamed file inside a code repository;
- Open the repository with Cursor;
- The calculator window pops up automatically.
The calculator itself is harmless — but what if git.exe contained ransomware, a remote backdoor, or a data exfiltration tool? The consequences would be catastrophic.
The technical root cause is the classic PATH Hijacking attack. On Windows and Unix-like systems, when a program invokes an external command (such as git), the operating system searches for the corresponding executable in directories according to a predefined search order. If an application prioritizes the current working directory (CWD) or the project root over system-level paths like /usr/bin or C:\Windows\System32, an attacker can place a maliciously named file in the project directory to trigger execution first. This mirrors DLL Hijacking — secure coding standards require that external programs always be invoked using absolute paths, or that the source and signature of executables be strictly verified.
The root cause here is that Cursor searches for and invokes the git executable from within the project directory when performing Git-related operations. An attacker only needs to place a malicious program with the same name in the repository root to achieve a "open-and-execute" attack — no user interaction required, no permission prompts whatsoever.
A Familiar Windows AutoRun Nightmare
Someone in the community offered a spot-on analogy: this is just like Windows AutoPlay — "You put a malicious autorun.inf on a USB drive, plug it in, and it runs automatically." The comparison quickly resonated, described as "a perfect analogy — that's basically exactly what this is."
Windows AutoRun, introduced in the Windows 95 era, allowed programs specified in autorun.inf at the root of a disc or USB drive to execute automatically upon insertion — originally designed to streamline media playback. However, this mechanism was rapidly weaponized by malware, turning it into a highway for virus propagation. The Conficker worm, which ravaged the globe between 2008 and 2009, spread rapidly across millions of enterprise and government computers via AutoRun, with estimated damages in the billions of dollars. Microsoft didn't fully disable AutoRun execution by default until 2011 — more than a decade after it had been exploited at scale. History is quietly repeating itself in the AI era: an auto-execution mechanism designed for "convenience" has once again become a gaping hole in the security perimeter. This historical precedent makes it clear that any auto-execution design that prioritizes "convenience" over "confirmation" is inherently fragile against a determined attacker.
As one commenter put it:
"Opening a repository should never execute any code."
This statement captures the core principle at the heart of the controversy — opening a project in an IDE is a "read" operation and should never trigger arbitrary code execution.
The Debate: Is This the User's Problem or the Tool's Flaw?
The community is divided on the severity of the vulnerability.
View 1: Users Bear Some Responsibility
Some argue that for a malicious git.exe to end up in a project root, "the user would have to be pretty careless themselves." Proponents of this view contend: "At that point, with or without this oversight from Cursor, they'd probably get other malware anyway."
View 2: Average Developers Have No Way to Defend Themselves
However, far more people pushed back against this reasoning. As one person noted: "It's completely conceivable that someone clones a repo to investigate it, and it comes with a .exe file that doesn't raise red flags — or at least, they wouldn't expect that opening the project in their IDE would trigger execution."
This rebuttal holds considerable weight. Cloning and exploring unfamiliar repositories is part of a developer's daily workflow, especially in the open-source community. No one expects "open" to mean "run." Shifting the security burden to users is no different from blaming people for plugging in a USB drive — the root cause always lies in the tool's design.
The Supply Chain Attack Concern
What makes this vulnerability truly alarming is its potential when combined with software supply chain attacks. One user put it bluntly:
"Start the countdown — malicious
git.exefiles will be distributed via NPM soon."
A software supply chain attack occurs when an attacker, rather than targeting a system directly, achieves infiltration by compromising upstream software components that the target depends on. Such attacks have grown increasingly prevalent in recent years: in the 2021 SolarWinds incident, attackers inserted a backdoor into the official build pipeline, affecting thousands of enterprises and government agencies; the event-stream and ua-parser-js poisoning incidents in the NPM ecosystem, as well as endless typosquatting attacks on PyPI, all demonstrate that the package managers developers rely on daily have become high-value targets.
Combine the Cursor vulnerability with a supply chain attack, and an attacker only needs to slip a disguised git.exe into a popular open-source package to silently trigger execution on tens of thousands of Cursor users' machines worldwide — this "poison once, harvest at scale" attack pattern is the fundamental reason security researchers regard this vulnerability as a high-severity threat. Given Cursor's rapid adoption in the AI coding wave, its potential attack surface is expanding rapidly.
Why Full Disclosure Became the Last Resort
In the security research community, Responsible Disclosure typically follows the process of notifying the vendor privately, allowing a remediation window, and only then going public. Google Project Zero's standard 90-day fix window has become the industry benchmark. Full Disclosure — publicly releasing complete technical details directly — is grounded in the logic that users can only protect themselves if they know a vulnerability exists, and that public pressure is the most effective lever for pushing vendors to respond quickly. In between lies the Bug Bounty model, which attempts to establish a virtuous cycle through financial incentives.
This incident escalated to full disclosure precisely because of Cursor's lack of timely response. When official channels failed, publicly exposing the vulnerability became the only path to both pressuring the vendor into action and alerting users to protect themselves. This also reflects a broader lag in security response infrastructure among AI tool vendors — a wake-up call for the entire industry: in the race to ship features and hit release cadences, security response mechanisms cannot be an afterthought.
A Developer's Self-Protection Guide
Until Cursor releases an official fix, developers using Cursor and similar AI editors should exercise heightened caution:
- Do not open repositories from unknown sources in Cursor;
- After cloning an unfamiliar project, inspect the root directory for suspicious executables (e.g.,
git.exe,node.exe); - Treat dependencies introduced via NPM, PyPI, and similar package managers with care — especially packages that bundle binary files;
- Stay up to date with Cursor's official security advisories and version releases.
AI programming tools are profoundly transforming the way developers work, but the pursuit of convenience must never come at the expense of security boundaries. A single "open-and-execute" design flaw is enough to turn the most advanced tool into an unwitting accomplice for attackers.
Key Takeaways
Related articles

Andrew Ng's New Company LearnVector: Achieving One-on-One Personalized Learning with AI
Andrew Ng launches LearnVector, using generative AI to deliver one-on-one personalized learning. Explore its core vision, potential capabilities, challenges, and how LLMs can solve education's scalability problem.

Truth Has No Direction: How the Tarski Paradox Challenges LLM Truth Probe Techniques
How a Tarski-style attack challenges LLM truth probes from the foundations of logic. Is the linear representation hypothesis valid, or is the "truth direction" in AI activations just a statistical illusion?

Andrew Ng's New Company LearnVector: Achieving One-on-One Personalized Learning with AI
Andrew Ng launches LearnVector, leveraging generative AI to create one-on-one personalized learning experiences. Explore its core vision, potential capabilities, challenges, and how LLMs could solve education's scalability problem.