Skip to content

Conversation

@leedxw
Copy link
Contributor

@leedxw leedxw commented Dec 22, 2025

An attacker is currently attempting to find vulnerabilites on our sites.

Fatal errors are being generated via 2fa via wp-login.php

PHP Fatal error:  Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/www/html/wp-includes/pluggable.php:686
 Stack trace:
 #0 /var/www/html/wp-includes/pluggable.php(686): trim()
 #1 /var/www/html/wp-content/plugins/2fa/lib/login.php(168): wp_authenticate()
 #2 /var/www/html/wp-includes/class-wp-hook.php(341): {closure}()
 #3 /var/www/html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
 #4 /var/www/html/wp-includes/plugin.php(522): WP_Hook->do_action()
 #5 /var/www/html/wp-login.php(571): do_action()
 #6 {main}
 thrown in /var/www/html/wp-includes/pluggable.php on line 686

This is happening because POST variables are being presented as arrays but processed using string-only functions.

We should be checking for strings before using user-supplied values like this.

Copy link
Contributor

@brent-dxw brent-dxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks login with 2fa..

An attacker is currently attempting to find vulnerabilites on our sites.

Fatal errors are being generated via 2fa via `wp-login.php`

```
PHP Fatal error:  Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/www/html/wp-includes/pluggable.php:686
 Stack trace:
 #0 /var/www/html/wp-includes/pluggable.php(686): trim()
 #1 /var/www/html/wp-content/plugins/2fa/lib/login.php(168): wp_authenticate()
 #2 /var/www/html/wp-includes/class-wp-hook.php(341): {closure}()
 #3 /var/www/html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
 #4 /var/www/html/wp-includes/plugin.php(522): WP_Hook->do_action()
 #5 /var/www/html/wp-login.php(571): do_action()
 #6 {main}
 thrown in /var/www/html/wp-includes/pluggable.php on line 686
```

This is happening because POST variables are being presented as arrays but processed using string-only functions.

We should be checking for strings before using user-supplied values like this.
```
PHP Warning:  Array to string conversion in /var/www/html/wp-includes/formatting.php on line 1128

"GET /wp-login.php?reauth=1&redirect_to[%24ne]=https://accessibility.blog.gov.uk/wp-admin/ HTTP/1.1"
```
Copy link
Contributor

@brent-dxw brent-dxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm locally- works with email 2fa on blogs site and still works for user without 2fa

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.

3 participants