Skip to content
CVE-2026-62176 Sumo Logic CSE · Sumo

Detect PraisonAI Deploy API Server Code Injection via f-string Interpolation (CVE-2026-62176) in Sumo Logic CSE

Detects exploitation of CVE-2026-62176, a CWE-94 code injection vulnerability in PraisonAI (versions <= 4.6.77, fixed in 4.6.78). The deploy/api.py module generates Python server code by interpolating the agents_file parameter directly into an f-string, which is then written to a file and executed via subprocess.Popen. An attacker who controls the agents_file value through a CLI argument, configuration, or upstream API can break out of the string context and inject arbitrary Python, achieving code execution when the deploy command runs. The same pattern exists in deploy/docker.py. Detection focuses on PraisonAI deploy invocations, writes of generated server source files containing injected payloads, and anomalous child processes spawned by the Python server process.

MITRE ATT&CK

Tactic
Initial Access Execution

Sumo Detection Query

Sumo Logic CSE (Sumo)
sql
// df00tech DF00-7488fa6bd1 · https://df00tech.com/detections/CVE-2026-62176 · licence: https://df00tech.com/detections/licence
_sourceCategory=*endpoint* OR _sourceCategory=*sysmon* OR _sourceCategory=*linux*
| json auto nodrop
| if (isEmpty(commandLine), process, commandLine) as cmd
| if (isEmpty(parentImage), parent_process_name, parentImage) as pproc
| where (cmd matches /praisonai/i and (cmd matches /deploy/i or cmd matches /serve/i))
     or (pproc matches /python|uvicorn/i and (cmd matches /__import__|os\.system|subprocess|\/bin\/sh|\/bin\/bash|curl |wget /i))
| count by host, user, pproc, cmd
| sort by _count desc
high severity medium confidence

Detects PraisonAI deploy invocations and suspicious python/uvicorn child commands indicating injected payload execution.

Data Sources

Endpoint process logsSysmonLinux process telemetry

Required Tables

endpoint_process

False Positives & Tuning

  • Legitimate PraisonAI deployment activity.
  • Developer and CI test runs of the deployed API.
  • Benign python tooling using subprocess/os.

Other platforms for CVE-2026-62176


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 further down this page.

  1. Test 1 Simulate f-string injection payload in generated server file

    Expected signal: Process creation for python3 executing the generated file; file write of /tmp/praisonai_api.py; child process of python3 running id/os.system.

  2. Test 2 PraisonAI deploy invocation with crafted agents_file value

    Expected signal: Command line referencing praisonai deploy with embedded __import__/os.system tokens.

  3. Test 3 Suspicious shell child of uvicorn server (Windows)

    Expected signal: ProcessCreate event for cmd.exe with a parent chain including powershell/python and command line containing injection tokens.


Response Playbook

Triage

  1. Confirm the installed PraisonAI version on the host (`pip show praisonai`); versions <= 4.6.77 are vulnerable to CVE-2026-62176.
  2. Identify the source of the agents_file value used in the deploy command and determine whether it originated from untrusted input.
  3. Inspect the generated server source file for Python that breaks out of f-string literals, such as `__import__`, `os.system`, `subprocess`, or appended statements after a closing quote.
  4. Review process lineage: check whether the python/uvicorn server process spawned shells or network utilities shortly after generation.

Containment

  1. Stop the deployed PraisonAI API server process (uvicorn/python) and prevent it from auto-restarting.
  2. Quarantine or delete the attacker-controlled generated server source file and block regeneration until the input source is sanitized.
  3. Isolate the affected host from the network if suspicious child processes or outbound connections were observed.

Evidence Collection

  1. Preserve the generated server source file, the deploy command line, and the agents_file value that supplied the interpolated input.
  2. Collect process creation logs for the python/uvicorn parent and all child processes, including full command lines and timestamps.

Escalation Criteria

  • !Escalate to incident response if the generated file contains executable payloads beyond expected server code or if the server process spawned shells, downloaders, or reverse-shell commands.
  • !Escalate if the agents_file input was sourced from an untrusted or externally controllable channel, indicating active exploitation rather than a benign deploy.

Investigation Guide

Forensic Artifacts

  • >The deploy-generated Python server source file and its modification timestamp.
  • >Shell history and process audit logs showing the `praisonai deploy` invocation and any child processes.
  • >The PraisonAI agents_file configuration supplying the interpolated input.

Tuning Guidance

Baseline legitimate `praisonai deploy` usage in your environment (known hosts, users, and expected agents_file values). Allowlist deploys where the agents_file input comes from trusted, validated configuration. Prioritize alerts where the generated server source or child processes contain shell/network-exec indicators, and suppress developer-sandbox hosts that routinely generate and test servers.


Hunting Queries

Surface all PraisonAI deploy invocations and writes of generated Python server files for retrospective review.

Hunting — KQL
kql
// df00tech DF00-7488fa6bd1 · https://df00tech.com/detections/CVE-2026-62176 · licence: https://df00tech.com/detections/licence
DeviceFileEvents | where FileName endswith ".py" and FolderPath has_any ("praisonai","deploy") | where InitiatingProcessCommandLine has "praisonai" | project Timestamp, DeviceName, FolderPath, InitiatingProcessCommandLine
Hunting — SPL
spl
``` df00tech DF00-7488fa6bd1 · https://df00tech.com/detections/CVE-2026-62176 · licence: https://df00tech.com/detections/licence ```
index=* (sourcetype=linux:process OR sourcetype=Sysmon) (CommandLine="*praisonai*" AND CommandLine="*deploy*") | table _time host user CommandLine

Atomic Red Team Tests

Test 1 Simulate f-string injection payload in generated server file
linux

Writes a Python file mimicking a PraisonAI deploy-generated server where an interpolated value broke out of the f-string and injected a benign system call.

Command

bash
printf 'import uvicorn\nAGENT_NAME = "x"); import os; os.system("id > /tmp/praisonai_poc.txt"); ("\n' > /tmp/praisonai_api.py && python3 /tmp/praisonai_api.py || true

Cleanup

bash
rm -f /tmp/praisonai_api.py /tmp/praisonai_poc.txt

Expected Telemetry

Process creation for python3 executing the generated file; file write of /tmp/praisonai_api.py; child process of python3 running id/os.system.

Expected Detection

The KQL/SPL/EQL rules fire on the generated server write and the suspicious child command of the python parent.

Test 2 PraisonAI deploy invocation with crafted agents_file value
linux

Runs a mock deploy command line containing an agents_file value with injection metacharacters to trigger invocation detection.

Command

bash
python3 -c "print('simulating praisonai deploy')" ; echo praisonai deploy --agents_file 'name"); __import__(\'os\').system(\'echo pwn\'); ("' > /tmp/praisonai_deploy_cmd.log

Cleanup

bash
rm -f /tmp/praisonai_deploy_cmd.log

Expected Telemetry

Command line referencing praisonai deploy with embedded __import__/os.system tokens.

Expected Detection

Deploy-invocation branch of the detections matches on the praisonai + deploy command line containing injection tokens.

Test 3 Suspicious shell child of uvicorn server (Windows)
windows

Launches a process that mimics a uvicorn-parented shell spawn resulting from injected code.

Command

powershell
powershell -NoProfile -Command "$env:_parent='uvicorn'; Start-Process cmd.exe -ArgumentList '/c echo subprocess os.system __import__ & whoami'"

Cleanup

powershell
Remove-Item -ErrorAction SilentlyContinue $env:TEMP\praisonai_poc.txt

Expected Telemetry

ProcessCreate event for cmd.exe with a parent chain including powershell/python and command line containing injection tokens.

Expected Detection

The suspicious-child branch of the KQL and CQL rules matches on injection tokens in the child command line.

Related Detections