Avoid fatal errors by checking POST validity#86
Merged
Merged
Conversation
brent-dxw
requested changes
Dec 22, 2025
Contributor
brent-dxw
left a comment
There was a problem hiding this comment.
This breaks login with 2fa..
15b884f to
8cef460
Compare
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" ```
8cef460 to
de7adb6
Compare
brent-dxw
approved these changes
Dec 22, 2025
Contributor
brent-dxw
left a comment
There was a problem hiding this comment.
lgtm locally- works with email 2fa on blogs site and still works for user without 2fa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An attacker is currently attempting to find vulnerabilites on our sites.
Fatal errors are being generated via 2fa via
wp-login.phpThis 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.