security: FORGE_TOKEN leaked into argv by service_proc start (service_proc.nu:225) #106
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills#106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
service_proc startembedsFORGE_TOKEN(andWEBROOT) into thebash -ccommand string passed toscreen, which puts the secret on the process argv of the bash wrapper./proc/<pid>/cmdlineis world-readable on Linux, so every other user on a shared host can read the token with plainps aux— no root, no-eflag required.Confirmed on a live multi-user host:
ps aux | grep hero_proc_serverreturned a line containingFORGE_TOKEN="<actual-token>"visible to all users. Rotating the token does not help while the leaky process is alive; the new value re-leaks on the nextservice_proc start.Location
tools/modules/services/service_proc.nu:215–227, specifically line 225:then passed to
sp_screen_start $cmd $rootwhich wraps inbash -c.Root cause
The launcher bakes env vars into the command string to survive
sudostripping env on the root-managed path. That's only needed for the sudo branch (line 71). The non-sudo branch (^screen -dmS ... bash -c $cmd, line 73) inherits env from the calling nushell and doesn't need the inlineVAR="..."prefix.Proposed fix
Non-sudo path (covers the multi-user case):
Sudo path: use
sudo --preserve-env=FORGE_TOKEN,WEBROOTinsidesp_screen_start, or pass via a 0600 env file thathero_proc_serverreads at startup. Either way, do not interpolate the token into thebash -cstring.Verification
After patch,
ps aux | grep FORGE_TOKENon the host should return no matches in hero_proc's argv chain.cat /proc/<pid>/cmdline | tr '\0' ' 'should show the binary + flags only.Impact
High. Every
service_proc starton a multi-user host exposes the invoking user's forge token cross-user. All tokens ever started via this launcher on a shared host should be rotated.