forked from moloch--/CSP-Bypass
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathburp_scanner_issues.py
271 lines (201 loc) · 7.5 KB
/
burp_scanner_issues.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
"""
@author: moloch
Scanner issues reported by the plugin.
"""
# pylint: disable=E0602,C0103,W0621
from burp import IScanIssue
class BaseCSPIssue(IScanIssue):
""" Just a base class with some helpful docstrings """
def __init__(self, httpService, url, httpMessages, severity, confidence,
directive=None):
"""
Setters for all the getters, `directive' and `payload' are optional
"""
self._httpService = httpService
self._url = url
self._httpMessages = httpMessages
self._severity = severity
self._confidence = confidence
self._directive = directive
def getUrl(self):
"""
This method returns the URL for which the issue was generated.
@return The URL for which the issue was generated.
"""
return self._url
def getIssueName(self):
"""
This method returns the name of the issue type.
@return The name of the issue type (e.g. "SQL injection").
"""
raise NotImplementedError()
def getIssueType(self):
"""
This method returns a numeric identifier of the issue type. See the Burp
Scanner help documentation for a listing of all the issue types.
@return A numeric identifier of the issue type.
"""
return 0 # https://portswigger.net/burp/help/scanner_issuetypes.html
def getSeverity(self):
"""
This method returns the issue severity level.
@return The issue severity level. Expected values are "High", "Medium",
"Low", "Information" or "False positive".
"""
return self._severity
def getConfidence(self):
"""
This method returns the issue confidence level.
@return The issue confidence level. Expected values are "Certain", "Firm"
or "Tentative".
"""
return self._confidence
def getIssueBackground(self):
"""
This method returns a background description for this type of issue.
@return A background description for this type of issue, or
<code>null</code> if none applies.
"""
raise NotImplementedError()
def getRemediationBackground(self):
"""
This method returns a background description of the remediation for this
type of issue.
@return A background description of the remediation for this type of
issue, or
<code>null</code> if none applies.
"""
raise NotImplementedError()
def getIssueDetail(self):
"""
This method returns detailed information about this specific instance of
the issue.
@return Detailed information about this specific instance of the issue,
or
<code>null</code> if none applies.
"""
raise NotImplementedError()
def getRemediationDetail(self):
"""
This method returns detailed information about the remediation for this
specific instance of the issue.
@return Detailed information about the remediation for this specific
instance of the issue, or
<code>null</code> if none applies.
"""
raise NotImplementedError()
def getHttpMessages(self):
"""
This method returns the HTTP messages on the basis of which the issue was
generated.
@return The HTTP messages on the basis of which the issue was generated.
Note: The items in this array should be instances of
<code>IHttpRequestResponseWithMarkers</code> if applicable, so that
details of the relevant portions of the request and response messages are
available.
"""
if isinstance(self._httpMessages, list):
return self._httpMessages
else:
return [self._httpMessages]
def getHttpService(self):
"""
This method returns the HTTP service for which the issue was generated.
@return The HTTP service for which the issue was generated.
"""
return self._httpService
class WildcardContentSource(BaseCSPIssue):
def getIssueName(self):
return "Wildcard Content Source: %s" % self._directive
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class UnsafeContentSource(BaseCSPIssue):
def getIssueName(self):
return "Unsafe Content Source: %s" % self._directive
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class InsecureContentDirective(BaseCSPIssue):
def getIssueName(self):
return "Insecure Content Source: %s" % self._directive
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class MissingDirective(BaseCSPIssue):
def getIssueName(self):
return "Missing CSP Directive: %s" % self._directive
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class WeakDefaultSource(BaseCSPIssue):
def getIssueName(self):
return "Weak default-src Directive"
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class DeprecatedHeader(BaseCSPIssue):
def getIssueName(self):
return "Deprecated Header"
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return "Issue details"
def getRemediationDetail(self):
return "Remediation details"
class KnownCSPBypass(BaseCSPIssue):
# pylint: disable=W0231
def __init__(self, httpService, url, httpMessages, severity, confidence,
directive=None, bypass=None):
"""
Burp uses old style classes so we can't use super()
"""
self._httpService = httpService
self._url = url
self._httpMessages = httpMessages
self._severity = severity
self._confidence = confidence
self._directive = directive
self._bypass = bypass
def getIssueName(self):
return "Known CSP Bypass: %s" % self._directive
def getIssueBackground(self):
return "Issue background"
def getRemediationBackground(self):
return "Remediation background"
def getIssueDetail(self):
return """
A known bypass exists in the %s directive for the domain "%s"
Example Payload: %s
""" % (self._directive, self._bypass[0], self._bypass[1])
def getRemediationDetail(self):
return """
Remove the content source \"%s\" domain from your %s CSP directive.
""" % (self._bypass[0], self._directive)