Skip to content

security: fix Docker CWD rw mount and unsanitized pip install in code interpreter#5256

Open
ffulbtech wants to merge 1 commit intocrewAIInc:mainfrom
ffulbtech:fix/code-interpreter-security
Open

security: fix Docker CWD rw mount and unsanitized pip install in code interpreter#5256
ffulbtech wants to merge 1 commit intocrewAIInc:mainfrom
ffulbtech:fix/code-interpreter-security

Conversation

@ffulbtech
Copy link
Copy Markdown

Security Fix

Two vulnerabilities in the code interpreter tool:

1. Docker volume mounted read-write (CWE-732)

code_interpreter_tool.py line 271 mounts the host CWD as /workspace with mode: "rw". LLM-generated code running in the "safe" Docker container can read AND write all files in the host CWD including .env, source code, and credentials.

Fix: Changed to mode: "ro" (read-only).

2. Unsanitized library names passed to pip (CWE-20)

In _install_libraries (Docker path) and run_code_unsafe (host path), library names from LLM output are passed directly to pip install without validation. This enables dependency confusion/typosquatting attacks.

Fix: Validate library names against ^[a-zA-Z0-9][a-zA-Z0-9._-]* pattern.

Combined Impact

A prompt-injected LLM can install a malicious package which then exfiltrates data from the mounted host directory.

Note: Private vulnerability reporting is not enabled for this repo, so submitting as a PR.

… interpreter

1. Change Docker volume mount from rw to ro to prevent LLM-generated
   code from writing to host filesystem (CWE-732)
2. Validate library names before pip install to prevent dependency
   confusion and command injection via malicious package names (CWE-20)

The code interpreter tool markets Docker as safe isolation, but mounting
the host CWD read-write undermines this. Additionally, library names
from LLM output are passed directly to pip without validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant