hermes - 💡(How to fix) Fix security: sudo passwords cached in plain Python dict in process memory

Official PRs (…)
ON THIS PAGE

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…

Sudo passwords are cached in a plain Python dict (_sudo_password_cache) in process memory. If the Hermes process is compromised or its memory is dumped, the cached sudo password is retrievable, enabling privilege escalation on the host.

Root Cause

Sudo passwords are cached in a plain Python dict (_sudo_password_cache) in process memory. If the Hermes process is compromised or its memory is dumped, the cached sudo password is retrievable, enabling privilege escalation on the host.

Code Example

_sudo_password_cache: dict[str, str] = {}
RAW_BUFFERClick to expand / collapse

Summary

Sudo passwords are cached in a plain Python dict (_sudo_password_cache) in process memory. If the Hermes process is compromised or its memory is dumped, the cached sudo password is retrievable, enabling privilege escalation on the host.

Details

In tools/terminal_tool.py:

_sudo_password_cache: dict[str, str] = {}

The password prompt also reads directly from /dev/tty in some code paths.

Impact

  • Memory dumps (e.g., via /proc/<pid>/mem, core dumps, or container escape) expose the sudo password
  • Container compromise → host privilege escalation if sudo password is reused

Recommendation

  • Store sudo passwords in an OS keyring or credential manager (e.g., keyring library, systemd-creds, pass)
  • Alternatively, use a short-lived file with 0600 permissions and delete immediately after use
  • Clear the cache aggressively after command execution (not just per-session)
  • Never cache passwords in a plain Python dict

Files

  • tools/terminal_tool.py

Severity: MEDIUM

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: sudo passwords cached in plain Python dict in process memory