UAT: ContainerToolExecutor has no security hardening — no-new-privileges, read-only filesystem, and cap-drop not enforced #6134

Open
opened 2026-04-09 15:21:15 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: Container Tool Execution — Security
Severity: Non-critical (backlog)
Found by: UAT Testing (container-tool-execution worker)


What Was Tested

Code-level analysis of ContainerToolExecutor._build_exec_command() against the spec's container security requirements.

Expected Behavior (from spec)

The spec states that container tool execution should provide isolation. Standard container security hardening should be applied to prevent privilege escalation and limit attack surface:

  • --no-new-privileges — prevents privilege escalation via setuid/setgid binaries
  • --read-only — mounts the container filesystem as read-only (writes only to explicitly mounted volumes)
  • --cap-drop ALL — drops all Linux capabilities
  • --security-opt no-new-privileges:true — additional privilege escalation prevention

Actual Behavior

_build_exec_command() builds a minimal devcontainer exec command with no security flags:

cmd = [
    devcontainer,
    "exec",
    *target_args,
    "--",
    "sh",
    "-c",
    f"timeout {int(container_timeout)} cleveragents-tool-exec "
    + shlex.quote(tool_name),
]

No security constraints are applied. A tool running inside the container could:

  1. Escalate privileges via setuid binaries
  2. Write to the container filesystem outside of mounted volumes
  3. Use Linux capabilities not needed for tool execution

Code Location

  • src/cleveragents/tool/container_executor.py_build_exec_command() (lines 430-461)
  • src/cleveragents/tool/container_executor.pyContainerConfig class (lines 55-82) — no security fields

Expected Fix

Add security hardening options to ContainerConfig and apply them in _build_exec_command():

  • no_new_privileges: bool = True
  • read_only_filesystem: bool = False (opt-in, as tools may need to write)
  • drop_capabilities: list[str] = ["ALL"]

These should be passed as --security-opt and --cap-drop flags to the underlying container runtime.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** Container Tool Execution — Security **Severity:** Non-critical (backlog) **Found by:** UAT Testing (container-tool-execution worker) --- ## What Was Tested Code-level analysis of `ContainerToolExecutor._build_exec_command()` against the spec's container security requirements. ## Expected Behavior (from spec) The spec states that container tool execution should provide isolation. Standard container security hardening should be applied to prevent privilege escalation and limit attack surface: - `--no-new-privileges` — prevents privilege escalation via setuid/setgid binaries - `--read-only` — mounts the container filesystem as read-only (writes only to explicitly mounted volumes) - `--cap-drop ALL` — drops all Linux capabilities - `--security-opt no-new-privileges:true` — additional privilege escalation prevention ## Actual Behavior `_build_exec_command()` builds a minimal `devcontainer exec` command with no security flags: ```python cmd = [ devcontainer, "exec", *target_args, "--", "sh", "-c", f"timeout {int(container_timeout)} cleveragents-tool-exec " + shlex.quote(tool_name), ] ``` No security constraints are applied. A tool running inside the container could: 1. Escalate privileges via setuid binaries 2. Write to the container filesystem outside of mounted volumes 3. Use Linux capabilities not needed for tool execution ## Code Location - `src/cleveragents/tool/container_executor.py` — `_build_exec_command()` (lines 430-461) - `src/cleveragents/tool/container_executor.py` — `ContainerConfig` class (lines 55-82) — no security fields ## Expected Fix Add security hardening options to `ContainerConfig` and apply them in `_build_exec_command()`: - `no_new_privileges: bool = True` - `read_only_filesystem: bool = False` (opt-in, as tools may need to write) - `drop_capabilities: list[str] = ["ALL"]` These should be passed as `--security-opt` and `--cap-drop` flags to the underlying container runtime. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.6.0 milestone 2026-04-09 21:18:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#6134
No description provided.