This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvulnerability.py
155 lines (124 loc) · 5.77 KB
/
vulnerability.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
"""
Vulnerability class
"""
import re
class Vulnerability(object):
"""
A class for representing the vulnerabilities
"""
def __init__(self, name: str, regex: str) -> None:
"""
Constructor for Vulnerability class
:param name: The name of the vulnerability
:param regex: The regular expression of the vulnerability
"""
self.name = name
self.regex = re.compile(regex, re.I | re.S)
vulnerability_list.append(self)
vulnerability_list = []
# Broken Access Control
Vulnerability(
'Broken Access Control',
'(fix|prevent|protect|patch|found).* ((impro.* (auth|access.* control))|url.* access)|((impro.* (auth|access.* control))|url.* access).* (fix|prevent|protect|patch|found)|insec.* direct obj.* ref.*|direct ref.*|auth.* bypass.* control'
)
# Broken Authentication and Session Management
Vulnerability(
'Broken Authentication and Session Management',
'brute.*force|sess.*hijack|broken auth|auth.* brok|auth.* bypass|sess.* fixation|(cred|pass|session ?id|connect).*(plaintext|un(hash|salt|encrypt|safe))|(plaintext|un(hash|salt|encrypt|safe)).*(cred|pass|session ?id|connect)|(weak|bad|unsafe).* pass.* verif.*|fix.* (url rewriting|rewriting url)|timeout.*(session|auth.* token)'
)
# Buffer Overflow
Vulnerability('Buffer Overflow', 'buff.* overflow')
# Bug Tracker Issue
Vulnerability(
'Bug Tracker Issue',
r'fix.* https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)'
)
# Context Leaks
Vulnerability(
'Context Leaks',
'(fix|rem|patch|found|prevent).*context leak|context leak.*(fix|removed?|patch|found|prevent)'
)
# Cross-Site Request Forgery
Vulnerability(
'Cross-Site Request Forgery',
'(fix|prevent|protect|found|patch).*(cross([- ])?site.*(req|ref).*forgery|csrf|sea.*surf|xsrf)|(cross([- ])?site.*(req|ref).*forgery|csrf|sea.*surf|xsrf).*(fix|prevent|protect|found|patch)|(one.*click|autom).*attack|sess.*riding|conf.*deput'
)
# Cross-Site Scripting
Vulnerability(
'Cross-Site Scripting',
'(fix|prevent|protect|found|patch).* (xss|cross.*(site|zone) script|script.* attack)|(xss|cross.*(site|zone) script|script.* attack).* (fix|prevent|protect|found|patch)|crlf injec|http resp.* split|(reflect|stored|dom).*xss|xss.*(reflect|stored|dom)|xss (vuln|attack|issue)|(validate|sanitize).* (un(trusted|safe)|malicious)'
)
# Distributed Denial-of-Service / Denial-of-Service
Vulnerability(
'Distributed Denial-of-Service / Denial-of-Service',
'(dos|((distributed)? denial.*of.*service)|ddos|deadlocks?)'
)
# Encryption Issues
Vulnerability(
'Encryption Issues',
r'encrypt.*(bug|vulnerab|problem|defect|warning|issue|weak|attack|flaw|fault|error)|(en|de)crypt.*|cipher|\btls\b|\brsa\b|ssl'
)
# Hard Coded
Vulnerability('Hard Coded', 'hard[\s-]coded?')
# Injection
Vulnerability(
'Injection',
'(sql|http header|xxe|nosql|ldap|regex|xpath|xquery|code|queries|xml|html|(shell|os |oper.*sys.*|co?m?ma?n?d)|e-?mail).*injec.*|(patch|fix|prevent|found|protect).*(injec| sqli | osci )|(injec|sqli |osci ).*(patch|fix|prevent|found|protect)|(sanitiz).* headers?|headers? sanitized?.*|quer.* parameterized?|(parameterized?).* quer.*'
)
# Insufficient Attack Protection
Vulnerability(
'Insufficient Attack Protection',
'(detect|block|answer|respond|prevent).* (attack|expolit)|(attack|expolit).* (detect|block|answer|respond|prevent)'
)
# Memory Leaks
Vulnerability(
'Memory Leaks',
'(fix|rem|patch|found|prevent).* mem.* leak|mem.* leak (fix|removed?|patch|found|prevent)'
)
# Miscellaneous
Vulnerability(
'Miscellaneous',
'(fix|found|prevent|protect|patch).*sec.*(bug|vulnerab|problem|defect|warning|issue|weak|attack|flaw|fault|error)|sec.* (bug|vulnerab|problem|defect|warning|issue|weak|attack|flaw|fault|error).*(fix|found|prevent|protect|patch)|(sec|kern)?.*harden.*|vulnerab|attack|cve|nvd|cwe'
)
# Null Pointers
Vulnerability('Null Pointers', 'null[\s-]pointers?|nullpointerexception')
# Overflow
Vulnerability(
'Overflow',
'(fix|rem|patch|found|prevent).* overflow|overflow.* (fix|removed?|patch|found|prevent)'
)
# Resource Leaks
Vulnerability(
'Resource Leaks',
'(fix|rem|patch|found|prevent).* resource.* leaks|resource.* leaks (fix|removed?|patch|found|prevent)'
)
# Path / Directory Traversal
Vulnerability(
'Path / Directory Traversal',
'((path|dir.*) traver.*|(dot-dot-slash|directory traversal|directory climbing|backtracking).*(attack|vuln))'
)
# SHA-1 collision
Vulnerability(
'SHA-1 Collision',
'sha-?1 collision'
)
# Security Misconfiguration
Vulnerability(
'Security Misconfiguration',
'(rem|del).*(pass.*|cred.*|confid.*info)|(fix|update|patch|protect|prevent).*(misconfig.*|vuln.*config.*)|access.*((default|admin).*(account|cred).*|un(used.*(page|url)|patch.*(flaw|issue|vuln|problem|weak).*|protect.*(file|dir).*|log|backup))'
)
# Sensitive Data Exposure
Vulnerability(
'Sensitive Data Exposure',
r'(fix|prevent|found|protect|patch).* (man.*in.*midle|mitm|bucket.*brig)|(un|not).*encrypt.*data|(weak|bad|unsafe).*(pass.* hash|key (gener.*|manag.*))|(important|safe).* header(s)? miss|unsafe.* crypto|(fix|change|update|add).* (http(?!s?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))|sec.*cookie.* flag)|rem.* http(?!s?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))|(fix|rem).* (secret.*key|hash collision)|(patch|fix|prevent|upgrade|protect).* (sha([- ])?1|md5|md2|md4|(3)?des|collision)'
)
# Using Components with Known Vulnerabilities
Vulnerability(
'Using Components with Known Vulnerabilities',
'(vuln|(un|not )safe|malicious|danger).* (version|dependenc|component|librar).*'
)
# Underprotected APIs
Vulnerability(
'Underprotected APIs',
'(fix|protect).* api|(?<!.)api.* (fix|protect)|secure.* commun.*'
)