/

CVE-2026-51898

Severity:

CRITICAL RISK

(9.8)

Code Injection (CWE-94) in pandas-ai 3.0 CodeExecutor

CVE-2026-51898

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote 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

A critical code injection vulnerability in pandas-ai 3.0.0 affects the CodeExecutor.execute component. If attacker-influenced content reaches the execution path, it may allow arbitrary code to run with the permissions of the hosting application.

A critical code injection vulnerability in pandas-ai 3.0.0 affects the CodeExecutor.execute component. If attacker-influenced content reaches the execution path, it may allow arbitrary code to run with the permissions of the hosting application.

Affected context

The vulnerability occurs in deployments that use pandas-ai 3.0.0 and invoke the CodeExecutor.execute functionality. Risk depends on whether untrusted or insufficiently constrained input can influence the code submitted to the executor and on the privileges available to the hosting process.

The vulnerability occurs in deployments that use pandas-ai 3.0.0 and invoke the CodeExecutor.execute functionality. Risk depends on whether untrusted or insufficiently constrained input can influence the code submitted to the executor and on the privileges available to the hosting process.

Exploit preconditions

  • Attack surface: The pandas-ai code execution component
  • Required access: Ability to supply or influence input processed by CodeExecutor.execute
  • Trigger point: Execution of attacker-influenced content by the code executor
  • Why exploitation is possible: Input reaches an execution-capable path without adequate separation between data and executable code
  • Attack surface: The pandas-ai code execution component
  • Required access: Ability to supply or influence input processed by CodeExecutor.execute
  • Trigger point: Execution of attacker-influenced content by the code executor
  • Why exploitation is possible: Input reaches an execution-capable path without adequate separation between data and executable code

Why this happens

The underlying issue is an insecure code-generation or code-execution pattern in which externally influenced content can be interpreted as executable instructions. This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because the application does not sufficiently constrain or isolate the code that reaches CodeExecutor.execute.

The underlying issue is an insecure code-generation or code-execution pattern in which externally influenced content can be interpreted as executable instructions. This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because the application does not sufficiently constrain or isolate the code that reaches CodeExecutor.execute.

Potential impact

  • An attacker may execute arbitrary code in the application process
  • Sensitive data may be read, modified, or exfiltrated
  • Application credentials or environment secrets could be exposed
  • The host or surrounding services could be compromised
  • Data-processing results may be altered or poisoned
  • An attacker may execute arbitrary code in the application process
  • Sensitive data may be read, modified, or exfiltrated
  • Application credentials or environment secrets could be exposed
  • The host or surrounding services could be compromised
  • Data-processing results may be altered or poisoned

General mitigation guidance

Mitigation generally focuses on removing unnecessary dynamic code execution and reducing trust in generated or user-influenced content.

Common defensive patterns include:

  • Prefer data-only APIs and fixed, allowlisted operations over general-purpose code execution
  • Enforce strict validation and constrained grammars before execution
  • Isolate execution in a strongly sandboxed, least-privileged environment
  • Restrict filesystem, network, process, and credential access for the executor
  • Separate trusted application logic from untrusted prompts, queries, and generated code
  • Apply resource limits, audit execution requests, and use read-only or ephemeral runtimes where practical

Mitigation generally focuses on removing unnecessary dynamic code execution and reducing trust in generated or user-influenced content.

Common defensive patterns include:

  • Prefer data-only APIs and fixed, allowlisted operations over general-purpose code execution
  • Enforce strict validation and constrained grammars before execution
  • Isolate execution in a strongly sandboxed, least-privileged environment
  • Restrict filesystem, network, process, and credential access for the executor
  • Separate trusted application logic from untrusted prompts, queries, and generated code
  • Apply resource limits, audit execution requests, and use read-only or ephemeral runtimes where practical

How teams detect issues like this

Organizations can look for:

  • Static analysis findings involving dynamic evaluation, shell execution, or compilation of constructed strings
  • Code review signals showing user-controlled values concatenated into executable code
  • Uses of CodeExecutor.execute reachable from public or semi-trusted inputs
  • Runtime policies that block unexpected child processes, network access, or filesystem writes
  • Audit records correlating execution requests with input sources and authorization decisions

Automated code review and software composition analysis tools may help identify related execution paths, but should be combined with manual review and runtime controls.

Organizations can look for:

  • Static analysis findings involving dynamic evaluation, shell execution, or compilation of constructed strings
  • Code review signals showing user-controlled values concatenated into executable code
  • Uses of CodeExecutor.execute reachable from public or semi-trusted inputs
  • Runtime policies that block unexpected child processes, network access, or filesystem writes
  • Audit records correlating execution requests with input sources and authorization decisions

Automated code review and software composition analysis tools may help identify related execution paths, but should be combined with manual review and runtime controls.

Sources

SourceLink
gist.github.comgist.github.com/Ro1ME/6cc410b487a2374fdd9e8749621f3135
github.comgithub.com/sinaptik-ai/pandas-ai/issues/1893

Frequently asked

questions

Exploitability depends on the deployment and exposure of pandas-ai. It may be remotely exploitable when an external or lower-trust user can influence content passed to CodeExecutor.execute.

Not necessarily. Authentication requirements depend on which interfaces expose the affected functionality and whether those interfaces accept untrusted input.

Avoid executing generated or user-influenced code whenever possible. If execution is essential, use strict allowlists and a separate, least-privileged sandbox with no unnecessary secrets or network access.

Treat generated code as untrusted, validate inputs and execution requests, review dynamic execution paths, enforce isolation policies, and monitor runtime behavior for unexpected process or resource access.

Exploitability depends on the deployment and exposure of pandas-ai. It may be remotely exploitable when an external or lower-trust user can influence content passed to CodeExecutor.execute.

Not necessarily. Authentication requirements depend on which interfaces expose the affected functionality and whether those interfaces accept untrusted input.

Avoid executing generated or user-influenced code whenever possible. If execution is essential, use strict allowlists and a separate, least-privileged sandbox with no unnecessary secrets or network access.

Treat generated code as untrusted, validate inputs and execution requests, review dynamic execution paths, enforce isolation policies, and monitor runtime behavior for unexpected process or resource access.

Find out what's already
exploitable in your codebase.