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

Insufficient password length management #886

Open
stoeckmann opened this issue Dec 30, 2023 · 0 comments
Open

Insufficient password length management #886

stoeckmann opened this issue Dec 30, 2023 · 0 comments

Comments

@stoeckmann
Copy link
Contributor

stoeckmann commented Dec 30, 2023

The login.defs file contains the two fields PASS_MAX_LEN and PASS_MIN_LEN.

PASS_MAX_LEN

The example etc/login.defs states:

#
# Number of significant characters in the password for crypt().
# Default is 8, don't change unless your crypt() is better.
# Ignored if MD5_CRYPT_ENAB set to "yes".
#
#PASS_MAX_LEN           8

Contrary to its description, PASS_MAX_LEN is only considered if the encryption method is DES. You can easily test this by using e.g. MD5, YESCRYPT etc. and change the password with passwd and enter a password which is longer than the configured maximum length.

Yet, the maximum length is actually capped. The agetpass function supplied by shadow allows up to PASS_MAX characters (definition in C file, not configurable). Yet passwords are already silently truncated at 199 characters due to internal limit in passwd.

PASS_MIN_LEN

If PASS_MIN_LEN is not set login.defs, then an invalid message is printed in passwd:

Proof of Concept even if PAM support is compiled in (run as root):

# passwd -P /.
Changing password for root
Enter the new password (minimum of 5 characters)
Please use a combination of upper and lower case letters and numbers.
New password:

According to this message, a minimum of 5 characters is in place. But in fact, empty passwords are allowed as well. This happens because src/ and lib/ use different default values if PASS_MIN_LEN does not exist.

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

No branches or pull requests

1 participant