CVE-2026-42031: Ckan SQL Injection Vulnerability
HIGHCVE-2026-42031 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Ckan libraries in the PyPI ecosystem. The issue involves ckan has unauthenticated sql injection and authorization bypass in `datastore_search_sql`. Remediation is available by upgrading affected packages to version 2.10.10, 2.11.5.
CVE-2026-42031 at a Glance
How to Fix CVE-2026-42031
To remediate this vulnerability, upgrade all affected Ckan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ckan>=2.10.10
pip install ckan>=2.11.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ckan
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-42031, inspect your installed packages using pip:
pip show ckan
Analyze the terminal output to locate any version of Ckan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.10), your application is affected.
Note: The pip show ckan command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where 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. In Ckan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-42031 Affected Ckan Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2026-42031?
Which Ckan versions are affected?
What version fixes CVE-2026-42031?
Is ckan affected?
What CWE is associated with CVE-2026-42031?
How can I check PyPI dependencies for CVE-2026-42031?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h7j7-3rx6-xvcg",
"modified" : "2026-05-14T20:39:45Z",
"published" : "2026-04-29T23:11:21Z",
"aliases" : [ "CVE-2026-42031" ],
"summary" : "CKAN has Unauthenticated SQL Injection and Authorization Bypass in `datastore_search_sql`",
"details" : "### Impact\n\nA vulnerability in `datastore_search_sql` allowed attackers to inject SQL in order to gain access to private resources and PostgreSQL system information.\n\n### Patches\nThe issue has been patched in CKAN 2.10.10 and CKAN 2.11.5\n\n### Workarounds\nDisable the DataStore SQL search (`ckan.datastore.sqlsearch.enabled = false`). Note that the SQL search is disabled by default.\n\n### More information\n\nAs stated in the [documentation](https://docs.ckan.org/en/2.11/maintaining/configuration.html#ckan-datastore-sqlsearch-enabled), this action function has protections that offer some safety but are not designed to prevent all types of abuse. Depending on the sensitivity of private data in a project's DataStore and the likelihood of abuse of a consuming site, a developer may choose to disable this action function or restrict its use with a [`IAuthFunctions`](https://docs.ckan.org/en/2.11/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IAuthFunctions) plugin.\n\n### Credits\n\n* Reported by Arvin Shivram of Brutecat Security",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ckan"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.10.10"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "ckan"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.11.0"
}, {
"fixed" : "2.11.5"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.11.4"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ckan/ckan/security/advisories/GHSA-h7j7-3rx6-xvcg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42031"
}, {
"type" : "WEB",
"url" : "https://docs.ckan.org/en/2.10/changelog.html#v-2-10-10-2026-04-29"
}, {
"type" : "WEB",
"url" : "https://docs.ckan.org/en/2.11/changelog.html#v-2-11-5-2026-04-29"
}, {
"type" : "WEB",
"url" : "https://docs.ckan.org/en/2.11/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IAuthFunctions"
}, {
"type" : "WEB",
"url" : "https://docs.ckan.org/en/2.11/maintaining/configuration.html#ckan-datastore-sqlsearch-enabled"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ckan/ckan"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-863", "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-29T23:11:21Z",
"nvd_published_at" : "2026-05-13T19:17:22Z"
}
}