Skip to content

Dynamic eval executes commands with shell=True without sanitization #143

Open

Description

@pguptaj

Dynamic eval executes commands with shell=True without sanitization

Severity: Critical
File: backend/app/code/eval/dynamic_eval.py:129

The _run_command method executes shell commands using subprocess.run with shell=True. While the method is used for running test commands, if the command string comes from LLM-generated code or user input, arbitrary command execution is possible.

result = subprocess.run(
    command,
    shell=True,
    cwd=cwd,
    capture_output=True,
    text=True,
    timeout=timeout,
    env=run_env,
)

Why it matters

Malicious or buggy LLM-generated code can execute arbitrary shell commands on the backend server. The Docker sandbox should be used for all code execution, not the subprocess backend.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions