Pending 2FA sessions can update Login plugin profile data through unprotected page forms
Description
With front-end 2FA enabled, a successful password check creates a pending session whose user is authenticated but not yet authorized. The Login plugin's profile-update form handler checks that the session user exists, but does not require the session to be fully authorized. A page without an access rule can therefore invoke the profile-update action while the second-factor challenge is still pending.
Affected versions
Static review confirms the vulnerable code in grav-plugin-login 3.9.8. The relevant 2FA behavior first appears in release 2.7.0, so the recommended affected range is 2.7.0 through 3.9.8. Historical releases were not dynamically tested.
Details
processUserProfile() validates the submitted form and checks user->exists(), then updates fields allowed by the Login plugin's profile configuration. During a delayed 2FA login, the user exists and is authenticated, but authorized remains false. The normal profile page is protected and rejects that pending session; a page without protected access returns before that gate and can still dispatch the same update_user form action.
Impact
An attacker who has the victim's password and can publish the required page form can change allowed profile data before completing the victim's second factor. Where twofa_enabled is an allowed profile field, this can remove the second-factor requirement and permit account takeover. This crosses the 2FA trust boundary.
Patches
A patched release is not yet available. The fix must require a fully authorized session before any profile mutation. Version details will be added when the fix is tested and tagged.
Credits
Reported by @redwolf1919.