New to ShortSpan? We distil the AI-security research that matters into practitioner takeaways — edited by Ben Williams (NCC Group).Get the weekly email
// Analysis
Hook updates let attackers steer AI agent harnesses
Published: Fri, 04 Sep 2026 • By Elise Veyron
Agents
New research shows AI agent harnesses trust lifecycle-hook updates that bind shell commands to routine events. An attacker can ship a benign plugin, then later push a hook-bearing update that runs with host privileges outside the Large Language Model’s view. The HookPry framework compromises all seven tested harnesses with high reliability.
Agent frameworks are getting busy wiring “lifecycle hooks” to everything: session start, tool calls, file edits. Those hooks aren’t prompts. They are shell commands that run with host privileges and often fire at times the Large Language Model (LLM) never sees. That separation is the gap this paper pries open.
How the attack lands
The weak point is the update path. Many harnesses treat pluginmanifests and hook configurations as trusted metadata. The authors show an attacker can publish a clean, useful, versioned plugin to earn adoption, then later ship an innocuous-looking update that silently registers new hooks. Once installed, routine events trigger host-side commands without the model’s involvement. No jailbreaks, no prompt games, just scheduled execution.
HookPry, the team’s automated framework, strings this together across heterogeneous harnesses. It uses Adversarial Manifest Optimisation to make the initial plugin highly discoverable while keeping behaviour benign. Temporal Decoupling delays the payload until a chosen trust boundary is crossed, such as after first successful use. Least Common Interface compiles one abstract attack into native hook syntax for each target. The payload menu covers ten objectives: privilege escalation, data exfiltration, persistence, output manipulation, and more.
What the data show
Across 25 harness–backend combinations and 1,000 end-to-end runs, HookPry compromised all seven evaluated harnesses. Verified end-to-end success hit 77.0% (770 full passes, 34 partials). Hooks initiated in 83.9% of runs and actually triggered about 82% of the time; the drop from trigger to final effect reflects environment and policy constraints, not model hesitancy.
After trigger, the model barely matters. Codex CLI, OpenClaw and Claude Code show cross-backend standard deviation under 2.5 percentage points, signalling that execution is harness-controlled. Native lifecycle hooks also beat model-mediated tricks: on a 50-target set, direct hooks reached 92.0% success versus 56.0% for mechanically translated malicious tool descriptions.
Defences underwhelm. Microsoft Defender flagged 0 of 40 malicious artefacts in this setup. Two static-rule baselines each caught roughly half; unioned, they still missed 47.5%. Prompt-layer hardening cannot help when the malicious path lives outside the model’s reasoning loop.
There are boundaries here: the tests used ephemeral, synthetic environments, no forced installs, and no sandbox escapes. Success hinges on events occurring, updates being adopted, and the privileges of spawned subprocesses. Still, the shape of the problem is clear: update-driven trust migration turns “metadata” into an execution channel.
For those building marketplaces and enterprise controls, this raises policy questions rather than easy fixes. Who vouches for hook updates, and how are they reviewed at scale? What provenance and signing cover manifests as first-class code? When should harnesses refuse host-level hooks by default? The answers will decide whether agents remain helpful or become a new supply-chain liability.
Additional analysis of the original ArXiv paper
📋Original Paper Title and Abstract
A Blind Trust, the Bloody Thrust: When Attacker-Controlled Hook Updates Steer AI Agent Harnesses towards Malicious Behaviors
Authors: Pengxun Li, Litian Zhang, Jianwei Hou, Shujiang Wu, Song Li, Zifeng Kang, and Xi Zhang
Modern AI agent harnesses expose lifecycle hooks that bind shell commands to runtime events such as session start, tool calls, and file edits. These commands run with host privileges yet ship as lifecycle-hook configuration and may fire at times the LLM never observes. We identify the lifecycle-hook update path, which harnesses trust blindly, as a new attack surface. Under a supply-chain threat model in which an attacker controls only plugin metadata and lifecycle-hook configuration, a benign versioned plugin can be trojanized by an update that silently binds attacker-chosen commands to benign events, yielding malicious host-side behavior such as privilege escalation. We propose HookPry, an open-source and fully automated attack framework that systematically exploits this vulnerability across heterogeneous AI agent harnesses. HookPry realizes ten attack objectives; across 25 combinations of harnesses and backends in 1,000 end-to-end runs, it compromises all seven evaluated harnesses, with per-harness success rates reaching 92.5%. Representative defenses remain insufficient: Microsoft Defender has 0% recall, and the union of three static defenses misses 47.5% of malicious artifacts.
🔍ShortSpan Analysis of the Paper
Problem
The paper studies a newly identified supply-chain attack surface in AI agent harnesses: lifecycle hooks. These hooks are manifest entries that bind host shell commands to runtime events such as session start, tool calls and file edits. Hook commands execute with host privileges and can fire at times when the language model does not observe them, creating a post-trigger execution boundary that is invisible to prompt-layer defences. Under a realistic threat model in which an attacker controls only plugin metadata, versioning and hook configuration, a benign, versioned plugin can be trojanised by a later update that silently registers attacker-chosen commands, enabling host-side effects including privilege escalation and data exfiltration.
Approach
The authors build HookPry, an open-source automated framework that realises end-to-end lifecycle-hook attacks across heterogeneous harnesses. HookPry chains three components: Adversarial Manifest Optimisation (AMO) to make an initially benign plugin highly discoverable while preserving benign behaviour; Temporal Decoupling (TD) to separate initial trust acquisition from a later hook-bearing update and to activate payloads only when a chosen runtime trust boundary is reached; and Least Common Interface (LCI) to compile a single abstract attack logic into native hook configurations for multiple target harnesses. The evaluation covers 40 attack cases, seven harnesses and five LLM backends, yielding 25 harness-backend combinations and 1,000 end-to-end runs in ephemeral, synthetic environments. External oracles adjudicate successful host-side effects.
Key Findings
HookPry compromises all seven evaluated harnesses; across 1,000 runs it produced 770 full passes, 34 partials and 196 fails, giving a micro-averaged verified end-to-end attack success rate of 77.0%. No runs were explicitly blocked by the harnesses.
Mechanism utility is high: hook-related steps initiated in 83.9% of runs and lifecycle hooks were actually triggered in about 82% of cases; variation in final effect arises from environment and policy constraints after trigger.
Some harnesses show near model independence after trigger: Codex CLI, OpenClaw and Claude Code have cross-backend standard deviations below 2.5 percentage points, indicating that post-trigger execution is harness-controlled rather than model-mediated.
Native lifecycle hooks reach 92.0% success on a 50-target paired dataset; mechanically translated malicious tool descriptions converted into hooks achieve 56.0% on the same targets, showing the advantage of direct hook execution over model-mediated tool invocation.
Representative static defences are inadequate: Microsoft Defender detected 0 of 40 malicious artifacts; two static-rule baselines detected about 47.5 to 50.0% each, and the union of the three still missed 47.5% of malicious samples.
Limitations
Experiments used ephemeral environments with synthetic assets and excluded forced installation, implementation bugs, sandbox escapes and real user data. Success depends on event occurrence, update adoption and hook subprocess privileges. Defence evaluation covered only a small set of static tools and synthetic benign controls; dynamic analysis and broader enterprise policies were not assessed.
Implications
Offensively, an attacker who can publish and later update a marketplace plugin can stealthily install privileged host-side commands that run outside the model’s reasoning loop, enabling credential theft, persistence, manipulation of tool outputs and resource hijacking. The attack is practical across harnesses and evades common static scanners, so adversaries can leverage update-based trust migration to achieve covert, high-privilege effects without exploiting code vulnerabilities or prompting the model to act maliciously.
- It exposes a real, under-appreciated attack surface: AI coding agents can be steered to malicious dependencies simply by editing setup docs (README,...
- It targets the harness that coordinates tools, context, and state for LLM agents—often the most valuable point for an attacker to compromise.
- It ...
- Highlights a new, more dangerous attack class: backdoors planted in one step (a file or tool output) that Activate later to give an attacker persist...
- Simple takeaway: The study shows that most prompt tweaks don’t trigger exploitation by LLM agents, but a specific “goal reframing” prompt reliably c...
- It shows a real risk: attackers can steer AI agents by embedding harmful instructions in external content, often leaving no obvious signs in the fin...
- Why it’s noteworthy: it shows that safe-by-prompt checks may miss risks that arise when a task is split into multiple steps, allowing vulnerable cod...
- It maps a wide range of real advisories in an AI agent framework, showing how security problems appear across layers from LLM reasoning to host exec...
- Why it matters: It provides a comprehensive, taxonomic view of prompt injection risks specific to agentic coding assistants and their tool, file-sys...
- Identifies a new stealthy attack surface: attackers can inject adversarial guidance into bootstrap hooks of autonomous coding agents, not just throu...
- It shows that manipulating an agent’s execution context (files, memory, tools, etc.) can trigger unsafe behavior even if the task looks fine, reveal...
Get the weekly digest
The few AI-security papers that matter, with the practitioner takeaway. No spam.