Summary
CVE-2026-51872 is a critical code injection vulnerability in Devika v1.0, an open-source AI software engineering agent. The flaw resides in the Runner.run_code function in src/agents/runner/runner.py, which executes LLM-generated commands without validating or sanitizing their contents, allowing an attacker to achieve arbitrary code execution on the host running Devika. The vulnerability carries a CVSS v3.1 base score of 9.8 (Critical) and requires no authentication or user interaction to exploit.
Technical details
- Root cause:
Runner.run_codeprocesses structured responses returned by the LLM backend and only checks for the presence of expected fields (e.g.,actionandresponse) without inspecting or sanitizing the actual contents of the embedded command data. - Execution path: When the parsed action indicates a command should be run, the command string taken from the LLM response is split (e.g., via
command.split(" ")) and passed directly to a subprocess execution call, with no whitelisting, sandboxing, or input validation applied. - Trigger conditions: An attacker who can influence the content processed by the LLM — for example through crafted user prompts or prompt injection against the agent — can cause the model to emit a malicious command/code payload that Devika will execute verbatim.
- Attack vector: Network — exploitation does not require local access, prior authentication, or victim interaction, and can be delivered through normal interaction with an exposed Devika instance (e.g., its Socket.IO-based chat interface).
- Impact: Full compromise of confidentiality, integrity, and availability of the host system, including arbitrary file creation/modification and arbitrary code execution with the privileges of the Devika service process.
Affected software
- Devika v1.0 (stitionai/devika) —
src/agents/runner/runner.py,Runner.run_codefunction
Severity
- CVSS v3.1 Base Score: 9.8 (Critical)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Mitigation and recommended actions
- Immediate: As of this writing, no official patched release or fixed version from the Devika maintainers has been confirmed. Security teams should monitor the upstream
stitionai/devikarepository for a fix addressingrunner.pyand upgrade as soon as a patched version is available. - If no patch is available:
- Do not expose Devika instances directly to the internet or untrusted networks; restrict access to trusted internal users via VPN or firewall allow-listing.
- Run Devika inside an isolated, sandboxed environment (e.g., container with restricted filesystem/network access and no sensitive credentials) so that arbitrary code execution cannot impact other systems.
- Review and restrict the permissions of the service account running Devika to the minimum required.
- Disable or tightly control any functionality that allows the agent to execute LLM-generated commands or code against the host, and audit logs for unexpected subprocess executions.
- Treat all LLM-generated output used by the agent as untrusted input and avoid passing it to command execution or file system operations without independent validation.

