(IHttpRequestResponse basePair, IScannerInsertionPoint insertionPoint)
| 13 | } |
| 14 | |
| 15 | public List<IScanIssue> doActiveScan(IHttpRequestResponse basePair, IScannerInsertionPoint insertionPoint) { |
| 16 | List<IScanIssue> issues = new ArrayList<>(); |
| 17 | |
| 18 | // Generate random canaries |
| 19 | String canary1 = randstr(4); |
| 20 | String canary2 = randstr(4); |
| 21 | String canary3 = randstr(4); |
| 22 | |
| 23 | // Construct the attack payload |
| 24 | String probe = canary1 + "<!--esi-->" + canary2 + "<!--esx-->" + canary3; |
| 25 | byte[] payload = insertionPoint.buildRequest(probe.getBytes()); |
| 26 | |
| 27 | // Send the attack request |
| 28 | IHttpRequestResponse attack = callbacks.makeHttpRequest(basePair.getHttpService(), payload); |
| 29 | String resp = helpers.bytesToString(attack.getResponse()); |
| 30 | |
| 31 | // Expected response |
| 32 | String expect = canary1 + canary2 + "<!--esx-->" + canary3; |
| 33 | |
| 34 | // Check if the expected response is in the actual response |
| 35 | if (resp.contains(expect)) { |
| 36 | issues.add(new CustomScanIssue( |
| 37 | attack.getHttpService(), |
| 38 | helpers.analyzeRequest(attack).getUrl(), |
| 39 | new IHttpRequestResponse[] { attack }, |
| 40 | "Edge Side Include", |
| 41 | "The application appears to support Edge Side Includes:<br/><br/> " + |
| 42 | "The following probe was sent: <b>" + htmlEncode(probe) + |
| 43 | "</b><br/>In the response, the ESI comment has been stripped: <b>" + htmlEncode(expect) + |
| 44 | "</b><br/><br/>Refer to https://gosecure.net/2018/04/03/beyond-xss-edge-side-include-injection/ for further information", |
| 45 | "Tentative", |
| 46 | CustomScanIssue.severity.High |
| 47 | )); |
| 48 | } |
| 49 | |
| 50 | return issues; |
| 51 | } |
| 52 | } |
nothing calls this directly
no test coverage detected