Skip to content
Heist/ feed
Back to feed
High

Cockpit CMS has SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-31891
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 17:17 UTC · Revision 1

Source evidence

Cockpit CMS has SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()

core-osv · Original source

Published 18 Mar 2026, 02:58 UTC

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.

osv:CVE-2026-31891
Complete source record
{
  "id": "b7882835e663f91fe2809d6a5127bf32f2ca744e4ef894fc6aad6eba81b5fcc2",
  "url": "https://osv.dev/vulnerability/CVE-2026-31891",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Cockpit CMS has SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()",
    "summary": "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.",
    "evidence": "osv:CVE-2026-31891",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2026-31891",
      "aliases": [
        "CVE-2026-31891",
        "GHSA-7x5c-vfhj-9628"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/cockpit-hq/cockpit",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "ea00332f9de700e40fcc9eccc82a9f295cdea066"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "2.13.5"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "ea00332f9de700e40fcc9eccc82a9f295cdea066"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "2.13.5"
                  },
                  {
                    "cpe": "cpe:2.3:a:agentejo:cockpit:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "2.13.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.13.4",
            "2.13.3",
            "2.13.2",
            "2.13.1",
            "2.13.0",
            "2.12.1",
            "2.12.0",
            "2.11.4",
            "2.11.3",
            "2.11.2",
            "2.11.1",
            "2.11.0",
            "2.10.3",
            "2.10.2",
            "2.10.1",
            "2.10.0",
            "2.9.4",
            "2.9.3",
            "2.9.2",
            "2.9.1",
            "2.9.0",
            "2.8.6",
            "2.8.5",
            "2.8.4",
            "2.8.3",
            "2.8.2",
            "2.8.1",
            "2.8.0",
            "2.7.2",
            "2.7.1",
            "2.7.0",
            "2.6.3",
            "2.6.2",
            "2.6.1",
            "2.6.0",
            "2.5.2",
            "2.5.1",
            "2.5.0",
            "2.4.1",
            "2.4.0",
            "2.3.9",
            "2.3.8",
            "2.3.7",
            "2.3.6",
            "2.3.5",
            "2.3.4",
            "2.3.3",
            "2.3.2",
            "2.3.1",
            "2.3.0",
            "2.2.2",
            "2.2.1",
            "2.2.0",
            "2.1.2",
            "2.1.1",
            "2.1.0",
            "2.0.2",
            "2.0.1",
            "2.0.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-31891.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:51.200072608Z",
      "provider": "osv",
      "references": [
        "https://github.com/Cockpit-HQ/Cockpit/releases/tag/2.13.5",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31891.json",
        "https://github.com/Cockpit-HQ/Cockpit/security/advisories/GHSA-7x5c-vfhj-9628",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-31891"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-89"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31891.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-31891",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 519965,
  "published_at": "2026-03-18T02:58:12.427+00:00"
}