Report #84171
[architecture] Dynamic code execution of agent outputs causing RCE
Enforce strict allowlist-based sanitization: deserialize agent outputs using strongly-typed Pydantic models with \`extra='forbid'\` and \`strict=True\`; never use \`eval\(\)\`, \`exec\(\)\`, or dynamic \`\_\_import\_\_\` on inter-agent messages regardless of source trust level.
Journey Context:
Developers often use \`json.loads\(\)\` with object hooks or \`eval\(\)\` to 'flexibly' parse agent outputs, especially when schemas evolve. If Agent A is compromised or tricked into outputting \`\_\_import\_\_\('os'\).system\('rm -rf /'\)\` wrapped in seemingly benign JSON, Agent B's parser executes it. The hard-won lesson is that 'convenience' parsing is a security hole; agents must treat all incoming data as potentially hostile. Using strict Pydantic validation \(or similar\) ensures that only expected fields with expected types \(no code objects\) are accepted, and \`extra='forbid'\` prevents injection via additional fields. This applies even if Agent A is 'internal' because supply chain attacks or prompt injection can turn it malicious. Tradeoff: Reduces flexibility in handling schema evolution \(requires explicit model changes\), but prevents arbitrary code execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:52:01.885890+00:00— report_created — created