Detect PraisonAI Deploy API Server Code Injection via f-string Interpolation (CVE-2026-62176) in IBM QRadar
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
QRadar Detection Query
-- df00tech DF00-7488fa6bd1 · https://df00tech.com/detections/CVE-2026-62176 · licence: https://df00tech.com/detections/licence
SELECT QIDNAME(qid) AS event, sourceip, username, "Process Name" AS process, "Parent Process Name" AS parent, "Command Line" AS cmd, starttime
FROM events
WHERE ( "Command Line" ILIKE '%praisonai%' AND ( "Command Line" ILIKE '%deploy%' OR "Command Line" ILIKE '%serve%' ) )
OR ( "Parent Process Name" ILIKE '%python%' OR "Parent Process Name" ILIKE '%uvicorn%' )
AND ( "Command Line" ILIKE '%__import__%' OR "Command Line" ILIKE '%os.system%' OR "Command Line" ILIKE '%subprocess%' OR "Command Line" ILIKE '%/bin/sh%' OR "Command Line" ILIKE '%/bin/bash%' )
ORDER BY starttime DESC LAST 24 HOURS Surfaces PraisonAI deploy invocations and suspicious child commands of python/uvicorn servers consistent with CVE-2026-62176 injection.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate PraisonAI deploy runs.
- Scripted python tooling referencing subprocess/os.
- Security tooling spawning python helpers.
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.
- 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.
- Test 2 PraisonAI deploy invocation with crafted agents_file value
Expected signal: Command line referencing praisonai deploy with embedded __import__/os.system tokens.
- 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
- Confirm the installed PraisonAI version on the host (`pip show praisonai`); versions <= 4.6.77 are vulnerable to CVE-2026-62176.
- Identify the source of the agents_file value used in the deploy command and determine whether it originated from untrusted input.
- 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.
- Review process lineage: check whether the python/uvicorn server process spawned shells or network utilities shortly after generation.
Containment
- Stop the deployed PraisonAI API server process (uvicorn/python) and prevent it from auto-restarting.
- Quarantine or delete the attacker-controlled generated server source file and block regeneration until the input source is sanitized.
- Isolate the affected host from the network if suspicious child processes or outbound connections were observed.
Evidence Collection
- Preserve the generated server source file, the deploy command line, and the agents_file value that supplied the interpolated input.
- 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.
// 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 ``` 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
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
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
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.
Runs a mock deploy command line containing an agents_file value with injection metacharacters to trigger invocation detection.
Command
python3 -c "print('simulating praisonai deploy')" ; echo praisonai deploy --agents_file 'name"); __import__(\'os\').system(\'echo pwn\'); ("' > /tmp/praisonai_deploy_cmd.log Cleanup
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.
Launches a process that mimics a uvicorn-parented shell spawn resulting from injected code.
Command
powershell -NoProfile -Command "$env:_parent='uvicorn'; Start-Process cmd.exe -ArgumentList '/c echo subprocess os.system __import__ & whoami'" Cleanup
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.