Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-51918 Overview
CVE-2026-51918 is a code injection vulnerability in FinRobot 1.0.0, an open-source AI agent platform for financial analysis maintained by the AI4Finance Foundation. The flaw resides in the CodingUtils.create_file_with_code() function, which processes untrusted input and writes it to executable Python files without sanitization. Attackers can supply crafted code strings that execute in the application context, leading to arbitrary command execution on the host. The vulnerability is network-exploitable, requires no authentication, and no user interaction. It is tracked under CWE-94: Improper Control of Generation of Code.
Critical Impact
Unauthenticated attackers can achieve arbitrary code execution against FinRobot 1.0.0 deployments through the create_file_with_code() sink.
Affected Products
- FinRobot 1.0.0 (AI4Finance Foundation)
- Deployments embedding the CodingUtils module from FinRobot 1.0.0
- Downstream AI agent pipelines invoking create_file_with_code() with external input
Discovery Timeline
- 2026-10-02 - CVE-2026-51918 published to NVD
- 2026-10-05 - Last updated in NVD database
Technical Details for CVE-2026-51918
Vulnerability Analysis
FinRobot is a multi-agent framework that uses large language models (LLMs) to generate and execute Python code for financial tasks. The CodingUtils.create_file_with_code() helper writes model- or caller-supplied code to a file that is later executed by the agent runtime. Because the function treats its input as trusted source code, any string reaching the sink becomes executable logic. An attacker who can influence the code argument — through a prompt, an API call, or an upstream agent message — achieves arbitrary code execution on the host running FinRobot.
The network attack surface is broad. FinRobot deployments typically expose chat or API endpoints that feed user input into agent planning loops, so prompt-injection or direct API abuse both reach the vulnerable function.
Root Cause
The root cause is improper control of generated code [CWE-94]. create_file_with_code() concatenates or writes caller-provided text into a Python file without validating that the content originates from a trusted source or conforms to an allowlist. The agent runtime then imports or executes the file, giving attacker-controlled code the privileges of the FinRobot process.
Attack Vector
Exploitation requires reaching any FinRobot interface that eventually calls create_file_with_code() with attacker-influenced input. In practice this includes LLM chat sessions, task submission endpoints, and inter-agent messages. A proof-of-concept and discussion are published in the GitHub Gist PoC Repository and the upstream GitHub Issue Discussion. Public PoC availability lowers the barrier to weaponization, though no in-the-wild exploitation is confirmed.
// Example exploitation code (sanitized)
// No verified exploit code is reproduced here. See the referenced PoC gist
// for technical details of the create_file_with_code() sink abuse.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-51918
Indicators of Compromise
- Unexpected Python files created in FinRobot working directories, especially files written immediately before a child python process is spawned.
- Outbound network connections from the FinRobot host to unknown destinations following agent task execution.
- Prompt or API payloads containing Python keywords such as import os, subprocess, or __import__ directed at agent endpoints.
Detection Strategies
- Instrument CodingUtils.create_file_with_code() call sites to log the source identity and a hash of the written content for correlation.
- Alert on FinRobot processes spawning shells (/bin/sh, bash, cmd.exe) or executing newly created .py files that were not part of the deployment baseline.
- Apply LLM prompt-injection detection rules to inbound requests reaching FinRobot agent APIs.
Monitoring Recommendations
- Collect process-creation and file-write telemetry from hosts running FinRobot and forward to a central analytics pipeline.
- Baseline normal agent-generated file names and flag deviations such as filenames with randomized tokens or unusual extensions.
- Monitor egress traffic from AI agent hosts for connections to code-hosting, paste, or command-and-control infrastructure.
How to Mitigate CVE-2026-51918
Immediate Actions Required
- Restrict network exposure of FinRobot 1.0.0 instances; place them behind authenticated reverse proxies and allowlisted source IPs.
- Run FinRobot as a least-privileged, non-root user inside a container or sandbox with no outbound internet access by default.
- Audit logs and generated file directories for signs of exploitation referencing create_file_with_code().
Patch Information
No vendor patch is referenced in the NVD entry at the time of publication. Track the GitHub Issue Discussion in the AI4Finance-Foundation/FinRobot repository for an official fix. Until a patch is released, treat all FinRobot 1.0.0 deployments as vulnerable.
Workarounds
- Wrap CodingUtils.create_file_with_code() with an allowlist that rejects any content containing dangerous imports or dynamic execution primitives.
- Execute generated code in an isolated sandbox such as a disposable container, gVisor, or Firecracker microVM with no host filesystem or network access.
- Disable or gate agent features that invoke create_file_with_code() when input originates from untrusted users or external LLM outputs.
# Configuration example
# Run FinRobot in a restricted container with no network and read-only root FS
docker run --rm \
--network none \
--read-only \
--tmpfs /tmp:rw,noexec,nosuid,size=64m \
--cap-drop ALL \
--user 10001:10001 \
finrobot:1.0.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

