Skip to content

#13655 fix: stripslash passwords on login and user edit - #12953

Draft
skikken wants to merge 2 commits into
WordPress:trunkfrom
skikken:fix/13655-stripslash-passwords
Draft

#13655 fix: stripslash passwords on login and user edit#12953
skikken wants to merge 2 commits into
WordPress:trunkfrom
skikken:fix/13655-stripslash-passwords

Conversation

@skikken

@skikken skikken commented Aug 10, 2026

Copy link
Copy Markdown

Current state on trunk: wp_insert_user() already stripslashes user_pass before hashing (the data compaction unslashes the whole user record at the end of the function), so new hashes are of the unslashed password. The remaining gaps are the input paths that pass the slashed value around:

  • wp_signon() reads $_POST['pwd'] without unslashing (wp-includes/user.php)
  • edit_user() in wp-admin/includes/user.php reads $_POST['pass1']/$_POST['pass2'] raw
  • the lost-password flow in wp-login.php passes $_POST['pass1'] raw into reset_password()

Trac ticket: https://core.trac.wordpress.org/ticket/13655

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet
Used for: Writing test cases


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Passwords containing quotes or backslashes were hashed with magic
quote slashes intact on the login, admin user edit, and password
reset paths, so the stored hash did not match the actual password.

Unslash passwords at the input boundary and migrate legacy hashes
on authentication by checking the slashed variant and rehashing.

Closes #13655
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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