Skip to content

Bug: PATH override can hijack privileged ip and nsenter helpers #1113

@drew

Description

@drew

The Docker driver allows a sandbox template or spec to override PATH before driver-controlled environment keys are applied. The supervisor later performs privileged network setup by resolving helper binaries through PATH with calls like Command::new("ip") and Command::new("nsenter").

Because the supervisor container runs as root with SYS_ADMIN, NET_ADMIN, SYS_PTRACE, SYSLOG, apparmor=unconfined, and network_mode = "host", a malicious image or spec can cause a controlled helper binary such as /malicious/bin/ip or /malicious/bin/nsenter to execute during privileged setup. With host networking enabled, the impact extends to host network state rather than remaining confined to a container network namespace.

Possible impact includes host route changes, iptables changes, interface manipulation, traffic interception, or denial of service.

Suggested mitigations:

  • Make PATH driver-controlled after merging user environment, similar to OPENSHELL_ENDPOINT.
  • Prefer absolute helper paths such as /usr/sbin/ip and /usr/bin/nsenter after validating them.
  • Replace shell-out helper usage with Rust netlink/syscall code or a trusted bind-mounted helper binary.
  • Add a regression test that attempts to override PATH and verifies the final supervisor environment keeps the trusted path.

Metadata

Metadata

Assignees

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