Summary
Grav Login has an authentication bypass that can let an attacker with an account password sign in without completing two-factor verification when the global twofa_enabled setting is off. The resulting session may be accepted by the API plugin, potentially granting the account's full permissions, including super-admin control.
Affected context
The issue affects Grav Login deployments where two-factor verification is expected but the global twofa_enabled setting is off. The described login paths include the /login form, remember-me cookies, and magic links; sessions obtained through these paths may be accepted by the API plugin.
Exploit preconditions
- Attack surface: Grav Login authentication flows and session handling
- Required access: The attacker must know the password for an account
- Configuration condition: The global
twofa_enabledsetting must be off - Trigger point: Sign-in through the login form, a remember-me cookie, or a magic link
- Why exploitation is possible: The authentication flow can issue a session without requiring the expected two-factor verification, and the API plugin accepts that session
Why this happens
The authentication flow does not consistently enforce the required verification step when the global two-factor setting is off. This is an authentication-mechanism failure mapped to CWE-287: Improper Authentication: a user's password can be sufficient to obtain an authenticated session even when additional verification is expected.
Potential impact
- An attacker could access the victim account without completing two-factor verification
- The session may grant the account's full permissions
- An attacker could gain super-admin control if the compromised account has that role
- The API plugin may accept the resulting session for unauthorized actions
General mitigation guidance
Mitigation patterns focus on consistently enforcing authentication requirements across every sign-in and session path.
- Treat two-factor requirements as explicit authentication policy, not as an optional side effect of a global setting
- Ensure form, remember-me, and magic-link flows apply equivalent verification and session controls
- Validate that sessions represent completion of all required authentication steps before accepting them in plugins or APIs
- Use least privilege for accounts and administrative roles
- Reduce reliance on password-only access for sensitive accounts
How teams detect issues like this
- Review authentication code paths for conditions where two-factor checks can be skipped or inferred from a global setting
- Use static analysis and code review to identify inconsistent verification logic across login, cookie, and magic-link flows
- Test that sessions lacking required verification are rejected by API and other plugin integrations
- Enforce policy checks that require consistent multi-factor verification for privileged accounts
- Monitor for sign-ins and sensitive API activity that do not show evidence of required verification

