Users: passwords containing a colon are rejected with a generic failure message #65
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?
How it was found
Code reading of src/src/commands/users.rs and frontend/src/lib/views/Users.svelte while working on BSET-46. Not reproduced against a real system (no pkexec calls were made, by rule).
Confidence
High for the code path, not run live.
Explanation
valid_chpasswd_password rejects any password containing ':' (and newlines, NUL, or longer than 512 bytes) because chpasswd reads user:password lines. add_user and change_password return "invalid password" in that case. In Users.svelte, the change-password sheet catches the error and shows only "The password wasn't changed", and the Add sheet just prints the raw error. A user who picks a password with a colon gets no hint why. The sheets should say "Passwords can't contain a colon" up front, or the backend could avoid the restriction by setting the password another way (for example passwd --stdin style or a chpasswd -e hashed input).
Smaller related nit: the Add sheet hint says "Lowercase letters and numbers" but valid_username also allows _ and -.
PR: #82
Verified on merge
9b07bcf(PR #82): svelte-check 0/0, npm test, build, fmt, clippy -D warnings, cargo test 180 passed incl. colon_in_password_is_one_entry and the injection tests. Reviewer checked shadow-utils chpasswd.c (split at first ':' only; PAM path receives the split strings). Live VM on the PR head: change to a:b-pass-99 showed Password changed, and su to that user with a:b-pass-99 succeeded.