Skip to content

fix(security): pipe sudo password via stdin instead of shell cmdline - #698

Closed
johnh4098 wants to merge 1 commit into
NousResearch:mainfrom
johnh4098:fix/sudo-password-cmdline-exposure
Closed

fix(security): pipe sudo password via stdin instead of shell cmdline#698
johnh4098 wants to merge 1 commit into
NousResearch:mainfrom
johnh4098:fix/sudo-password-cmdline-exposure

Conversation

@johnh4098

Copy link
Copy Markdown
Contributor

SUDO_PASSWORD was being passed as part of the shell command string:

echo 'password' | sudo -S -p '' apt install curl

This makes the password visible in /proc//cmdline and ps aux for
the entire duration of the command — readable by any unprivileged
process on the same machine (CWE-214).

The fix passes the password through subprocess stdin instead. The
transformed command now contains bare sudo -S -p '' with no
credential in the argument list. The password travels as bytes in
memory only.

local, ssh, docker, singularity — full fix via stdin pipe
modal, daytona — fallback with printf (remote sandbox, different
threat model), noted in comments

Fixes the credential exposure on any system where SUDO_PASSWORD is set.

@teknium1

Copy link
Copy Markdown
Contributor

Important security fix — clean separation of password from command line across all 6 backends. All 2857 tests pass. Merged to main. Thanks @johnh4098! 🔒🎉

teknium1 added a commit that referenced this pull request Mar 10, 2026
… shell cmdline

Authored by johnh4098. Fixes CWE-214: SUDO_PASSWORD was visible in
/proc/PID/cmdline via echo pipe. Now passed through subprocess stdin.
All 6 backends updated: local, ssh, docker, singularity pipe via stdin;
modal and daytona use printf fallback (remote sandbox, documented).
@teknium1 teknium1 closed this Mar 10, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…n instead of shell cmdline

Authored by johnh4098. Fixes CWE-214: SUDO_PASSWORD was visible in
/proc/PID/cmdline via echo pipe. Now passed through subprocess stdin.
All 6 backends updated: local, ssh, docker, singularity pipe via stdin;
modal and daytona use printf fallback (remote sandbox, documented).
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…n instead of shell cmdline

Authored by johnh4098. Fixes CWE-214: SUDO_PASSWORD was visible in
/proc/PID/cmdline via echo pipe. Now passed through subprocess stdin.
All 6 backends updated: local, ssh, docker, singularity pipe via stdin;
modal and daytona use printf fallback (remote sandbox, documented).
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…n instead of shell cmdline

Authored by johnh4098. Fixes CWE-214: SUDO_PASSWORD was visible in
/proc/PID/cmdline via echo pipe. Now passed through subprocess stdin.
All 6 backends updated: local, ssh, docker, singularity pipe via stdin;
modal and daytona use printf fallback (remote sandbox, documented).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants