Summary
The Grav Login plugin's registration handler accepts attacker-controlled groups and access fields from user signup data without proper server-side validation.
When registration is enabled and these fields are allowed, an unauthenticated user can register an account with admin.super privileges, effectively bypassing normal authorization controls.
Affected context
This vulnerability appears in Grav installations that:
- Use the Login plugin with user self-registration enabled
- Include
groupsand/oraccessin the list of allowed registration fields - Rely on client-provided form fields to define user roles and capabilities
In such setups, the registration endpoint becomes a path where untrusted POST data is treated as authoritative for assigning user privileges.
Exploit preconditions
- Attack surface: Public web interface, specifically the user registration endpoint exposed by the Login plugin.
- Required access: No prior authentication is required; an attacker only needs network access to the registration form or endpoint.
- Trigger point: Submission of a crafted registration POST request that includes
groupsand/oraccessfields set to high-privilege values (e.g.,admin.super), when those fields are configured as allowed. - Why exploitation is possible: The server-side registration logic trusts client-supplied group and access data and lacks an authorization gate or whitelist-based enforcement on which privileges may be self-assigned.
Why this happens
The core issue is that the Login::register() method conflates user-controlled input with security-sensitive authorization data.
Instead of treating groups and access as privileged configuration determined by trusted administrators, it accepts them directly from registration POST data when allowed by configuration.
This is a combination of:
- CWE-20: Improper Input Validation, because the application does not validate or constrain the values supplied for group and access fields.
- CWE-862: Missing Authorization, because there is no dedicated authorization check that prevents unauthenticated users from assigning themselves administrative roles.
Abstractly, this reflects an insecure pattern where role/permission assignment is driven by untrusted client fields rather than server-side, policy-enforced logic.
Potential impact
- An unauthenticated attacker could create a new account with full
admin.superprivileges. - Attackers can manage site configuration, users, plugins, and content as if they were legitimate administrators.
- Complete compromise of the Grav site, including defacement, data exfiltration, and destructive changes.
- Potential for further compromise of connected systems (e.g., via malicious plugin uploads or configuration changes).
- Long-term persistence by creating additional high-privilege accounts or backdoor configurations.
General mitigation guidance
Defensive strategies focus on separating untrusted registration data from authorization controls and enforcing strict server-side policy:
- Treat group and access assignments as server-controlled properties, not form-driven inputs, even if configuration exposes them.
- Implement a fixed, minimal-privilege role (e.g., basic user group) that is automatically applied to all self-registered accounts, regardless of client-supplied fields.
- Enforce strict whitelists on which groups or access scopes can ever be assigned at registration, configured and enforced on the server.
- Add explicit authorization checks to ensure only already-privileged users or trusted processes can grant elevated permissions.
- Use defense-in-depth by:
- Avoiding exposure of sensitive fields like
groupsandaccessin registration forms. - Applying principle of least privilege to all default roles and capabilities.
- Review registration and profile update flows across the application for similar patterns where users can influence their own roles or permissions.
How teams detect issues like this
Identification typically involves both code-centric and configuration-centric review:
- Code review signals:
- Registration or profile update code that reads
groups,roles, oraccessdirectly from request data. - Conditionals that depend solely on configuration flags to accept sensitive fields without enforcing business rules.
- Absence of dedicated authorization checks around permission or group assignments.
- Static analysis patterns:
- Rules that flag when permission-related fields are derived from untrusted input (
$_POST, request body, query parameters). - Data-flow analysis tracing user-controlled input into role assignment or access-control structures.
- Configuration audits:
- Automated checks for deployments where registration is enabled and
groups/accessare listed as allowed fields. - Monitoring for newly created accounts with administrative privileges, especially if registration is publicly accessible.
- Organizations may also use security scanners or custom CI checks to detect insecure role-assignment flows and enforce policy that permission changes occur only in restricted administrative endpoints.

