forked from PortSwigger/BChecks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uuid-detected-guid-versions.bcheck
210 lines (191 loc) · 9.82 KB
/
uuid-detected-guid-versions.bcheck
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
metadata:
language: v1-beta
name: "UUID detected"
description: "This bcheck template passively identifies and reports the use of various UUID versions within application."
author: "vavkamil"
tags: "passive", "guid", "uuid"
define:
# Modify config based on the application you are testing :)
config_check_request = "False" # It will return a lot of noise, like cookies
config_check_response = "True" # It will return a lot of noise, like response headers
config_request_url = "False" # It will identify GET/POST/PUT/PATCH requests from Frontend with no UUID in response
config_request_body = "False" # It will identify POST/PUT/PATCH requests from Frontend with no UUID in response
####################################################################################################
references = "References
- https://www.intruder.io/research/in-guid-we-trust
- https://portswigger.net/bappstore/65f32f209a72480ea5f1a0dac4f38248
- https://datatracker.ietf.org/doc/html/rfc4122"
####################################################################################################
issueDetail_uuid_v1 = `The request/response contains GUID Version 1 at
{latest.request.url}
The GUID is generated using
- Current timestamp
- A clock sequence that remains static for the duration of the system's uptime
- A node ID, often based on the system's MAC address (if accessible).
{references}`
####################################################################################################
issueDetail_uuid_v3 = `The request/response contains GUID Version 3 at
{latest.request.url}
The GUID is generated using the MD5 hash of a name combined with a namespace ID.
{references}`
####################################################################################################
issueDetail_uuid_v4 = `The request/response contains GUID Version 4 at
{latest.request.url}
The GUID is generated randomly, making it unpredictable and more complicated to reproduce.
It's considered safer for most use-cases compared to other versions, although its entropy should be checked.
{references}`
####################################################################################################
issueDetail_uuid_v5 = `The request/response contains GUID Version 5 at
{latest.request.url}
The GUID is generated using the SHA-1 hash of a name combined with a namespace ID.
{references}`
####################################################################################################
issueRemediation = "The application should use GUID v4, which is randomly generated.
An attacker might be able to generate UUID using predictable data."
####################################################################################################
issueRemediation_ok = "The application is using GUID v4, which is randomly generated."
given response then
# Check UUID anywhere in response
if {config_check_response} matches "True" then
# UUID v1 - RFC 4122 variant
# Example: 0f9a9c50-79b9-11ee-b962-0242ac120002
if {base.response} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: high
confidence: firm
detail: `{issueDetail_uuid_v1}`
remediation: `{issueRemediation}`
# UUID v3 - RFC 4122 variant
# Example: 3d813cbb-47fb-32ba-91df-831e1593ac29
else if {base.response} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[3][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v3}`
remediation: `{issueRemediation}`
# UUID v4 - RFC 4122 variant
# Example: 9f1e379d-e839-4d3a-9c2a-1d4dde67f75c
else if {base.response} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[4][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: info
confidence: firm
detail: `{issueDetail_uuid_v4}`
remediation: `{issueRemediation_ok}`
# UUID v5 - RFC 4122 variant
# Example: 74738ff5-5367-5958-9aee-98fffdcd1876
else if {base.response} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v5}`
remediation: `{issueRemediation}`
end if
end if
# Check UUID anywhere in request
if {config_check_request} matches "True" then
# UUID v1 - RFC 4122 variant
# Example: 0f9a9c50-79b9-11ee-b962-0242ac120002
if {base.request} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: high
confidence: firm
detail: `{issueDetail_uuid_v1}`
remediation: `{issueRemediation}`
# UUID v3 - RFC 4122 variant
# Example: 3d813cbb-47fb-32ba-91df-831e1593ac29
else if {base.request} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[3][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v3}`
remediation: `{issueRemediation}`
# UUID v4 - RFC 4122 variant
# Example: 9f1e379d-e839-4d3a-9c2a-1d4dde67f75c
else if {base.request} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[4][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: info
confidence: firm
detail: `{issueDetail_uuid_v4}`
remediation: `{issueRemediation_ok}`
# UUID v5 - RFC 4122 variant
# Example: 74738ff5-5367-5958-9aee-98fffdcd1876
else if {base.request} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v5}`
remediation: `{issueRemediation}`
end if
end if
# Check UUID in request URL
if {config_request_url} matches "True" then
# UUID v1 - RFC 4122 variant
# Example: 0f9a9c50-79b9-11ee-b962-0242ac120002
if {base.request.url} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: high
confidence: firm
detail: `{issueDetail_uuid_v1}`
remediation: `{issueRemediation}`
# UUID v3 - RFC 4122 variant
# Example: 3d813cbb-47fb-32ba-91df-831e1593ac29
else if {base.request.url} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[3][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v3}`
remediation: `{issueRemediation}`
# UUID v4 - RFC 4122 variant
# Example: 9f1e379d-e839-4d3a-9c2a-1d4dde67f75c
else if {base.request.url} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[4][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: info
confidence: firm
detail: `{issueDetail_uuid_v4}`
remediation: `{issueRemediation_ok}`
# UUID v5 - RFC 4122 variant
# Example: 74738ff5-5367-5958-9aee-98fffdcd1876
else if {base.request.url} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v5}`
remediation: `{issueRemediation}`
end if
end if
# Check UUID in request URL
if {config_request_body} matches "True" then
# UUID v1 - RFC 4122 variant
# Example: 0f9a9c50-79b9-11ee-b962-0242ac120002
if {base.request.body} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: high
confidence: firm
detail: `{issueDetail_uuid_v1}`
remediation: `{issueRemediation}`
# UUID v3 - RFC 4122 variant
# Example: 3d813cbb-47fb-32ba-91df-831e1593ac29
else if {base.request.body} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[3][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v3}`
remediation: `{issueRemediation}`
# UUID v4 - RFC 4122 variant
# Example: 9f1e379d-e839-4d3a-9c2a-1d4dde67f75c
else if {base.request.body} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[4][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: info
confidence: firm
detail: `{issueDetail_uuid_v4}`
remediation: `{issueRemediation_ok}`
# UUID v5 - RFC 4122 variant
# Example: 74738ff5-5367-5958-9aee-98fffdcd1876
else if {base.request.body} matches "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" then
report issue:
severity: low
confidence: firm
detail: `{issueDetail_uuid_v5}`
remediation: `{issueRemediation}`
end if
end if