# Fail2Install (CVE-2026-132165): Drupal Installer Flaw Lets Attackers Take Over Sites and Run Code

Drupal core installer treats transient DB connection failures as 'not installed', letting anonymous attackers reopen install.php on live sites, reinstall, and achieve RCE.

- Payout: Real-world hack
- Severity: critical
- Program: Drupal
- Found by (vendor credit): Lee Rowlands (larowlan), Pamela Barone (pameeela), Scott Euser (scott_euser), Stephan Zeidler (szeidler), Tyler Nighswander (tylerni7-ant)
- Analysis by: StepSecurity
- Disclosed: 2026-11-25
- CVE: CVE-2026-132165
- Write-up quality: 8/10
- Original: https://www.stepsecurity.io/blog/fail2install-cve-2026-132165
- Library page: https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-fail2install-cve-2026-132165
- Tags: area:web domain:web impact:ato impact:rce kind:incident platform:threat-intel sev:critical tech:php technique:race-window technique:source-review vuln:auth-bypass vuln:misconfiguration vuln:race-condition vuln:rce

**Target:** Drupal core installer (core/install.php) with MySQL/PostgreSQL backend
**Root cause:** Early installer DB checks treat a connection error as 'database not set up yet' and continue, while the requirements check that would abort runs later; a race where the DB refuses early connections and accepts later ones makes the installer believe the site is uninstalled.
**Steps:**
1. Flood a finished Drupal site to exhaust DB connection slots (Apache+PostgreSQL: hold all 100 slots with slow requests, then free one at the right moment; Apache+MySQL: send requests with invalid-UTF-8 Referer so the DB logger retries on a second connection; PHP-FPM: exhaust ~28k TIME_WAIT outgoing ports at ~471 conn/s (reached on 4-vCPU servers)).
2. During the flood send `GET /core/install.php?langcode=en&profile=standard`; if the race wins, the response is the 'Database configuration' form instead of 'Drupal already installed'.
3. Submit the database form pointing settings.php at an attacker-controlled DB, or choose SQLite with a path like `web/modules/x.php` inside the web root.
4. Set the site name to PHP code so it is written into the SQLite .php file, then request `GET /modules/<file>.php/core/x.php` to bypass the .htaccess rule and execute it.
**How found:** Researchers noticed the installer's early DB checks swallow connection errors ('database might not be set up yet') while the aborting requirements check runs later, hypothesizing a race where the DB refuses early and accepts later connections within one request; they reproduced by flooding official Docker images to exhaust connection slots or local ports, reaching the reinstall form but not completing it.
**Exploitation:** Attacker floods the site to force DB connection refusals during a single install.php request, reopening the installer on a live site. They then point the site at their own database (or a SQLite file written to a .php path under web root), create an admin account, and either log in as admin or plant PHP code executed via the .php/core/x.php .htaccess bypass, yielding server-side code execution and access to settings.php secrets.
**Escalation:** Reinstall grants admin; SQLite-to-.php file plus .htaccess suffix-check bypass escalates to arbitrary PHP execution and theft of DB credentials and hash salt.
**Insight:** Installers/setup wizards that probe state via a DB connection and treat connection errors as 'fresh install' are raceable: exhaust the DB pool (or local ports via TIME_WAIT) so early probes fail and later ones succeed within one request. Also, .htaccess rules that only check URL suffix (e.g. /core/x.php) can be bypassed with /file.php/core/x.php to execute planted PHP.

## Proof of concept (copied exactly from the original report)

**Request that reopens installer during flood**

```
During that flood we sent GET /core/install.php?langcode=en&profile=standard and read the page title back.
The installer's own forms tell you what happened. "Database configuration" is the form that sets a site's database, so it is the point from which a site is reinstalled. "Requirements problem" means the installer caught the database error and stopped. "Drupal already installed" means its first check reached the database and refused.
On 11.4.12, the installer reopened on a live, finished site, with no change to anything stored on it.
```

**Bypass .htaccess to execute planted PHP file**

```
A direct request for it returned 403, blocked by the stock .htaccess. The request GET /modules/<file>.php/core/x.php returned 200 and ran the PHP: the computed sum came back in the response, so the file was executed, not served.
```

**SQLite .php payload detection grep**

```
grep -rla --include='*.php' '^SQLite format 3' web/

The -a flag is needed because the file is binary. In our test, this found the SQLite database an attack would plant; an ordinary module file did not match.
```

