Skip to content

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

High severity GitHub Reviewed Published Mar 17, 2026 in Cockpit-HQ/Cockpit • Updated Mar 17, 2026

Package

composer cockpit-hq/cockpit (Composer)

Affected versions

< 2.13.5

Patched versions

2.13.5

Description

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.

References

@aheinze aheinze published to Cockpit-HQ/Cockpit Mar 17, 2026
Published to the GitHub Advisory Database Mar 17, 2026
Reviewed Mar 17, 2026
Last updated Mar 17, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

EPSS score

Weaknesses

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

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. Learn more on MITRE.

CVE ID

CVE-2026-31891

GHSA ID

GHSA-7x5c-vfhj-9628

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.