T09 · Insecure Skill Coding Practices
- Location
scripts/sandbox/backends/docker_backend.py:71- Finding
Domain Allowlist Enables Unrestricted Sandbox Network Access
- Content
View full analysis
Vulnerability Details
File Location:
scripts/sandbox/backends/docker_backend.py:71-75; related option wiring atscripts/audit.py:1884-1888
Vulnerability Type: Sandbox network-policy bypass
Risk Level: HighComplete Code Snippet
From
scripts/audit.py:1884-1888:python if args.dynamic and _SANDBOX_AVAILABLE: dyn_opts = DynamicScanOptions.auto( timeout_sec=args.sandbox_timeout, whitelist_domains=args.allow_domain, network=bool(args.allow_domain), )From
scripts/sandbox/backends/docker_backend.py:71-75:python network = 'none' if not options.network else 'bridge' cmd = [ 'docker', 'run', '--rm', '--network', network,Technical Analysis
The
--allow-domainoption is documented and presented as a domain-specific egress allowlist. However, the CLI converts any nonempty list into the Booleannetwork=True. The Docker backend then changes the container from--network noneto unrestricted Docker bridge networking.The
whitelist_domainsvalues are not used by the Docker backend to filter DNS requests, destination IP addresses, ports, or protocols. Consequently, specifying one trusted domain does not restrict the scanned program to that domain.This crosses an authorization boundary because the user authorizes network access to explicitly named destinations, while attacker-controlled code under dynamic analysis receives general network connectivity. The project comments acknowledge that proxy-based allowlist enforcement is only a future extension, but the public option currently behaves as though the restriction is enforced.
Attack Path
- An attacker supplies a Skill containing a Python entry point that performs network requests to attacker-controlled or otherwise unauthorized destinations.
- The auditor invokes dynamic analysis with a seemingly restricted option, such as:
text --dynamic --allow-domai
...[truncated 1079 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not change the container to bridge networking merely because an allowlist is nonempty.
- Until real enforcement is available, reject
--allow-domainwith a clear error and retain--network none. - Implement egress through a dedicated filtering proxy or firewall that:
- Resolves and validates each approved hostname.
- Restricts destination IP addresses and ports.
- Blocks direct IP connections.
- Revalidates DNS results to mitigate DNS rebinding.
- Blocks private, loopback, link-local, metadata-service, and Docker-network ranges unless separately authorized.
- Prevents bypass through alternative protocols or proxy environment variables.
- Add integration tests proving that an approved destination succeeds while an unlisted domain and a direct IP address fail.
- Clearly distinguish domain observation from domain enforcement in documentation and report metadata.
