RouteGuard: Internal-Signal Detection of Skill Poisoning in LLM Agents

Xiao, Wenjie, Tang, Xuehai, Zhou, Biyu, Hu, Songlin, Han, Jizhong

–arXiv.org Artificial Intelligence 

Agent skills are rapidly becoming the reusable interface layer of LLM agents, but they also create a new supply-chain-style indirect injection threat: an attacker can hide malicious instructions inside a skill that already looks like legitimate guidance and thereby hijack the agent's goal. We study the pre-execution detection problem: given an untrusted skill, how can we detect, inside an instruction-like skill carrier, malicious instructions that can redirect model reasoning and induce erroneous behavior before the skill is executed? This setting is fundamentally different from ordinary indirect prompt injection, because benign skills are already dense, action-oriented instruction sources. As a result, rule-based matching and surface semantic screening become brittle exactly in the slices that matter most. We show that successful skill poisoning produces a structured internal effect that we call attention hijacking: during response generation, attention shifts from trusted context to the malicious skill span, the shift is stronger for earlier injections and for descriptionchannel payloads, and larger shifts are associated with harmful outputs. Motivated by this mechanism, we propose RouteGuard, a frozenbackbone detector that combines responseconditioned attention and hidden-state alignment signals through reliability-gated late fusion. Across five evaluation questions spanning heterogeneous skill benchmarks and ordinary indirect prompt injection, RouteGuardis consistently the strongest or most robust detector; on the critical Skill-Injectchannel slice, it reaches 0.8834 F1 and recovers 90.51% of descriptionattacks missed by lexical screening. The central conclusion is simple: skill poisoning should be treated as malicious instruction competition inside an instruction-like carrier, and reliable defense therefore requires internal-signal detection rather than text-only filtering.