Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "empty" password handling in "no-hard-coded-passwords" to balk at an empty root password explicitly (CVE-2019-5021) #5880

Merged
merged 1 commit into from
May 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions test/tests/no-hard-coded-passwords/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,20 @@ ret=0
for user in "${!passwds[@]}"; do
pass="${passwds[$user]}"

if [ -z "$pass" -o '*' = "$pass" ]; then
# '*' and '' mean no password
if [ -z "$pass" ]; then
# for root this is a security vulnerability (see CVE-2019-5021, for example)
if [ "$user" = 'root' ]; then
echo >&2 "error: empty password detected for '$user'"
ret=1
else
echo >&2 "warning: empty password detected for '$user'"
fi
continue
fi

if [ "$pass" = '*' ]; then
# "If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means)."
# (Debian uses this for having default-provided accounts without a password but also without being explicitly locked, for example)
continue
fi

Expand Down