CVE-2026-31891
Received Received - Intake
SQL Injection in Cockpit CMS API Allows Data Exposure

Publication date: 2026-03-18

Last updated on: 2026-03-20

Assigner: GitHub, Inc.

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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-18
Last Modified
2026-03-20
Generated
2026-05-07
AI Q&A
2026-03-18
EPSS Evaluated
2026-05-05
NVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
agentejo cockpit to 2.13.5 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-89 The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

CVE-2026-31891 is a SQL Injection vulnerability found in the MongoLite Aggregation Optimizer of Cockpit CMS versions 2.13.4 and earlier. It affects the toJsonExtractRaw() method, allowing attackers to inject arbitrary SQL through unsanitized field names in aggregation queries sent to the /api/content/aggregate/{model} endpoint.

Attackers only need a valid read-only API key, which is the lowest privilege level, and no admin access is required. This vulnerability allows bypassing the _state=1 filter that normally restricts content to published items, enabling unauthorized access to unpublished or restricted content stored in the underlying SQLite database.

The vulnerability was patched in version 2.13.5 by applying field-name sanitization to the vulnerable method, closing the injection vector.


How can this vulnerability impact me? :

This vulnerability can lead to unauthorized data disclosure by allowing attackers to access unpublished or restricted content in the Cockpit CMS database.

Since attackers only need a read-only API key and no admin privileges, the risk of data leakage is significant even with minimal access.

The confidentiality of the data is highly impacted, while the integrity and availability of the system remain unaffected.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability affects Cockpit CMS instances running version 2.13.4 or earlier with API access enabled, specifically when the /api/content/aggregate/{model} endpoint is publicly accessible or reachable by untrusted users.

Detection involves checking if your Cockpit CMS version is 2.13.4 or earlier and if the vulnerable API endpoint is accessible. Additionally, monitoring for unusual aggregation queries containing unsanitized field names or unexpected access to unpublished content could indicate exploitation attempts.

Since the vulnerability is exploited via SQL injection through aggregation queries, you can inspect web server logs or API access logs for suspicious requests to the /api/content/aggregate/{model} endpoint that include unusual or malformed field names.

Specific commands are not provided in the available resources, but general approaches include:

  • Use network monitoring tools (e.g., tcpdump, Wireshark) to capture traffic to the /api/content/aggregate/{model} endpoint and analyze for suspicious payloads.
  • Search web server or application logs for requests to /api/content/aggregate/{model} containing unusual parameters or SQL keywords.
  • Check the Cockpit CMS version by running a command or checking the application metadata to confirm if it is 2.13.4 or earlier.

What immediate steps should I take to mitigate this vulnerability?

The primary and immediate mitigation step is to upgrade Cockpit CMS to version 2.13.5 or later, where the vulnerability has been patched by applying field-name sanitization to the toJsonExtractRaw() method.

If upgrading immediately is not possible, restrict access to the /api/content/aggregate/{model} endpoint to trusted users only, ensuring it is not publicly accessible or reachable by untrusted users.

Additionally, review and limit API keys to only those necessary, and monitor API usage for suspicious activity.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart