forked from Gilzy/403Bypasser
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path403Bypasser.py
612 lines (484 loc) · 21.8 KB
/
403Bypasser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
from burp import IBurpExtender, IScanIssue, IScannerCheck, IContextMenuFactory, IContextMenuInvocation, ITab
from javax.swing import JMenuItem
from javax import swing
from javax.swing import JPanel, JButton, JList, JTable, table, JLabel, JScrollPane, JTextField, WindowConstants, GroupLayout, LayoutStyle, JFrame
from java.awt import BorderLayout
import java.util.ArrayList as ArrayList
import java.lang.String as String
from java.lang import Short
import thread
queryPayloadsFile = open('query payloads.txt', "r")
queryPayloadsFromFile = queryPayloadsFile.readlines()
headerPayloadsFile = open('header payloads.txt', "r")
headerPayloadsFromFile = headerPayloadsFile.readlines()
extentionName = "403 Bypasser"
requestNum = 2
class uiTab(JFrame):
def queryAddButtonClicked(self, event):
textFieldValue = self.queryPayloadsAddPayloadTextField.getText()
if textFieldValue != "":
tableModel = self.queryPayloadsTable.getModel()
tableModel.addRow([textFieldValue])
self.queryPayloadsAddPayloadTextField.setText("")
def queryClearButtonClicked(self, event):
global requestNum
requestNum = 2
tableModel = self.queryPayloadsTable.getModel()
tableModel.setRowCount(0)
def queryRemoveButtonClicked(self, event):
tableModel = self.queryPayloadsTable.getModel()
selectedRows = self.queryPayloadsTable.getSelectedRows()
for row in selectedRows:
tableModel.removeRow(row)
global requestNum
if requestNum > 2:
requestNum -= 1
def headerAddButtonClicked(self, event):
textFieldValue = self.headerPayloadsAddPayloadTextField.getText()
if textFieldValue != "":
tableModel = self.headerPayloadsTable.getModel()
tableModel.addRow([textFieldValue])
self.headerPayloadsAddPayloadTextField.setText("")
def headerClearButtonClicked(self, event):
global requestNum
requestNum = 2
tableModel = self.headerPayloadsTable.getModel()
tableModel.setRowCount(0)
def headerRemoveButtonClicked(self, event):
tableModel = self.headerPayloadsTable.getModel()
selectedRows = self.headerPayloadsTable.getSelectedRows()
for row in selectedRows:
tableModel.removeRow(row)
global requestNum
if requestNum > 2:
requestNum -= 1
def __init__(self):
self.queryPayloadsLabel = JLabel()
self.jScrollPane1 = JScrollPane()
self.queryPayloadsTable = JTable()
self.queryPayloadsAddPayloadTextField = JTextField()
self.queryPayloadsAddButton = JButton("Add", actionPerformed=self.queryAddButtonClicked)
self.queryPayloadsClearButton = JButton("Clear", actionPerformed=self.queryClearButtonClicked)
self.queryPayloadsRemoveButton = JButton("Remove", actionPerformed=self.queryRemoveButtonClicked)
self.headerPayloadsLabel = JLabel()
self.jScrollPane2 = JScrollPane()
self.headerPayloadsTable = JTable()
self.headerPayloadsAddPayloadTextField = JTextField()
self.headerPayloadsAddButton = JButton("Add", actionPerformed=self.headerAddButtonClicked)
self.headerPayloadsClearButton = JButton("Clear", actionPerformed=self.headerClearButtonClicked)
self.headerPayloadsRemoveButton = JButton("Remove", actionPerformed=self.headerRemoveButtonClicked)
self.panel = JPanel()
self.queryPayloadsLabel.setText("Query Payloads")
queryTableData = []
for queryPayload in queryPayloadsFromFile:
queryTableData.append([queryPayload])
headerTableData = []
for headerPayload in headerPayloadsFromFile:
headerTableData.append([headerPayload])
queryTableColumns = [None]
queryTableModel = table.DefaultTableModel(queryTableData,queryTableColumns)
self.queryPayloadsTable.setModel(queryTableModel)
self.queryPayloadsTable.getTableHeader().setUI(None)
self.jScrollPane1.setViewportView(self.queryPayloadsTable)
self.jScrollPane1.setViewportView(self.queryPayloadsTable)
self.headerPayloadsLabel.setText("Header Payloads")
headerTableColumns = [None]
headerTableModel = table.DefaultTableModel(headerTableData,headerTableColumns)
self.headerPayloadsTable.setModel(headerTableModel)
self.headerPayloadsTable.getTableHeader().setUI(None)
self.jScrollPane2.setViewportView(self.headerPayloadsTable)
layout = GroupLayout(self.panel)
self.panel.setLayout(layout)
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, False)
.addComponent(self.queryPayloadsAddButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(self.queryPayloadsRemoveButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(self.queryPayloadsClearButton, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, False)
.addComponent(self.queryPayloadsLabel)
.addComponent(self.queryPayloadsAddPayloadTextField)
.addComponent(self.jScrollPane1, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
.addGap(100, 100, 100)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, False)
.addComponent(self.headerPayloadsAddButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(self.headerPayloadsRemoveButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(self.headerPayloadsClearButton, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, False)
.addComponent(self.headerPayloadsLabel)
.addComponent(self.headerPayloadsAddPayloadTextField)
.addComponent(self.jScrollPane2, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
.addGap(0, 483, Short.MAX_VALUE))
)
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(self.headerPayloadsLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(self.jScrollPane2, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(self.headerPayloadsClearButton)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(self.headerPayloadsRemoveButton)))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(self.headerPayloadsAddPayloadTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(self.headerPayloadsAddButton)))
.addGroup(layout.createSequentialGroup()
.addComponent(self.queryPayloadsLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(self.jScrollPane1, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(self.queryPayloadsClearButton)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(self.queryPayloadsRemoveButton)))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(self.queryPayloadsAddPayloadTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(self.queryPayloadsAddButton))))
.addContainerGap(324, Short.MAX_VALUE))
)
class BurpExtender(IBurpExtender, IScannerCheck, IContextMenuFactory, ITab):
def registerExtenderCallbacks(self, callbacks):
self.callbacks = callbacks
self.helpers = self.callbacks.getHelpers()
self.callbacks.registerScannerCheck(self)
self.callbacks.registerContextMenuFactory(self)
self.callbacks.setExtensionName(extentionName)
self.callbacks.addSuiteTab(self)
sys.stdout = self.callbacks.getStdout()
sys.stderr = self.callbacks.getStderr()
return None
def getTabCaption(self):
return extentionName
def getUiComponent(self):
self.frm = uiTab()
return self.frm.panel
def createMenuItems(self, invocation):
self.context = invocation
self.menuList = []
self.menuItem = JMenuItem("Bypass 403", actionPerformed=self.testFromMenu)
self.menuList.append(self.menuItem)
return self.menuList
def testFromMenu(self, event):
selectedMessages = self.context.getSelectedMessages()
for message in selectedMessages:
thread.start_new_thread(self.doActiveScan, (message, "" , True, ))
return None
def isInteresting(self, response):
responseCode = response.getStatusCode()
if responseCode == 403:
return True
else:
return False
def findAllCharIndexesInString(self,s, ch):
return [i for i, ltr in enumerate(s) if ltr == ch]
def generatePayloads(self, path, payload):
payloads = []
#generate payloads before slash
for i in self.findAllCharIndexesInString(path, "/"):
pathWithPayload = path[:i] + payload + path[i:]
payloads.append(pathWithPayload)
#generate payloads after slash
for i in self.findAllCharIndexesInString(path, "/"):
pathWithPayload = path[:i] + "/" + payload + path[i+1:]
payloads.append(pathWithPayload)
#generate payloads in between slashes
for i in self.findAllCharIndexesInString(path, "/"):
pathWithPayload = path[:i] + "/" + payload + "/" + path[i+1:]
payloads.append(pathWithPayload)
#generate payloads at the end of the path
payloads.append(path + "/" + payload)
payloads.append(path + "/" + payload + "/")
return payloads
def tryBypassWithQueryPayload(self, request, payload, httpService):
results = []
#each result element is an array of [detail,httpMessage]
requestPath = request.getUrl().getPath()
payloads = self.generatePayloads(requestPath, payload)
originalRequest = self.helpers.bytesToString(request.getRequest())
for pathToTest in payloads:
try:
newRequest = originalRequest.replace(requestPath, pathToTest)
newRequestResult = self.callbacks.makeHttpRequest(httpService, newRequest)
newRequestStatusCode = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getStatusCode())
except:
print("No response from server")
newRequestStatusCode = None
pass
if newRequestStatusCode == "200":
originalRequestUrl = str(request.getUrl())
vulnerableReuqestUrl = originalRequestUrl.replace(requestPath,pathToTest)
responseHeaders = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getHeaders()).split(",")
resultContentLength = "No CL in response"
for header in responseHeaders:
if "Content-Length: " in header:
resultContentLength = header[17:]
if resultContentLength[-1] == ']': # happens if CL header is the last header in response
resultContentLength = resultContentLength.rstrip(']')
issue = []
global requestNum
issue.append("<tr><td>" + str(requestNum) + "</td><td>" + vulnerableReuqestUrl.replace(payload, "<b>" + payload + "</b>") + "</td> <td>" + newRequestStatusCode + "</td> <td>" + resultContentLength + "</td></tr>")
issue.append(newRequestResult)
results.append(issue)
requestNum += 1
if len(results) > 0:
return results
else:
return None
def tryBypassWithHeaderPayload(self, baseRequestResponse, payload, httpService):
results = []
#each result element is an array of [detail,httpMessage]
headerAlreadyAdded = False
requestInfo = self.helpers.analyzeRequest(baseRequestResponse)
headers = requestInfo.getHeaders()
for index, header in enumerate(headers):
if header.split(" ")[0].lower() == payload.split(" ")[0].lower(): #if header already exist
headers[index] = payload
headerAlreadyAdded = True
if headerAlreadyAdded == False:
headers.append(payload)
requestBody = baseRequestResponse.getRequest()[requestInfo.getBodyOffset():]
headersAsJavaSublist = ArrayList()
for header in headers:
headersAsJavaSublist.add(String(header))
newRequest = self.helpers.buildHttpMessage(headersAsJavaSublist, requestBody)
newRequestResult = self.callbacks.makeHttpRequest(httpService, newRequest)
newRequestStatusCode = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getStatusCode())
if newRequestStatusCode == "200":
originalRequestUrl = str(baseRequestResponse.getUrl())
responseHeaders = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getHeaders()).split(",")
resultContentLength = "No CL in response"
for header in responseHeaders:
if "Content-Length: " in header:
resultContentLength = header[17:]
if resultContentLength[-1] == ']': # happens if CL header is the last header in response
resultContentLength = resultContentLength.rstrip(']')
issue = []
issue.append("<tr><td>" + str(requestNum) + "</td><td>" + originalRequestUrl + "</td><td>" + payload + "</td> <td>" + newRequestStatusCode + "</td> <td>" + resultContentLength + "</td></tr>")
issue.append(newRequestResult)
results.append(issue)
if len(results) > 0:
return results
else:
return None
def tryBypassWithPOSTAndEmptyCL(self, baseRequestResponse, httpService):
issue = []
requestInfo = self.helpers.analyzeRequest(baseRequestResponse)
headers = requestInfo.getHeaders()
headers[0] = headers[0].replace("GET", "POST")
headers.append("Content-Length: 0")
headersAsJavaSublist = ArrayList()
for header in headers:
headersAsJavaSublist.add(String(header))
requestBody = baseRequestResponse.getRequest()[requestInfo.getBodyOffset():]
newRequest = self.helpers.buildHttpMessage(headersAsJavaSublist, requestBody)
newRequestResult = self.callbacks.makeHttpRequest(httpService, newRequest)
newRequestStatusCode = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getStatusCode())
if newRequestStatusCode == "200":
responseHeaders = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getHeaders()).split(",")
requestUrl = str(baseRequestResponse.getUrl())
resultContentLength = "No CL in response"
for header in responseHeaders:
if "Content-Length: " in header:
resultContentLength = header[17:]
if resultContentLength[-1] == ']': # happens if CL header is the last header in response
resultContentLength = resultContentLength.rstrip(']')
requestNum = 2
issue.append("<tr><td>" + str(requestNum) + "</td><td>" + requestUrl + "</td> <td>" + newRequestStatusCode + "</td> <td>" + resultContentLength + "</td></tr>")
issue.append(newRequestResult)
if len(issue) > 0:
return issue
else:
return None
def tryBypassWithDowngradedHttpAndNoHeaders(self, baseRequestResponse, httpService):
issue = []
requestInfo = self.helpers.analyzeRequest(baseRequestResponse)
headers = requestInfo.getHeaders()
newHeader = headers[0].replace("HTTP/1.1", "HTTP/1.0")
requestBody = baseRequestResponse.getRequest()[requestInfo.getBodyOffset():]
headersAsJavaSublist = ArrayList()
headersAsJavaSublist.add(String(newHeader))
newRequest = self.helpers.buildHttpMessage(headersAsJavaSublist, requestBody)
newRequestResult = self.callbacks.makeHttpRequest(httpService, newRequest)
newRequestStatusCode = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getStatusCode())
if newRequestStatusCode == "200":
responseHeaders = str(self.helpers.analyzeResponse(newRequestResult.getResponse()).getHeaders()).split(",")
requestUrl = str(baseRequestResponse.getUrl())
resultContentLength = "No CL in response"
for header in responseHeaders:
if "Content-Length: " in header:
resultContentLength = header[17:]
if resultContentLength[-1] == ']': # happens if CL header is the last header in response
resultContentLength = resultContentLength.rstrip(']')
requestNum = 2
issue = []
issue.append("<tr><td>" + str(requestNum) + "</td><td>" + requestUrl + "</td> <td>" + newRequestStatusCode + "</td> <td>" + resultContentLength + "</td></tr>")
issue.append(newRequestResult)
if len(issue) > 0:
return issue
else:
return None
def doPassiveScan(self, baseRequestResponse):
return None
def doActiveScan(self, baseRequestResponse, insertionPoint, isCalledFromMenu=False):
response = self.helpers.analyzeResponse(baseRequestResponse.getResponse())
if self.isInteresting(response) == False and isCalledFromMenu == False:
return None
else:
issues = self.testRequest(baseRequestResponse)
if issues != None:
if isCalledFromMenu == True:
for i in range(len(issues)):
self.callbacks.addScanIssue(issues[i])
else:
return issues
else:
return None
def testRequest(self, baseRequestResponse):
queryPayloadsResults = []
headerPayloadsResults = []
findings = []
httpService = baseRequestResponse.getHttpService()
#test for query-based issues
queryPayloadsFromTable = []
for rowIndex in range(self.frm.queryPayloadsTable.getRowCount()):
queryPayloadsFromTable.append(str(self.frm.queryPayloadsTable.getValueAt(rowIndex, 0)))
for payload in queryPayloadsFromTable:
payload = payload.rstrip('\n')
result = self.tryBypassWithQueryPayload(baseRequestResponse, payload, httpService)
if result != None:
queryPayloadsResults += result
#process query-based results
if len(queryPayloadsResults) > 0:
issueDetails = []
issueHttpMessages = []
issueHttpMessages.append(baseRequestResponse)
for issue in queryPayloadsResults:
issueDetails.append(issue[0])
issueHttpMessages.append(issue[1])
findings.append(
CustomScanIssue(
httpService,
self.helpers.analyzeRequest(baseRequestResponse).getUrl(),
issueHttpMessages,
"Possible 403 Bypass",
"<table><tr><td>Request #</td><td>URL</td><td>Status Code</td><td>Content Length</td></tr>" + "".join(issueDetails) + "</table>",
"High",
)
)
#test for header-based issues
global requestNum
requestNum = 2
headerPayloadsFromTable = []
for rowIndex in range(self.frm.headerPayloadsTable.getRowCount()):
headerPayloadsFromTable.append(str(self.frm.headerPayloadsTable.getValueAt(rowIndex, 0)))
for payload in headerPayloadsFromTable:
payload = payload.rstrip('\n')
result = self.tryBypassWithHeaderPayload(baseRequestResponse, payload, httpService)
if result != None:
headerPayloadsResults += result
#process header-based results
if len(headerPayloadsResults) > 0:
issueDetails = []
issueHttpMessages = []
issueHttpMessages.append(baseRequestResponse)
for issue in headerPayloadsResults:
issueDetails.append(issue[0])
issueHttpMessages.append(issue[1])
findings.append(
CustomScanIssue(
httpService,
self.helpers.analyzeRequest(baseRequestResponse).getUrl(),
issueHttpMessages,
"Possible 403 Bypass - Header Based",
"<table><tr><td>Request #</td><td>URL</td><td>Header</td><td>Status Code</td><td>Content Length</td></tr>" + "".join(issueDetails) + "</table>",
"High",
)
)
#replace GET with POST and empty Content-Length
requestInfo = self.helpers.analyzeRequest(baseRequestResponse)
requestHeaders = requestInfo.getHeaders()
if requestHeaders[0].startswith("GET"):
postAndEmptyCLResult = self.tryBypassWithPOSTAndEmptyCL(baseRequestResponse, httpService)
if postAndEmptyCLResult != None:
issueDetails = []
issueHttpMessages = []
issueHttpMessages.append(baseRequestResponse)
issueDetails.append(postAndEmptyCLResult[0])
issueHttpMessages.append(postAndEmptyCLResult[1])
findings.append(
CustomScanIssue(
httpService,
self.helpers.analyzeRequest(baseRequestResponse).getUrl(),
issueHttpMessages,
"Possible 403 Bypass - Different Request Method",
"<table><tr><td>Request #</td><td>URL</td><td>Status Code</td><td>Content Length</td></tr>" + "".join(issueDetails) + "</table>",
"High",
)
)
#change the protocol to HTTP/1.0 and remove all other headers
downgradedHttpResult = self.tryBypassWithDowngradedHttpAndNoHeaders(baseRequestResponse, httpService)
if downgradedHttpResult != None:
issueDetails = []
issueHttpMessages = []
issueHttpMessages.append(baseRequestResponse)
issueDetails.append(downgradedHttpResult[0])
issueHttpMessages.append(downgradedHttpResult[1])
findings.append(
CustomScanIssue(
httpService,
self.helpers.analyzeRequest(baseRequestResponse).getUrl(),
issueHttpMessages,
"Possible 403 Bypass - Downgraded HTTP Version",
"<table><tr><td>Request #</td><td>URL</td><td>Status Code</td><td>Content Length</td></tr>" + "".join(issueDetails) + "</table>",
"High",
)
)
if findings:
return findings
else:
return None
def consolidateDuplicateIssues(self, existingIssue, newIssue):
if (existingIssue.getIssueDetail() == newIssue.getIssueDetail()):
return -1
else:
return 0
class CustomScanIssue (IScanIssue):
def __init__(self, httpService, url, httpMessages, name, detail, severity):
self._httpService = httpService
self._url = url
self._httpMessages = httpMessages
self._name = name
self._detail = detail
self._severity = severity
def getUrl(self):
return self._url
def getIssueName(self):
return self._name
def getIssueType(self):
return 0
def getSeverity(self):
return self._severity
def getConfidence(self):
return "Firm"
def getIssueBackground(self):
return extentionName + " sent a request and got 403 response. " + extentionName + " sent another request and got 200 response, this may indicate a misconfiguration on the server side that allows access to forbidden pages."
def getRemediationBackground(self):
pass
def getIssueDetail(self):
return self._detail
def getRemediationDetail(self):
pass
def getHttpMessages(self):
return self._httpMessages
def getHttpService(self):
return self._httpService