
Proof-of-Concept-Exploit für ein TOCTOU-Race beim WordPress-Core-Update (CWE-367), das eine manipulierte wp-config.php schreibt und damit Datenbankübernahme, Admin-Login und RCE ermöglicht.
| Feld | Wert |
|---|---|
| CVE | CVE-2026-119977 |
| CVSS | 8.1 (Hoch) |
| CWE | CWE-367 (Time-of-Check Time-of-Use) |
| Angriffsvektor | Netzwerk (vollständig remote, nur HTTP) |
| Betroffen | WordPress 4.7.0 – 7.1.3 |
| Behoben in | WordPress 7.1.4 |
NUR AUTORISIERTE SICHERHEITSTESTS. Dieses PoC dient der Validierung der Schwachstelle auf Systemen, die Ihnen gehören oder für die Sie eine ausdrückliche schriftliche Genehmigung zum Testen besitzen. Unbefugter Zugriff auf Computersysteme ist nach dem CFAA (USA), dem Computer Misuse Act (UK) und ähnlichen Gesetzen weltweit illegal.
Während eines WordPress-Core-Updates führt der Updater Folgendes aus:
wp-content/upgrade/.wp-content/upgrade/wordpress-<version>-no-content/wordpress/
/wp-admin/setup-config.php — den WordPress-Installationsassistenten. Dieser Endpunkt ist nicht authentifiziert, wenn keine wp-config.php in seinem Arbeits-ABSPATH (dem Staging-Verzeichnis) existiert. Er verfügt außerdem über error_reporting(0), was PHP-Fatal-Errors während der teilweisen Extraktion maskiert, und setzt WP_INSTALLING = true, was den Wartungsmodus umgeht.copy_dir() überführt den gesamten Staging-Baum mit $overwrite = true in das Live-Root-Verzeichnis. Das $skip-Array in 7.1.3 ist:
$skip = array( 'wp-content', 'wp-includes/version.php' );
wp-config.php ist NICHT in $skip enthalten — daher wird eine vom Angreifer geschriebene Konfiguration
im Staging-Verzeichnis in das Live-Root-Verzeichnis übernommen.Timeline
──────────────────────────────────────────────────────────────────────
unpack_package() copy_dir()
extracts ZIP ──────────────── snapshots staging dir ──── promotes files
│ │
│ ◄── RACE WINDOW ──► │
│ │
setup-config.php becomes copy_dir() sees the new wp-config.php
accessible in staging dir and copies it to ABSPATH (live root)
│ │
Attacker POSTs to it Target now connects to attacker's
with rogue DB credentials MySQL database
──────────────────────────────────────────────────────────────────────
Ergebnis: Die wp-config.php der Live-Site verweist nun auf den
MySQL-Server des Angreifers, der ein vorab angelegtes Administratorkonto enthält.
Phase 0 ─► Prepare attacker MySQL with pre-seeded WordPress tables
(admin user: attacker/pwned2026, blogname: "PWNED by CVE-2026-119977")
Phase 1 ─► Fingerprint target WordPress version via HTTP
(RSS feed, meta tag, or version.php source leak)
Phase 2 ─► Compute predictable staging URL:
{target}/wp-content/upgrade/wordpress-{next_ver}-no-content/wordpress/
Phase 3 ─► Aggressive POST-as-detection loop:
Continuously POST setup-config.php?step=2 with attacker DB creds
├── 404 → staging not up yet (keep polling)
├── 200 + 0 bytes → extraction incomplete (retry fast)
└── 200 + HTML → SUCCESS: wp-config.php written!
Phase 4 ─► Verify DB takeover: GET target homepage, check for attacker markers
Phase 5 ─► Login as attacker admin (attacker / pwned2026)
Phase 6 ─► Deploy webshell via theme editor (functions.php injection)
Phase 7 ─► Interactive remote command execution
┌─────────────────────────────────────┐
│ ATTACKER VPS │
│ (e.g. 203.0.113.50) │
│ │
│ ┌──────────────────────────────┐ │
│ │ exploit.py │ │
│ │ Python 3.8+ (stdlib only) │ │
│ │ │ │
│ │ Sends HTTP POST to target's │ │
│ │ staging setup-config.php │ │
│ │ with DB creds pointing to │ │
│ │ THIS server's MySQL │ │
│ └──────────┬───────────────────┘ │
│ │ │
│ ┌──────────▼───────────────────┐ │
│ │ MySQL 8.0 │ │
│ │ Port 3306 (open to target) │ │
│ │ │ │
│ │ Database: attacker_db │ │
│ │ ├── wp_users (attacker admin)│ │
│ │ ├── wp_options (PWNED title) │ │
│ │ ├── wp_posts │ │
│ │ └── ... (12 tables total) │ │
│ └──────────────────────────────┘ │
└────────────┬────────────────────────┘
│
HTTP POST (port 443/80) │ MySQL (port 3306)
─────────────────────► │ ◄─────────────────
│
┌────────────▼────────────────────────┐
│ TARGET SERVER │
│ (WordPress 7.1.3) │
│ │
│ During update, staging dir appears:│
│ wp-content/upgrade/ │
│ wordpress-7.1.4-no-content/ │
│ wordpress/ │
│ wp-admin/ │
│ setup-config.php ◄── POST │
│ wp-config.php ◄── WRITTEN │
│ │
│ copy_dir() promotes wp-config.php │
│ to ABSPATH (live root) │
│ │
│ Site now connects to attacker DB │
└─────────────────────────────────────┘