Summary
Grav versions from 2.0.0 up to, but not including, 2.2.18 can expose password hashes, two-factor authentication secrets, and password-reset tokens through unfiltered account serialization. A publisher or read-only user manager who can access the relevant Flex form or API may obtain sensitive account data, potentially enabling super-admin account takeover.
Affected context
The issue affects Grav's user-account handling when account records are serialized without filtering sensitive fields. In the affected version range, a publisher or read-only user manager may reach the user-accounts Flex form embedded in a page or query the Flex API with admin.users.read.
Exploit preconditions
- Attack surface: User-account Flex form or Flex API
- Required access: Publisher or read-only user-manager access sufficient to reach the relevant form or API
- Trigger point: Account serialization when the form is embedded or the API is queried
- Why exposure is possible: Serialized account data is not filtered to exclude password hashes, 2FA secrets, and reset tokens
Why this happens
The underlying issue is insufficient protection of sensitive data during account serialization. Returning account objects without an explicit, role-aware allowlist can expose fields that should remain private, mapping to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Potential impact
- Password hashes, 2FA secrets, or reset tokens may be disclosed
- Attackers with the required account access could use exposed data to compromise accounts
- Super-admin account takeover may be possible
- A compromised administrator account could be used to make further changes to the site
General mitigation guidance
Defensive patterns focus on minimizing the sensitive data returned by account-management interfaces:
- Serialize only explicitly approved fields using a strict allowlist
- Exclude secrets, hashes, and reset tokens from responses by default
- Apply authorization checks to each exposed field and account-management operation
- Limit access to user-management forms and APIs according to least privilege
- Treat account data as sensitive across templates, API responses, logs, and exports
How teams detect issues like this
- Review serialization and API response code for direct exposure of complete account objects
- Use static analysis or code-review checks to flag sensitive fields returned from user-management endpoints
- Test responses for password hashes, 2FA secrets, and reset tokens across roles with different permissions
- Enforce response-schema policies that allow only approved account fields

