MCPcopy Create free account
hub / github.com/albinowax/ActiveScanPlusPlus / doActiveScan

Method doActiveScan

src/burp/CodeExec.java:54–119  ·  view source on GitHub ↗
(IHttpRequestResponse basePair, IScannerInsertionPoint insertionPoint)

Source from the content-addressed store, hash-verified

52 }
53
54 @Override
55 public List<IScanIssue> doActiveScan(IHttpRequestResponse basePair, IScannerInsertionPoint insertionPoint) {
56 Set<String> payloads = new HashSet<>();
57 List<String> languages = _getLangs(basePair);
58
59 for (String lang : languages) {
60 List<String> newPayloads = _payloads.get(lang);
61 if (newPayloads != null) {
62 payloads.addAll(newPayloads);
63 }
64 }
65 payloads.addAll(_payloads.get("any"));
66
67 int delayTarget = 0;
68 int margin = 1000;
69 for (String payload : payloads) {
70 if (delayTarget == 0) {
71 long baseTime = _attack(basePair, insertionPoint, payload, 0).getKey();
72 if (baseTime < 1000) {
73 delayTarget = 4000;
74 margin = 1000;
75 } else if (baseTime < 9000) {
76 delayTarget = 9000;
77 margin = 3000;
78 } else {
79 return Collections.emptyList();
80 }
81 }
82 if (_attack(basePair, insertionPoint, payload, delayTarget).getKey() > delayTarget) {
83 Utilities.log("Suspicious delay detected. Confirming it's consistent...");
84 Pair<Long, IHttpRequestResponse> dummyAttack = _attack(basePair, insertionPoint, payload, 0);
85 long dummyTime = dummyAttack.getKey();
86 IHttpRequestResponse dummyRequest = dummyAttack.getValue();
87
88 if (dummyRequest.getResponse() == null) {
89 Utilities.log("Received empty response to baseline request - abandoning attack");
90 break;
91 }
92
93 if (dummyTime + margin < delayTarget) {
94 Pair<Long, IHttpRequestResponse> attack = _attack(basePair, insertionPoint, payload, delayTarget);
95 long timer = attack.getKey();
96 if (timer > delayTarget) {
97 Utilities.log("Code execution confirmed");
98 URL url = helpers.analyzeRequest(attack.getValue()).getUrl();
99 if (_done.contains(url)) {
100 Utilities.log("Skipping report - vulnerability already reported");
101 break;
102 }
103 _done.add(url);
104 return Arrays.asList(new CustomScanIssue(
105 attack.getValue().getHttpService(),
106 url,
107 new IHttpRequestResponse[] {dummyRequest, attack.getValue()},
108 "Code injection",
109 "The application appears to evaluate user input as code.<p> It was instructed to sleep for 0ms, and a response time of <b>" + dummyTime + "</b>ms was observed. <br/>It was then instructed to sleep for "+delayTarget+"ms, which resulted in a response time of <b>" + timer + "</b>ms.</p>",
110 "Firm",
111 CustomScanIssue.severity.High

Callers

nothing calls this directly

Calls 4

_getLangsMethod · 0.95
_attackMethod · 0.95
getUrlMethod · 0.80
getHttpServiceMethod · 0.80

Tested by

no test coverage detected