hermes - 💡(How to fix) Fix security: terminal command approval guards can be bypassed with shell obfuscation [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The tools/approval.py module uses regex blocklists (HARDLINE_PATTERNS, DANGEROUS_PATTERNS) to detect dangerous shell commands. These regex guards are inherently fragile and can be bypassed with standard shell obfuscation techniques.

Root Cause

The tools/approval.py module uses regex blocklists (HARDLINE_PATTERNS, DANGEROUS_PATTERNS) to detect dangerous shell commands. These regex guards are inherently fragile and can be bypassed with standard shell obfuscation techniques.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Summary

The tools/approval.py module uses regex blocklists (HARDLINE_PATTERNS, DANGEROUS_PATTERNS) to detect dangerous shell commands. These regex guards are inherently fragile and can be bypassed with standard shell obfuscation techniques.

Bypass Techniques

  1. Base64 encoding: echo cm0gLXJmIC8= | base64 -d | bash
  2. Command substitution: $(echo rm -rf /) or backticks
  3. Env var expansion: /$HOME/.ssh instead of /home/user/.ssh
  4. Alias trickery: alias ls=rm; ls -rf /
  5. Unicode homoglyphs: using lookalike characters
  6. force=True parameter: completely skips all guards when a tool call includes this internal flag.

Impact

An attacker (via prompt injection or a compromised skill) could execute destructive commands (rm -rf, credential exfiltration, reverse shells) that bypass the approval system entirely.

Recommendation

Replace regex blocklists with an allowlist of safe commands/arguments. The force=True parameter should require a cryptographic user confirmation (e.g., a signed token or a TOTP challenge), not just a boolean flag. Consider moving all untrusted command execution to a restricted shell or containerized backend by default.

Files

  • tools/approval.py
  • tools/terminal_tool.py (force parameter)

Severity: HIGH

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix security: terminal command approval guards can be bypassed with shell obfuscation [1 pull requests]