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

#21022 Add sha2 pre-hashing for passwords #5

Open
wants to merge 2 commits into
base: 21022-bcrypt
Choose a base branch
from

Conversation

johnbillion
Copy link
Owner

@johnbillion johnbillion commented Nov 5, 2024

This introduces password pre-hashing using sha384 and base64 encoding in order to retain the entropy of passwords greater than 72 bytes in size. The base64 encoding is required to prevent a null byte being present in the hashed password value.

See WordPress#7333 for all the details.

sha384 is used because it results in a string 64 bytes in size being passed to bcrypt, whereas sha512 results in a string 88 bytes in size which causes 16 bytes to be truncated by bcrypt to bring it down to 72 bytes. Truncating a hashed value could introduce an unknown weakness.

The wp- prefix is needed to allow differentiating between passwords hashed using this mechanism by WordPress core, versus a password hashed using vanilla bcrypt via one of the several plugins that exist in the ecosystem that implement bcrypt hashing. Not doing so would mean not being able to retain support for passwords stored while one of those plugins were in use.

Tickets

Trac ticket: https://core.trac.wordpress.org/ticket/21022
Trac ticket: https://core.trac.wordpress.org/ticket/50027

Benefits

  • Retains entropy of passwords greater than 72 bytes in size

Concerns

  • Benefits only a tiny minority of users (those using a password greater than 72 bytes)
  • Adds complexity and risk for little gain
  • May risk facilitating password shucking
  • OWASP recommends that hash layering should be avoided for these reasons
  • The required wp- prefix reduces portability between applications other than WordPress

Copy link

github-actions bot commented Nov 5, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props johnbillion.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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