title: Pickle Payload Reaches an Execution Primitive Through an Indirect Name Resolver
id: ATR-2026-02662
rule_version: 2
status: experimental
description: |
  Detects a Python deserialization payload that never names an execution primitive in its opcodes, because it calls a name RESOLVER instead: pkgutil.resolve_name("os:system") returns os.system as a stack value, and the second REDUCE calls that value. An opcode scanner sees only pkgutil. resolve_name -- which is on nobody's blocklist -- and the string "os:system" is inert data it does not analyse. Mined from CVE-2026-3490 (picklescan universal blocklist bypass, CVSS 10.0), which reports that EVERY entry in picklescan's _unsafe_globals can be reached this way; importlib.import_module, operator.attrgetter and __import__ are the same trick with a different resolver. Two shapes are matched, chosen because neither occurs in writing ABOUT the attack. First, the payload as bytes: the resolver name and the module:attr target adjacent with NO quote character between them, which is what a pickle stream looks like when a tool reads the file (the string is length-prefixed, not quoted) and is exactly what advisory prose is not -- prose quotes the argument. Second, the weaponisation source: a __reduce__ whose reduce tuple names a resolver as its callable. ATR-2026-00398 and ATR-2026-00433 cover the CALLER (pickle.loads(...), torch.load(..., weights_only=False)); nothing covered the payload itself.
author: ATR Community (CVE sweep)
date: 2026/08/23
schema_version: '0.1'
detection_tier: pattern
maturity: test
severity: critical
references:
  cve:
    - CVE-2026-3490
  cwe:
    - CWE-502
    - CWE-183
    - CWE-693
  owasp_llm:
    - LLM03:2025
    - LLM05:2025
  owasp_agentic:
    - ASI04:2026
    - ASI05:2026
  mitre_attack:
    - T1027 - Obfuscated Files or Information
  mitre_atlas:
    - AML.T0010 - AI Supply Chain Compromise
  external:
    - https://github.com/mmaitre314/picklescan/security/advisories/GHSA-vvpj-8cmc-gx39
    - https://www.vulncheck.com/advisories/picklescan-universal-blocklist-bypass-via-pkgutil-resolve-name
    - https://nvd.nist.gov/vuln/detail/CVE-2026-3490
metadata_provenance:
  cve: human-reviewed
  cwe: human-reviewed
  owasp_llm: human-reviewed
  owasp_agentic: human-reviewed
  mitre_attack: human-reviewed
  mitre_atlas: human-reviewed
compliance:
  eu_ai_act:
    - article: '15'
      context: Article 15 (accuracy, robustness and cybersecurity) requires protection against exploitation of system vulnerabilities; this rule detects deserialization payloads engineered specifically to pass an opcode blocklist before executing.
      strength: primary
    - article: '10'
      context: Article 10 (data and data governance) covers the integrity of data and model artefacts an AI system loads; a pickle carrying an indirect execution gadget is an integrity failure of that artefact.
      strength: secondary
  nist_ai_rmf:
    - subcategory: MG.2.3
      context: Malicious serialized artefacts are an identified AI supply-chain risk; this rule is the runtime countermeasure applied when the artefact crosses an agent tool boundary.
      strength: primary
    - subcategory: MP.5.1
      context: Recording blocklist-evading deserialization gadgets in the organizational AI risk register.
      strength: secondary
  iso_42001:
    - clause: '8.1'
      context: ISO/IEC 42001 Clause 8.1 (operational planning and control) is operationalised by inspecting model and cache artefacts for execution gadgets before they are loaded.
      strength: primary
    - clause: '8.3'
      context: ISO/IEC 42001 Clause 8.3 (AI risk treatment) is implemented by alerting on the gadget rather than on the blocked function name the gadget was chosen to avoid.
      strength: secondary
tags:
  category: model-security
  subcategory: deserialization-gadget
  scan_target: runtime
  confidence: high
  suppress_in_code_blocks: true
agent_source:
  type: mcp_exchange
  framework:
    - any
  provider:
    - any
detection:
  condition: any
  conditions:
    - field: content
      operator: regex
      value: \bresolve_name[\x00-\x09\x0b-\x1f\x7f-\xff~]{1,24}\b(?:os|posix|nt|subprocess|builtins|__builtin__|pty|commands)\s{0,1}:\s{0,1}(?:system|popen\w{0,2}|exec\w{0,2}|eval|call|run|check_output|check_call|getoutput|spawn\w{0,3})\b
      description: 'A pickle stream in which pkgutil.resolve_name is followed by a module:attribute target naming an execution primitive, separated ONLY by pickle framing bytes -- opcodes and length prefixes, i.e. control characters, high bytes, or the tilde stand-in this rule''s test vectors use. rule_version 2 replaced the previous separator class (any 0-24 characters except newline and quote), which let ordinary prose through: a changelog saying ''reject resolve_name targets such as os:system'', an advisory saying ''resolve_name with os:system'', a markdown table cell, a YAML denylist, and a Traditional Chinese advisory all fired. Framing bytes cannot appear in prose, and a genuine protocol-4 pickle contains nothing else between the two strings.'
    - field: content
      operator: regex
      value: (?:^|\n|\\n)[^-\n]{0,60}\breturn\s{0,4}\(\s{0,4}(?:\w{1,24}\.)?(?:resolve_name|import_module|attrgetter|__import__)\s{0,4},\s{0,4}\(?\s{0,4}["\x27](?:os|posix|nt|subprocess|builtins|__builtin__|pty|commands)(?:\s{0,1}[:.]\s{0,1}(?:system|popen\w{0,2}|exec\w{0,2}|eval|call|run|check_output|check_call|getoutput|spawn\w{0,3}))?["\x27]
      description: 'A __reduce__ implementation whose reduce tuple names a name-resolution gadget as the callable AND passes a LITERAL string naming an execution primitive as its argument. The literal-argument requirement is what separates the gadget from the legitimate uses of the same callable: copyreg module pickling (return (import_module, (mod.__name__,))), a picklable attrgetter wrapper (return (attrgetter, (self.attr,))), a lazy loader (return (import_module, name)) and a multiprocessing reduction all pass a variable, not a hard-coded ''os:system''. The line must not begin with a dash, which keeps the rule off the removal side of a diff that DELETES the gadget.'
  false_positives:
    - 'ADVERSARIAL, 2026-08-24 refutation pass: rule_version 1 fired on 11 of 16 benign probes. Seven were security writing about CVE-2026-3490 with an UNQUOTED target -- changelog, advisory prose, denylist config, markdown table, ATR''s own coverage note, slide notes, and a Traditional Chinese advisory. Four were legitimate reduce tuples: copyreg module pickling, a picklable attrgetter, a lazy loader, and a multiprocessing reduction. All eleven are now true_negatives.'
    - 'Legitimate pkgutil.resolve_name / importlib.import_module use, which is what those functions exist for: entry-point loading, logging handler configuration, plugin registries, Django-style dotted settings. Twelve such samples were written and run during authoring; none matched, because the target is a project module rather than an execution primitive, and because the argument is quoted.'
    - A normal __reduce__ that returns (self.__class__, (args,)) or a module-level factory -- the first tuple element is not a name resolver.
    - 'A unified diff whose REMOVAL line deletes the gadget (a patch that fixes this very bug). FOUND during authoring by a full-corpus run -- the sample is another sweep''s benign twin, ''diff -u old.py new.py / - def __reduce__(self): return (pkgutil.resolve_name, ...)'' -- and fixed by requiring that the line carrying the return does not begin with a dash. The addition side of such a diff is still read normally.'
    - Security writing about CVE-2026-3490 that quotes pkgutil.resolve_name("os:system"). The quote characters around the argument keep the first condition silent, and code fences / inline code are suppressed by tags.suppress_in_code_blocks. Prose that writes the target string UNQUOTED and directly after the resolver name would still match; that shape was written during authoring and is the residual limit.
response:
  actions:
    - alert
  message_template: |
    [ATR-2026-02662] This artefact resolves an execution primitive by name (pkgutil.resolve_name / import_module / attrgetter) instead of importing it. An opcode blocklist cannot see the target -- do not deserialize it.
confidence: 85
