Repository navigation
Credential fixes: empty passwords, line overflow, truncated names - #187
Merged
Merged
Conversation
- user_set_password()/user_create() refuse an empty password (USER_ERR_EMPTY_PASSWORD); passwd and useradd say so. Two empty lines used to "match" and store the hash of "". - One read_line() for every credential prompt, always consuming the line to its newline. The su password and login-name loops stopped at a full buffer: an over-long su password's tail ran as a kernel-shell command, and an over-long login name logged in as its 31-char prefix with the tail read as the password. Over-long login/wizard names are refused. - user_create() refuses names that do not fit (USER_ERR_NAME_TOO_LONG) instead of truncating after the full-name duplicate check, which let kernel-shell useradd store a second account under an existing name. - IDS spray table compares only the stored (truncated) prefix, so one over-long name failing three times no longer reads as 3 distinct names. - Drop /etc/issue's nonexistent root/root, user/user hints (dead code: user_create_etc_structure() has no caller). verify/verify-cred-fixes.sh: unfixed tree FAIL (6 assertions), fixed PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 5 of 7 from the audit.
Fixes
passwdwith two empty lines passed the compare (equal lengths) and stored the hash of"";useraddtook an empty password too. Now refused in the primitives (user_set_password,user_create→USER_ERR_EMPTY_PASSWORD), with readable messages in passwd/useradd.read_line(), which always reads through to the newline.user_createran the duplicate check on the full name and then stored it truncated. Kernel-shelluseraddwith a 32-char name therefore created a second account under an existing 31-char name. It now refuses (USER_ERR_NAME_TOO_LONG). Ring 3 never reached this: SYS_CRED already returns -ENAMETOOLONG at the boundary.strcmpagainst the full name. Three failedsus of one 40-char name read as 3 distinct names and raised a "Credential spray" alert. It now compares only the stored prefix./etc/issueno longer claims root/root and user/user exist. This is dead code:user_create_etc_structure()has no caller, so the harness has no leg for it.Verification
verify/verify-cred-fixes.sh(one boot):The build stays
-Werrorclean.🤖 Generated with Claude Code