TL;DR: AI instruction files, including Skills, hooks, AGENTS.md and MCP configs, can be abused to exfiltrate prompts, redirect traffic through attacker-controlled endpoints and expose over 1,230 hardcoded API keys and JWTs across many services, according to Mitiga research. Instruction files now behave like malware delivery infrastructure because agents trust them before any human review happens.
At a glance
What this is: NHI Mgmt Group's analysis, drawing on Mitiga's blog post: AI instruction files can be abused to exfiltrate prompts, reroute agent traffic and surface hardcoded secrets across the agent supply chain.
Why it matters: Practitioners need to treat agent instruction files as executable trust inputs, because compromise can arrive through content, config and dependency paths before any binary payload appears.
By the numbers:
- Over 1,230 hardcoded API keys and JWT tokens were found across tens of services.
Context
AI instruction files are trusted configuration and content files that shape how an agent behaves at runtime. When those files can carry commands, endpoint overrides or embedded secrets, the security model shifts from review-after-load to trust-before-execution.
That shift creates a supply-chain problem for agentic systems, not just a code-review problem. A malicious repository, template or helper file can influence what the agent reads, sends or executes long before a defender sees a conventional malware artifact.
The same trust boundary now spans Skills, hooks, agent brain files and MCP configs, so governance has to cover the full instruction path rather than a single directory. MCP security becomes relevant because endpoint and token handling sit inside the same trust chain.
Key questions
Q: How do poisoned instruction files affect AI coding agents?
A: Poisoned instruction files can override the user’s visible task by feeding the agent trusted guidance that changes how it edits files, invokes tools and interprets project context. The risk is highest when those files are loaded automatically at session start and can persist across multiple runs, because the agent then treats attacker-written policy as normal operating instructions.
Q: Why can prompt exfiltration work without malware on disk?
A: Prompt exfiltration can work by tricking an AI agent or tool into revealing system prompts, hidden context, retrieved data, or credentials through normal model outputs or tool calls, so no malware is needed on disk. The attack abuses trust in prompts, context windows, and delegated access, especially when an agent can read files, call APIs, or relay sensitive data unchecked.
Q: How should teams govern MCP endpoint changes in AI workflows?
A: Govern MCP endpoint changes through change control, code review, allowlisted servers, and signed or approved configuration so an agent only connects to trusted tools. Treat each endpoint change as a delegated access change, because it can alter which systems, data, and actions the agent can reach. Revalidate scopes, authentication, and logging before release.
Q: What should teams do first when agent repos contain hardcoded secrets?
A: First isolate the repository, revoke or disable the exposed credentials, and rotate the exposed secrets before assuming anything in the codebase is trustworthy. Then search for all copies in code, logs, CI variables, issue trackers, and documentation, and replace hardcoded values with injected secrets from a vault or other controlled secret store.
Technical breakdown
How instruction files become an execution layer
AI instruction files are not inert documentation once an agent loads them. They can define triggers, shell commands, tool settings, routing choices and follow-on actions, which means a benign-looking file can alter runtime behaviour without a separate executable payload. In this research pattern, the file itself becomes the delivery mechanism, and the agent becomes the thing that carries the action forward. That matters because traditional malware detection often looks for binaries, dropper chains or obvious persistence artifacts. Here, the control surface is the agent's own trusted context. See the Agentic AI Identity Guide.
Practical implication: Treat instruction-file parsing and loading as an execution boundary, not a content-management task.
Why endpoint overrides and MCP configs change the trust boundary
Endpoint overrides and MCP server settings can redirect model traffic, tools or credentials to places the operator did not intend. Once a configuration file can steer requests through an attacker-controlled proxy or untrusted server, the security problem is no longer just configuration drift. It becomes delegated trust in a remote endpoint that can observe, replay or alter agent interactions. That creates a supply-chain-style dependency on whoever controls the destination, even when the original assistant or model is legitimate. See the MCP Security Guide.
Practical implication: Review any file that sets tool endpoints, base URLs or MCP targets as if it were an access-control decision.
How prompt exfiltration works without a binary implant
Prompt exfiltration abuses the fact that an agent will often treat instructions as higher priority than user intent. A malicious skill or hook can ask the agent to capture prompts, package them and send them out under the cover of normal workflow execution. The attack is subtle because there may be no obvious process injection, file drop or alertable payload. The instruction file is the malware, and the agent is the courier. That is a different pattern from classic endpoint compromise, where the defender hunts for a malicious process on disk or in memory.
Practical implication: Instrument agent inputs, tool calls and outbound destinations so prompt theft leaves an auditable trail.
Threat narrative
Attacker objective: The attacker wants the agent to carry out exfiltration and trust abuse while appearing to follow normal workflow instructions.
- Entry occurs when a malicious repository, instruction file or adjacent artifact is placed where the agent will trust and load it during normal development work.
- Credential access happens when the file instructs the agent to reuse exposed API keys, JWTs or upstream tokens, or to route traffic through an attacker-controlled endpoint.
- Escalation follows when the agent inherits broader permissions than the attacker could reasonably obtain directly, including tool access, file access or service reachability.
- Impact is prompt theft, traffic interception, secret exposure and downstream compromise of services that accepted the agent's delegated trust.
Breaches seen in the wild
- Smithery.ai MCP hosting breach 2025: A Smithery.ai build flaw gave GitGuardian a live fly.io token controlling 3,000+ hosted MCP servers and the API keys their clients sent.
- postmark-mcp malicious MCP server 2025: A fake Postmark MCP server on npm quietly BCC'd every email AI agents sent through it to an attacker, using victims' own Postmark tokens.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Instruction files have become a supply-chain control plane for AI agents: the core security problem is no longer only what code ships, but what context an agent is allowed to trust. A malicious skill, hook or brain file can shape runtime behaviour before any traditional malware detector sees a binary. That makes the loading step itself a governance boundary, not a convenience feature.
Prompt exfiltration is a trust-abuse pattern, not a novel payload class: the file tells the agent to steal the most valuable data it handles, then uses the agent's own permissions to move that data out. Traditional endpoint assumptions fail because there may be no separate implant to isolate, only trusted instructions that execute through normal agent workflow. Practitioners need to recognize this as delegated misuse of identity and action rights, not just content tampering.
Endpoint overrides create a hidden routing layer for identity and data: when a config file can rewrite where the agent sends model calls, tool traffic or secrets, trust shifts from the approved service to the destination operator. That breaks the assumption that legitimate model traffic stays inside an expected boundary, and it makes provenance of the endpoint as important as provenance of the repository. Governance must cover where the agent is pointed, not just what the agent is told.
Skillgate-style detection works because the threat is structured, not random: the useful control is to classify instruction-file patterns by the action they can induce, then block or review the risky families before the agent loads them. That approach is more durable than chasing filenames, because the same technique can surface across Skills, hooks, AGENTS.md, CLAUDE.md and MCP configs. The lesson is that agent security needs policy on instruction semantics, not only file extensions.
Hardcoded secrets in agent paths are an identity problem disguised as content sprawl: over 1,230 exposed API keys and JWT tokens across many services show that the agent workspace now carries live credentials as often as source code. Those secrets may be reachable through instruction files, build helpers or adjacent configs, which means access governance has to extend into the AI supply chain. NHI controls must follow the agent's working context, not stop at the secrets vault.
From our research library:
- 24,008 unique secrets were exposed in MCP configuration files in 2025 alone, the protocol's first year of widespread adoption, according to the State of Secrets Sprawl 2026.
- Read next: Agentic AI Identity Guide
What this signals
Instruction files create a new governance layer for autonomous systems: when runtime context can be changed by Skills, hooks or MCP configs, review cycles that focus only on source code miss the real control point. Security teams need to decide what an agent may trust before it loads, because post-load review is too late for instructions that already shaped execution.
Prompt theft becomes an identity event once the agent is the courier: the same permissions that let the agent do work can also let it exfiltrate prompts, tokens and local data. That means detection has to watch for unusual routing, outbound destinations and file access patterns around agent execution, not just for classic malware signatures.
In practice, the useful boundary is the agent's working context rather than the repository alone. If teams keep treating instruction files as documentation, they will continue to miss the point where configuration turns into delegated action.
For practitioners
- Audit instruction-file trust paths Inventory every place an agent loads context from, including Skills, hooks, AGENTS.md, CLAUDE.md, MCP configs and helper scripts, then classify which of those paths can alter runtime behaviour.
- Block endpoint and base-URL overrides Reject unapproved routing changes in agent configs, especially settings that can redirect model traffic, tool calls or MCP endpoints to external infrastructure.
- Scan for prompt-exfiltration patterns Look for instruction text that tells an agent to capture prompts, copy local data, phone home or chain to another file, and treat those patterns as high-risk even when no binary is present.
- Rotate any exposed API keys and JWTs Assume any secret embedded in an instruction file, repo mirror or adjacent helper is compromised once it has been published or indexed, and remove standing access before visibility changes.
- Re-scan agent repos after tool upgrades Run the same checks whenever a model, assistant or agent framework changes, because new runtime permissions can expose paths that older policies never covered.
Key takeaways
- Instruction files now sit on the critical path for AI agent compromise because they can steer runtime behaviour, not just describe it.
- The most damaging outcomes in this pattern are prompt exfiltration, endpoint redirection and secret leakage through trusted agent actions.
- Governance needs to move to load time, with review and filtering of skills, hooks, MCP configs and adjacent helper files before the agent consumes them.
Related NHI Mgmt Group resources: MCP Security Guide · Agentic AI Identity Guide · AI Agent Observability, Audit and Incident Response Guide · AI Coding Agents Security Guide
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI04 — Agentic Supply Chain Vulnerabilities | Instruction files and adjacent artifacts are being used as a delivery path for agent compromise. |
| ASI02 — Tool Misuse | The research shows agents can be steered into unsafe actions through trusted instructions and configs. | |
| Recommendation — Inventory agent instruction sources and block untrusted artifacts before they can influence runtime behavior. Restrict agent tools and review any instruction that can trigger outbound actions or privileged operations. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The article reports hardcoded API keys and JWTs exposed across agent-related files. |
| NHI-04 — Insecure Authentication | Redirected endpoints and exposed tokens weaken the assurance behind agent authentication flows. | |
| Recommendation — Scan agent repositories and configs for embedded secrets and revoke anything exposed. Bind agent authentication to approved endpoints and reject unmanaged routing changes. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | Agent files are altering effective permissions, destinations and delegated access paths. |
| Recommendation — Review agent entitlements and configuration changes as access-control events, not just file edits. | ||
| MITRE ATT&CK | TA0006;TA0010 — Credential Access; Exfiltration | The pattern combines secret harvesting with outbound theft through the agent's own execution path. |
| Recommendation — Map agent instruction abuse to credential-access and exfiltration detections in your monitoring pipeline. | ||
Key terms
- AI Instruction File: An AI instruction file is a prompt, configuration, or rule set that tells an AI system how to behave, what data to access, and how to act on inputs. In security terms, it is part of the control layer because it can shape privilege, retrieval, and output rules.
- Base-URL Override: Base-URL Override is a setting or attack technique that replaces the default API base URL used by a client, SDK, or agent. It redirects requests to a different endpoint, which can alter authentication, data flow, or tool execution if the override is not restricted to trusted destinations.
- Prompt Exfiltration: Prompt exfiltration is the unauthorized capture or leakage of prompts sent to an AI system. In security terms, it exposes hidden instructions, sensitive context, or embedded secrets from agent workflows, APIs, or logs, creating risk for NHI, data confidentiality, and downstream actions driven by compromised model context.
- MCP Server Configuration: MCP Server Configuration is the setup that defines how an MCP server exposes tools, resources, and prompts to AI agents. It specifies connection details, authentication, permissions, transport, and available capabilities, so the agent can safely discover and use external functions through the Model Context Protocol.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity security are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an identity security programme, it is worth exploring.
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org