Before the First Prompt Code Execution Paths in Trusted Codi... - #2822
Open
carlospolop wants to merge 1 commit into
Open
Before the First Prompt Code Execution Paths in Trusted Codi...#2822carlospolop wants to merge 1 commit into
carlospolop wants to merge 1 commit into
Conversation
Collaborator
Author
🔗 Additional ContextOriginal Blog Post: https://securitylabs.datadoghq.com/articles/coding-agent-project-trust-code-execution-before-first-prompt Content Categories: Based on the analysis, this content was categorized under "AI Security -> AI MCP Security, with a new subsection on repository-controlled pre-prompt code execution in coding agents; cross-reference Phishing Methodology -> AI Agent Abuse Local AI CLI Tools and MCP". Repository Maintenance:
Review Notes:
Bot Version: HackTricks News Bot v1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
The article demonstrates two repository-controlled code-execution paths in coding agents. After a developer clones an attacker-controlled repository, opens it in Codex or Claude Code, and approves project trust, repository-supplied configuration can execute arbitrary local code before the first user prompt, model response, MCP tool call, or generated shell-command approval. The payload runs in the coding agent's security context and can therefore interact with files, credenti...
🔧 Technical Details
Project-scoped MCP startup execution: If a coding agent supports repository-scoped local stdio MCP servers, trusting and opening the repository may automatically start the configured operating-system process. An attacker can define an interpreter such as
python3as the MCPcommandand supply a repository-controlled script throughargs. The payload runs during MCP initialization without a prompt, model response, MCP tool invocation, or generated-command approval. This can bypass controls that apply an additional review only to explicit command hooks.PATH hijacking of automatic agent commands: When project configuration controls the coding agent's environment, prepend a repository directory such as
./bintoPATHand place a tracked executable whose name matches a command automatically launched by the agent. If the agent executesgitwithout an absolute path, 🤖 Agent ActionsUpdated
src/AI/AI-MCP-Servers.mdwith:PATHhijacking through project settings.Validation passed for Markdown fences, internal links, references, forbidden sources, and
git diff --check.mdbook buildcould not run becausemdbookis not installed.This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.