
WordPress 코어 업데이트 TOCTOU 경쟁 조건(CWE-367)에 대한 개념 증명 익스플로잇으로, 악성 wp-config.php를 작성하여 데이터베이스 탈취, 관리자 로그인 및 RCE를 가능하게 합니다.
| 필드 | 값 |
|---|---|
| CVE | CVE-2026-119977 |
| CVSS | 8.1 (높음) |
| CWE | CWE-367 (Time-of-Check Time-of-Use) |
| 공격 벡터 | 네트워크 (완전 원격, HTTP 전용) |
| 영향 받는 버전 | WordPress 4.7.0 – 7.1.3 |
| 수정된 버전 | WordPress 7.1.4 |
승인된 보안 테스트 전용. 이 PoC는 본인이 소유하거나 테스트에 대한 명시적 서면 허가를 받은 시스템에서 취약점을 검증하기 위한 것입니다. 컴퓨터 시스템에 대한 무단 접근은 CFAA(미국), Computer Misuse Act(영국) 및 전 세계의 유사한 법률에 따라 불법입니다.
WordPress 코어 업데이트 중에 업데이터는 다음을 수행합니다:
wp-content/upgrade/에 다운로드합니다.wp-content/upgrade/wordpress-<version>-no-content/wordpress/
/wp-admin/setup-config.php — WordPress
설치 마법사가 포함됩니다. 이 엔드포인트는 작업 ABSPATH(스테이징 디렉터리)에
wp-config.php가 존재하지 않을 때 인증 없이 접근할 수 있습니다.
또한 error_reporting(0)이 있어 부분 추출 중 PHP 치명적 오류를
감추며, WP_INSTALLING = true를 설정하여 유지보수 모드를
우회합니다.copy_dir()은 $overwrite = true로 전체 스테이징 트리를
라이브 루트로 승격합니다. 7.1.3의 $skip 배열은 다음과 같습니다:
$skip = array( 'wp-content', 'wp-includes/version.php' );
wp-config.php가 $skip에 없음 — 따라서 스테이징 디렉터리에 공격자가 작성한 config가 라이브 루트로 승격됩니다.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
──────────────────────────────────────────────────────────────────────
결과: 라이브 사이트의 wp-config.php가 이제 공격자의 MySQL 서버를 가리키며, 해당 서버에는 미리 심어둔 관리자 계정이 존재합니다.
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 │
└─────────────────────────────────────┘
--atk-host 매개변수는 공격자의 로컬 주소가 아닙니다.
이는 대상 서버가 인식하는 MySQL 호스트명/IP입니다:
| 시나리오 | --atk-host 값 | 이유 |
|---|---|---|
| Docker (로컬 랩) | 127.0.0.1:3307 | Docker는 호스트 포트 3307에서 MySQL을 노출하며, 대상(XAMPP)은 동일한 호스트에 있음 |
| VPS → 원격 대상 | 203.0.113.50 | 대상이 VPS 공인 IP에 연결 |
| VPS → VPN을 통한 대상 | 10.8.0.1 | 대상이 VPN 터널 IP를 통해 연결 |
| 동일 LAN | 192.168.1.100 | 대상이 공격자의 LAN IP에 연결 |
MySQL 연결은 익스플로잇 스크립트가 아니라 대상 서버의 PHP 프로세스가 수행합니다. 익스플로잇은 단지 setup-config.php에 어떤 DB 호스트를 wp-config.php에 기록할지 알려줄 뿐입니다.
검증하는 가장 빠른 방법입니다. Docker = 공격자 VPS, 로컬 WordPress (XAMPP/MAMP 등) = 대상.
docker-exploit/
├── docker-compose.yml # Attacker infra definition
├── init-attacker-db.sql # Attacker DB seed (12 WP tables)
├── cve_2026_119977_exploit.py # Exploit script
└── README.md # This file