title: Skill Data Exfiltration via Compound Patterns
id: ATR-2026-00149
rule_version: 1
status: experimental
description: |
  Detects compound exfiltration patterns in SKILL.md files where sensitive data (credentials, SSH keys, wallet files, browser data, environment variables) is read AND transmitted to an external endpoint. Single-action patterns (just reading env vars or just mentioning curl) are intentionally excluded to avoid false positives on legitimate security and DevOps skills.
author: ATR Community
date: 2026/04/08
schema_version: '0.1'
detection_tier: pattern
maturity: test
severity: critical
references:
  mitre_atlas:
    - AML.T0010 - AI Supply Chain Compromise
  owasp_llm:
    - LLM06:2025
  owasp_agentic:
    - ASI04:2026
    - ASI05:2026
  owasp_ast:
    - AST01:2026 - Malicious Skills
  research:
    - 'Claude Code leak: context poisoning + exfiltration combo'
    - Adversarial SKILL.md benchmark 2026-04
metadata_provenance:
  mitre_atlas: auto-generated
compliance:
  nist_ai_rmf:
    - subcategory: MS.2.10
      context: The rule detects compound patterns where sensitive data (SSH keys, wallets, credentials, browser databases) is both read and transmitted externally from SKILL.md files; MS.2.10 requires that privacy risks—particularly unauthorized data exfiltration—are continuously assessed and evidenced.
      strength: primary
    - subcategory: GV.6.1
      context: SKILL.md files are third-party/supplier artifacts loaded into the agent runtime, and exfiltration logic embedded in them constitutes a supply-chain risk; GV.6.1 requires policies that govern third-party AI components against malicious data-harvesting behavior.
      strength: secondary
    - subcategory: MG.2.3
      context: Detection of compound read-and-transmit exfiltration patterns triggers the deactivation/quarantine response plans required by MG.2.3 to disengage the malicious skill before sensitive data leaves the host.
      strength: secondary
    - subcategory: MS.2.7
      context: NIST AI RMF MEASURE 2.7 (security and resilience evaluated and documented) is supported by this rule's runtime detection of the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      strength: primary
    - subcategory: MG.3.1
      context: NIST AI RMF MANAGE 3.1 (third-party resources regularly monitored) is supported where this rule detects the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      strength: secondary
    - subcategory: MG.3.2
      context: NIST AI RMF MANAGE 3.2 (pre-trained models monitored as part of maintenance) is supported where this rule detects the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      strength: secondary
  iso_42001:
    - clause: '8.1'
      context: ISO/IEC 42001 Clause 8.1 (operational planning and control, including control of externally provided processes) is operationalised by this rule's detection of the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      strength: primary
    - clause: '8.3'
      context: ISO/IEC 42001 Clause 8.3 (AI risk treatment) is supported by this rule, which implements runtime detection of the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns) as a treatment control.
      strength: secondary
  eu_ai_act:
    - article: '15'
      context: Article 15 (accuracy, robustness and cybersecurity) requires high-risk AI systems to resist unauthorised attempts to alter their use, outputs or performance; this rule provides runtime detection evidence by flagging the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      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 that detects the skill supply-chain compromise (Skill Data Exfiltration via Compound Patterns).
      strength: secondary
tags:
  category: skill-compromise
  subcategory: data-exfiltration
  scan_target: skill
  confidence: high
agent_source:
  type: mcp_exchange
  framework:
    - skill_md
  provider:
    - any
detection:
  conditions:
    - field: content
      operator: regex
      value: (?i)(tar|zip|7z)\s+[^\n]*~/?\.ssh
      description: SSH directory archive — skills should not archive user SSH keys
    - field: content
      operator: regex
      value: (?i)(find|ls|cat|strings)\s+(?:\S[^\n]*)?(wallet\.dat|seed\.txt|mnemonic|keystore)[^\n]*(\||>|>>|curl|wget|fetch|POST)
      description: Crypto wallet file enumeration and exfiltration
    - field: content
      operator: regex
      value: (?i)sqlite3\s+(?:\S[^\n]*)?(Cookies|Login\s*Data|cookies\.sqlite|places\.sqlite)
      description: Browser cookie/credential database access
    - field: content
      operator: regex
      value: (?i)(?:^|[\n;&|])[^\S\n]*(?:dig|nslookup|host)\b[^\n]{0,40}?\$[{(][^\n]{0,40}[.][a-z]
      description: DNS exfiltration via encoded subdomain queries (shell var embedded in a queried hostname, command-position only)
    - field: content
      operator: regex
      value: (?i)(curl|wget|fetch|http)\s*[^\n]*169\.254\.169\.254
      description: Cloud instance metadata service access (IMDS credential theft)
    - field: content
      operator: regex
      value: (?i)cat\s+(?:[^\s|][^|\n]*)?\.(env|bashrc|zshrc|npmrc)[^|\n]*\|\s*(curl|wget|nc|python|base64)
      description: Environment file bulk read piped to exfiltration
    - field: content
      operator: regex
      value: (?i)glob[.\w]*\s*\([^)]*\*\.[^)]*\)[\s\S]{0,500}(fetch|axios|request|https?\.request)\s*\(
      description: Source code glob enumeration + external upload
    - field: content
      operator: regex
      value: (?i)cat\s+[^\n]*\.env[^\n]*\.(bashrc|zshrc|aws|credentials|npmrc)
      description: Multi-file sensitive data collection in single cat command
    - field: content
      operator: regex
      value: (?i)\[SYSTEM\]\s*(?:\S[^\n]*)?(?:previous\s+instructions|new\s+directive|ignore\s+(?:all\s+)?previous|you\s+are\s+now)
      description: Fake [SYSTEM] block attempting to override instructions
    - field: content
      operator: regex
      value: (?i)<!--(?![^>]*(?:https?://|!\[|\]\())\s*[A-Za-z0-9+/]{40,}={0,2}\s*-->
      description: Base64-encoded hidden instruction in HTML comment — narrowed to require the comment be (essentially) JUST the blob. Previously any 40+ char alphanumeric run anywhere inside an HTML comment matched, which caught ordinary shields.io/markdown badge comments (e.g. '<!-- ![GitHub Downloads](https://img.shields.io/...) -->') whose long URL query string looks base64-shaped by character class alone.
    - field: content
      operator: regex
      value: (?i)(dangerouslyDisableSandbox|autoApprove|allowedTools|skip.?permissions)\s*[:=]\s*(true|\[)
      description: Security setting override attempt (sandbox disable, auto-approve)
    - field: content
      operator: regex
      value: (?i)npm\s+install\s+[^\n]*--registry\s+https?://(?!registry\.npmjs\.org)
      description: npm install from non-official registry (supply chain attack)
    - field: content
      operator: regex
      value: (?i)find\s+[~/]\s+[^\n]*-name\s+["']\*\.(pem|key|p12|keystore)["'][^\n]*(\||>|curl|wget)
      description: Sensitive file discovery + exfiltration pipeline
  condition: any
  false_positives:
    - Security audit skills that describe these patterns as examples to detect
    - SSH management skills that reference ~/.ssh for legitimate configuration
response:
  actions:
    - block_tool
    - alert
  actions_rationale: 'response-action eligibility (docs/RESPONSE-ACTION-ELIGIBILITY.md): benign FP 19/5352 = 0.36% meets the 0.5% ceiling but is not zero; ceiling = degrade. Removed quarantine_session(terminate). Detection unchanged — recall cost is zero.'
  message_template: |
    [ATR-2026-149] Compound data exfiltration pattern detected in skill. Sensitive data (credentials, keys, wallet, browser data) is being read AND transmitted externally. This matches known attack campaigns.
confidence: 90
wild_validated: 2026/04/08
wild_samples: 53577
wild_fp_rate: 0.1419
