{"answers":{"affected":"2 open source packages ship an affected version, including cockpit-hq/cockpit. It affects 1 product.","exploited":"There is no known exploitation of CVE-2026-31891 in the wild and no public exploit code.","fix":"Upgrade cockpit-hq/cockpit to 2.13.5 or later.","what":"CVE-2026-31891 is a high-severity SQL injection vulnerability in Cockpit-HQ Cockpit, published on 18 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2026-31891 and fix it if it is affected.\n\nWhat it is: CVE-2026-31891 is a high-severity SQL injection vulnerability in Cockpit-HQ Cockpit, published on 18 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2026-31891 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- cockpit-hq/cockpit (Packagist): affected all versions; fixed in 2.13.5\n- cockpit-hq/cockpit (Packagist): affected all versions; fixed in 2.13.5\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2026-31891/ (Markdown: https://insights.sbomify.com/CVE-2026-31891/index.md)","id":"CVE-2026-31891","markdown":"https://insights.sbomify.com/CVE-2026-31891/index.md","name":"CVE-2026-31891","record":{"aliases":["GHSA-7x5c-vfhj-9628","UBUNTU-CVE-2026-31891"],"analysis":{"component_type":"web_application","fix_type":"upgrade","impacts":["data_read","security_bypass"],"network_reachable":"yes","non_default_config":true,"product_category":"Cockpit CMS","requires_auth":"low_privilege","summary":"Attackers with read-only API keys can inject SQL to bypass content filters and extract unauthorized data from the database.","user_interaction":"not_required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"cockpit","vendor":"agentejo"}],"cvss":{"score":7.7,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N","version":"3.1"},"cwes":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"}],"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.","ecosystems":["Packagist"],"exploits":{"exploitdb":0,"first_seen":"2026-03-19","github_poc":1,"max_poc_stars":1,"metasploit":0,"nuclei":0,"refs":[{"date":"2026-03-19T22:54:08Z","kind":"github_poc","ref":"https://github.com/ffasterss/CVE-2026-31891","stars":1,"title":"SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()"}],"tier":"poc_unverified"},"has_fix":true,"headline":"Cockpit CMS has SQL Injection in MongoLite Aggregation Optimizer via toJsonExtractRaw()","id":"CVE-2026-31891","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Packagist","product":null,"products":[],"type":"sql_injection","year":"2026"},"n_packages":2,"n_references":2,"next":{"headline":"WorkflowTemplate Security Bypass via podSpecPatch in Strict/Secure Reference Mode","id":"CVE-2026-31892"},"packages":[{"ecosystem":"Packagist","fixed":["2.13.5"],"introduced":["0"],"last_affected":[],"package":"cockpit-hq/cockpit","purl":null,"source":"GHSA-7x5c-vfhj-9628"},{"ecosystem":"Packagist","fixed":["2.13.5"],"introduced":["0"],"last_affected":[],"package":"cockpit-hq/cockpit","purl":"pkg:composer/cockpit-hq/cockpit","source":"GHSA-7x5c-vfhj-9628"}],"prev":{"headline":"Inspektor Gadget: Tracing Denial of Service via Event Flooding","id":"CVE-2026-31890"},"products":["Cockpit"],"published":"2026-03-18","related":[{"cvss_score":9.9,"headline":"PHP Remote File Inclusion in cockpit-hq/cockpit","id":"CVE-2023-4195","kev_date_added":null,"published":"2023-08-06"},{"cvss_score":9.8,"headline":"Unrestricted Upload of File with Dangerous Type vulnerability on Cockpit CMS from Agentejo","id":"CVE-2024-4825","kev_date_added":null,"published":"2024-05-13"},{"cvss_score":9.8,"headline":"Improper Removal of Sensitive Information Before Storage or Transfer in cockpit-hq/cockpit","id":"CVE-2022-2818","kev_date_added":null,"published":"2022-08-15"},{"cvss_score":9.8,"headline":"Code injection in n/a","id":"CVE-2020-35131","kev_date_added":null,"published":"2021-01-08"},{"cvss_score":9.8,"headline":"SQL injection in n/a","id":"CVE-2020-35846","kev_date_added":null,"published":"2020-12-30"},{"cvss_score":9.8,"headline":"SQL injection in n/a","id":"CVE-2020-35847","kev_date_added":null,"published":"2020-12-30"},{"cvss_score":9.8,"headline":"SQL injection in n/a","id":"CVE-2020-35848","kev_date_added":null,"published":"2020-12-30"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2026-03-18","vendors":["Cockpit-HQ"]},"summary":"Attackers with read-only API keys can inject SQL to bypass content filters and extract unauthorized data from the database.","url":"https://insights.sbomify.com/CVE-2026-31891/"}