(IHttpRequestResponse basePair)
| 42 | }; |
| 43 | |
| 44 | private List<IScanIssue> interestingFileScan(IHttpRequestResponse basePair) { |
| 45 | List<IScanIssue> issues = new ArrayList<>(); |
| 46 | for (Object[] mapping : interestingFileMappings) { |
| 47 | String url = (String) mapping[0]; |
| 48 | String expect = (String) mapping[1]; |
| 49 | String reason = (String) mapping[2]; |
| 50 | |
| 51 | IHttpRequestResponse attack = fetchURL(basePair, url); |
| 52 | if (safeBytesToString(attack.getResponse()).contains(expect)) { |
| 53 | // prevent false positives by tweaking the URL and confirming the expected string goes away |
| 54 | IHttpRequestResponse baseline = fetchURL(basePair, url.substring(0, url.length() - 1)); |
| 55 | if (!safeBytesToString(baseline.getResponse()).contains(expect)) { |
| 56 | issues.add(new CustomScanIssue( |
| 57 | basePair.getHttpService(), |
| 58 | Utilities.helpers.analyzeRequest(attack).getUrl(), |
| 59 | new IHttpRequestResponse[]{attack, baseline}, |
| 60 | "Interesting response", |
| 61 | "The response to <b>" + htmlEncode(url) + "</b> contains <b>'" + htmlEncode(expect) + "'</b><br/><br/>This may be interesting. Here's a clue why: <b>" + htmlEncode(reason) + "</b>", |
| 62 | "Firm", |
| 63 | CustomScanIssue.severity.Information |
| 64 | )); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | return issues; |
| 69 | } |
| 70 | |
| 71 | private IHttpRequestResponse fetchURL(IHttpRequestResponse basePair, String url) { |
| 72 | String path = Utilities.helpers.analyzeRequest(basePair).getUrl().getPath(); |
no test coverage detected