(IHttpRequestResponse baseRequestResponse, IBurpExtenderCallbacks callbacks, IExtensionHelpers helpers, PrintWriter stdout)
| 22 | static List<String> FastJsonPayload = YamlReader.getInstance(BurpExtender.getCallbacks()).getStringList("scanModule.FastJsonScan.payload"); |
| 23 | |
| 24 | public synchronized static List<Object> ScanMain(IHttpRequestResponse baseRequestResponse, IBurpExtenderCallbacks callbacks, IExtensionHelpers helpers, PrintWriter stdout) throws IOException, InterruptedException { |
| 25 | Features.clear(); |
| 26 | URL url = helpers.analyzeRequest(baseRequestResponse).getUrl(); |
| 27 | String baseurl = url.getProtocol() + "://" + url.getAuthority(); |
| 28 | if(scandone.contains(Common.MD5(baseurl))){ |
| 29 | List<String> headers = helpers.analyzeRequest(baseRequestResponse).getHeaders(); |
| 30 | int bodyOffset = helpers.analyzeRequest(baseRequestResponse.getRequest()).getBodyOffset(); |
| 31 | String resp =new String(baseRequestResponse.getRequest()); |
| 32 | String respbody = resp.substring(bodyOffset); |
| 33 | stdout.println("fastjson 测试请求包内容为:" + respbody.trim().replace("\\r","")); |
| 34 | List<String> pocs = JsonParmAddPoc(respbody.trim().replace("\\r","")); |
| 35 | if(pocs != null){ |
| 36 | stdout.println("成功获取poc!"); |
| 37 | for(String poc:pocs){ |
| 38 | List<Object> Success = new ArrayList<>(); |
| 39 | byte[] request_bodys = poc.getBytes(); |
| 40 | byte[] body = helpers.buildHttpMessage(setHeader(headers), request_bodys); |
| 41 | IHttpRequestResponse requestResponse = callbacks.makeHttpRequest(baseRequestResponse.getHttpService(), body); |
| 42 | String data = Common.ceyeResult(); |
| 43 | for(String randString:Features){ |
| 44 | if(data.contains(randString)){ |
| 45 | stdout.println("Fastjson Rce find! 匹配randString值为: " + randString); |
| 46 | scandone.add(Common.MD5(baseurl)); |
| 47 | Success.add(requestResponse); |
| 48 | Success.add(randString); |
| 49 | return Success; |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | }else{ |
| 55 | stdout.println(baseurl + " Fastjson rce已扫描,跳过~"); |
| 56 | } |
| 57 | return null; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | public static List<String> setHeader(List<String> headers){ |
no test coverage detected