Skip to content

Fix argv injection in _create_user and gpasswd loop#4473

Open
Softer wants to merge 1 commit intoarchlinux:masterfrom
Softer:fix-argv-injection-useradd-gpasswd
Open

Fix argv injection in _create_user and gpasswd loop#4473
Softer wants to merge 1 commit intoarchlinux:masterfrom
Softer:fix-argv-injection-useradd-gpasswd

Conversation

@Softer
Copy link
Copy Markdown
Contributor

@Softer Softer commented Apr 24, 2026

Same class of bug as #4443, two sibling call sites that were missed back then. _create_user and the gpasswd loop interpolate user.username and group into f-strings that reach SysCommand(f'arch-chroot -S {target} {cmd}'), where shlex.split parses the payload as argv. A username like --uid 0 or -G wheel,root is accepted as useradd/gpasswd flags and gives trivial escalation. Vector is the same as #4443: custom install.py, plugins, tampered --config JSON.

Changes

_create_user now builds an argv list and calls run(). Failures are logged via debug(), and the SystemError re-raise is kept so guided install still aborts.

The gpasswd loop gets the same switch. Also wrapped it in try/except with debug() - previously a failing gpasswd was silently ignored.

Use argv list with run() instead of f-string interpolation into
SysCommand, add debug logging on failure.
@Softer Softer requested a review from Torxed as a code owner April 24, 2026 10:29
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.

1 participant