Rucio has SQL Injection in FilterEngine PostgreSQL Query Builder via DID Search API
A SQL injection vulnerability in FilterEngine.create_postgres_query allows any authenticated Rucio user to execute arbitrary SQL against the configured PostgreSQL metadata database through the DID search endpoint (GET /dids/<scope>/dids/search). When the external metadata plugin postgres_meta is configured, attacker-controlled filter keys and values are interpolated directly into raw SQL statements via Python str.format. This enables full database compromise including data exfiltration, data modification, and potential remote code execution via COPY ... FROM PROGRAM.
The vulnerability exists in lib/rucio/core/did_meta_plugins/filter_engine.py within the create_postgres_query() method (lines 408-484). This method builds raw SQL strings via Python .format() across 6 distinct injection points:
filter_engine.py:477 (string equality — default branch):
```python
expression = "{}->>'{}' {} '{}'".format(jsonb_column, key, POSTGRES_OP_MAP[oper], value)
```
filter_engine.py:442 (wildcard/LIKE branch):
```python
expression = "{}->>'{}' LIKE '{}' ".format(jsonb_column, key, value.replace('*', '%'))
```
filter_engine.py:456 (boolean branch — value unquoted):
```python
expression = "({}->>'{}' )::boolean {} {}".format(jsonb_column, key, POSTGRES_OP_MAP[oper], value)
```
filter_engine.py:462 (numeric branch — value unquoted):
```python
expression = "({}->>'{}' )::float {} {}".format(jsonb_column, key, POSTGRES_OP_MAP[oper], value)
```
filter_engine.py:472 (datetime branch):
```python
expression = "({}->>'{}' )::timestamp {} '{}'".format(jsonb_column, key, POSTGRES_OP_MAP[oper], value)
```
filter_engine.py:479 (non-JSONB column fallback):
```python
expression = "{} {} '{}'".format(key, POSTGRES_OP_MAP[oper], value)
```
Both key and value are attacker-controlled strings derived from HTTP query parameters. The resulting expression string is concatenated into a larger query string (postgres_query_str) that is then passed to psycopg3's sql.SQL():
```python
# postgres_meta.py:314-316
statement = sql.SQL("SELECT * FROM {} WHERE {} {}").format(
sql.Identifier(self.table),
sql.SQL(postgres_query_str), # <-- UNSANITIZED user-derived string
sql.SQL("LIMIT {}").format(sql.Literal(limit)) if limit else sql.SQL("")
)
```
sql.SQL() wraps the string as a trusted SQL syntax fragment — it does not escape or parameterize its contents. The statement is then executed via cur.execute(statement) at postgres_meta.py:321.
The data flow from HTTP request to SQL execution passes through multiple layers with no effective sanitization:
1. HTTP input (dids.py:265-274): Filter keys and values are accepted from query parameters via ast.literal_eval() or directly from individual query argument names/values. The fallback path only excludes 4 reserved keys (type, limit, long, recursive).
2. Plugin routing (did_meta_plugins/__init__.py:227-248): Each filter key is checked via manages_key(). postgres_meta.manages_key() unconditionally returns True (line 345) — it accepts ANY filter key without validation.
3. FilterEngine initialization: The postgres_meta plugin instantiates FilterEngine with strict_coerce=False. Unknown keys pass through _coerce_filter_word_to_model_attribute() as raw strings.
4. Value typecasting (filter_engine.py:275-297): _try_typecast_string() attempts to parse the value as a boolean, datetime, or number. SQL injection strings fail all these parsers and are returned unchanged.
5. Sanity checks (filter_engine.py:149-190): _sanity_check_translated_filters() does not validate arbitrary key names or values for SQL-unsafe characters.
6. SQL construction (filter_engine.py:442-479): The unsanitized key and value strings are interpolated directly into raw SQL strings via .format().
7. SQL execution (postgres_meta.py:316,321): The raw string is wrapped in sql.SQL() (treated as trusted SQL) and executed via cur.execute().
Prerequisites:
postgres_meta metadata plugin explicitly configured (this is NOT the default — the default is json_meta)```bash
TOKEN=$(curl -s -k \
-H 'X-Rucio-Account: testuser' \
-H 'X-Rucio-Username: testuser' \
-H 'X-Rucio-Password: testpass' \
'https://rucio.example.org/auth/userpass' \
-D - 2>/dev/null | grep -i 'x-rucio-auth-token' | awk '{print $2}' | tr -d '\r')
```
```bash
# postgres_meta uses create_postgres_query() -> raw string formatting
# filter_engine.py:477: "{}->>'{}' {} '{}'".format(jsonb_column,
This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. Rated impact: confidentiality high, integrity high, availability high.
The score comes from this vector: 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
CVE-2026-29090 is classified as CWE-89: SQL Injection. Untrusted input is concatenated into an SQL statement, letting an attacker change the query and reach data the request should not return.
CVE-2026-29090 is recorded against 1 package.
Published on 6 May 2026 and last revised on 2 July 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.
github.com (Web)
nvd.nist.gov (Advisory)
github.com (Advisory)
github.com (Web)
github.com (Package)
pypi.org (Web)
rucio has other advisories on record. If you are patching this one, these are worth checking on the same host:
These advisories are the same class of weakness (CWE-89: SQL Injection) in other software:
Details
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
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| rucio | 40.0.0 | 40.1.1 |
References
Similar Threats
Exploit Protection
CVE-2026-29090 carries CVSS 9.5 Critical rating. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.
Check My Site For CVE-2026-29090 →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.