Opened 6 weeks ago
Closed 5 weeks ago
#63433 closed defect (bug) (fixed)
Fatal error on lostpassword if user_login is given as array
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Login and Registration | Keywords: | has-patch |
Focuses: | Cc: |
Description
We have logged fatal errors from an attacker sending bad POST requests
PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/www/html/wp-includes/user.php:3179 Stack trace: #0 /var/www/html/wp-includes/user.php(3179): trim() #1 /var/www/html/wp-login.php(839): retrieve_password() #2 {main} thrown in /var/www/html/wp-includes/user.php on line 3179
To reproduce
curl -F user_login[]=x "http://localhost/wp-login.php?action=lostpassword"
Suggested patch
--- user.php.dist 2025-05-12 09:32:16.480168551 +0000 +++ user.php 2025-05-12 09:33:40.890850357 +0000 @@ -3173,5 +3173,5 @@ // Use the passed $user_login if available, otherwise use $_POST['user_login']. - if ( ! $user_login && ! empty( $_POST['user_login'] ) ) { + if ( ! $user_login && ! empty( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { $user_login = $_POST['user_login']; }
Change History (6)
This ticket was mentioned in PR #8795 on WordPress/wordpress-develop by @dilipbheda.
6 weeks ago
#1
- Keywords has-patch added
#3
@
6 weeks ago
Sorry, I think put the wrong value in the title - it's user_login.
To test the value as an array, send the value as an array.
curl -F user_login[]=x "http://localhost/wp-login.php?action=lostpassword"
Note: See
TracTickets for help on using
tickets.
Hi there!
Thanks for the ticket @leedxw
Could you share from how to get the
user_name
as array or it's something you just tried with array?