Skip to content

Commit 7650bca

Browse files
committed
replace getInferredMimeType and rich readme
1 parent 4736ccc commit 7650bca

File tree

10 files changed

+25
-7
lines changed

10 files changed

+25
-7
lines changed
Binary file not shown.
Binary file not shown.

.gradle/7.1/fileHashes/fileHashes.bin

150 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
18 Bytes
Binary file not shown.

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# burp_json_xss_finder_plugin
22
a simple burp plugin used to find "json xss"
3+
## 0x01简介
4+
该burp插件用于发现可能存在**json xss**的接口
5+
> Json xss 一种接口返回的数据是json格式,但是响应的content-type没有设置为application/json,而设置为text/html,这在接口返回的数据可控时,会导致xss
6+
7+
8+
## 0x02使用
9+
在burp专业版的Extender模块中 ADD 该插件的jar包
10+
![image.png](https://cdn.nlark.com/yuque/0/2022/png/22550391/1667403515114-f745b2ca-423a-4321-adb3-4b7a8893bf7a.png#clientId=u503c86b5-cbb2-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=587&id=uc9d272f6&margin=%5Bobject%20Object%5D&name=image.png&originHeight=1174&originWidth=2522&originalType=binary&ratio=1&rotation=0&showTitle=false&size=98292&status=done&style=none&taskId=u0a36a93a-4f7a-46fc-bbc3-8803c65099b&title=&width=1261)
11+
如果没有Errors就是导入成功,导入成功后会发现多了个Json Xss Finder的 tab
12+
13+
后续在使用浏览器中访问站点时就能被动地发现Json xss了
14+
![image.png](https://cdn.nlark.com/yuque/0/2022/png/22550391/1667403657546-731b5700-014b-4a54-a74f-e1fdaea26f65.png#clientId=u503c86b5-cbb2-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=818&id=u01d63617&margin=%5Bobject%20Object%5D&name=image.png&originHeight=1636&originWidth=2540&originalType=binary&ratio=1&rotation=0&showTitle=false&size=165427&status=done&style=none&taskId=u2dd63d43-1921-49e6-a78d-ce6b1c7b0bc&title=&width=1270)

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'org.example'
6-
version '1.0-SNAPSHOT'
6+
version '1.1-SNAPSHOT'
77

88
repositories {
99
mavenCentral()

src/main/java/burp/BurpExtender.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.awt.*;
77
import java.io.PrintWriter;
88
import java.net.URL;
9+
import java.nio.charset.StandardCharsets;
910
import java.util.ArrayList;
1011
import java.util.List;
1112

@@ -37,6 +38,7 @@ public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks)
3738
// obtain an extension helpers object
3839
helpers = callbacks.getHelpers();
3940
stdout.println(System.getProperty("user.dir"));
41+
stdout.println("Load Plugin Success");
4042

4143
// this.callbacks.restoreState(new File("xss.file"));
4244

@@ -119,8 +121,15 @@ public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequ
119121
IRequestInfo requestInfo = helpers.analyzeRequest(messageInfo.getRequest());
120122

121123
String statedMimeType = responseInfo.getStatedMimeType();
122-
String inferredMimeType = responseInfo.getInferredMimeType();
123-
if(statedMimeType.equals("HTML")&&inferredMimeType.equals("JSON")){
124+
// String inferredMimeType = responseInfo.getInferredMimeType(); burp has bug
125+
126+
int bodyOffset = responseInfo.getBodyOffset();
127+
String resp = new String(messageInfo.getResponse(), StandardCharsets.UTF_8);
128+
String rBody = resp.substring(bodyOffset);
129+
130+
131+
132+
if(statedMimeType.equals("HTML")&&Utils.IsJSON(rBody)){
124133
int row = log.size();
125134
log.add(new LogEntry(requestInfo.getMethod(), callbacks.saveBuffersToTempFiles(messageInfo),
126135
helpers.analyzeRequest(messageInfo).getUrl()));

src/main/java/burp/Utils.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ public static boolean IsJSON(String rBody){
66
if (rBody.startsWith("{")&&rBody.endsWith("}")){
77
return true;
88
}
9-
else if(rBody.startsWith("[")&&rBody.endsWith("]")){
10-
return true;
11-
}
12-
return false;
9+
else return rBody.startsWith("[") && rBody.endsWith("]");
1310
}
1411
}

0 commit comments

Comments
 (0)