7.7high
Cockpit CMS has SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()
- Severity
- 7.7high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.44% (higher than 39% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-7x5c-vfhj-9628
Description
Cockpit is a headless content management system. Any Cockpit CMS instance running version 2.13.4 or earlier with API access enabled is potentially affected by a a SQL Injection vulnerability in the MongoLite Aggregation Optimizer. Any deployment where the `/api/content/aggregate/{model}` endpoint is publicly accessible or reachable by untrusted users may be vulnerable, and attackers in possession of a valid read-only API key (the lowest privilege level) can exploit this vulnerability — no admin access is required. An attacker can inject arbitrary SQL via unsanitized field names in aggregation queries, bypass the `_state=1` published-content filter to access unpublished or restricted content, and extract unauthorized data from the underlying SQLite content database. This vulnerability has been patched in version 2.13.5. The fix applies the same field-name sanitization introduced in v2.13.3 for `toJsonPath()` to the `toJsonExtractRaw()` method in `lib/MongoLite/Aggregation/Optimizer.php`, closing the injection vector in the Aggregation Optimizer.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Cockpit-HQ Cockpit | < 2.13.5 | CVE List |
| cockpit-hq/cockpit (Packagist) | before 2.13.5 | GitHub Advisory Database |
| agentejo cockpit | before 2.13.5 | NVD |
All scores
| GitHub_M | 7.7high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N |
| GitHub | 7.7high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N |
| NVD | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Cockpit is a headless content management system. Any Cockpit CMS instance running version 2.13.4 or earlier with API access enabled is potentially affected by a a SQL Injection vulnerability in the MongoLite Aggregation Optimizer. Any deployment where the `/api/content/aggregate/{model}` endpoint is publicly accessible or reachable by untrusted users may be vulnerable, and attackers in possession of a valid read-only API key (the lowest privilege level) can exploit this vulnerability — no admin access is required. An attacker can inject arbitrary SQL via unsanitized field names in aggregation queries, bypass the `_state=1` published-content filter to access unpublished or restricted content, and extract unauthorized data from the underlying SQLite content database. This vulnerability has been patched in version 2.13.5. The fix applies the same field-name sanitization introduced in v2.13.3 for `toJsonPath()` to the `toJsonExtractRaw()` method in `lib/MongoLite/Aggregation/Optimizer.php`, closing the injection vector in the Aggregation Optimizer.
GitHub Advisory Database
Impact
This is a SQL Injection vulnerability in the MongoLite Aggregation Optimizer.
Any Cockpit CMS instance running version 2.13.4 or earlier with API access enabled is potentially affected.
Who is impacted:
- Any deployment where the
/api/content/aggregate/{model}endpoint is publicly accessible or reachable by untrusted users. - Attackers in possession of a valid read-only API key (the lowest privilege level) can exploit this vulnerability — no admin access is required.
What an attacker can do:
- Inject arbitrary SQL via unsanitized field names in aggregation queries.
- Bypass the
_state=1published-content filter to access unpublished or restricted content. - Extract unauthorized data from the underlying SQLite content database.
Confidentiality impact is High. Integrity and availability are not directly affected by this vulnerability.
Patches
This vulnerability has been patched in version 2.13.5.
All users running Cockpit CMS version 2.13.4 or earlier are strongly advised to upgrade to 2.13.5 or later immediately.
The fix applies the same field-name sanitization introduced in v2.13.3 for toJsonPath()
to the toJsonExtractRaw() method in lib/MongoLite/Aggregation/Optimizer.php,
closing the injection vector in the Aggregation Optimizer.
NVD (es)
Cockpit es un sistema de gestión de contenido sin interfaz gráfica. Cualquier instancia de Cockpit CMS que ejecute la versión 2.13.4 o anterior con acceso a la API habilitado es potencialmente afectada por una vulnerabilidad de inyección SQL en el Optimizador de Agregación de MongoLite. Cualquier despliegue donde el endpoint `/api/content/aggregate/{model}` sea accesible públicamente o alcanzable por usuarios no confiables puede ser vulnerable, y los atacantes en posesión de una clave API de solo lectura válida (el nivel de privilegio más bajo) pueden explotar esta vulnerabilidad — no se requiere acceso de administrador. Un atacante puede inyectar SQL arbitrario a través de nombres de campo no saneados en consultas de agregación, eludir el filtro de contenido publicado `_state=1` para acceder a contenido no publicado o restringido, y extraer datos no autorizados de la base de datos de contenido SQLite subyacente. Esta vulnerabilidad ha sido parcheada en la versión 2.13.5. La corrección aplica la misma sanitización de nombres de campo introducida en la v2.13.3 para `toJsonPath()` al método `toJsonExtractRaw()` en `lib/MongoLite/Aggregation/Optimizer.php`, cerrando el vector de inyección en el Optimizador de Agregación.
References
| https://github.com/Cockpit-HQ/Cockpit/security/advisories/GHSA-7x5c-vfhj-9628 | patch, vendor-advisory, web | |
| https://github.com/Cockpit-HQ/Cockpit/releases/tag/2.13.5 | product, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-31891 | advisory | |
| https://github.com/Cockpit-HQ/Cockpit | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31891 changed 2026-03-18 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-7x5c-vfhj-9628 changed 2026-03-19 | CC-BY-4.0 |
| NVD | CVE-2026-31891 changed 2026-06-17 | Public domain |