#20135: feat(security): RubberBand - static command pattern detection for exec pipeline
agents
size: XL
Cluster:
Security Enhancements and Fixes
> **Replaces #8023** (auto-closed by bot due to a dirty force push — branch is now clean)
## Summary
Adds a lightweight static detection layer to the exec pipeline that catches dangerous commands (credential access, exfiltration, reverse shells, persistence) as defense-in-depth against prompt injection.
**RFC Discussion:** #4981
## What it does
Pre-exec hook that analyzes commands before execution:
- **Credential access** - SSH keys, AWS creds, API tokens
- **Data exfiltration** - outbound data transfers
- **Reverse shells** - various shell callback techniques
- **Config tampering** - writes to protected config files
- **Memory poisoning** - writes to agent memory files
- **Persistence** - scheduled task creation
- **Indirect execution** - piped shell commands, eval
## Key differentiators
This PR improves on prior approaches (Shield-Shell #4684, #7604 proposal) with:
- **Zero external dependencies** - works fully offline, no API keys or cloud services required
- **Bypass mitigations**: Unicode normalization (NFKC), URL decoding, shell escape expansion
- **Context-aware scoring**: stripped content + execution pattern = higher risk
- **Configurable thresholds**: alert vs block based on score
- **Tested against 134 bypass techniques** (98.5% detection, 0 false positives)
- **Modes**: off | log | alert | block | shadow
- **Channel notifications**: Optional alerts to configured channel when commands are blocked/flagged
## Performance
~0.005ms overhead per command (effectively invisible vs 10-50ms exec spawn time).
## Configuration
```yaml
tools:
exec:
rubberband:
enabled: true
mode: "alert" # off | log | alert | block | shadow
notifyChannel: true
thresholds:
alert: 40
block: 60
```
## Related work
- **Shield-Shell (#4684)** - Similar goal, closed during freeze. RubberBand adds bypass mitigations and broader detection categories.
- **#7604** - Proposal for input/output validation. RubberBand is complementary (exec-level vs prompt-level).
- **#3387** - Tool result scanning. Different layer (output content vs command execution).
## AI Disclosure
Developed with Claude (Opus 4.5) running in OpenClaw. Fully tested on live fork. I understand the code and can answer questions.
*Like the bands on lobster claws — keeps the agent from pinching the operator.*
Most Similar PRs
#16907: fix(security): detect obfuscated commands that bypass allowlist fil...
by CornBrother0x · 2026-02-15
70.9%
#13817: feat(agents): configurable prompt injection monitor for tool results
by ElleNajt · 2026-02-11
69.7%
#6486: feat(security): add exec command denylist for defense-in-depth
by nia-agent-cyber · 2026-02-01
69.6%
#23174: feat(security): credential leak prevention — exfiltration patterns,...
by ihsanmokhlisse · 2026-02-22
67.8%
#21136: fix(security): harden agent autonomy controls
by novalis133 · 2026-02-19
66.6%
#10559: feat(security): add plugin output scanner for prompt injection dete...
by DukeDeSouth · 2026-02-06
66.6%
#22744: feat: masked secrets — prevent agents from accessing raw API keys
by theMachineClay · 2026-02-21
66.1%
#8086: feat(security): Add prompt injection guard rail
by bobbythelobster · 2026-02-03
66.0%
#17273: feat: add security-guard extension — agentic safety guardrails
by miloudbelarebia · 2026-02-15
65.9%
#18003: feat(infra): Adaptive SSH Environment Wrapper (ARE)
by stakeswky · 2026-02-16
65.3%