CVE-2026-31891
JSON

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 packageVersionsReported by
Cockpit-HQ Cockpit< 2.13.5CVE List
cockpit-hq/cockpit (Packagist)before 2.13.5GitHub Advisory Database
agentejo cockpitbefore 2.13.5NVD

All scores

GitHub_M7.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
GitHub7.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Classification

CWE-89

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=1 published-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

Sources

SourceRecordLicence
CVE ListCVE-2026-31891 changed 2026-03-18CVE Terms of Use
GitHub Advisory DatabaseGHSA-7x5c-vfhj-9628 changed 2026-03-19CC-BY-4.0
NVDCVE-2026-31891 changed 2026-06-17Public domain