Advisory

GHSA-3jhr-mxmx-38cx

Details, part 2 of 2. The advisory

Details

Suggested fix

Trimming the UserInterface entry alone is insufficient: User extends Data, and the
separate generic allowlist entry for Grav\Common\Data\Data (`get, value, items,
offsetget, offsetexists) independently grants the same access via instanceof`
matching, through three methods (get, value, offsetGet), not just one. I verified
this by simulating the UserInterface-only fix and confirming all three still leak
hashed_password and secret/twofa_secret.

The robust fix mirrors what was already done for Config in GHSA-j274-39qw-32c9:
introduce a redacting facade for User (analogous to SandboxConfig) that filters
hashed_password/secret/twofa_secret on every read path, and allow-list that facade in
place of the raw User/Data class -- rather than trying to enumerate safe methods on a
class whose parent class is independently allow-listed elsewhere in the same policy.
A narrower alternative: override User::get()/value()/offsetGet() to apply the same
redaction jsonSerialize() already does, so the fields simply don't exist to leak
regardless of which accessor method reaches them.

Affected component

  • system/config/security.yaml, twig_sandbox.allowed_methods entry for Grav\Common\User\Interfaces\UserInterface
  • system/src/Grav/Common/User/DataUser/User.php, offsetGet() (behaves correctly given the sandbox's input; the gap is in what the sandbox allows through)

**Ecosystem:** `Composer`
**Package name:** `getgrav/grav`
**Affected versions:** current `2.0.15` dev tree (bounded by whenever `UserInterface` was first added to `allowed_methods` in `security.yaml` — worth checking `git log -p` on that file if you want an exact lower bound before submitting)
**Patched versions:** leave blank

**Severity / CVSS v3.1 vector string:**

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

Resolves to **7.7 / High**. Attack Vector = Network, Attack Complexity = Low, Privileges Required = Low, User Interaction = None, Scope = Changed, Confidentiality = High, Integrity = None, Availability = None. Flag clearly in your submission (as the description does) that if the maintainers confirm the "arbitrary other user" reachability, this should be rescored toward Critical given the 2FA-bypass implication.

**CWE:** `CWE-522` (Insufficiently Protected Credentials), add `CWE-284` (Improper Access Control)

Sources & licences