forked from viveksabbani/CAP6614_Final_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPython-project-2-scan.json
296 lines (296 loc) · 11.4 KB
/
Python-project-2-scan.json
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
{
"errors": [],
"generated_at": "2024-11-26T05:10:59Z",
"metrics": {
".\\Python-project-2\\vulnerable-employee-system.py": {
"CONFIDENCE.HIGH": 9,
"CONFIDENCE.LOW": 1,
"CONFIDENCE.MEDIUM": 3,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 3,
"SEVERITY.LOW": 6,
"SEVERITY.MEDIUM": 4,
"SEVERITY.UNDEFINED": 0,
"loc": 143,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 9,
"CONFIDENCE.LOW": 1,
"CONFIDENCE.MEDIUM": 3,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 3,
"SEVERITY.LOW": 6,
"SEVERITY.MEDIUM": 4,
"SEVERITY.UNDEFINED": 0,
"loc": 143,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "2 import sqlite3\n3 import subprocess\n4 import pickle\n",
"col_offset": 0,
"end_col_offset": 17,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with the subprocess module.",
"line_number": 3,
"line_range": [
3
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b404-import-subprocess",
"test_id": "B404",
"test_name": "blacklist"
},
{
"code": "3 import subprocess\n4 import pickle\n5 import base64\n",
"col_offset": 0,
"end_col_offset": 13,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 502,
"link": "https://cwe.mitre.org/data/definitions/502.html"
},
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with pickle module.",
"line_number": 4,
"line_range": [
4
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b403-import-pickle",
"test_id": "B403",
"test_name": "blacklist"
},
{
"code": "8 from flask import Flask, request, jsonify, session, render_template_string\n9 import xml.etree.ElementTree as ET\n10 \n",
"col_offset": 0,
"end_col_offset": 34,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 20,
"link": "https://cwe.mitre.org/data/definitions/20.html"
},
"issue_severity": "LOW",
"issue_text": "Using xml.etree.ElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.",
"line_number": 9,
"line_range": [
9
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b405-import-xml-etree",
"test_id": "B405",
"test_name": "blacklist"
},
{
"code": "11 app = Flask(__name__)\n12 app.secret_key = \"dev_secret_key_123\" # Vulnerability #1: Hardcoded secret key\n13 \n",
"col_offset": 17,
"end_col_offset": 37,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "MEDIUM",
"issue_cwe": {
"id": 259,
"link": "https://cwe.mitre.org/data/definitions/259.html"
},
"issue_severity": "LOW",
"issue_text": "Possible hardcoded password: 'dev_secret_key_123'",
"line_number": 12,
"line_range": [
12
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b105_hardcoded_password_string.html",
"test_id": "B105",
"test_name": "hardcoded_password_string"
},
{
"code": "44 cursor = conn.cursor()\n45 query = f\"SELECT * FROM employees WHERE name LIKE '%{name}%'\" # SQL Injection vulnerability\n46 cursor.execute(query)\n",
"col_offset": 12,
"end_col_offset": 65,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "LOW",
"issue_cwe": {
"id": 89,
"link": "https://cwe.mitre.org/data/definitions/89.html"
},
"issue_severity": "MEDIUM",
"issue_text": "Possible SQL injection vector through string-based query construction.",
"line_number": 45,
"line_range": [
45
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b608_hardcoded_sql_expressions.html",
"test_id": "B608",
"test_name": "hardcoded_sql_expressions"
},
{
"code": "56 command = f\"cat employees.db > exports/{filename}.{format_type}\" # Command injection vulnerability\n57 os.system(command)\n58 return f\"Data exported to {filename}.{format_type}\"\n",
"col_offset": 4,
"end_col_offset": 22,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "HIGH",
"issue_text": "Starting a process with a shell, possible injection detected, security issue.",
"line_number": 57,
"line_range": [
57
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b605_start_process_with_a_shell.html",
"test_id": "B605",
"test_name": "start_process_with_a_shell"
},
{
"code": "65 decoded = base64.b64decode(data)\n66 employee_data = pickle.loads(decoded) # Insecure deserialization\n67 return f\"Imported data for {employee_data['name']}\"\n",
"col_offset": 24,
"end_col_offset": 45,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 502,
"link": "https://cwe.mitre.org/data/definitions/502.html"
},
"issue_severity": "MEDIUM",
"issue_text": "Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.",
"line_number": 66,
"line_range": [
66
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_calls.html#b301-pickle",
"test_id": "B301",
"test_name": "blacklist"
},
{
"code": "85 xml_data = request.data\n86 tree = ET.parse(xml_data) # XXE vulnerability\n87 root = tree.getroot()\n",
"col_offset": 11,
"end_col_offset": 29,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 20,
"link": "https://cwe.mitre.org/data/definitions/20.html"
},
"issue_severity": "MEDIUM",
"issue_text": "Using xml.etree.ElementTree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called",
"line_number": 86,
"line_range": [
86
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree",
"test_id": "B314",
"test_name": "blacklist"
},
{
"code": "91 def hash_password(password):\n92 return hashlib.md5(password.encode()).hexdigest() # Weak hashing algorithm\n93 \n",
"col_offset": 11,
"end_col_offset": 41,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 327,
"link": "https://cwe.mitre.org/data/definitions/327.html"
},
"issue_severity": "HIGH",
"issue_text": "Use of weak MD5 hash for security. Consider usedforsecurity=False",
"line_number": 92,
"line_range": [
92
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b324_hashlib.html",
"test_id": "B324",
"test_name": "hashlib"
},
{
"code": "103 cursor = conn.cursor()\n104 cursor.execute(f\"SELECT salary FROM employees WHERE id = {id}\") # IDOR vulnerability\n105 salary = cursor.fetchone()\n",
"col_offset": 19,
"end_col_offset": 66,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "MEDIUM",
"issue_cwe": {
"id": 89,
"link": "https://cwe.mitre.org/data/definitions/89.html"
},
"issue_severity": "MEDIUM",
"issue_text": "Possible SQL injection vector through string-based query construction.",
"line_number": 104,
"line_range": [
104
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b608_hardcoded_sql_expressions.html",
"test_id": "B608",
"test_name": "hardcoded_sql_expressions"
},
{
"code": "128 \n129 subprocess.run(['cp', 'employees.db', f'exports/{filename}.db'],\n130 capture_output=True, text=True, check=True)\n131 return f\"Data exported to {filename}.db\"\n",
"col_offset": 4,
"end_col_offset": 61,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "LOW",
"issue_text": "Starting a process with a partial executable path",
"line_number": 129,
"line_range": [
129,
130
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b607_start_process_with_partial_path.html",
"test_id": "B607",
"test_name": "start_process_with_partial_path"
},
{
"code": "128 \n129 subprocess.run(['cp', 'employees.db', f'exports/{filename}.db'],\n130 capture_output=True, text=True, check=True)\n131 return f\"Data exported to {filename}.db\"\n",
"col_offset": 4,
"end_col_offset": 61,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "LOW",
"issue_text": "subprocess call - check for execution of untrusted input.",
"line_number": 129,
"line_range": [
129,
130
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b603_subprocess_without_shell_equals_true.html",
"test_id": "B603",
"test_name": "subprocess_without_shell_equals_true"
},
{
"code": "188 init_db()\n189 app.run(debug=True) # Additional vulnerability: Debug mode enabled in production\n",
"col_offset": 4,
"end_col_offset": 23,
"filename": ".\\Python-project-2\\vulnerable-employee-system.py",
"issue_confidence": "MEDIUM",
"issue_cwe": {
"id": 94,
"link": "https://cwe.mitre.org/data/definitions/94.html"
},
"issue_severity": "HIGH",
"issue_text": "A Flask app appears to be run with debug=True, which exposes the Werkzeug debugger and allows the execution of arbitrary code.",
"line_number": 189,
"line_range": [
189
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b201_flask_debug_true.html",
"test_id": "B201",
"test_name": "flask_debug_true"
}
]
}