/

CVE-2026-42032

Severity:

CRITICAL RISK

(9.1)

Authorization Bypass / Broken Access Control in CKAN

CVE-2026-42032

Analyzed

Vulnerability type

Category:

Authorization Bypass / Broken Access Control

CWE:

CWE-863

Impact:

Unauthorized Access to Sensitive Data and System Information

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A broken authorization vulnerability in CKAN's datastore_search_sql endpoint allows attackers to bypass access controls and query private datastore resources and PostgreSQL system information.

When exploited, this flaw can expose sensitive datasets and internal database metadata, even if those resources are intended to remain private.

Affected context

The issue arises in CKAN deployments that expose or rely on the datastore_search_sql API endpoint for querying datastore-backed resources.

It affects environments where:

  • CKAN is configured with private or restricted datasets stored in the datastore
  • datastore_search_sql is reachable to users with limited or untrusted access
  • Application logic expects this endpoint to enforce object-level authorization checks

In such contexts, assumptions that only authorized users can query specific datasets or system-level information may be invalid.

Exploit preconditions

  • Attack surface: HTTP(S) interface to the CKAN datastore_search_sql endpoint
  • Required access: Network access to the CKAN API; no elevated privileges are assumed beyond basic ability to reach the endpoint
  • Trigger point: Submission of crafted SQL-like queries through the datastore_search_sql API targeting private tables or metadata
  • Why exploitation is possible: The endpoint does not correctly apply or enforce authorization and object-level access control, allowing queries to run against resources the caller should not be able to access

Why this happens

This vulnerability stems from incomplete or missing authorization checks in the datastore SQL search path.

Instead of consistently applying object-level permissions and dataset visibility rules, the datastore_search_sql endpoint executes queries in a context that over-trusts the caller.

This maps to CWE-863: Incorrect Authorization, where the application fails to ensure that the requesting principal is permitted to perform the requested action on a given resource.

Conceptually, the logic conflates "having access to the query interface" with "having access to all underlying data and system information exposed through that interface."

Potential impact

  • Unauthorized reading of private or restricted datasets stored in the CKAN datastore
  • Access to PostgreSQL system information, such as metadata, catalog tables, or structural details
  • Exposure of sensitive organizational or governmental data intended to remain internal
  • Facilitation of further attacks (e.g., reconnaissance for SQL-based exploitation or lateral movement)
  • Breach of compliance obligations due to leakage of regulated or confidential information

General mitigation guidance

Mitigation typically focuses on reinforcing authorization boundaries around data-access endpoints and avoiding direct exposure of low-level query interfaces.

Common defensive patterns include:

  • Centralizing authorization enforcement so that all datastore access paths, including SQL-like interfaces, reuse the same permission checks and object-level policies
  • Implementing strict allowlists or query abstractions that limit which tables, views, and system catalogs can be referenced through public APIs
  • Treating any generic query endpoint as high risk and restricting its availability to trusted service accounts rather than end users
  • Segregating sensitive and public datasets at both the application and database layer, using dedicated roles and schemas with least-privilege access
  • Applying defense-in-depth by combining application-level authorization with database-level permissions that prevent unintended table access

How teams detect issues like this

Detection strategies can leverage both code-centric and operational signals:

  • Static analysis and code review:
  • Look for API endpoints that construct or execute datastore queries without explicit permission checks or policy evaluation
  • Flag direct SQL access functions that bypass higher-level authorization layers
  • Review for inconsistent reuse of access-control utilities compared to other data-access paths
  • Configuration and policy review:
  • Assess whether datastore roles and database grants align with application-level visibility rules
  • Verify that low-level query endpoints are not exposed to general users without additional gating
  • Runtime monitoring:
  • Monitor API logs for unusual or broad datastore_search_sql queries, such as requests referencing system catalogs or unexpected tables
  • Alert on access patterns where low-privileged accounts query private datasets or metadata-heavy views

Automated security testing and API-focused scanners can help identify endpoints where access patterns do not match documented authorization requirements.

Sources

SourceLink
github.comgithub.com/ckan/ckan/security/advisories/GHSA-cg4x-64p3-x59h

Frequently asked

questions

The vulnerability is exploitable by anyone who can reach the datastore_search_sql endpoint over the network, including low-privileged or partially authenticated users, if the deployment does not restrict access to that API.

An attacker generally needs only the ability to send requests to the CKAN API endpoint in question; they do not need direct database credentials, as the flaw exists in how the application mediates access to the datastore.

The safest pattern is to enforce consistent, centralized authorization logic for all datastore interactions, ensuring that datastore_search_sql applies the same object-level permissions as other data-access paths and cannot bypass dataset visibility rules.

To prevent similar problems, treat any generic query or search endpoints as high-risk, require explicit authorization checks before executing queries, adopt least-privilege database roles, and incorporate security-focused code reviews or automated checks for endpoints that expose direct query capabilities.

Find out what's already
exploitable in your codebase.