CVE-2026-47392 Elastic Security · Elastic

Detect PraisonAI Sandbox Escape via print.__self__ Builtins Leak in execute_code in Elastic Security

Detects exploitation of CVE-2026-47392, a critical sandbox escape vulnerability in PraisonAI (praisonaiagents <= 1.6.39, PraisonAI <= 4.6.39). The flaw allows attackers to leak the Python builtins module through `print.__self__` within the `execute_code` subprocess mode, bypassing sandbox restrictions and achieving arbitrary code execution on the host. A public proof-of-concept is available.

MITRE ATT&CK

Tactic
Execution Privilege Escalation Lateral Movement

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.name with maxspan=2m
  [process where event.type == "start"
   and (process.name like~ "python*" or process.name like~ "praisonai*")
   and (process.command_line like~ "*praisonai*" or process.args like~ "*praisonaiagents*")]
  [process where event.type == "start"
   and (
     process.command_line like~ "*print.__self__*"
     or process.command_line like~ "*__builtins__*"
     or process.command_line like~ "*execute_code*"
     or (process.command_line like~ "*subprocess*" and process.command_line like~ "*shell=True*")
   )]
critical severity high confidence

EQL sequence detection correlating a PraisonAI process start followed by suspicious builtins access or subprocess shell execution within a two-minute window on the same host.

Data Sources

Elastic Endpoint SecurityElastic Agent process events

Required Tables

logs-endpoint.events.process*

False Positives & Tuning

  • Legitimate multi-step PraisonAI workflows that include subprocess calls for authorized data processing
  • Developer environments where agents are intentionally tested with extended Python access
  • Containerized PraisonAI deployments where subprocess activity is expected and monitored separately
  • Automated benchmark or load-testing tools that invoke PraisonAI repeatedly with shell helpers

Other platforms for CVE-2026-47392


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1PraisonAI Builtins Leak via print.__self__ in execute_code

    Expected signal: Process spawn: python3 executing praisonaiagents code_tools module; child process executing 'id' command via os.popen; stdout contains 'SANDBOX_ESCAPE_SUCCESS' followed by uid/gid output

  2. Test 2PraisonAI Sandbox Escape to Reverse Shell

    Expected signal: Process tree: python3 -> praisonaiagents -> bash -c 'bash -i' with network connection to 127.0.0.1:4444; network telemetry showing TCP connection from python process

  3. Test 3PraisonAI Sandbox Escape with Credential File Exfiltration

    Expected signal: File open event on /tmp/lab_creds.txt by python process; outbound HTTP POST to 127.0.0.1:8888 from PraisonAI process; process command line contains __builtins__ and os.system invocation

Unlock Pro Content

Get the full detection package for CVE-2026-47392 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections