Type: Code Injection
Product: pandas-ai
Affected versions: 3.0.0
Affected component: pandasai/core/code_execution/code_executor.py:CodeExecutor.execute
Suggested CWE: CWE-94 (Code Injection)
Reference: sinaptik-ai/pandas-ai#1893
sinaptik-ai pandas-ai 3.0.0 is vulnerable to Code Injection in CodeExecutor.execute.
Condensed from the authorized local validation used for the original report; local filesystem paths are replaced with <local-path>.
EXPECTED SUCCESSFUL RESULT:
- A marker file (poc_marker.txt) is created on the host file system
- The file contains the expected marker content
- This demonstrates that LLM-generated code executed with full host access ROOT CAUSE:
- Source anchor: pandasai/core/code_execution/code_executor.py:27 (CodeExecutor.execute)
- LLM-generated code is executed directly using Python's exec() without sandbox isolation
- Default configuration (sandbox=None) provides no protection against arbitrary code execution
- No validation or sanitization of generated code before execution SECURITY IMPACT:
- Arbitrary file system access (read/write/delete)
- Command execution via subprocess or os.system
- Network access and data exfiltration …
Ro1ME