title: Diagnostic Content Remediation Command Injection (Agentjacking)
id: ATR-2026-02027
rule_version: 1
status: experimental
description: |
  Detects indirect prompt injection delivered through untrusted diagnostic / error-monitoring content (the "Agentjacking" class disclosed by Tenet Security, 2026-06, against the Sentry MCP server). An attacker plants a fabricated error event whose remediation section instructs the coding agent to run an attacker-controlled command; the agent treats the injected text as trusted diagnostic guidance and executes it. This rule keys on the distinctive combination of a resolution / remediation framing carried inside diagnostic content AND an auto-executing or remote-fetch-execute payload (npx --yes on a scoped package, curl/wget piped to a shell, iwr|iex, base64|sh). It does not fire on ordinary remediation advice that names a known package install, and it does not key on any single vendor name.
author: ATR Community
date: 2026/07/10
schema_version: '0.1'
detection_tier: pattern
maturity: test
severity: critical
references:
  owasp_llm:
    - LLM01:2025
    - LLM06:2025
  owasp_agentic:
    - ASI06:2026
  mitre_atlas:
    - AML.T0051 - LLM Prompt Injection
  mitre_attack:
    - T1059 - Command and Scripting Interpreter
metadata_provenance:
  mitre_atlas: human-reviewed
  owasp_llm: human-reviewed
  owasp_agentic: human-reviewed
compliance:
  eu_ai_act:
    - article: '15'
      context: 'Article 15 (accuracy, robustness, cybersecurity) — runtime detection of indirect prompt injection via diagnostic content is a cybersecurity control for high-risk AI systems. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: primary
    - article: '9'
      context: 'Article 9 (risk management system) requires identified risks to be addressed by appropriate measures; this rule is a runtime risk-treatment control. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: secondary
  nist_ai_rmf:
    - subcategory: MP.5.1
      context: 'NIST AI RMF MAP 5.1 — likelihood and impact of the identified attack are characterised; this rule detects the adversarial input at runtime. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: primary
    - subcategory: MG.3.2
      context: 'NIST AI RMF MANAGE 3.2 — runtime monitoring/maintenance control that surfaces this attack class. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: secondary
  iso_42001:
    - clause: '8.1'
      context: 'ISO/IEC 42001 Clause 8.1 (operational planning and control) — detection of this payload is an operational control. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: primary
    - clause: '8.3'
      context: 'ISO/IEC 42001 Clause 8.3 (AI risk treatment) — this rule implements runtime detection as a treatment control. Technique: Diagnostic Content Remediation Command Injection (Agentjacking).'
      strength: secondary
tags:
  category: tool-poisoning
  subcategory: diagnostic-content-command-injection
  scan_target: both
  confidence: high
  source: threat-research
  vendor_sources: tenet-agentjacking-2026-06
agent_source:
  type: llm_io
  framework:
    - any
  provider:
    - any
detection:
  condition: any
  false_positives:
    - A legitimate error/remediation note that recommends installing a named, known package (e.g. 'run npm install lodash@latest') with no auto-execute or remote-fetch-and-run payload.
    - A real stack trace or reproduction step that mentions npm/npx to reproduce or build, without a resolution/remediation framing telling the agent to execute an attacker package.
    - Security advisory text describing the Agentjacking technique itself without an actual executable injected payload.
    - A setup/quickstart guide using npx to scaffold a project (e.g. 'npx create-next-app') outside of any diagnostic/error-resolution context.
  conditions:
    - field: content
      operator: regex
      value: (?i)(?:#{1,4}\s*resolution|recommended\s+(?:fix|remediation|resolution|action)|to\s+(?:fix|resolve|clear|remediate)\s+(?:this|the|your)|\brun\s+the\s+following\s+(?:diagnostic|command|tool|fix|to)|resolution\s*[:=]|"remediation")[\s\S]{0,240}(?:npx\s+(?:--yes|-y)\s+@[\w.-]+\/[\w.-]+|\bcurl\s+[^\n|]{0,200}\|\s*(?:ba|z|d)?sh\b|\bwget\s+[^\n|]{0,200}\|\s*(?:ba|z|d)?sh\b|iwr\s+[^\n|]{0,200}\|\s*iex\b|base64\s+-d\s*\|\s*(?:ba)?sh\b)
      description: resolution/remediation framing inside diagnostic content directly followed by an auto-execute (npx --yes scoped pkg) or remote-fetch-execute (curl|sh, iwr|iex, base64|sh) payload
    - field: content
      operator: regex
      value: (?i)(?:sentry|error\s+event|issue\s+(?:id|#|tracker)|monitoring\s+alert|exception\s+(?:captured|event)|stack\s*trace|breadcrumb)[\s\S]{0,300}(?:"?(?:resolution|remediation|recommended_action|fix|extra)"?\s*[:=][\s\S]{0,160})?(?:npx\s+(?:--yes|-y)\s+@[\w.-]+\/[\w.-]+|\bcurl\s+[^\n|]{0,200}\|\s*(?:ba)?sh\b|iwr\s+[^\n|]{0,200}\|\s*iex\b)
      description: untrusted diagnostic/error-monitoring context (error event, issue tracker, Sentry, breadcrumb) carrying an auto-execute or remote-fetch-execute payload, optionally in a resolution/extra field
    - field: content
      operator: regex
      value: (?i)"?(?:resolution|remediation|recommended_action)"?\s*[:=]\s*["'`][\s\S]{0,160}(?:npx\s+(?:--yes|-y)\s+@[\w.-]+\/[\w.-]+|\bcurl\s+[^\n|]{0,160}\|\s*(?:ba)?sh\b|iwr\s+[^\n|]{0,160}\|\s*iex\b)
      description: a structured resolution/remediation field (as in a Sentry event extra dict) whose value is an auto-execute or fetch-and-run command
response:
  actions:
    - alert
  message_template: |
    [ATR-2026-02027] CRITICAL: indirect prompt injection via diagnostic content (Agentjacking) detected - untrusted error/remediation content is directing the agent to run an auto-executing or remote-fetch-execute command. Do not execute; treat diagnostic tool output as untrusted data, not instructions.
confidence: 80
