-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolaris.py
73 lines (31 loc) · 1.04 KB
/
solaris.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
from flask import Flask, request, make_response
import subprocess
import os
import pickle
app = Flask(__name__)
# Insecure Deserialization
@app.route('/unpickle', methods=['POST'])
def unpickle():
data = request.data # This could be user-controlled
obj = pickle.loads(data) # Insecure deserialization
return "Object deserialized!"
# Command Injection
@app.route('/cmd')
def cmd():
cmd = request.args.get("cmd") # User-controlled input
return subprocess.check_output(cmd, shell=True) # Command injection
# Path Traversal
@app.route('/get-file')
def get_file():
filename = request.args.get("filename") # User input
with open(filename, 'r') as f: # Path traversal
content = f.read()
return content
# Incorrect Use of make_response() Leading to XSS
@app.route('/xss')
def xss():
response = make_response("Hello, World!")
response.headers['Content-Type'] = "application/javascript" # Potential XSS
return response
if __name__ == '__main__':
app.run(debug=True)