/

CVE-2026-51918

Severity:

CRITICAL RISK

(9.8)

Code Injection (CWE-94) in FinRobot CodingUtils Method

CVE-2026-51918

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

FinRobot 1.0.0 contains a code injection vulnerability in CodingUtils.create_file_with_code().

If attacker-controlled data reaches this function in an execution context that processes generated code, an attacker may cause unintended code to run, potentially resulting in full application compromise.

FinRobot 1.0.0 contains a code injection vulnerability in CodingUtils.create_file_with_code().

If attacker-controlled data reaches this function in an execution context that processes generated code, an attacker may cause unintended code to run, potentially resulting in full application compromise.

Affected context

The vulnerability occurs in FinRobot 1.0.0 where the CodingUtils.create_file_with_code() function handles code-related input. Risk depends on whether untrusted or insufficiently validated data can reach the function and whether the resulting content is subsequently interpreted, executed, or used by a privileged process.

The vulnerability occurs in FinRobot 1.0.0 where the CodingUtils.create_file_with_code() function handles code-related input. Risk depends on whether untrusted or insufficiently validated data can reach the function and whether the resulting content is subsequently interpreted, executed, or used by a privileged process.

Exploit preconditions

  • Attack surface: The code-generation or file-creation functionality exposed through CodingUtils.create_file_with_code()
  • Required access: The ability to provide or influence input processed by the vulnerable function
  • Trigger point: Invocation of the function with attacker-controlled or inadequately constrained content
  • Why exploitation is possible: Input may be incorporated into generated code or executable content without sufficient separation between data and code
  • Attack surface: The code-generation or file-creation functionality exposed through CodingUtils.create_file_with_code()
  • Required access: The ability to provide or influence input processed by the vulnerable function
  • Trigger point: Invocation of the function with attacker-controlled or inadequately constrained content
  • Why exploitation is possible: Input may be incorporated into generated code or executable content without sufficient separation between data and code

Why this happens

The underlying issue is an unsafe code-generation pattern in which externally influenced input can enter a code-producing workflow without reliable validation, escaping, or execution boundaries.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where an application allows input to affect generated code in a way that can alter program behavior or enable unintended execution.

The underlying issue is an unsafe code-generation pattern in which externally influenced input can enter a code-producing workflow without reliable validation, escaping, or execution boundaries.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where an application allows input to affect generated code in a way that can alter program behavior or enable unintended execution.

Potential impact

  • An attacker may execute arbitrary code in the FinRobot process context.
  • The vulnerability could expose application data, credentials, or connected services.
  • A compromised process may be used for unauthorized file modification or further network activity.
  • The severity of impact can increase when the application runs with elevated privileges or broad system access.
  • An attacker may execute arbitrary code in the FinRobot process context.
  • The vulnerability could expose application data, credentials, or connected services.
  • A compromised process may be used for unauthorized file modification or further network activity.
  • The severity of impact can increase when the application runs with elevated privileges or broad system access.

General mitigation guidance

Mitigation generally focuses on preventing untrusted data from becoming executable code and reducing the privileges available to code-generation components.

Common defensive patterns include:

  • Prefer structured data and fixed operations over dynamic code generation.
  • Keep data and executable logic strictly separated.
  • Apply allowlisted validation and context-appropriate escaping before content reaches code-generation paths.
  • Avoid executing generated content unless there is a strong, isolated need.
  • Use sandboxing, constrained runtimes, and least-privilege service accounts where execution cannot be eliminated.
  • Restrict filesystem, network, and secret access available to the affected process.

Mitigation generally focuses on preventing untrusted data from becoming executable code and reducing the privileges available to code-generation components.

Common defensive patterns include:

  • Prefer structured data and fixed operations over dynamic code generation.
  • Keep data and executable logic strictly separated.
  • Apply allowlisted validation and context-appropriate escaping before content reaches code-generation paths.
  • Avoid executing generated content unless there is a strong, isolated need.
  • Use sandboxing, constrained runtimes, and least-privilege service accounts where execution cannot be eliminated.
  • Restrict filesystem, network, and secret access available to the affected process.

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving dynamic execution, string-based code construction, and generated source files.
  • Code-review signals such as user-controlled values interpolated into source code or passed to interpreters.
  • Tests that verify hostile input remains data rather than becoming executable syntax.
  • Policy enforcement that prohibits dynamic execution in high-privilege application components.

Automated security review tools may help identify code-generation and injection patterns, but findings should be validated against the actual execution flow.

Organizations can look for:

  • Static-analysis findings involving dynamic execution, string-based code construction, and generated source files.
  • Code-review signals such as user-controlled values interpolated into source code or passed to interpreters.
  • Tests that verify hostile input remains data rather than becoming executable syntax.
  • Policy enforcement that prohibits dynamic execution in high-privilege application components.

Automated security review tools may help identify code-generation and injection patterns, but findings should be validated against the actual execution flow.

Sources

SourceLink
gist.github.comgist.github.com/Ro1ME/8180c78c3852f747638e9cf04b51dda1
github.comgithub.com/AI4Finance-Foundation/FinRobot/issues/102

Frequently asked

questions

Exploitability depends on how FinRobot is deployed and whether an attacker can supply input that reaches CodingUtils.create_file_with_code(). A network-facing workflow or service accepting untrusted requests may increase exposure.

The available description does not establish a specific authentication requirement. The key condition is the ability to influence input processed by the vulnerable function.

Avoid generating or executing code from untrusted input. Prefer fixed, structured operations, strict allowlists, and isolated execution when dynamic behavior is unavoidable.

Review code-generation paths, enforce separation between data and code, apply least privilege, and use static analysis and security-focused tests for injection behavior.

Exploitability depends on how FinRobot is deployed and whether an attacker can supply input that reaches CodingUtils.create_file_with_code(). A network-facing workflow or service accepting untrusted requests may increase exposure.

The available description does not establish a specific authentication requirement. The key condition is the ability to influence input processed by the vulnerable function.

Avoid generating or executing code from untrusted input. Prefer fixed, structured operations, strict allowlists, and isolated execution when dynamic behavior is unavoidable.

Review code-generation paths, enforce separation between data and code, apply least privilege, and use static analysis and security-focused tests for injection behavior.

Find out what's already
exploitable in your codebase.