Skip to content

[SECURITY] No command pattern denylist — agents can execute destructive operations unchecked #796

@h-network

Description

@h-network

Problem Statement

NemoClaw sandboxes rely on filesystem and network policies (via OpenShell Landlock/seccomp) to contain agent actions. However, there is no command-level filtering — agents can execute arbitrary commands within the sandbox, including destructive operations like:

  • rm -rf /sandbox/*
  • dd if=/dev/zero of=/dev/sda
  • chmod -R 777 /
  • curl with encoded/obfuscated payloads
  • Shell injection via backticks, $(), or pipe chains

Impact

An agent that is prompt-injected or behaves unexpectedly can destroy all writable data within the sandbox before any policy layer intervenes. Filesystem policies restrict WHERE the agent can write, but not WHAT commands it runs in writable areas.

Proposed Design

Implement a zero-latency deterministic pattern denylist that evaluates every command before execution:

DENY_PATTERNS = [
    r"rm\s+(-[rf]+\s+)?/",           # recursive delete from root
    r"dd\s+if=",                       # raw disk operations
    r"chmod\s+(-R\s+)?[0-7]{3}\s+/",  # recursive permission changes
    r"mkfs\.",                          # filesystem formatting
    r">\s*/dev/",                       # writing to devices
    r"\|\s*sh\b",                       # piping to shell
    r"curl.*\|\s*(bash|sh)",           # download and execute
]

This runs BEFORE any LLM-based verification, at zero token cost, with zero variance. Same input, same decision, every time. Should be implemented as a pre-execution hook in the sandbox runtime.

Alternatives Considered

PR #794 implements credential redaction in CLI output, which addresses secret leakage in logs. This proposal is distinct — it targets command execution filtering before the command runs, not output sanitization after. They operate at different points in the execution pipeline and are complementary.

Category

enhancement: feature

Checklist

  • I searched existing issues and this is not a duplicate
  • This is a design proposal, not a "please build this" request

Metadata

Metadata

Assignees

Labels

enhancement: featureUse this label to identify requests for new capabilities in NemoClaw.priority: highImportant issue that should be resolved in the next releasesecuritySomething isn't secure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions