### Summary A SQL injection vulnerability exists in Rucio versions 1.30.0 and later before 35.8.5, 38.5.5, 39.4.2, and 40.1.1, in `FilterEngine.create_postgres_query()`. This allows any authenticated Rucio user to execute arbitrary SQL against the PostgreSQL metadata database through the DID search endpoint (`GET /dids/<scope>/dids/search`). When the `postgres_meta` metadata plugin is configured, attacker-controlled filter keys and values are interpolated directly into raw SQL strings via Python `.format()`, then passed to `psycopg3`'s `sql.SQL()` which treats the string as trusted SQL syntax. Depending on the database privileges assigned to the service account, exploitation can expose sensitive tables, modify or delete metadata, access server-side files, or achieve code execution through PostgreSQL features such as COPY ... FROM PROGRAM. This issue affects deployments that explicitly use the postgres_meta metadata plugin. This vulnerability has been fixed in versions 35.8.5, 38.5.5, 39.4.2, and 40.1.1.
The vulnerability results from directly inserting attacker-controlled filter keys and values into raw SQL strings using the Python `.format()` method. The string constructed this way is then passed to `psycopg3` as `sql.SQL()`, which treats it as trusted SQL syntax — without any parameterization or sanitization. The vulnerable endpoint is `GET /dids/<scope>/dids/search` and is accessible to any logged-in Rucio user, provided the deployment uses the `postgres_meta` metadata plugin.
An attacker can read or modify any tables in the PostgreSQL database, gain access to files on the server side, and with appropriate service account permissions — achieve remote code execution (RCE) through the PostgreSQL `COPY ... FROM PROGRAM` mechanism.
Rucio should be updated to version 35.8.5, 38.5.5, 39.4.2 or 40.1.1 (depending on the branch in use). Details in the vendor's references: https://github.com/rucio/rucio/security/advisories/GHSA-6j7p-qjhg-9947. Until the patch is implemented, consider disabling the `postgres_meta` plugin or restricting access to the DID search endpoint.
Rucio in versions 1.30.0 and later, before 35.8.5, 38.5.5, 39.4.2 and 40.1.1, only in deployments using the `postgres_meta` metadata plugin.
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XCern Rucio
APPCern1.30.0 – 35.8.5 (excl.)36.0.0 – 38.5.5 (excl.)39.0.0 – 39.4.2 (excl.)40.0.0 – 40.1.1 (excl.)
Related vulnerabilities
SQL injection w Rucio FilterEngine — atak przez endpoint wyszukiwania DID
Rucio is a software framework that provides functionality to organize, manage, and access large volumes of sci...
Rucio is a software framework that provides functionality to organize, manage, and access large volumes of sci...
Rucio to framework programowy zapewniający funkcjonalność organizowania, zarządzania i dostępu do dużych wolum...
Rucio to framework oprogramowania zapewniający funkcjonalność organizacji, zarządzania i dostępu do dużych ilo...