codewatch-scan 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codewatch/__init__.py +0 -0
- codewatch/__main__.py +14 -0
- codewatch/asgi.py +16 -0
- codewatch/settings.py +175 -0
- codewatch/urls.py +40 -0
- codewatch/wsgi.py +16 -0
- codewatch_scan-0.1.0.dist-info/METADATA +81 -0
- codewatch_scan-0.1.0.dist-info/RECORD +136 -0
- codewatch_scan-0.1.0.dist-info/WHEEL +5 -0
- codewatch_scan-0.1.0.dist-info/entry_points.txt +4 -0
- codewatch_scan-0.1.0.dist-info/licenses/LICENSE +21 -0
- codewatch_scan-0.1.0.dist-info/top_level.txt +2 -0
- core/__init__.py +0 -0
- core/analyzers/__init__.py +19 -0
- core/analyzers/accessibility.py +199 -0
- core/analyzers/base.py +192 -0
- core/analyzers/body_models.py +154 -0
- core/analyzers/codewatch_checks.py +394 -0
- core/analyzers/constant_branches.py +251 -0
- core/analyzers/containers.py +316 -0
- core/analyzers/coverage.py +131 -0
- core/analyzers/dependencies.py +347 -0
- core/analyzers/drf_serializers.py +65 -0
- core/analyzers/else_branches.py +106 -0
- core/analyzers/extra.py +400 -0
- core/analyzers/flask_resources.py +65 -0
- core/analyzers/inline_scripts.py +50 -0
- core/analyzers/jinja_sandboxes.py +63 -0
- core/analyzers/match_statements.py +148 -0
- core/analyzers/multi_tools.py +888 -0
- core/analyzers/php_template_sinks.py +444 -0
- core/analyzers/project_checks.py +150 -0
- core/analyzers/python_tools.py +333 -0
- core/analyzers/route_converters.py +237 -0
- core/analyzers/slices.py +94 -0
- core/analyzers/starred_targets.py +42 -0
- core/analyzers/stored_fields.py +386 -0
- core/analyzers/summaries.py +1387 -0
- core/analyzers/template_sinks.py +162 -0
- core/api.py +360 -0
- core/apps.py +6 -0
- core/benchmark.py +955 -0
- core/bundled/catalog/codewatch/rules/javascript-crypto.yml +224 -0
- core/bundled/catalog/codewatch/rules/javascript-injection.yml +116 -0
- core/bundled/catalog/codewatch/rules/javascript-taint.yml +1539 -0
- core/bundled/catalog/codewatch/rules/javascript-web.yml +562 -0
- core/bundled/catalog/codewatch/rules/php-web.yml +719 -0
- core/bundled/catalog/codewatch/rules/python-crypto.yml +203 -0
- core/bundled/catalog/codewatch/rules/python-django.yml +267 -0
- core/bundled/catalog/codewatch/rules/python-injection.yml +115 -0
- core/bundled/catalog/codewatch/rules/python-web.yml +3382 -0
- core/bundled/catalog/custom/mappings.json +360 -0
- core/bundled/catalog/custom/overrides.json +4 -0
- core/bundled/catalog/custom/rules/django-settings.yml +19 -0
- core/bundled/catalog/imported/changes.json +5 -0
- core/bundled/catalog/imported/docs.json +1143 -0
- core/bundled/catalog/imported/meta.json +54 -0
- core/bundled/catalog/imported/rules.json +85421 -0
- core/bundled/catalog/imported/standards.json +11191 -0
- core/bundled/tools/analyzers.lock +786 -0
- core/bundled/tools/axe-scan.mjs +45 -0
- core/bundled/tools/checkov.lock +2463 -0
- core/bundled/tools/codewatch-checks.mjs +99 -0
- core/bundled/tools/eslint-a11y.config.js +16 -0
- core/bundled/tools/eslint-quality.config.js +63 -0
- core/bundled/tools/eslint-typed.config.js +18 -0
- core/bundled/tools/package-lock.json +6102 -0
- core/bundled/tools/package.json +32 -0
- core/bundled/tools/rule-metadata.mjs +56 -0
- core/bundled/tools/semgrep.lock +1232 -0
- core/bundled/tools/stylelint.config.json +11 -0
- core/catalog/__init__.py +190 -0
- core/catalog/build.py +84 -0
- core/catalog/merge.py +122 -0
- core/catalog/sources.py +418 -0
- core/catalog/standards.py +119 -0
- core/catalog/update.py +99 -0
- core/catalog_views.py +115 -0
- core/client.py +645 -0
- core/collect.py +518 -0
- core/duplicates.py +60 -0
- core/fingerprint.py +25 -0
- core/folders.py +73 -0
- core/gate.py +77 -0
- core/git.py +149 -0
- core/jobs.py +86 -0
- core/management/__init__.py +0 -0
- core/management/commands/__init__.py +0 -0
- core/management/commands/addproject.py +40 -0
- core/management/commands/buildcatalog.py +15 -0
- core/management/commands/scan.py +74 -0
- core/management/commands/updatecatalog.py +14 -0
- core/mcp_server.py +140 -0
- core/middleware.py +17 -0
- core/migrations/0001_initial.py +115 -0
- core/migrations/0002_auth_tokens_a11y.py +60 -0
- core/migrations/0003_default_admin.py +43 -0
- core/migrations/0004_project_members.py +28 -0
- core/migrations/0005_uploads_and_sources.py +55 -0
- core/migrations/0006_thresholds.py +28 -0
- core/migrations/0007_also_reported_by.py +18 -0
- core/migrations/0008_new_code_period.py +18 -0
- core/migrations/0009_resolution_safe.py +18 -0
- core/migrations/0010_analysis_progress.py +18 -0
- core/migrations/0011_overall_gate_conditions.py +20 -0
- core/migrations/__init__.py +0 -0
- core/models.py +323 -0
- core/network.py +41 -0
- core/paths.py +29 -0
- core/ratings.py +67 -0
- core/runner.py +168 -0
- core/templates/core/account.html +30 -0
- core/templates/core/analysis.html +49 -0
- core/templates/core/base.html +121 -0
- core/templates/core/form_table.html +12 -0
- core/templates/core/gate_badge.html +1 -0
- core/templates/core/index.html +26 -0
- core/templates/core/issues.html +38 -0
- core/templates/core/login.html +13 -0
- core/templates/core/new_project.html +27 -0
- core/templates/core/password_change.html +10 -0
- core/templates/core/project.html +40 -0
- core/templates/core/rating.html +1 -0
- core/templates/core/ratings.html +32 -0
- core/templates/core/rule.html +33 -0
- core/templates/core/rules.html +42 -0
- core/templates/core/scan_progress.html +2 -0
- core/templates/core/settings.html +36 -0
- core/templates/core/source.html +15 -0
- core/templates/core/standards.html +30 -0
- core/templates/core/user_edit.html +15 -0
- core/templates/core/users.html +18 -0
- core/templatetags/__init__.py +0 -0
- core/templatetags/codewatch.py +42 -0
- core/tool_setup.py +68 -0
- core/views.py +564 -0
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
# codewatch built-in taint rules for PHP web apps: request data (superglobals and the common frameworks' request
|
|
2
|
+
# objects) reaching a dangerous call in the same function. PHP has no summary passes yet, so each rule sets
|
|
3
|
+
# `interprocedural: false`, which keeps it out of summaries.py (whose patterns are Python and JavaScript).
|
|
4
|
+
rules:
|
|
5
|
+
- id: codewatch.php.web.xss
|
|
6
|
+
mode: taint
|
|
7
|
+
languages: [php]
|
|
8
|
+
severity: ERROR
|
|
9
|
+
message: >-
|
|
10
|
+
Data from the HTTP request is written into the page without escaping. Escape it for where it goes:
|
|
11
|
+
htmlspecialchars($value, ENT_QUOTES) in HTML, esc_html()/esc_attr() in WordPress, e() or {{ }} in Laravel.
|
|
12
|
+
metadata: &xss-meta
|
|
13
|
+
category: security
|
|
14
|
+
subcategory: [vuln]
|
|
15
|
+
type: vulnerability
|
|
16
|
+
interprocedural: false
|
|
17
|
+
title: Request data in an HTML response without escaping
|
|
18
|
+
cwe: ["CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"]
|
|
19
|
+
owasp: ["A05:2025 - Injection"]
|
|
20
|
+
references:
|
|
21
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
|
|
22
|
+
- https://www.php.net/manual/en/function.htmlspecialchars.php
|
|
23
|
+
pattern-sources: &php-sources
|
|
24
|
+
- pattern-either:
|
|
25
|
+
- pattern: $_GET
|
|
26
|
+
- pattern: $_POST
|
|
27
|
+
- pattern: $_REQUEST
|
|
28
|
+
- pattern: $_COOKIE
|
|
29
|
+
- pattern: $_FILES[...]['name']
|
|
30
|
+
- patterns:
|
|
31
|
+
- pattern: $_SERVER[$KEY]
|
|
32
|
+
- metavariable-regex:
|
|
33
|
+
metavariable: $KEY
|
|
34
|
+
regex: ^['"](REQUEST_URI|PHP_SELF|PATH_INFO|QUERY_STRING|HTTP_[A-Z_]+)['"]$
|
|
35
|
+
- pattern: filter_input($TYPE, ...)
|
|
36
|
+
- pattern: filter_input_array(...)
|
|
37
|
+
- pattern: getallheaders()
|
|
38
|
+
- pattern: file_get_contents('php://input')
|
|
39
|
+
# Laravel, Symfony, CakePHP, CodeIgniter, Yii, Craft, Slim, Laminas, Joomla and Magento request objects.
|
|
40
|
+
- patterns:
|
|
41
|
+
- pattern-either:
|
|
42
|
+
- pattern: $REQ->$GET(...)
|
|
43
|
+
- pattern: $REQ->$BAG->$GET(...)
|
|
44
|
+
- metavariable-regex:
|
|
45
|
+
metavariable: $REQ
|
|
46
|
+
regex: ^\$(request|req|httpRequest|serverRequest)$
|
|
47
|
+
- metavariable-regex:
|
|
48
|
+
metavariable: $GET
|
|
49
|
+
regex: ^(input|get|query|post|all|only|except|cookie|header|getParam|getParams|getQuery|getQueryParam|getQueryParams|getBodyParam|getBodyParams|getParsedBody|getQueryString|getRequestUri|getPathInfo|getData|getPost|getCookie|getHeader|getContent|getUri|getValue|param|params|data|segment|get_post|post_get|getVar|getString|getRaw|getHtml|getUserParam)$
|
|
50
|
+
- patterns:
|
|
51
|
+
- pattern-either:
|
|
52
|
+
- pattern: request()->$GET(...)
|
|
53
|
+
- pattern: request($KEY)
|
|
54
|
+
- pattern: Request::$GET(...)
|
|
55
|
+
- pattern: Input::$GET(...)
|
|
56
|
+
- pattern: Yii::$app->request->$GET(...)
|
|
57
|
+
- pattern: Craft::$app->getRequest()->$GET(...)
|
|
58
|
+
- pattern: Craft::$app->request->$GET(...)
|
|
59
|
+
- pattern: $THIS->getRequest()->$GET(...)
|
|
60
|
+
- pattern: $THIS->request->$GET(...)
|
|
61
|
+
- pattern: $THIS->input->$GET(...)
|
|
62
|
+
- pattern: $APP->input->$GET(...)
|
|
63
|
+
- metavariable-regex:
|
|
64
|
+
metavariable: $GET
|
|
65
|
+
regex: ^(input|get|query|post|all|only|except|cookie|header|getParam|getParams|getQuery|getQueryParam|getQueryParams|getBodyParam|getBodyParams|getParsedBody|getQueryString|getRequestUri|getPathInfo|getData|getPost|getCookie|getHeader|getContent|getUri|getValue|param|params|data|segment|get_post|post_get|getVar|getString|getRaw|getHtml|getUserParam)$
|
|
66
|
+
- pattern: Tools::getValue(...)
|
|
67
|
+
# CakePHP 2's request properties, in controllers and views (MISP GHSA-p9m5: $this->request->data echoed
|
|
68
|
+
# by a .ctp view), and OpenCart's ($this->request->get['route'], GHSA-qx44). Not a bare $this->data or
|
|
69
|
+
# $this->params, which other classes use for their own state.
|
|
70
|
+
- patterns:
|
|
71
|
+
- pattern: $THIS->request->$PROP
|
|
72
|
+
- metavariable-regex:
|
|
73
|
+
metavariable: $PROP
|
|
74
|
+
regex: ^(data|query|pass|named|here|url|get|post|cookie)$
|
|
75
|
+
# Routing's free text only: params['action'] and ['controller'] are names the router matched.
|
|
76
|
+
- patterns:
|
|
77
|
+
- pattern: $THIS->request->params[$KEY]
|
|
78
|
+
- metavariable-regex:
|
|
79
|
+
metavariable: $KEY
|
|
80
|
+
regex: ^['"](named|pass)['"]$
|
|
81
|
+
# CakePHP's Referer header (MISP GHSA-p8fp printed it into a link); not a source for open-redirect,
|
|
82
|
+
# where going back to it is the idiom.
|
|
83
|
+
- pattern: $this->referer(...)
|
|
84
|
+
- pattern: $this->Controller->referer(...)
|
|
85
|
+
- pattern: $this->controller->referer(...)
|
|
86
|
+
- patterns:
|
|
87
|
+
- pattern: $THIS->params[$KEY]
|
|
88
|
+
- metavariable-regex:
|
|
89
|
+
metavariable: $KEY
|
|
90
|
+
regex: ^['"](named|pass|url|form|data)['"]$
|
|
91
|
+
- pattern: $THIS->passedArgs
|
|
92
|
+
pattern-sanitizers: &escaped
|
|
93
|
+
- patterns:
|
|
94
|
+
- pattern-either:
|
|
95
|
+
- pattern: htmlspecialchars(...)
|
|
96
|
+
- pattern: htmlentities(...)
|
|
97
|
+
- pattern: strip_tags(...)
|
|
98
|
+
- pattern: e(...)
|
|
99
|
+
- pattern: h(...)
|
|
100
|
+
- pattern: esc_html(...)
|
|
101
|
+
- pattern: esc_attr(...)
|
|
102
|
+
- pattern: esc_url(...)
|
|
103
|
+
- pattern: esc_js(...)
|
|
104
|
+
- pattern: esc_textarea(...)
|
|
105
|
+
- pattern: esc_html__(...)
|
|
106
|
+
- pattern: esc_attr__(...)
|
|
107
|
+
- pattern: wp_kses(...)
|
|
108
|
+
- pattern: wp_kses_post(...)
|
|
109
|
+
- pattern: sanitize_text_field(...)
|
|
110
|
+
- pattern: sanitize_key(...)
|
|
111
|
+
- pattern: sanitize_title(...)
|
|
112
|
+
- pattern: sanitize_email(...)
|
|
113
|
+
- pattern: Html::encode(...)
|
|
114
|
+
- pattern: Html::escape(...)
|
|
115
|
+
- pattern: CHtml::encode(...)
|
|
116
|
+
- pattern: Xss::filter(...)
|
|
117
|
+
- pattern: Purifier::clean(...)
|
|
118
|
+
- pattern: $PURIFIER->purify(...)
|
|
119
|
+
- pattern: json_encode(...)
|
|
120
|
+
- pattern: urlencode(...)
|
|
121
|
+
- pattern: rawurlencode(...)
|
|
122
|
+
- pattern: http_build_query(...)
|
|
123
|
+
- pattern: filter_var($X, FILTER_SANITIZE_FULL_SPECIAL_CHARS, ...)
|
|
124
|
+
- pattern: filter_var($X, FILTER_SANITIZE_SPECIAL_CHARS, ...)
|
|
125
|
+
- pattern: filter_input($T, $N, FILTER_SANITIZE_FULL_SPECIAL_CHARS, ...)
|
|
126
|
+
- pattern: filter_input($T, $N, FILTER_SANITIZE_SPECIAL_CHARS, ...)
|
|
127
|
+
# CakePHP's view helpers ($this->Html->link(), $this->Form->create()) escape what they are given; a
|
|
128
|
+
# component's $this->Controller is no helper (MISP GHSA-p8fp: ->referer() into ->set()).
|
|
129
|
+
- patterns:
|
|
130
|
+
- pattern: $THIS->$HELPER->$METHOD(...)
|
|
131
|
+
- metavariable-regex: {metavariable: $HELPER, regex: '^(?!Controller$)[A-Z][A-Za-z]*$'}
|
|
132
|
+
# An escaper called as a function or a method, named for what it does: Strings::htmlentities() (phpMyFAQ),
|
|
133
|
+
# escape_input() (phpIPAM), $escaper->escapeHtml() (Laminas, Magento).
|
|
134
|
+
- patterns:
|
|
135
|
+
- pattern-either:
|
|
136
|
+
- pattern: $F(...)
|
|
137
|
+
- pattern: $OBJ->$F(...)
|
|
138
|
+
- pattern: $CLS::$F(...)
|
|
139
|
+
- metavariable-regex:
|
|
140
|
+
metavariable: $F
|
|
141
|
+
regex: '(?i)^(html_?(entities|special_?chars|escape|encode|safe)|escape_?(html\w*|attr\w*|input|output|js|url)|esc_?(html|attr|url|js)\w*|encode_?html|sanitize_?(html|text|string|input|output)\w*|purify|xss_?clean|clean_?xss|remove_?xss)$'
|
|
142
|
+
# A named check that the value passed: `if ($this->isLocalUrl($request, $target)) { return
|
|
143
|
+
# $this->redirect($target); }` (GHSA-62f9), or one that said no and ended the request before the use.
|
|
144
|
+
- &php-checked
|
|
145
|
+
patterns:
|
|
146
|
+
- pattern-either:
|
|
147
|
+
- pattern-inside: if (<... $CHECK(..., $X, ...) ...>) { ... }
|
|
148
|
+
- pattern-inside: if (<... $OBJ->$CHECK(..., $X, ...) ...>) { ... }
|
|
149
|
+
- pattern-inside: if (<... $CLS::$CHECK(..., $X, ...) ...>) { ... }
|
|
150
|
+
- pattern-not-inside: if (<... !$CHECK(..., $X, ...) ...>) { ... }
|
|
151
|
+
- pattern-not-inside: if (<... !$OBJ->$CHECK(..., $X, ...) ...>) { ... }
|
|
152
|
+
- pattern-not-inside: if (<... !$CLS::$CHECK(..., $X, ...) ...>) { ... }
|
|
153
|
+
- metavariable-regex:
|
|
154
|
+
metavariable: $CHECK
|
|
155
|
+
regex: '(?i)^(is_?|check_?)?(safe|valid|allowed|permitted|trusted|whitelisted|allowlisted|local)\w{0,40}$'
|
|
156
|
+
- pattern: $X
|
|
157
|
+
- &php-guarded
|
|
158
|
+
patterns:
|
|
159
|
+
- pattern-either:
|
|
160
|
+
- pattern-inside: |
|
|
161
|
+
if (!$CHECK(..., $X, ...)) {
|
|
162
|
+
...
|
|
163
|
+
return ...;
|
|
164
|
+
}
|
|
165
|
+
...
|
|
166
|
+
- pattern-inside: |
|
|
167
|
+
if (!$CHECK(..., $X, ...)) {
|
|
168
|
+
...
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
...
|
|
172
|
+
- pattern-inside: |
|
|
173
|
+
if (!$CHECK(..., $X, ...)) {
|
|
174
|
+
...
|
|
175
|
+
exit;
|
|
176
|
+
}
|
|
177
|
+
...
|
|
178
|
+
- pattern-inside: |
|
|
179
|
+
if (!$CHECK(..., $X, ...)) {
|
|
180
|
+
...
|
|
181
|
+
exit(...);
|
|
182
|
+
}
|
|
183
|
+
...
|
|
184
|
+
- pattern-inside: |
|
|
185
|
+
if (!$CHECK(..., $X, ...)) {
|
|
186
|
+
...
|
|
187
|
+
die(...);
|
|
188
|
+
}
|
|
189
|
+
...
|
|
190
|
+
- pattern-inside: |
|
|
191
|
+
if (!$CHECK(..., $X, ...)) {
|
|
192
|
+
...
|
|
193
|
+
die;
|
|
194
|
+
}
|
|
195
|
+
...
|
|
196
|
+
- pattern-inside: |
|
|
197
|
+
if (!$CHECK(..., $X, ...)) {
|
|
198
|
+
...
|
|
199
|
+
throw $E;
|
|
200
|
+
}
|
|
201
|
+
...
|
|
202
|
+
- pattern-inside: |
|
|
203
|
+
if (!$CHECK(..., $X, ...)) {
|
|
204
|
+
...
|
|
205
|
+
wp_die(...);
|
|
206
|
+
}
|
|
207
|
+
...
|
|
208
|
+
- pattern-inside: |
|
|
209
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
210
|
+
...
|
|
211
|
+
return ...;
|
|
212
|
+
}
|
|
213
|
+
...
|
|
214
|
+
- pattern-inside: |
|
|
215
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
216
|
+
...
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
...
|
|
220
|
+
- pattern-inside: |
|
|
221
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
222
|
+
...
|
|
223
|
+
exit;
|
|
224
|
+
}
|
|
225
|
+
...
|
|
226
|
+
- pattern-inside: |
|
|
227
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
228
|
+
...
|
|
229
|
+
exit(...);
|
|
230
|
+
}
|
|
231
|
+
...
|
|
232
|
+
- pattern-inside: |
|
|
233
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
234
|
+
...
|
|
235
|
+
die(...);
|
|
236
|
+
}
|
|
237
|
+
...
|
|
238
|
+
- pattern-inside: |
|
|
239
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
240
|
+
...
|
|
241
|
+
die;
|
|
242
|
+
}
|
|
243
|
+
...
|
|
244
|
+
- pattern-inside: |
|
|
245
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
246
|
+
...
|
|
247
|
+
throw $E;
|
|
248
|
+
}
|
|
249
|
+
...
|
|
250
|
+
- pattern-inside: |
|
|
251
|
+
if (!$OBJ->$CHECK(..., $X, ...)) {
|
|
252
|
+
...
|
|
253
|
+
wp_die(...);
|
|
254
|
+
}
|
|
255
|
+
...
|
|
256
|
+
- pattern-inside: |
|
|
257
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
258
|
+
...
|
|
259
|
+
return ...;
|
|
260
|
+
}
|
|
261
|
+
...
|
|
262
|
+
- pattern-inside: |
|
|
263
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
264
|
+
...
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
...
|
|
268
|
+
- pattern-inside: |
|
|
269
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
270
|
+
...
|
|
271
|
+
exit;
|
|
272
|
+
}
|
|
273
|
+
...
|
|
274
|
+
- pattern-inside: |
|
|
275
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
276
|
+
...
|
|
277
|
+
exit(...);
|
|
278
|
+
}
|
|
279
|
+
...
|
|
280
|
+
- pattern-inside: |
|
|
281
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
282
|
+
...
|
|
283
|
+
die(...);
|
|
284
|
+
}
|
|
285
|
+
...
|
|
286
|
+
- pattern-inside: |
|
|
287
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
288
|
+
...
|
|
289
|
+
die;
|
|
290
|
+
}
|
|
291
|
+
...
|
|
292
|
+
- pattern-inside: |
|
|
293
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
294
|
+
...
|
|
295
|
+
throw $E;
|
|
296
|
+
}
|
|
297
|
+
...
|
|
298
|
+
- pattern-inside: |
|
|
299
|
+
if (!$CLS::$CHECK(..., $X, ...)) {
|
|
300
|
+
...
|
|
301
|
+
wp_die(...);
|
|
302
|
+
}
|
|
303
|
+
...
|
|
304
|
+
- metavariable-regex:
|
|
305
|
+
metavariable: $CHECK
|
|
306
|
+
regex: '(?i)^(is_?|check_?|validate_?)?(safe|valid|allowed|permitted|trusted|whitelisted|allowlisted|local)\w{0,40}$'
|
|
307
|
+
- pattern: $X
|
|
308
|
+
- &numeric
|
|
309
|
+
pattern-either:
|
|
310
|
+
- pattern: intval(...)
|
|
311
|
+
- pattern: floatval(...)
|
|
312
|
+
- pattern: absint(...)
|
|
313
|
+
- pattern: (int) $X
|
|
314
|
+
- pattern: (integer) $X
|
|
315
|
+
- pattern: (float) $X
|
|
316
|
+
- pattern: (bool) $X
|
|
317
|
+
- pattern: (boolean) $X
|
|
318
|
+
- pattern: count(...)
|
|
319
|
+
- pattern: strlen(...)
|
|
320
|
+
- pattern: isset(...)
|
|
321
|
+
- pattern: empty(...)
|
|
322
|
+
- pattern: is_numeric(...)
|
|
323
|
+
- pattern: ctype_digit(...)
|
|
324
|
+
- pattern: ctype_alnum(...)
|
|
325
|
+
- pattern: in_array(...)
|
|
326
|
+
- pattern: array_key_exists(...)
|
|
327
|
+
- pattern: md5(...)
|
|
328
|
+
- pattern: sha1(...)
|
|
329
|
+
- pattern: hash(...)
|
|
330
|
+
- pattern: password_hash(...)
|
|
331
|
+
- pattern: filter_var($X, FILTER_VALIDATE_INT, ...)
|
|
332
|
+
- pattern: filter_var($X, FILTER_VALIDATE_FLOAT, ...)
|
|
333
|
+
- pattern: filter_var($X, FILTER_VALIDATE_BOOLEAN, ...)
|
|
334
|
+
- pattern: filter_input($T, $N, FILTER_VALIDATE_INT, ...)
|
|
335
|
+
- pattern: filter_input($T, $N, FILTER_SANITIZE_NUMBER_INT, ...)
|
|
336
|
+
- pattern: sprintf("%d", ...)
|
|
337
|
+
- pattern: number_format(...)
|
|
338
|
+
# Arithmetic gives a number (users.php?offset=<?= $_GET['offset'] + 6 ?>, GHSA-m473), and so do dates.
|
|
339
|
+
- pattern: $A + $B
|
|
340
|
+
- pattern: $A - $B
|
|
341
|
+
- pattern: $A * $B
|
|
342
|
+
- pattern: $A / $B
|
|
343
|
+
- pattern: $A % $B
|
|
344
|
+
- pattern: date(...)
|
|
345
|
+
- pattern: gmdate(...)
|
|
346
|
+
- pattern: mktime(...)
|
|
347
|
+
- pattern: strtotime(...)
|
|
348
|
+
- pattern: round(...)
|
|
349
|
+
- pattern: abs(...)
|
|
350
|
+
- pattern: min(...)
|
|
351
|
+
- pattern: max(...)
|
|
352
|
+
- pattern: $A == $B
|
|
353
|
+
- pattern: $A === $B
|
|
354
|
+
- pattern: $A != $B
|
|
355
|
+
- pattern: $A !== $B
|
|
356
|
+
pattern-sinks:
|
|
357
|
+
- patterns:
|
|
358
|
+
- pattern-either:
|
|
359
|
+
- pattern: echo $X;
|
|
360
|
+
- pattern: print $X;
|
|
361
|
+
- pattern: print($X);
|
|
362
|
+
- pattern: exit($X);
|
|
363
|
+
- pattern: die($X);
|
|
364
|
+
- focus-metavariable: $X
|
|
365
|
+
- pattern: printf(...)
|
|
366
|
+
- pattern: vprintf(...)
|
|
367
|
+
|
|
368
|
+
- id: codewatch.php.web.sql-injection
|
|
369
|
+
mode: taint
|
|
370
|
+
languages: [php]
|
|
371
|
+
severity: ERROR
|
|
372
|
+
message: >-
|
|
373
|
+
Data from the HTTP request is built into an SQL statement. Use a prepared statement with placeholders
|
|
374
|
+
(PDO::prepare, mysqli bind_param, $wpdb->prepare, the query builder's bindings) instead of concatenation.
|
|
375
|
+
metadata:
|
|
376
|
+
category: security
|
|
377
|
+
subcategory: [vuln]
|
|
378
|
+
type: vulnerability
|
|
379
|
+
interprocedural: false
|
|
380
|
+
title: Request data built into an SQL statement
|
|
381
|
+
cwe: ["CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')"]
|
|
382
|
+
owasp: ["A05:2025 - Injection"]
|
|
383
|
+
references:
|
|
384
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/Query_Parameterization_Cheat_Sheet.html
|
|
385
|
+
- https://www.php.net/manual/en/pdo.prepared-statements.php
|
|
386
|
+
pattern-sources: *php-sources
|
|
387
|
+
pattern-sanitizers:
|
|
388
|
+
- *php-checked
|
|
389
|
+
- *php-guarded
|
|
390
|
+
- *numeric
|
|
391
|
+
# Escaping keeps a value inside its quotes; an unquoted escaped value is still injectable, but flagging every
|
|
392
|
+
# escaped value would bury the rest.
|
|
393
|
+
- pattern-either:
|
|
394
|
+
- pattern: mysqli_real_escape_string(...)
|
|
395
|
+
- pattern: mysql_real_escape_string(...)
|
|
396
|
+
- pattern: mysql_escape_string(...)
|
|
397
|
+
- pattern: pg_escape_string(...)
|
|
398
|
+
- pattern: pg_escape_literal(...)
|
|
399
|
+
- pattern: sqlite_escape_string(...)
|
|
400
|
+
- pattern: addslashes(...)
|
|
401
|
+
- pattern: esc_sql(...)
|
|
402
|
+
- pattern: $DB->real_escape_string(...)
|
|
403
|
+
- pattern: $DB->escape(...)
|
|
404
|
+
- pattern: $DB->escapeString(...)
|
|
405
|
+
- pattern: $DB->escape_string(...)
|
|
406
|
+
- pattern: $DB->quote(...)
|
|
407
|
+
- pattern: $DB->quoteValue(...)
|
|
408
|
+
- pattern: $DB->qstr(...)
|
|
409
|
+
- pattern: $wpdb->prepare(...)
|
|
410
|
+
- pattern: $DB->quoteName(...)
|
|
411
|
+
- pattern: $DB->quoteIdentifier(...)
|
|
412
|
+
pattern-sinks:
|
|
413
|
+
- patterns:
|
|
414
|
+
- pattern-either:
|
|
415
|
+
- pattern: mysql_query($SQL, ...)
|
|
416
|
+
- pattern: mysql_db_query($D, $SQL, ...)
|
|
417
|
+
- pattern: mysqli_query($C, $SQL, ...)
|
|
418
|
+
- pattern: mysqli_multi_query($C, $SQL, ...)
|
|
419
|
+
- pattern: mysqli_real_query($C, $SQL, ...)
|
|
420
|
+
- pattern: mysqli_prepare($C, $SQL)
|
|
421
|
+
- pattern: $DB->prepare($SQL)
|
|
422
|
+
- pattern: pg_query($C, $SQL)
|
|
423
|
+
- pattern: pg_query($SQL)
|
|
424
|
+
- pattern: pg_send_query($C, $SQL)
|
|
425
|
+
- pattern: sqlsrv_query($C, $SQL, ...)
|
|
426
|
+
- pattern: odbc_exec($C, $SQL, ...)
|
|
427
|
+
- patterns:
|
|
428
|
+
- pattern: $DB->$QUERY($SQL, ...)
|
|
429
|
+
- metavariable-regex:
|
|
430
|
+
metavariable: $QUERY
|
|
431
|
+
regex: ^(query|exec|multi_query|real_query|unbuffered_query|get_results|get_row|get_var|get_col|executeQuery|executeStatement|executeUpdate|fetchAll|fetchAssoc|fetchOne|fetchColumn|fetchAllAssociative|fetchAssociative|createQuery|createNativeQuery|whereRaw|orWhereRaw|havingRaw|orderByRaw|selectRaw|groupByRaw|raw|unprepared|setQuery|Execute|GetAll|GetRow|GetOne|GetCol|SelectLimit|sql_query|createCommand|findBySql)$
|
|
432
|
+
- focus-metavariable: $SQL
|
|
433
|
+
- patterns:
|
|
434
|
+
- pattern: DB::$RAW($SQL, ...)
|
|
435
|
+
- metavariable-regex:
|
|
436
|
+
metavariable: $RAW
|
|
437
|
+
regex: ^(raw|select|statement|unprepared|insert|update|delete|selectOne)$
|
|
438
|
+
- focus-metavariable: $SQL
|
|
439
|
+
|
|
440
|
+
- id: codewatch.php.web.path-traversal
|
|
441
|
+
mode: taint
|
|
442
|
+
languages: [php]
|
|
443
|
+
severity: ERROR
|
|
444
|
+
message: >-
|
|
445
|
+
Data from the HTTP request is used in a file path or include, so "../" (or an absolute path) can reach
|
|
446
|
+
files outside the intended folder. Take only the file name (basename()) or check the resolved path
|
|
447
|
+
(realpath()) stays inside the folder.
|
|
448
|
+
metadata:
|
|
449
|
+
category: security
|
|
450
|
+
subcategory: [vuln]
|
|
451
|
+
type: vulnerability
|
|
452
|
+
interprocedural: false
|
|
453
|
+
title: Request data in a file path
|
|
454
|
+
cwe: ["CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')"]
|
|
455
|
+
owasp: ["A01:2025 - Broken Access Control"]
|
|
456
|
+
references:
|
|
457
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html
|
|
458
|
+
- https://owasp.org/www-community/attacks/Path_Traversal
|
|
459
|
+
pattern-sources: *php-sources
|
|
460
|
+
pattern-sanitizers:
|
|
461
|
+
- *php-checked
|
|
462
|
+
- *php-guarded
|
|
463
|
+
- *numeric
|
|
464
|
+
- pattern-either:
|
|
465
|
+
- pattern: basename(...)
|
|
466
|
+
- pattern: sanitize_file_name(...)
|
|
467
|
+
- pattern: realpath(...)
|
|
468
|
+
- pattern: md5(...)
|
|
469
|
+
pattern-sinks:
|
|
470
|
+
- patterns:
|
|
471
|
+
- pattern-either:
|
|
472
|
+
- pattern: include $X;
|
|
473
|
+
- pattern: include_once $X;
|
|
474
|
+
- pattern: require $X;
|
|
475
|
+
- pattern: require_once $X;
|
|
476
|
+
- pattern: file_get_contents($X, ...)
|
|
477
|
+
- pattern: file_put_contents($X, ...)
|
|
478
|
+
- pattern: fopen($X, ...)
|
|
479
|
+
- pattern: file($X, ...)
|
|
480
|
+
- pattern: readfile($X, ...)
|
|
481
|
+
- pattern: unlink($X, ...)
|
|
482
|
+
- pattern: rmdir($X, ...)
|
|
483
|
+
- pattern: mkdir($X, ...)
|
|
484
|
+
- pattern: copy($X, ...)
|
|
485
|
+
- pattern: copy($S, $X, ...)
|
|
486
|
+
- pattern: rename($X, ...)
|
|
487
|
+
- pattern: rename($S, $X, ...)
|
|
488
|
+
- pattern: move_uploaded_file($S, $X)
|
|
489
|
+
- pattern: opendir($X, ...)
|
|
490
|
+
- pattern: scandir($X, ...)
|
|
491
|
+
- pattern: glob($X, ...)
|
|
492
|
+
- pattern: parse_ini_file($X, ...)
|
|
493
|
+
- pattern: highlight_file($X, ...)
|
|
494
|
+
- pattern: show_source($X, ...)
|
|
495
|
+
- pattern: fpassthru($X)
|
|
496
|
+
- pattern: touch($X, ...)
|
|
497
|
+
- pattern: symlink($S, $X)
|
|
498
|
+
- pattern: chmod($X, ...)
|
|
499
|
+
- pattern: tempnam($X, ...)
|
|
500
|
+
- pattern: simplexml_load_file($X, ...)
|
|
501
|
+
- pattern: new SplFileObject($X, ...)
|
|
502
|
+
- pattern: new SplFileInfo($X, ...)
|
|
503
|
+
- pattern: $ZIP->extractTo($X, ...)
|
|
504
|
+
- focus-metavariable: $X
|
|
505
|
+
|
|
506
|
+
- id: codewatch.php.web.command-injection
|
|
507
|
+
mode: taint
|
|
508
|
+
languages: [php]
|
|
509
|
+
severity: ERROR
|
|
510
|
+
message: >-
|
|
511
|
+
Data from the HTTP request reaches a shell command, so a user can run their own commands. Quote each
|
|
512
|
+
argument with escapeshellarg(), or pass an argument array to proc_open() or Symfony Process.
|
|
513
|
+
metadata:
|
|
514
|
+
category: security
|
|
515
|
+
subcategory: [vuln]
|
|
516
|
+
type: vulnerability
|
|
517
|
+
interprocedural: false
|
|
518
|
+
title: Request data in a shell command
|
|
519
|
+
cwe: ["CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"]
|
|
520
|
+
owasp: ["A05:2025 - Injection"]
|
|
521
|
+
references:
|
|
522
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html
|
|
523
|
+
- https://www.php.net/manual/en/function.escapeshellarg.php
|
|
524
|
+
pattern-sources: *php-sources
|
|
525
|
+
pattern-sanitizers:
|
|
526
|
+
- *php-checked
|
|
527
|
+
- *php-guarded
|
|
528
|
+
- *numeric
|
|
529
|
+
- pattern-either:
|
|
530
|
+
- pattern: escapeshellarg(...)
|
|
531
|
+
- pattern: escapeshellcmd(...)
|
|
532
|
+
pattern-sinks:
|
|
533
|
+
- patterns:
|
|
534
|
+
- pattern-either:
|
|
535
|
+
- pattern: exec($X, ...)
|
|
536
|
+
- pattern: system($X, ...)
|
|
537
|
+
- pattern: shell_exec($X)
|
|
538
|
+
- pattern: passthru($X, ...)
|
|
539
|
+
- pattern: popen($X, ...)
|
|
540
|
+
- pattern: proc_open($X, ...)
|
|
541
|
+
- pattern: pcntl_exec($X, ...)
|
|
542
|
+
- pattern: Process::fromShellCommandline($X, ...)
|
|
543
|
+
- pattern-not: proc_open([...], ...)
|
|
544
|
+
- focus-metavariable: $X
|
|
545
|
+
- pattern: "`...`"
|
|
546
|
+
|
|
547
|
+
- id: codewatch.php.web.code-injection
|
|
548
|
+
mode: taint
|
|
549
|
+
languages: [php]
|
|
550
|
+
severity: ERROR
|
|
551
|
+
message: >-
|
|
552
|
+
Data from the HTTP request is run as PHP code. Never evaluate request data; map it to one of a fixed set of
|
|
553
|
+
functions or values instead.
|
|
554
|
+
metadata:
|
|
555
|
+
category: security
|
|
556
|
+
subcategory: [vuln]
|
|
557
|
+
type: vulnerability
|
|
558
|
+
interprocedural: false
|
|
559
|
+
title: Request data run as code
|
|
560
|
+
cwe: ["CWE-94: Improper Control of Generation of Code ('Code Injection')"]
|
|
561
|
+
owasp: ["A05:2025 - Injection"]
|
|
562
|
+
references:
|
|
563
|
+
- https://owasp.org/www-community/attacks/Code_Injection
|
|
564
|
+
pattern-sources: *php-sources
|
|
565
|
+
pattern-sanitizers:
|
|
566
|
+
- *php-checked
|
|
567
|
+
- *php-guarded
|
|
568
|
+
- *numeric
|
|
569
|
+
pattern-sinks:
|
|
570
|
+
- patterns:
|
|
571
|
+
- pattern-either:
|
|
572
|
+
- pattern: eval($X);
|
|
573
|
+
- pattern: assert($X, ...)
|
|
574
|
+
- pattern: create_function($A, $X)
|
|
575
|
+
- pattern: create_function($X, ...)
|
|
576
|
+
- pattern: call_user_func($X, ...)
|
|
577
|
+
- pattern: call_user_func_array($X, ...)
|
|
578
|
+
- pattern: preg_replace("=~/e[a-z]*$/", $X, ...)
|
|
579
|
+
- focus-metavariable: $X
|
|
580
|
+
# A variable used as the function or class name: $_GET['f']() or new $class().
|
|
581
|
+
- patterns:
|
|
582
|
+
- pattern-either:
|
|
583
|
+
- pattern: $X(...)
|
|
584
|
+
- pattern: new $X(...)
|
|
585
|
+
- metavariable-regex:
|
|
586
|
+
metavariable: $X
|
|
587
|
+
regex: ^\$\w+$
|
|
588
|
+
- focus-metavariable: $X
|
|
589
|
+
|
|
590
|
+
- id: codewatch.php.web.ssrf
|
|
591
|
+
mode: taint
|
|
592
|
+
languages: [php]
|
|
593
|
+
severity: ERROR
|
|
594
|
+
message: >-
|
|
595
|
+
Data from the HTTP request chooses the URL the server fetches, so a user can make it call internal
|
|
596
|
+
services. Check the host against a list of allowed hosts before the request.
|
|
597
|
+
metadata:
|
|
598
|
+
category: security
|
|
599
|
+
subcategory: [vuln]
|
|
600
|
+
type: vulnerability
|
|
601
|
+
interprocedural: false
|
|
602
|
+
title: Request data chooses the server's outbound URL
|
|
603
|
+
cwe: ["CWE-918: Server-Side Request Forgery (SSRF)"]
|
|
604
|
+
owasp: ["A01:2025 - Broken Access Control"]
|
|
605
|
+
references:
|
|
606
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
|
|
607
|
+
pattern-sources: *php-sources
|
|
608
|
+
pattern-sanitizers:
|
|
609
|
+
- *php-checked
|
|
610
|
+
- *php-guarded
|
|
611
|
+
- *numeric
|
|
612
|
+
- pattern-either:
|
|
613
|
+
- pattern: urlencode(...)
|
|
614
|
+
- pattern: rawurlencode(...)
|
|
615
|
+
- pattern: http_build_query(...)
|
|
616
|
+
pattern-sinks:
|
|
617
|
+
- patterns:
|
|
618
|
+
- pattern-either:
|
|
619
|
+
- pattern: $CLIENT->request($M, $X, ...)
|
|
620
|
+
- pattern: $CLIENT->$VERB($X, ...)
|
|
621
|
+
- metavariable-regex:
|
|
622
|
+
metavariable: $CLIENT
|
|
623
|
+
regex: ^\$(client|http|httpClient|guzzle|this->client|this->httpClient)$
|
|
624
|
+
- metavariable-regex:
|
|
625
|
+
metavariable: $VERB
|
|
626
|
+
regex: ^(get|post|put|patch|delete|head|request|send|sendRequest|getAsync|postAsync)$
|
|
627
|
+
- focus-metavariable: $X
|
|
628
|
+
- patterns:
|
|
629
|
+
- pattern-either:
|
|
630
|
+
- pattern: curl_init($X)
|
|
631
|
+
- pattern: curl_setopt($C, CURLOPT_URL, $X)
|
|
632
|
+
- pattern: fsockopen($X, ...)
|
|
633
|
+
- pattern: get_headers($X, ...)
|
|
634
|
+
- pattern: wp_remote_get($X, ...)
|
|
635
|
+
- pattern: wp_remote_post($X, ...)
|
|
636
|
+
- pattern: wp_remote_request($X, ...)
|
|
637
|
+
- pattern: wp_remote_head($X, ...)
|
|
638
|
+
- pattern: wp_safe_remote_get($X, ...)
|
|
639
|
+
- pattern: Http::get($X, ...)
|
|
640
|
+
- pattern: Http::post($X, ...)
|
|
641
|
+
- focus-metavariable: $X
|
|
642
|
+
|
|
643
|
+
- id: codewatch.php.web.open-redirect
|
|
644
|
+
mode: taint
|
|
645
|
+
languages: [php]
|
|
646
|
+
severity: WARNING
|
|
647
|
+
message: >-
|
|
648
|
+
Data from the HTTP request chooses where the user is redirected, so a link to this site can send them to
|
|
649
|
+
any other. Redirect only to a path on this site, or check the URL against a list of allowed hosts
|
|
650
|
+
(wp_safe_redirect() in WordPress).
|
|
651
|
+
metadata:
|
|
652
|
+
category: security
|
|
653
|
+
subcategory: [vuln]
|
|
654
|
+
type: vulnerability
|
|
655
|
+
interprocedural: false
|
|
656
|
+
title: Request data chooses the redirect target
|
|
657
|
+
cwe: ["CWE-601: URL Redirection to Untrusted Site ('Open Redirect')"]
|
|
658
|
+
owasp: ["A01:2025 - Broken Access Control"]
|
|
659
|
+
references:
|
|
660
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html
|
|
661
|
+
pattern-sources: *php-sources
|
|
662
|
+
pattern-sanitizers:
|
|
663
|
+
- *php-checked
|
|
664
|
+
- *php-guarded
|
|
665
|
+
- *numeric
|
|
666
|
+
- pattern-either:
|
|
667
|
+
- pattern: urlencode(...)
|
|
668
|
+
- pattern: rawurlencode(...)
|
|
669
|
+
- pattern: $this->referer(...)
|
|
670
|
+
- pattern: $this->Controller->referer(...)
|
|
671
|
+
- pattern: $this->controller->referer(...)
|
|
672
|
+
- pattern: wp_validate_redirect(...)
|
|
673
|
+
- pattern: wp_sanitize_redirect(...)
|
|
674
|
+
pattern-sinks:
|
|
675
|
+
- patterns:
|
|
676
|
+
- pattern-either:
|
|
677
|
+
- patterns:
|
|
678
|
+
- pattern: header($X, ...)
|
|
679
|
+
- metavariable-regex:
|
|
680
|
+
metavariable: $X
|
|
681
|
+
regex: '(?i)^["'']\s*location\s*:'
|
|
682
|
+
- pattern: wp_redirect($X, ...)
|
|
683
|
+
- pattern: redirect($X, ...)
|
|
684
|
+
- pattern: redirect()->to($X, ...)
|
|
685
|
+
- pattern: redirect()->away($X, ...)
|
|
686
|
+
- pattern: Redirect::to($X, ...)
|
|
687
|
+
- pattern: Redirect::away($X, ...)
|
|
688
|
+
- pattern: new RedirectResponse($X, ...)
|
|
689
|
+
- pattern: $THIS->redirect($X, ...)
|
|
690
|
+
- focus-metavariable: $X
|
|
691
|
+
|
|
692
|
+
- id: codewatch.php.web.unsafe-deserialization
|
|
693
|
+
mode: taint
|
|
694
|
+
languages: [php]
|
|
695
|
+
severity: ERROR
|
|
696
|
+
message: >-
|
|
697
|
+
Data from the HTTP request is passed to unserialize(), which can build objects whose magic methods run
|
|
698
|
+
code. Use json_decode(), or unserialize($data, ['allowed_classes' => false]).
|
|
699
|
+
metadata:
|
|
700
|
+
category: security
|
|
701
|
+
subcategory: [vuln]
|
|
702
|
+
type: vulnerability
|
|
703
|
+
interprocedural: false
|
|
704
|
+
title: Request data unserialized
|
|
705
|
+
cwe: ["CWE-502: Deserialization of Untrusted Data"]
|
|
706
|
+
owasp: ["A08:2025 - Software or Data Integrity Failures"]
|
|
707
|
+
references:
|
|
708
|
+
- https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html
|
|
709
|
+
pattern-sources: *php-sources
|
|
710
|
+
pattern-sanitizers:
|
|
711
|
+
- *php-checked
|
|
712
|
+
- *php-guarded
|
|
713
|
+
- *numeric
|
|
714
|
+
pattern-sinks:
|
|
715
|
+
- patterns:
|
|
716
|
+
- pattern: unserialize($X, ...)
|
|
717
|
+
- pattern-not: "unserialize($Y, ['allowed_classes' => false])"
|
|
718
|
+
- pattern-not: "unserialize($Y, array('allowed_classes' => false))"
|
|
719
|
+
- focus-metavariable: $X
|