/

CVE-2026-29090

Severity:

HIGH RISK

(8.8)

SQL Injection in Rucio postgres_meta DID Search FilterEngine

CVE-2026-29090

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution on Metadata Database

Severity:

HIGH RISK

(8.8)

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 SQL injection vulnerability in Rucio's FilterEngine.create_postgres_query() allows authenticated users to inject attacker-controlled SQL fragments into queries executed against the PostgreSQL metadata database when the postgres_meta plugin is enabled.

By abusing the DID search endpoint with crafted filter keys and values, an attacker can coerce the service into executing arbitrary SQL, which may expose or modify metadata, access server-side files, or in some environments lead to code execution via advanced PostgreSQL features.

Affected context

The vulnerability occurs in Rucio deployments that:

  • Run versions 1.30.0 and later prior to 35.8.5, 38.5.5, 39.4.2, or 40.1.1, and
  • Use the postgres_meta metadata plugin for DID metadata handling, and
  • Expose the DID search endpoint (GET /dids/<scope>/dids/search) to authenticated users.

In this configuration, user-supplied filter keys and values are incorporated into SQL queries for the PostgreSQL-backed metadata store. The issue is present when those inputs are interpolated into query strings without proper parameterization or sanitization and then executed under the privileges of the Rucio database service account.

Exploit preconditions

  • Attack surface: HTTP API, specifically the DID search endpoint (GET /dids/<scope>/dids/search) in Rucio.
  • Required access: Valid Rucio user credentials or any means of making authenticated requests to the affected endpoint.
  • Trigger point: Submission of crafted filter parameters that the FilterEngine.create_postgres_query() function uses to build SQL for the postgres_meta metadata backend.
  • Why exploitation is possible: The vulnerable code uses Python string formatting (.format()) to interpolate attacker-controlled filter keys and values directly into raw SQL strings. These strings are then wrapped by psycopg3.sql.SQL() and treated as trusted SQL syntax instead of using bound parameters, allowing arbitrary SQL fragments to be injected and executed.

Why this happens

The core bug lies in constructing SQL queries via string interpolation rather than parameterized statements.

In the vulnerable path, the FilterEngine.create_postgres_query() function formats attacker-controlled filter keys and values into query templates with Python's .format(). This pattern treats input as part of the SQL program, not as data, and bypasses the protections normally provided by parameter binding.

Because psycopg3's sql.SQL() is used on a fully formatted string, it cannot distinguish user input from SQL syntax, directly mapping to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). The postgres_meta plugin amplifies the risk by dynamically constructing metadata queries from flexible filters, making it easy for malicious input to influence query structure.

Potential impact

  • Unauthorized reading of metadata tables that may include sensitive information about datasets, scopes, or internal system state.
  • Modification or deletion of metadata records, potentially corrupting dataset catalogs, masking or falsifying data provenance, or impacting operational workflows.
  • Enumeration of database schema, including table and column names, which can aid further attacks.
  • Abuse of PostgreSQL features such as COPY ... TO/FROM to exfiltrate or tamper with server-side files, depending on database configuration and privileges.
  • In environments where the database user has elevated privileges, potential execution of server-side code or OS-level commands via PostgreSQL extensions or COPY ... FROM PROGRAM.

General mitigation guidance

Risk reduction typically centers on enforcing strict separation between user input and SQL syntax and limiting the blast radius of any compromised query path.

Defensive patterns include:

  • Refactoring query construction to use parameterized queries or safe query composition APIs that never concatenate raw user input into SQL strings.
  • Constraining allowed filter keys to a fixed, whitelisted set of known-safe columns, rejecting or ignoring unexpected field names.
  • Normalizing and validating filter values according to expected types (e.g., integers, enums, bounded-length strings) before they are passed to the database layer.
  • Ensuring the database service account used by Rucio follows least-privilege principles, with minimal rights required for metadata operations and no superuser-like capabilities.
  • Segregating the metadata database or schema from more sensitive data stores so that even successful injection is confined to a narrower scope.
  • Applying defense-in-depth at the API boundary, such as generic input validation policies that disallow obviously dangerous patterns where appropriate, while still relying primarily on proper parameterization.

How teams detect issues like this

Detection efforts can focus on both code-level anti-patterns and runtime indicators.

Code and design review:

  • Search for query construction that uses Python string operations (e.g., .format(), f-strings, % formatting) to embed variables into SQL, especially in metadata or search components.
  • Flag uses of psycopg3.sql.SQL() or similar APIs where the argument is a preformatted string combining both static SQL and dynamic input rather than composed via parameterized constructs.
  • Review plugin code such as postgres_meta for dynamic query generation logic and confirm it enforces strict whitelists for columns and operations.

Static and automated analysis:

  • Configure static analysis tools or linters to detect SQL concatenation patterns and require parameterization, raising alerts on unsafe constructs in database access layers.
  • Integrate security-focused code review checks in CI pipelines that specifically scan for CWE-89 patterns and enforce secure coding guidelines for data access.

Runtime and logging:

  • Enable detailed SQL logging or audit logs at the database level to detect anomalous queries, such as those containing unexpected keywords (UNION, COPY, ;, --) or targeting non-Rucio tables.
  • Monitor application logs for suspicious search requests with unusual filter keys or values that do not conform to normal usage patterns.

Sources

SourceLink
github.comgithub.com/rucio/rucio/security/advisories/GHSA-6j7p-qjhg-9947

Frequently asked

questions

Yes. Any party that can send authenticated HTTP requests to the DID search endpoint in a vulnerable Rucio deployment using the postgres_meta plugin can attempt to exploit this issue, subject to the reachability of the service.

Elevated privileges in Rucio are not strictly required; the description specifies that "any authenticated Rucio user" can exploit the vulnerability. However, the impact of successful exploitation depends heavily on the privileges of the underlying PostgreSQL service account used by the application.

The most robust fix is to eliminate string-based SQL construction for user-controlled filters and replace it with parameterized queries or a safe query builder that never directly embeds filter values into SQL syntax. In addition, constrain filterable fields via strict whitelists and validate all filter values according to expected types and formats.

Establish coding standards that forbid building SQL via string concatenation or formatting, enforce the use of parameter binding APIs in all database access layers, and integrate static analysis and security review into your development workflow. Combining these practices with least-privilege database accounts and careful plugin design significantly reduces the likelihood and impact of future SQL injection flaws.

Find out what's already
exploitable in your codebase.