New Plugin Release 4.2.0
The version 4.2.0 has been released today on WordPress.
Important security release. It fixes multiple security vulnerabilities affecting authentication, authorization, and REST API endpoints. All users are strongly encouraged to upgrade as soon as possible. Review the Breaking Changes section before upgrading.
Security
- Fixed multiple security vulnerabilities affecting authentication, authorization, and REST API endpoints
- Strengthened validation and authorization across the affected endpoints
- Improved the data returned by REST API endpoints
- Added security regression tests to prevent these issues from coming back
New Features
- Expected audience (aud) - new optional setting for the plugin's own JWTs (Authentication) and for each JWT Rule. When set, new JWTs carry that
audand only JWTs whoseaudcontains it are accepted (new error code130). Read more about the audience setting. - Revoke sessions on password change - new option in Authentication, off by default. When on, changing a password deletes the user's refresh tokens and rejects every JWT issued before the change. JWTs without an
iatclaim are then also rejected for that user. Read more about revoking sessions. /authnow checks the password withwp_authenticate(), so brute-force and user-block plugins (Limit Login Attempts, Wordfence and similar) protect it likewp-login.php. Application passwords can't be exchanged for a JWT. Read more about password checks.- OAuth backward-compatibility options - new options, off by default, to accept tokens that aren't bound to the configured app. They are Allow tokens issued for other Google clients, Allow tokens issued for other Facebook apps, Allow tokens issued for other GitHub apps (also accepts personal access tokens) and Auth0 Allow opaque access tokens. The admin screen shows a security warning while one is on, because any app on that provider could then log its users into the matching WordPress accounts. See OAuth backward compatibility.
- Dashboard security notices - a new Security notices section lists the enabled options and settings that weaken security (the critical and warning findings of the security report), most severe first. Click a notice to open the matching settings tab. The dashboard and the AI
security-reportability also report the OAuth options above when they are on. See the Dashboard. - The AI Abilities security report now warns when authentication with
password_hashis enabled - Admin: optional support banner with a donation link at the top of the settings page. It can be dismissed for 6 months, and no features are locked behind donations
Breaking Changes
These changes were introduced on purpose to strengthen the security of your WordPress site, so most of them can't be kept optional. The OAuth token checks are the exception. The new options Allow tokens issued for other Google clients, Allow opaque access tokens, Allow tokens issued for other Facebook apps, and Allow tokens issued for other GitHub apps turn them off for one provider each. When one is on, your applications stay backward compatible and keep working as before 4.2.0, but without the security fix for that provider. See OAuth backward compatibility.
-
WordPress 6.2 or newer is required (was 4.4). The plugin's database queries use the
%iidentifier placeholder added in WordPress 6.2. -
OAuth login links - the OAuth login buttons (Google, Auth0, Facebook, GitHub) now go through the plugin, which redirects to the provider. Custom login buttons or links that send visitors straight to the provider with the plugin's callback as
redirect_uristop working. Link toGET /oauth/token?provider=<provider>instead. See the OAuth flow. -
OAuth tokens - tokens sent to the OAuth endpoint (and Google
id_tokens used on all endpoints) must be issued for the app configured in the plugin:- a Facebook or GitHub
access_tokenmust belong to the configured app (GitHub personal access tokens are rejected) - a Google
id_tokenmust have the configured Client ID asaud - an Auth0
access_tokenmust be a JWT issued for the configured Auth0 Client ID (azporaud), so opaque Auth0 access tokens are rejected
To stay backward compatible, turn on the matching new OAuth option. See OAuth backward compatibility.
- a Facebook or GitHub
-
Reset password -
POST /user/reset_passwordwith an unknown email now answers200instead of404with the "Wrong user." message. -
Reverse proxy - with "Trust reverse proxy IP headers" on, the client IP is read from the last
X-Forwarded-Forentry only. Sites whose proxy sends the client IP only inClient-IPmust switch the proxy toX-Forwarded-For. See Trust reverse proxy IP headers. -
Two-factor - after too many wrong two-factor codes (30 by default, Two Factor filter
two_factor_failed_attempt_limit) sent toPOST /auth/2faor the OAuth two-factor form, the user's password is reset and the user and admin are emailed, as onwp-login.php. Read more about two-factor failed codes. -
API keys on
/batch/v1- API keys need thecreate,updateanddeletepermissions, otherwise they get401. See API Keys. -
HTTP status of error responses - client errors that used to answer
500now answer their real status (401,403,404,422or429). Theerror_codevalues didn't change, so code that checkserror_codekeeps working. See the full list of changed statuses. -
Audience - once you set an expected audience, JWTs issued before it have no
audand stop working, so users must log in again
Bug Fixes
- Fix the Facebook browser login returning a
500error instead of the login page with the error message when Facebook rejects the code - Fix two parallel
/auth/refreshcalls with the same refresh token both getting a new JWT: a refresh token can now be used once only - Fix API keys and refresh tokens staying in the database when a user is deleted in wp-admin, and an API key of a deleted user causing a
500error instead of401 - Fix
/authrejecting Base64 passwords that contain',"or\. Invalid Base64 now answers "Wrong user credentials." - Fix
/authand/auth/refreshreturning a refresh token that couldn't be saved: they now answer500(new error code131) - Fix API key
expires_ataccepting any text: it must be a date, a date time or an ISO 8601 date (new error code132), is read as UTC and stored as UTC. The admin form now sends the browser's local time converted to UTC - Fix the Delete button in Security > Revoked Tokens, which always failed with "Invalid revoked token ID."
- Failing to store the two-factor session now has its own error code
133(500). It used to share code107with "two-factor session expired"
API Reference
- Every endpoint in the API reference now documents its real request parameters, status codes and error codes, with examples taken from the plugin messages
- The endpoints used by the plugin admin screens (
/api-keys*and/revoked-tokens*) are taggedinternal, with their access rules: revoked tokens are for administrators only, and API keys can be managed by their owner, while administrators can manage every user's keys
If you encounter any issues after updating, please open an issue on GitHub.
