安全客July 13, 2026🇨🇳Translated from Chinese

Ghostcommit Attack: Malicious Prompts Hidden in PNG Images Hijack AI Coding Agents to Steal .env Secrets

A new supply-chain attack technique named Ghostcommit enables adversaries to conceal prompt-injection commands inside ordinary PNG images, thereby bypassing AI code-review systems and compelling coding agents to exfiltrate sensitive secrets such as .env configuration files.

Attack Principle and Comparative Verification

The ASSET Research Group conducted experiments showing that when a pull request directly contains plaintext instructions to steal a repository’s .env file, tools such as the Cursor vulnerability bot and CodeRabbit immediately detect the malicious command and flag it as a high-severity issue before the code is merged.

To circumvent these safeguards, the researchers split the attack payload into two parts: a seemingly legitimate specification document named AGENTS.md placed in the repository root, and a PNG image (docs/images/build-spec.png) that actually contains the complete malicious logic. The image instructs the agent to read the .env file byte-by-byte and encode its contents as an ASCII numeric sequence. Because most text-oriented review tools treat images as opaque binary files and CodeRabbit skips PNG files by default, the entire pull request passes without any security warnings.

Attack Trigger Flow

The theft does not occur at merge time. Instead, the trap activates later when a developer, in a separate session, asks the coding agent to implement ordinary functionality. The agent consults the already-merged AGENTS.md file, parses the referenced image, reads the local .env file, and emits a module-level constant (for example _PROV_CANARY) containing hundreds of numeric values. When these numbers are decoded, they reconstruct the complete plaintext of the .env file. In one real-world test using Claude Sonnet inside Cursor, the model produced a tuple of 311 numbers that, once decoded, revealed API keys, database addresses, and cloud credentials.

Two Major Detection Blind Spots Exploited

  • Malicious prompts are hidden inside images, rendering them invisible to human reviewers, regex scanners, and large-language-model tools that only analyze textual diffs.
  • Extracted secrets are disguised as numeric tuples; conventional secret-scanning tools that rely on string patterns fail to recognize ASCII-decodable number sequences.

Multi-Tool and Multi-Model Test Results

Researchers evaluated 11 combinations of coding tools and models. Results showed that whether the attack succeeds depends primarily on the agent framework rather than the underlying model. Cursor leaked .env contents with Claude Sonnet 4.6, Composer-2, and GPT-5.5. Antigravity leaked secrets with Sonnet, Gemini 3.1 Pro, and Gemini 3 Flash. In contrast, the Claude Code platform blocked the attack across its entire model family (Sonnet 4.6, Haiku 4.5, Opus 4.7). Notably, the same Sonnet model behaved differently across environments. In one extreme test, Antigravity running Opus initially computed the secrets but then autonomously removed the sensitive output after recognizing the social-engineering pattern; the same model inside Claude Code never read the AGENTS.md file and therefore never triggered its self-defense mechanism.

Self-Developed Defense Prototype

The research team built a lightweight multimodal GitHub code-review tool based on the open-source Gemma 4 model that runs on a single 4 GB GPU. The prototype combines three detection capabilities: invisible-character identification, code-structure analysis, and simultaneous LLM-based validation of both specification documents and embedded images. In stress testing it achieved 100 % interception of 15 known attack samples with zero false positives, detected 49 out of 50 attacks in 80 previously unseen real-world submissions, and correctly classified all 30 normal business pull requests without raising alerts. The team has open-sourced the complete proof-of-concept code, including the split-payload pull-request samples and numeric-decoding utilities, to help the security community develop countermeasures.

Related articles

BoletimSecAI Security

AgentForger Vulnerability in ChatGPT Workspace Agents Enabled Malicious AI Deployment via Single Phishing Link

A vulnerability in ChatGPT Workspace Agents allowed attackers to create and deploy a malicious AI agent inside an organization from a single phishing link. Named AgentForger, the flaw was fixed by OpenAI on June 8, 2026. The attack exploited a permissive parameter in the Agent Builder that accepted instructions directly through the URL. An authenticated user opening the prepared link would trigger automatic execution of the command without additional confirmation. The victim required access to Workspace Agents and at least one pre-authorized enterprise connector such as Outlook, Gmail, Google Drive, Slack, Teams, or Google Calendar. The malicious prompt instructed the platform to create an agent, connect available applications, disable approval requests, publish the component, and schedule it for recurring operation. In the demonstration, the agent monitored emails from the attacker with subjects starting with “TASK” and executed the contained instructions while returning results to the attacker-controlled address.

安全客AI Security

AI Coding Tools Under Fire: Grok Build Uploads Entire Git Histories, Claude Code Suspected of Silent Transfers

Security researcher cereblab uncovered that Grok Build 0.2.93 establishes separate HTTPS channels to exfiltrate full Git repositories, resulting in a 27800-fold traffic discrepancy between task context and storage uploads to Google Cloud Storage buckets. The tool ignores user instructions such as "do not read" and decouples the improve_model_enabled client switch from the server-controlled trace_upload_enabled flag, allowing continued uploads even when privacy settings are disabled. Similar concerns emerged around Claude Code, which maintains undisclosed WebSocket connections that transmit file paths, dependency trees, and code metadata without user awareness or audit logs. Comparative traffic audits showed that Codex and Gemini produced no anomalous outbound activity, while Grok Build and Claude Code were the only tools confirmed to perform data transfers beyond user authorization. The incidents highlight systemic issues including server-side remote control of client behavior, lack of third-party audits for closed-source binaries, and the conflict between model training data needs and user data sovereignty. Experts recommend zero-trust measures such as network blocking, Docker sandboxing without mounting .git directories, git filter-repo sanitization, and preference for auditable open-source alternatives like Continue.dev or locally deployed Ollama models.

安全客AI Security

PentesterFlow Launches Open-Source AI CLI Tool for Penetration Testers and Bug Bounty Hunters

PentesterFlow is a new open-source, human-in-the-loop AI command-line tool designed specifically for penetration testers and bug bounty hunters. It automates the full workflow from reconnaissance to report generation while requiring explicit analyst approval before executing sensitive commands. The tool addresses common issues in agentic AI security tools such as hallucinations, weak context retention, and poor tool integration by incorporating built-in pentesting skills and evidence-based vulnerability confirmation. It supports connections to local or hosted LLMs including Ollama, Gemini, Groq, and others, and features continuous local learning that stores user preferences and lessons without retraining models. A key differentiator is its integration with Burp Suite and a permission-based execution model that includes a YOLO mode for isolated environments. The project positions itself as a transparent alternative to fully autonomous tools like PentAGI and PentestGPT.

SecuritylabAI Security

Optimizing Cybersecurity Content for LLMs: How Sites Can Enter Generative AI Answers

Search engines and AI services like ChatGPT, Gemini, Perplexity, Copilot and Google AI Overviews increasingly deliver synthesized answers instead of link lists. For cybersecurity publishers this changes competition because high traditional rankings no longer guarantee visibility or accurate citation. The article explains GEO, AEO and LLMO practices, shows how material moves through indexing, fragment selection and summarization stages, and stresses the need for self-contained facts that survive extraction and paraphrasing. It provides concrete writing frameworks for vulnerability reports, including required fields such as CVE identifiers, affected versions, attack conditions and real-world exploitation evidence. Technical requirements cover correct robots.txt handling for Googlebot, OAI-SearchBot, GPTBot and Bingbot plus the use of IndexNow for rapid updates. The piece also warns about poisoning risks, prompt injection and slopsquatting attacks that can feed false data into generative systems.