
استغلال إثبات مفهوم لسباق TOCTOU في تحديث نواة WordPress (CWE-367) يكتب ملف wp-config.php مزيفًا، مما يتيح الاستيلاء على قاعدة البيانات، وتسجيل دخول المسؤول، والتنفيذ عن بُعد (RCE).
| الحقل | القيمة |
|---|---|
| CVE | CVE-2026-119977 |
| CVSS | 8.1 (عالية) |
| CWE | CWE-367 (وقت الفحص ووقت الاستخدام) |
| ناقل الهجوم | الشبكة (عن بُعد بالكامل، عبر HTTP فقط) |
| المتأثر | WordPress 4.7.0 – 7.1.3 |
| تم إصلاحها في | WordPress 7.1.4 |
اختبار أمني مُصرَّح به فقط. هذا الإثبات (PoC) مخصص للتحقق من صحة الثغرة على الأنظمة التي تملكها أو لديك إذن كتابي صريح باختبارها. الوصول غير المصرح به إلى أنظمة الحاسوب غير قانوني بموجب CFAA (الولايات المتحدة)، وقانون إساءة استخدام الحاسوب (المملكة المتحدة)، و قوانين مماثلة حول العالم.
أثناء تحديث نواة WordPress، يقوم المُحدِّث بما يلي:
wp-content/upgrade/.wp-content/upgrade/wordpress-<version>-no-content/wordpress/
/wp-admin/setup-config.php — معالج تثبيت
WordPress. نقطة النهاية هذه غير مُصادَق عليها عندما لا يوجد
wp-config.php في مسار ABSPATH العامل الخاص بها (دليل التهيئة).
كما أنها تحتوي على error_reporting(0) الذي يحجب أخطاء PHP القاتلة أثناء
الاستخراج الجزئي، وتضبط WP_INSTALLING = true الذي يتجاوز
وضع الصيانة.copy_dir() بترقية شجرة التهيئة بأكملها إلى الجذر الفعلي باستخدام
$overwrite = true. مصفوفة $skip في 7.1.3 هي:
$skip = array( 'wp-content', 'wp-includes/version.php' );
wp-config.php غير موجود في $skip — لذا فإن ملف الإعدادات الذي يكتبه المهاجم
في دليل staging يُرقّى إلى الجذر المباشر.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 ليس عنوان المهاجم المحلي.
بل هو اسم المضيف/عنوان IP الخاص بـ MySQL كما تراه الخادم الهدف: