Independent analysis by NHI Mgmt GroupSource article: Bloom Security, “Execute Before the Model Sees It: Dynamic Execution Primitives in AI Agent Skills and Commands” (June 1, 2026)

TL;DR: Skill files that look like Markdown can execute shell commands, read files, and trigger hooks before the model sees them, according to Bloom Security, which found ten of 31 agentic platforms with confirmed pre-model execution. Security gates built around model refusal cannot protect a runtime that has already acted.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Bloom Security's research: Agentic skill files can trigger shell execution, file reads, and hooks before the model call, creating a pre-model execution surface.

Why it matters: IAM, PAM, and agent governance teams need to treat skill installation as code execution, because model-level safety controls cannot contain actions that run before inference.


Context

Agentic coding platforms often treat skill files as instructions, but some implementations execute parts of those files before the model is called. That breaks the normal assumption that the model is the first policy boundary, because the platform can already have run shell commands, read local files, or registered hooks by the time inference starts.

For identity governance, this matters because the effective trust boundary shifts from the AI model to the skill loader, the local filesystem, and the session runtime. Zero Trust for AI Agents applies here in a narrow sense: the platform must verify what runs, when it runs, and whether the action was ever model-mediated.

The article's findings are especially relevant to AI agents used in development environments, where skills are shared, copied, and installed like packages. That makes pre-model execution a governance problem, not a niche implementation detail.


Key questions

Q: How do pre-model execution paths work in AI agent skills?

A: Pre-model execution paths are code or commands that run before an AI agent’s model makes a decision, such as parsing a skill package or resolving shell expansion. They matter because untrusted input can be executed outside the model’s reasoning path. Constrain loaders, disable implicit command execution, and treat skill metadata as code.

Q: Why do skill loaders become a code execution risk?

A: Skill loaders become a code execution risk when they automatically run install scripts, initialise dependencies, or evaluate package metadata during loading. That means installation becomes an execution step, not just a file transfer. Restrict loader privileges, inspect hooks, and require signed or allowlisted skill packages before activation.

Q: How should teams detect malicious hooks in agent skill files?

A: Teams should detect malicious hooks by scanning skill files for unexpected post-load actions, command invocation, filesystem writes, network calls, and wildcard matchers that expand scope beyond the declared task. Compare hooks against a allowlist of approved behaviours, and review any loader that can execute code before the agent’s main prompt runs.

Q: What happens when a shared skill directory is compromised?

A: A compromise of a shared skill directory lets an attacker alter every agent or service that trusts that directory, turning one tampered skill into repeated code execution. Access controls, integrity checks, signed packages, and separate per-project storage reduce blast radius. Treat the shared skill directory as a high-trust software supply chain location.


Technical breakdown

Pre-model execution primitives in skill loaders

A skill loader becomes an execution engine when it expands shell syntax, inlines file contents, or substitutes arguments before prompting the model. In that design, the model receives rendered output rather than the original instruction source, so it cannot inspect the command that already ran. The practical issue is not just prompt injection. It is a control-flow inversion where the platform transforms a supposed instruction artifact into a pre-inference execution path. That path may be triggered by benign-looking Markdown, YAML frontmatter, or command files, which makes inspection harder and sandbox assumptions weaker. See the AI Coding Agents Security Guide.

Practical implication: Review every skill format for pre-inference execution paths before allowing it into a shared developer environment.

Session-wide hooks as an execution persistence mechanism

Hooks embedded in skill metadata can bind commands to tool events and persist for the life of a session. That creates a durable execution channel that does not depend on repeated user interaction or model approval. Once loaded, a wildcard hook can intercept future tool calls silently, which is materially different from a one-time command substitution. The risk is architectural: a skill can declare ongoing control over later actions through configuration that appears harmless at rest. This is why session scope matters as much as command content.

Practical implication: Constrain hook scope to explicit, user-visible invocation paths and block session-wide wildcard interception by default.

Supply-chain spread of skill-based execution

Skills spread through repositories, shared directories, and copied dotfiles, so the attack surface looks more like package distribution than like a single prompt attack. Once a malicious skill is installed, it can persist across sessions and, in some ecosystems, across multiple tools that read overlapping paths. That creates a supply-chain problem at the identity layer: trust is being inherited from file provenance rather than from runtime authorisation. The important detail is that the model is downstream of that trust decision, which means conventional guardrails arrive too late to stop the initial execution.

Practical implication: Treat installed skills as software supply-chain artefacts and require provenance review before they reach shared developer machines.


Threat narrative

Attacker objective: The attacker wants to run code on the developer's machine before model safeguards, then persist that execution path long enough to extend control across sessions and tools.

  1. Entry occurs when a developer installs or opens a skill package that contains pre-model primitives disguised as normal instructions.
  2. Credential or environment access is obtained when the loader executes shell expansion, file reads, or hooks before any model-mediated review can happen.
  3. Escalation follows when session-wide hooks or shared directories persist that execution path across later tool calls and across multiple platforms.
  4. Impact is achieved when the pre-model command writes files, sends network traffic, or modifies local developer state before any approval or refusal can intervene.

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

Skill files are no longer just instructions once a platform executes them before inference. That changes the governance unit from prompt content to executable delivery artifact. The security question is no longer whether the model will comply, but whether the platform already ran something the model never saw. Practitioners should treat the loader as the true policy boundary, not the model.

Pre-model execution breaks the trust model that most agent governance assumes. Approval gates, refusal policies, and tool-use guardrails are all downstream of the execution point Bloom Security identified. That means a skill can trigger filesystem or shell activity even when the model would have refused the same action. The implication is that agent governance has to move earlier in the lifecycle, before the skill is loaded.

Skill laundering is a useful named concept for this failure mode. It describes a trusted distribution path that launders attacker code into pre-model execution under the appearance of documentation. The model becomes irrelevant to the first harmful action, which is why the risk sits in installation, provenance, and session persistence. Practitioners should classify any pre-model skill primitive as executable supply-chain content, not prompt text.

Frontmatter hooks create a standing-control problem inside the agent session. A skill that registers tool-intercepting hooks does not just execute once, it alters the future control path for the whole session. That is a governance issue analogous to persistent privilege, except the persistence is hidden in configuration rather than in an account. Teams should rethink whether session-scoped hooks belong anywhere near unvetted third-party skills.

From our research library:

What this signals

Execution has moved from the model to the loader. Governance programmes that only monitor prompts or tool calls will miss the moment when shell code, file reads, or hooks fire before inference. The operating assumption has to change from “the model decides” to “the platform may already have acted.”

That shift is now visible in adoption data: 69% of security leaders agree identity management must fundamentally shift to address agentic AI systems, according to the 2026 Infrastructure Identity Survey. The practical consequence is that agent identity controls must extend into installation, provenance, and runtime boundaries, not stop at prompt policy.

Pre-model execution creates a new trust boundary for agentic systems. Only 44% of organisations have implemented any policies to manage their AI agents, despite 92% agreeing that governing AI agents is critical to enterprise security, according to the 2026 Infrastructure Identity Survey. That gap means many programmes are still governing the wrong layer, leaving the loader and session runtime outside formal control.


For practitioners

  • Review skill files as executable artefacts Inspect SKILL.md, command files, and frontmatter before installation, with special attention to shell expansion, file interpolation, and hook declarations.
  • Block pre-model primitives by policy Disallow session-wide hooks, wildcard interceptors, and any syntax that expands or executes before the model call unless the platform can prove explicit user consent.
  • Separate model approval from runtime approval Require a distinct consent path for commands that run before inference, because model-requested tool approval does not govern actions that happen earlier in the stack.
  • Scan developer repos for skill supply-chain exposure Look for shared skill directories, dotfiles sync, and copied marketplace packages that can propagate the same execution path across machines and platforms.

Key takeaways

  • Agentic skill files can act like executable code when the platform runs shell commands, reads files, or registers hooks before the model sees anything.
  • The central governance failure is not prompt compliance but the assumption that the model is the first meaningful control point in the stack.
  • Practitioners need install-time review, execution provenance, and session-scoped restrictions because model refusal cannot stop pre-model actions.

Related NHI Mgmt Group resources: Zero Trust for AI Agents · Agentic AI Identity Guide · Shadow AI and AI Agent Discovery 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 define the specific risk controls and attack patterns relevant to this term.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10ASI02 — Tool MisusePre-model shell expansion and hook execution let skills misuse tools before the model can mediate them.
ASI03 — Identity & Privilege AbuseSession-wide hooks and inherited skills abuse runtime authority granted to the agent stack.
Recommendation — Restrict tool-triggering primitives so agent skills cannot invoke commands before explicit approval. Constrain agent session authority and prevent skills from inheriting broader runtime privileges than intended.
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakagePre-model hooks can exfiltrate environment variables, files, and other secrets before model review.
NHI-03 — Vulnerable Third-Party NHIMarketplace and shared skill packages behave like third-party identities with unreviewed execution power.
Recommendation — Scan skill directories for secret-handling code and block any pre-model path that can expose credentials. Assess third-party skill sources as untrusted NHI supply-chain inputs before allowing installation.
MITRE ATT&CKTA0002;TA0006;TA0003 — Execution; Credential Access; PersistenceThe article documents pre-model execution, secret access, and session persistence as a chained attack path.
Recommendation — Map skill-based pre-model behavior to execution, credential access, and persistence techniques in detection and response.

Key terms

  • Session-Wide Hook: A Session-Wide Hook is a hook that runs once and then affects an entire agent or user session, rather than a single command or call. It can initialise state, alter prompts, or register behaviour that persists across multiple actions, so its scope is broader than a one-off hook.
  • Skill Loader: A Skill Loader is software that discovers, reads, validates, and activates an AI agent skill package. It may parse metadata, resolve dependencies, register hooks, and prepare execution context, which makes the loader part of the trusted path and a potential code execution point if it runs untrusted content.
  • Pre-Model Surface: Pre-Model Surface is the part of an AI agent workflow that executes before the model is called. It includes loaders, parsers, installers, and other pre-processing steps where untrusted content can trigger command execution, file access, or other side effects before the agent reasons about the task.
  • Skill Laundering: Skill Laundering is the practice of making a skill, plugin, or tool appear harmless while it hides executable behaviour, unsafe dependencies, or broader permissions. It usually relies on packaging, naming, or metadata that disguises the real runtime effect when the skill is loaded or invoked.

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.
NHIMG Editorial Note
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