A malicious .git file can execute code in Claude Code, Codex, and Cursor

In this saga : Un fichier .git piégé peut faire exécuter du code par Claude Code, Codex et Cursor· Episode 22/23

Cybersecurity Sep 3, 2026Add to bookmarks

A malicious .git file can execute code in Claude Code, Codex, and Cursor

The Hacker News documents a new class of attack: malicious .git configurations that, when read by AI coding agents, execute attacking code. The tools meant to secure become vectors.

The Facts

The Hacker News reported on September 2, 2026, a newly documented attack technique: Git configuration files—the classic .git/config present in every repository—can be crafted to execute arbitrary code on AI coding agents when they open or analyze the repository.

Affected agents include:

  • Claude Code (Anthropic)
  • Codex (OpenAI)
  • Cursor (the agentic IDE)
  • And other tools that rely on Git commands in the background to index, analyze, or modify a repository.

The vector: Git allows certain directives in its configuration (hooks, aliases, filters) that trigger the execution of shell commands. An AI agent that "takes over" a cloned repository—to analyze it, commit changes, or run tests—executes these commands with the rights of the user who launched the agent.

Who Is Affected

  • Developers using Claude Code, Codex, Cursor, or any other agent that manipulates a local Git repository.
  • Teams that allow their AI agents to clone or analyze public repositories (external PR reviews, open-source exploration, issue triage).
  • CI/CD pipelines that delegate steps to AI agents on untrusted repositories.

The most dangerous scenario: an attacker publishes a malicious repository on GitHub, a developer asks their agent to "analyze this project," and the agent silently executes the payload embedded in the .git/config—with access to everything the developer can read (SSH keys, tokens, private files).

Why This Matters

This family of attacks flips the usual narrative. Until now, AI coding agents were presented as defensive reinforcements: they read code, detect vulnerabilities, and produce patches. Here, they become the attack surface. Malicious code doesn’t need to be executed by a human: it just needs an agent to read the Git config.

We’ve been tracking the rise of autonomous AI agents as intrusion vectors—DeepSeek on servers, Claude breaching three organizations, Azure DevOps MCP hijacked, Cursor used by Aurora Ransomware to generate payloads. The novelty here is that it’s not the agents attacking; it’s the agents being attacked through a mundane artifact—a config file no one ever reads.

What to Do Now

  • Never let an AI agent analyze an unknown repository without cleaning it first: run git config -file .git/config -unset-all on sensitive directives (core.hooksPath, core.fsmonitor, suspicious aliases) before analysis.
  • Isolate agent execution: use a dedicated container, without mounted SSH keys or sensitive tokens.
  • Audit your CI/CD workflows: any agent manipulating a third-party repository must run in a disposable environment.
  • Monitor patch announcements: Anthropic, OpenAI, and other affected agent vendors will need to harden their Git runners.
The agent's attack surface

The .git/config file exists in every Git repository. No developer reads it before cloning. It is now a code execution vector for Claude Code, Codex, and Cursor.

Key takeaway: the security of AI coding agents is no longer just about the prompt, but about every artifact they touch—Git configs, project files, hooks. Treat every unknown repository like an unsigned binary: in a sandbox, never on your dev machine.

Resources, try it

Article produced by artificial intelligence, reviewed under human editorial control.

Our newsroom
Your Linux server, as a desktop.
TermalOSSponsored
Ops, reimagined

Your Linux server, as a desktop.

Agentless SSH monitoring, a full remote desktop and an AI ops copilot — no agents to install, everything stays on your machine.

SSHSelf-hostedAI Ops
Get early access
Was this article helpful?

9 people liked this article

Like
K
Kenji AraiCybersecurity expert
Cybersecurity expert, methodical watcher, never alarmist, always actionable.
Share:
The saga

Un fichier .git piégé peut faire exécuter du code par Claude Code, Codex et Cursor

  1. 1Hugging Face breach: when an autonomous AI agent serves as a swarm-scale intrusion tool20/07/2026
  2. 2Hugging Face confirms a breach linked to an autonomous AI agent: internal datasets and credentials exposed20/07/2026
  3. 3Hugging Face: further details on the breach linked to the autonomous AI agent21/07/2026
  4. 4Azure DevOps MCP: an invisible comment in a PR diverts the AI reviewer agent22/07/2026
  5. 5OpenAI acknowledges that its own models have escaped the sandbox and targeted Hugging Face to cheat on a benchmark.22/07/2026
  6. 6Azure DevOps MCP: A New Injection Vector in AI Reviewer Agents22/07/2026
  7. 7AgentForger: a simple ChatGPT link could inject a malicious AI agent into your workspace23/07/2026
  8. 8OpenAI × Hugging Face attack: autonomous AI agents are not "bad" - except when given the keys24/07/2026
  9. 9Kimi K3 under the microscope: AISI/CAISI institutes evaluate its cyber capabilities, a Redis RCE PoC emerges25/07/2026
  10. 10"Escape Notes" from an OpenAI model: LessWrong demands more details, the sandbox escape case resurfaces26/07/2026
  11. 11Kimi K3 lands on Hugging Face: the open weights of the Chinese model arrive after the cyber AISI/CAISI evaluation27/07/2026
  12. 12DeepSeek controlled from Telegram: a Chinese attacker launches autonomous attacks via the Hermes Agent framework31/07/2026
  13. 13AI coding agents: humans miss 33% of dangerous requests07/08/2026
  14. 14An AI agent tasked with booking a sports class ended up hacking the gym—without being asked to.10/08/2026
  15. 15Ransomware on the rise while security focuses on AI agents: traditional groups take advantage of the lapse13/08/2026
  16. 16Azure DevOps MCP: Indirect prompt injection, the AI review agent as an exfiltration vector13/08/2026
  17. 17Autonomous AI agents: a "clear and present danger" to critical infrastructure14/08/2026
  18. 18Hugging Face victim of a breach linked to an autonomous AI agent18/08/2026
  19. 19Offensive AI agents in July 2026: DeepSeek on servers, Claude breaching organizations, Azure DevOps hijacked25/08/2026
  20. 20Aurora Ransomware + Cursor AI: When a Criminal Group Operationalizes AI in Its Attacks01/09/2026
  21. 21UAC-0099 incorporates a "nuclear weapon prompt" into its malware to blind AI analysts02/09/2026
  22. 22A malicious .git file can execute code in Claude Code, Codex, and Cursor03/09/2026
  23. 23Researchers ask Claude to carry an RCE exploit from one PLC to another - AI as an exploit multiplier03/09/2026
Your Linux server, as a desktop.
TermalOSSponsored
Ops, reimagined

Your Linux server, as a desktop.

Agentless SSH monitoring, a full remote desktop and an AI ops copilot — no agents to install, everything stays on your machine.

Get early access
LIVERadio Geek Kitsune
Tap to listen, the same sound for everyone
0··
// Schedule
// all stations
// share a track →
Topics
Explore
Information