deepscan-cli 1.0.0

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.
Files changed (47) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +419 -0
  3. package/dist/bin/deepscan.d.ts +1 -0
  4. package/dist/bin/deepscan.js +393 -0
  5. package/dist/bin/deepscan.js.map +1 -0
  6. package/dist/chunk-OSYJXVNF.js +7268 -0
  7. package/dist/chunk-OSYJXVNF.js.map +1 -0
  8. package/dist/index.d.ts +470 -0
  9. package/dist/index.js +21 -0
  10. package/dist/index.js.map +1 -0
  11. package/package.json +68 -0
  12. package/rules/built-in/converted-semgrep.yml +37 -0
  13. package/rules/built-in/default-config.yml +59 -0
  14. package/rules/built-in/quality.yml +117 -0
  15. package/rules/built-in/security.yml +383 -0
  16. package/rules/built-in/semgrep-apex.yml +336 -0
  17. package/rules/built-in/semgrep-bash.yml +362 -0
  18. package/rules/built-in/semgrep-c.yml +429 -0
  19. package/rules/built-in/semgrep-clojure.yml +166 -0
  20. package/rules/built-in/semgrep-csharp.yml +1260 -0
  21. package/rules/built-in/semgrep-dart.yml +21 -0
  22. package/rules/built-in/semgrep-dockerfile.yml +874 -0
  23. package/rules/built-in/semgrep-elixir.yml +146 -0
  24. package/rules/built-in/semgrep-generic.yml +2945 -0
  25. package/rules/built-in/semgrep-go.yml +2898 -0
  26. package/rules/built-in/semgrep-hcl.yml +8181 -0
  27. package/rules/built-in/semgrep-html.yml +94 -0
  28. package/rules/built-in/semgrep-java.yml +4219 -0
  29. package/rules/built-in/semgrep-javascript.yml +6243 -0
  30. package/rules/built-in/semgrep-json.yml +360 -0
  31. package/rules/built-in/semgrep-kotlin.yml +540 -0
  32. package/rules/built-in/semgrep-lua.yml +46 -0
  33. package/rules/built-in/semgrep-ocaml.yml +773 -0
  34. package/rules/built-in/semgrep-php.yml +1638 -0
  35. package/rules/built-in/semgrep-python.yml +11240 -0
  36. package/rules/built-in/semgrep-regex.yml +6444 -0
  37. package/rules/built-in/semgrep-ruby.yml +2687 -0
  38. package/rules/built-in/semgrep-rust.yml +278 -0
  39. package/rules/built-in/semgrep-scala.yml +807 -0
  40. package/rules/built-in/semgrep-sh.yml +46 -0
  41. package/rules/built-in/semgrep-solidity.yml +1046 -0
  42. package/rules/built-in/semgrep-swift.yml +200 -0
  43. package/rules/built-in/semgrep-terraform.yml +147 -0
  44. package/rules/built-in/semgrep-typescript.yml +6212 -0
  45. package/rules/built-in/semgrep-xml.yml +31 -0
  46. package/rules/built-in/semgrep-yaml.yml +2785 -0
  47. package/rules/examples/custom-api-security.yml +66 -0
@@ -0,0 +1,4219 @@
1
+ rules:
2
+ - id: anthropic-hardcoded-api-key-java
3
+ name: anthropic-hardcoded-api-key-java
4
+ description: Anthropic API key is hardcoded in source code. Use environment variables or a secrets manager instead.
5
+ category: secrets
6
+ severity: high
7
+ confidence: medium
8
+ languages:
9
+ - java
10
+ patterns:
11
+ - pattern: $OBJ.apiKey("$KEY")
12
+ message: Anthropic API key is hardcoded in source code. Use environment variables or a secrets manager instead.
13
+ cwe:
14
+ - CWE-798
15
+ owasp: []
16
+ references:
17
+ - https://docs.anthropic.com/en/docs/initial-setup
18
+ tags:
19
+ - anthropic
20
+ - id: gemini-hardcoded-api-key-java
21
+ name: gemini-hardcoded-api-key-java
22
+ description: Google Gemini API key is hardcoded in source code. Use environment variables or a secrets manager instead.
23
+ category: secrets
24
+ severity: high
25
+ confidence: medium
26
+ languages:
27
+ - java
28
+ patterns:
29
+ - pattern: $OBJ.apiKey("$KEY")
30
+ message: Google Gemini API key is hardcoded in source code. Use environment variables or a secrets manager instead.
31
+ cwe:
32
+ - CWE-798
33
+ owasp: []
34
+ references:
35
+ - https://ai.google.dev/gemini-api/docs/api-key
36
+ tags:
37
+ - gemini
38
+ - google
39
+ - id: llm-api-key-in-source-java
40
+ name: llm-api-key-in-source-java
41
+ description: >-
42
+ AI/LLM API key found hardcoded in source code. Detected key prefix matches a known AI provider (OpenAI, Anthropic,
43
+ Google, Hugging Face). Use environment variables or a secrets manager instead.
44
+ category: injection
45
+ severity: high
46
+ confidence: medium
47
+ languages:
48
+ - java
49
+ patterns:
50
+ - regex: .*
51
+ message: >-
52
+ AI/LLM API key found hardcoded in source code. Detected key prefix matches a known AI provider (OpenAI,
53
+ Anthropic, Google, Hugging Face). Use environment variables or a secrets manager instead.
54
+ cwe:
55
+ - CWE-798
56
+ owasp: []
57
+ references:
58
+ - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/
59
+ tags:
60
+ - openai
61
+ - anthropic
62
+ - google
63
+ - huggingface
64
+ - id: openai-hardcoded-api-key-java
65
+ name: openai-hardcoded-api-key-java
66
+ description: OpenAI API key is hardcoded in source code. Use environment variables or a secrets manager instead.
67
+ category: secrets
68
+ severity: high
69
+ confidence: medium
70
+ languages:
71
+ - java
72
+ patterns:
73
+ - pattern: new OpenAiService("$KEY")
74
+ message: OpenAI API key is hardcoded in source code. Use environment variables or a secrets manager instead.
75
+ cwe:
76
+ - CWE-798
77
+ owasp: []
78
+ references:
79
+ - https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
80
+ tags:
81
+ - openai
82
+ - id: contains-bidirectional-characters
83
+ name: contains-bidirectional-characters
84
+ description: >-
85
+ This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left languages
86
+ such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a manner that is
87
+ different from how it is displayed in code editing and review tools. If this is not what you were expecting,
88
+ please review this code in an editor that can reveal hidden Unicode characters.
89
+ category: security
90
+ severity: medium
91
+ confidence: medium
92
+ languages:
93
+ - bash
94
+ - c
95
+ - csharp
96
+ - go
97
+ - java
98
+ - javascript
99
+ - json
100
+ - kotlin
101
+ - lua
102
+ - ocaml
103
+ - php
104
+ - python
105
+ - ruby
106
+ - rust
107
+ - scala
108
+ - sh
109
+ - typescript
110
+ - yaml
111
+ patterns:
112
+ - regex: .*
113
+ message: >-
114
+ This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left
115
+ languages such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a
116
+ manner that is different from how it is displayed in code editing and review tools. If this is not what you
117
+ were expecting, please review this code in an editor that can reveal hidden Unicode characters.
118
+ cwe:
119
+ - CWE-94
120
+ owasp:
121
+ - A03:2021
122
+ - A05:2025
123
+ references:
124
+ - https://trojansource.codes/
125
+ tags:
126
+ - unicode
127
+ - id: tainted-sql-string
128
+ name: tainted-sql-string
129
+ description: >-
130
+ Detected user input used to manually construct a SQL string. This is usually bad practice because manual
131
+ construction could accidentally result in a SQL injection. An attacker could use a SQL injection to steal or
132
+ modify contents of the database. Instead, use a parameterized query which is available by default in most database
133
+ engines. Alternatively, consider using an object-relational mapper (ORM) such as Sequelize which will protect your
134
+ queries.
135
+ category: injection
136
+ severity: high
137
+ confidence: medium
138
+ languages:
139
+ - java
140
+ patterns:
141
+ - regex: .*
142
+ message: >-
143
+ Detected user input used to manually construct a SQL string. This is usually bad practice because manual
144
+ construction could accidentally result in a SQL injection. An attacker could use a SQL injection to steal or
145
+ modify contents of the database. Instead, use a parameterized query which is available by default in most
146
+ database engines. Alternatively, consider using an object-relational mapper (ORM) such as Sequelize which will
147
+ protect your queries.
148
+ cwe:
149
+ - CWE-89
150
+ owasp:
151
+ - A01:2017
152
+ - A03:2021
153
+ - A05:2025
154
+ references:
155
+ - https://owasp.org/www-community/attacks/SQL_Injection
156
+ tags:
157
+ - aws-lambda
158
+ - id: tainted-sqli
159
+ name: tainted-sqli
160
+ description: >-
161
+ Detected SQL statement that is tainted by `$EVENT` object. This could lead to SQL injection if variables in the
162
+ SQL statement are not properly sanitized. Use parameterized SQL queries or properly sanitize user input instead.
163
+ category: injection
164
+ severity: medium
165
+ confidence: medium
166
+ languages:
167
+ - java
168
+ patterns:
169
+ - regex: .*
170
+ message: >-
171
+ Detected SQL statement that is tainted by `$EVENT` object. This could lead to SQL injection if variables in
172
+ the SQL statement are not properly sanitized. Use parameterized SQL queries or properly sanitize user input
173
+ instead.
174
+ cwe:
175
+ - CWE-89
176
+ owasp:
177
+ - A01:2017
178
+ - A03:2021
179
+ - A05:2025
180
+ references:
181
+ - https://owasp.org/Top10/A03_2021-Injection
182
+ tags:
183
+ - sql
184
+ - java
185
+ - aws-lambda
186
+ - id: java-jwt-decode-without-verify
187
+ name: java-jwt-decode-without-verify
188
+ description: >-
189
+ Detected the decoding of a JWT token without a verify step. JWT tokens must be verified before use, otherwise the
190
+ token's integrity is unknown. This means a malicious actor could forge a JWT token with any claims. Call
191
+ '.verify()' before using the token.
192
+ category: auth
193
+ severity: medium
194
+ confidence: medium
195
+ languages:
196
+ - java
197
+ patterns:
198
+ - pattern: |
199
+ com.auth0.jwt.JWT.decode(...);
200
+ message: >-
201
+ Detected the decoding of a JWT token without a verify step. JWT tokens must be verified before use, otherwise
202
+ the token's integrity is unknown. This means a malicious actor could forge a JWT token with any claims. Call
203
+ '.verify()' before using the token.
204
+ cwe:
205
+ - CWE-345
206
+ owasp:
207
+ - A08:2021
208
+ - A08:2025
209
+ references:
210
+ - https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures
211
+ tags:
212
+ - jwt
213
+ - id: java-jwt-hardcoded-secret
214
+ name: java-jwt-hardcoded-secret
215
+ description: >-
216
+ A hard-coded credential was detected. It is not recommended to store credentials in source-code, as this risks
217
+ secrets being leaked and used by either an internal or external malicious adversary. It is recommended to use
218
+ environment variables to securely provide credentials or retrieve credentials from a secure vault or HSM (Hardware
219
+ Security Module).
220
+ category: secrets
221
+ severity: medium
222
+ confidence: medium
223
+ languages:
224
+ - java
225
+ patterns:
226
+ - regex: .*
227
+ message: >-
228
+ A hard-coded credential was detected. It is not recommended to store credentials in source-code, as this risks
229
+ secrets being leaked and used by either an internal or external malicious adversary. It is recommended to use
230
+ environment variables to securely provide credentials or retrieve credentials from a secure vault or HSM
231
+ (Hardware Security Module).
232
+ cwe:
233
+ - CWE-798
234
+ owasp:
235
+ - A07:2021
236
+ - A07:2025
237
+ references:
238
+ - https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
239
+ tags:
240
+ - java
241
+ - secrets
242
+ - jwt
243
+ - id: java-jwt-none-alg
244
+ name: java-jwt-none-alg
245
+ description: >-
246
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token has
247
+ already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
248
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
249
+ category: auth
250
+ severity: high
251
+ confidence: medium
252
+ languages:
253
+ - java
254
+ patterns:
255
+ - pattern: |
256
+ $JWT.sign(com.auth0.jwt.algorithms.Algorithm.none());
257
+ message: >-
258
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token
259
+ has already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
260
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
261
+ - pattern: |
262
+ $NONE = com.auth0.jwt.algorithms.Algorithm.none();
263
+ ...
264
+ $JWT.sign($NONE);
265
+ message: >-
266
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token
267
+ has already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
268
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
269
+ - pattern: |-
270
+ class $CLASS {
271
+ ...
272
+ $TYPE $NONE = com.auth0.jwt.algorithms.Algorithm.none();
273
+ ...
274
+ $RETURNTYPE $FUNC (...) {
275
+ ...
276
+ $JWT.sign($NONE);
277
+ ...
278
+ }
279
+ ...
280
+ }
281
+ message: >-
282
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token
283
+ has already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
284
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
285
+ cwe:
286
+ - CWE-327
287
+ owasp:
288
+ - A03:2017
289
+ - A02:2021
290
+ - A04:2025
291
+ references:
292
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
293
+ tags:
294
+ - jwt
295
+ - id: insecure-resteasy-deserialization
296
+ name: insecure-resteasy-deserialization
297
+ description: >-
298
+ When a Restful webservice endpoint is configured to use wildcard mediaType {*/*} as a value for the @Consumes
299
+ annotation, an attacker could abuse the SerializableProvider by sending a HTTP Request with a Content-Type of
300
+ application/x-java-serialized-object. The body of that request would be processed by the SerializationProvider and
301
+ could contain a malicious payload, which may lead to arbitrary code execution when calling the $Y.getObject
302
+ method.
303
+ category: security
304
+ severity: medium
305
+ confidence: medium
306
+ languages:
307
+ - java
308
+ patterns:
309
+ - pattern: |
310
+ @Consumes({"application/x-java-serialized-object"})
311
+ message: >-
312
+ When a Restful webservice endpoint is configured to use wildcard mediaType {*/*} as a value for the @Consumes
313
+ annotation, an attacker could abuse the SerializableProvider by sending a HTTP Request with a Content-Type of
314
+ application/x-java-serialized-object. The body of that request would be processed by the SerializationProvider
315
+ and could contain a malicious payload, which may lead to arbitrary code execution when calling the
316
+ $Y.getObject method.
317
+ - pattern: |
318
+ @Consumes({"*/*"})
319
+ message: >-
320
+ When a Restful webservice endpoint is configured to use wildcard mediaType {*/*} as a value for the @Consumes
321
+ annotation, an attacker could abuse the SerializableProvider by sending a HTTP Request with a Content-Type of
322
+ application/x-java-serialized-object. The body of that request would be processed by the SerializationProvider
323
+ and could contain a malicious payload, which may lead to arbitrary code execution when calling the
324
+ $Y.getObject method.
325
+ - pattern: |
326
+ @Consumes("*/*")
327
+ message: >-
328
+ When a Restful webservice endpoint is configured to use wildcard mediaType {*/*} as a value for the @Consumes
329
+ annotation, an attacker could abuse the SerializableProvider by sending a HTTP Request with a Content-Type of
330
+ application/x-java-serialized-object. The body of that request would be processed by the SerializationProvider
331
+ and could contain a malicious payload, which may lead to arbitrary code execution when calling the
332
+ $Y.getObject method.
333
+ - pattern: |
334
+ @Consumes({MediaType.WILDCARD_TYPE})
335
+ message: >-
336
+ When a Restful webservice endpoint is configured to use wildcard mediaType {*/*} as a value for the @Consumes
337
+ annotation, an attacker could abuse the SerializableProvider by sending a HTTP Request with a Content-Type of
338
+ application/x-java-serialized-object. The body of that request would be processed by the SerializationProvider
339
+ and could contain a malicious payload, which may lead to arbitrary code execution when calling the
340
+ $Y.getObject method.
341
+ cwe:
342
+ - CWE-502
343
+ owasp:
344
+ - A08:2017
345
+ - A08:2021
346
+ - A08:2025
347
+ references:
348
+ - https://access.redhat.com/blogs/766093/posts/3162112
349
+ tags:
350
+ - jax-rs
351
+ - id: default-resteasy-provider-abuse
352
+ name: default-resteasy-provider-abuse
353
+ description: >-
354
+ When a Restful webservice endpoint isn't configured with a @Consumes annotation, an attacker could abuse the
355
+ SerializableProvider by sending a HTTP Request with a Content-Type of application/x-java-serialized-object. The
356
+ body of that request would be processed by the SerializationProvider and could contain a malicious payload, which
357
+ may lead to arbitrary code execution. Instead, add a @Consumes annotation to the function or class.
358
+ category: security
359
+ severity: medium
360
+ confidence: medium
361
+ languages:
362
+ - java
363
+ patterns:
364
+ - pattern: |
365
+ @Path("...")
366
+ public $RETURNTYPE $METHOD(...) { ...}
367
+ message: >-
368
+ When a Restful webservice endpoint isn't configured with a @Consumes annotation, an attacker could abuse the
369
+ SerializableProvider by sending a HTTP Request with a Content-Type of application/x-java-serialized-object.
370
+ The body of that request would be processed by the SerializationProvider and could contain a malicious
371
+ payload, which may lead to arbitrary code execution. Instead, add a @Consumes annotation to the function or
372
+ class.
373
+ cwe:
374
+ - CWE-502
375
+ owasp:
376
+ - A08:2017
377
+ - A08:2021
378
+ - A08:2025
379
+ references:
380
+ - https://access.redhat.com/blogs/766093/posts/3162112
381
+ tags:
382
+ - jax-rs
383
+ - id: jax-rs-path-traversal
384
+ name: jax-rs-path-traversal
385
+ description: >-
386
+ Detected a potential path traversal. A malicious actor could control the location of this file, to include going
387
+ backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are
388
+ sanitized. You may also consider using a utility method such as org.apache.commons.io.FilenameUtils.getName(...)
389
+ to only retrieve the file name from the path.
390
+ category: file-ops
391
+ severity: medium
392
+ confidence: medium
393
+ languages:
394
+ - java
395
+ patterns:
396
+ - pattern: |
397
+ $RETURNTYPE $FUNC (..., @PathParam(...) $TYPE $VAR, ...) {
398
+ ...
399
+ new File(..., $VAR, ...);
400
+ ...
401
+ }
402
+ message: >-
403
+ Detected a potential path traversal. A malicious actor could control the location of this file, to include
404
+ going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file
405
+ paths are sanitized. You may also consider using a utility method such as
406
+ org.apache.commons.io.FilenameUtils.getName(...) to only retrieve the file name from the path.
407
+ - pattern: |-
408
+ $RETURNTYPE $FUNC (..., @javax.ws.rs.PathParam(...) $TYPE $VAR, ...) {
409
+ ...
410
+ new File(..., $VAR, ...);
411
+ ...
412
+ }
413
+ message: >-
414
+ Detected a potential path traversal. A malicious actor could control the location of this file, to include
415
+ going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file
416
+ paths are sanitized. You may also consider using a utility method such as
417
+ org.apache.commons.io.FilenameUtils.getName(...) to only retrieve the file name from the path.
418
+ cwe:
419
+ - CWE-22
420
+ owasp:
421
+ - A05:2017
422
+ - A01:2021
423
+ - A01:2025
424
+ references:
425
+ - https://www.owasp.org/index.php/Path_Traversal
426
+ tags:
427
+ - jax-rs
428
+ - id: seam-log-injection
429
+ name: seam-log-injection
430
+ description: >-
431
+ Seam Logging API support an expression language to introduce bean property to log messages. The expression
432
+ language can also be the source to unwanted code execution. In this context, an expression is built with a dynamic
433
+ value. The source of the value(s) should be verified to avoid that unfiltered values fall into this risky code
434
+ evaluation.
435
+ category: security
436
+ severity: high
437
+ confidence: medium
438
+ languages:
439
+ - java
440
+ patterns:
441
+ - pattern: |
442
+ $LOG.$INFO($X + $Y,...)
443
+ message: >-
444
+ Seam Logging API support an expression language to introduce bean property to log messages. The expression
445
+ language can also be the source to unwanted code execution. In this context, an expression is built with a
446
+ dynamic value. The source of the value(s) should be verified to avoid that unfiltered values fall into this
447
+ risky code evaluation.
448
+ cwe:
449
+ - CWE-95
450
+ owasp:
451
+ - A03:2021
452
+ - A05:2025
453
+ references:
454
+ - https://owasp.org/Top10/A03_2021-Injection
455
+ tags:
456
+ - jboss
457
+ - id: find-sql-string-concatenation
458
+ name: find-sql-string-concatenation
459
+ description: In $METHOD, $X is used to construct a SQL query via string concatenation.
460
+ category: injection
461
+ severity: high
462
+ confidence: medium
463
+ languages:
464
+ - java
465
+ patterns:
466
+ - pattern: |
467
+ $RETURN $METHOD(...,String $X,...){
468
+ ...
469
+ Session $SESSION = ...;
470
+ ...
471
+ String $QUERY = ... + $X + ...;
472
+ ...
473
+ PreparedStatement $PS = $SESSION.connection().prepareStatement($QUERY);
474
+ ...
475
+ ResultSet $RESULT = $PS.executeQuery();
476
+ ...
477
+ }
478
+ message: In $METHOD, $X is used to construct a SQL query via string concatenation.
479
+ - pattern: |
480
+ $RETURN $METHOD(...,String $X,...){
481
+ ...
482
+ String $QUERY = ... + $X + ...;
483
+ ...
484
+ Session $SESSION = ...;
485
+ ...
486
+ PreparedStatement $PS = $SESSION.connection().prepareStatement($QUERY);
487
+ ...
488
+ ResultSet $RESULT = $PS.executeQuery();
489
+ ...
490
+ }
491
+ message: In $METHOD, $X is used to construct a SQL query via string concatenation.
492
+ cwe:
493
+ - CWE-89
494
+ owasp:
495
+ - A01:2017
496
+ - A03:2021
497
+ - A05:2025
498
+ references:
499
+ - https://owasp.org/Top10/A03_2021-Injection
500
+ tags:
501
+ - jboss
502
+ - id: jjwt-none-alg
503
+ name: jjwt-none-alg
504
+ description: >-
505
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token has
506
+ already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
507
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
508
+ category: auth
509
+ severity: high
510
+ confidence: medium
511
+ languages:
512
+ - java
513
+ patterns:
514
+ - pattern: |
515
+ io.jsonwebtoken.Jwts.builder();
516
+ message: >-
517
+ Detected use of the 'none' algorithm in a JWT token. The 'none' algorithm assumes the integrity of the token
518
+ has already been verified. This would allow a malicious actor to forge a JWT token that will automatically be
519
+ verified. Do not explicitly use the 'none' algorithm. Instead, use an algorithm such as 'HS256'.
520
+ cwe:
521
+ - CWE-327
522
+ owasp:
523
+ - A03:2017
524
+ - A02:2021
525
+ - A04:2025
526
+ references:
527
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
528
+ tags:
529
+ - jwt
530
+ - id: assignment-comparison
531
+ name: assignment-comparison
532
+ description: The value of `$X` is being ignored and will be used in the conditional test
533
+ category: security
534
+ severity: high
535
+ confidence: medium
536
+ languages:
537
+ - java
538
+ patterns:
539
+ - pattern: if ($X=true) { ... }
540
+ message: The value of `$X` is being ignored and will be used in the conditional test
541
+ - pattern: if ($X=false) { ... }
542
+ message: The value of `$X` is being ignored and will be used in the conditional test
543
+ cwe: []
544
+ owasp: []
545
+ references: []
546
+ tags:
547
+ - java
548
+ - id: eqeq
549
+ name: eqeq
550
+ description: >-
551
+ `$X == $X` or `$X != $X` is always true. (Unless the value compared is a float or double). To test if `$X` is
552
+ not-a-number, use `Double.isNaN($X)`.
553
+ category: security
554
+ severity: high
555
+ confidence: medium
556
+ languages:
557
+ - java
558
+ patterns:
559
+ - regex: .*
560
+ message: >-
561
+ `$X == $X` or `$X != $X` is always true. (Unless the value compared is a float or double). To test if `$X` is
562
+ not-a-number, use `Double.isNaN($X)`.
563
+ cwe: []
564
+ owasp: []
565
+ references: []
566
+ tags:
567
+ - java
568
+ - id: hardcoded-conditional
569
+ name: hardcoded-conditional
570
+ description: This if statement will always have the same behavior and is therefore unnecessary.
571
+ category: security
572
+ severity: high
573
+ confidence: medium
574
+ languages:
575
+ - java
576
+ patterns:
577
+ - regex: .*
578
+ message: This if statement will always have the same behavior and is therefore unnecessary.
579
+ cwe: []
580
+ owasp: []
581
+ references: []
582
+ tags:
583
+ - java
584
+ - id: no-string-eqeq
585
+ name: no-string-eqeq
586
+ description: Strings should not be compared with '=='. This is a reference comparison operator. Use '.equals()' instead.
587
+ category: security
588
+ severity: medium
589
+ confidence: medium
590
+ languages:
591
+ - java
592
+ patterns:
593
+ - pattern: $X == (String $Y)
594
+ message: Strings should not be compared with '=='. This is a reference comparison operator. Use '.equals()' instead.
595
+ cwe: []
596
+ owasp: []
597
+ references: []
598
+ tags:
599
+ - java
600
+ - id: anonymous-ldap-bind
601
+ name: anonymous-ldap-bind
602
+ description: >-
603
+ Detected anonymous LDAP bind. This permits anonymous users to execute LDAP statements. Consider enforcing
604
+ authentication for LDAP. See https://docs.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html for more
605
+ information.
606
+ category: security
607
+ severity: medium
608
+ confidence: medium
609
+ languages:
610
+ - java
611
+ patterns:
612
+ - pattern: |
613
+ $ENV.put($CTX.SECURITY_AUTHENTICATION, "none");
614
+ ...
615
+ $DCTX = new InitialDirContext($ENV, ...);
616
+ message: >-
617
+ Detected anonymous LDAP bind. This permits anonymous users to execute LDAP statements. Consider enforcing
618
+ authentication for LDAP. See https://docs.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html for more
619
+ information.
620
+ cwe:
621
+ - CWE-287
622
+ owasp:
623
+ - A02:2017
624
+ - A07:2021
625
+ - A07:2025
626
+ references:
627
+ - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
628
+ tags:
629
+ - java
630
+ - id: bad-hexa-conversion
631
+ name: bad-hexa-conversion
632
+ description: >-
633
+ 'Integer.toHexString()' strips leading zeroes from each byte if read byte-by-byte. This mistake weakens the hash
634
+ value computed since it introduces more collisions. Use 'String.format("%02X", ...)' instead.
635
+ category: security
636
+ severity: medium
637
+ confidence: medium
638
+ languages:
639
+ - java
640
+ patterns:
641
+ - pattern: |-
642
+ $X $METHOD(...) {
643
+ ...
644
+ MessageDigest $MD = ...;
645
+ ...
646
+ $MD.digest(...);
647
+ ...
648
+ Integer.toHexString(...);
649
+ }
650
+ message: >-
651
+ 'Integer.toHexString()' strips leading zeroes from each byte if read byte-by-byte. This mistake weakens the
652
+ hash value computed since it introduces more collisions. Use 'String.format("%02X", ...)' instead.
653
+ cwe:
654
+ - CWE-704
655
+ owasp:
656
+ - A03:2017
657
+ references:
658
+ - https://cwe.mitre.org/data/definitions/704.html
659
+ tags:
660
+ - java
661
+ - id: blowfish-insufficient-key-size
662
+ name: blowfish-insufficient-key-size
663
+ description: Using less than 128 bits for Blowfish is considered insecure. Use 128 bits or more, or switch to use AES instead.
664
+ category: secrets
665
+ severity: medium
666
+ confidence: medium
667
+ languages:
668
+ - java
669
+ patterns:
670
+ - pattern: |
671
+ $KEYGEN = KeyGenerator.getInstance("Blowfish");
672
+ ...
673
+ $KEYGEN.init($SIZE);
674
+ message: >-
675
+ Using less than 128 bits for Blowfish is considered insecure. Use 128 bits or more, or switch to use AES
676
+ instead.
677
+ cwe:
678
+ - CWE-326
679
+ owasp:
680
+ - A03:2017
681
+ - A02:2021
682
+ - A04:2025
683
+ references:
684
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
685
+ tags:
686
+ - java
687
+ - id: cbc-padding-oracle
688
+ name: cbc-padding-oracle
689
+ description: >-
690
+ Using CBC with PKCS5Padding is susceptible to padding oracle attacks. A malicious actor could discern the
691
+ difference between plaintext with valid or invalid padding. Further, CBC mode does not include any integrity
692
+ checks. Use 'AES/GCM/NoPadding' instead.
693
+ category: security
694
+ severity: medium
695
+ confidence: medium
696
+ languages:
697
+ - java
698
+ patterns:
699
+ - pattern: |
700
+ "=~/.*\/CBC\/PKCS5Padding/"
701
+ message: >-
702
+ Using CBC with PKCS5Padding is susceptible to padding oracle attacks. A malicious actor could discern the
703
+ difference between plaintext with valid or invalid padding. Further, CBC mode does not include any integrity
704
+ checks. Use 'AES/GCM/NoPadding' instead.
705
+ cwe:
706
+ - CWE-327
707
+ owasp:
708
+ - A03:2017
709
+ - A02:2021
710
+ - A04:2025
711
+ references:
712
+ - https://capec.mitre.org/data/definitions/463.html
713
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#cipher-modes
714
+ - https://find-sec-bugs.github.io/bugs.htm#CIPHER_INTEGRITY
715
+ tags:
716
+ - java
717
+ - id: command-injection-formatted-runtime-call
718
+ name: command-injection-formatted-runtime-call
719
+ description: >-
720
+ A formatted or concatenated string was detected as input to a java.lang.Runtime call. This is dangerous if a
721
+ variable is controlled by user input and could result in a command injection. Ensure your variables are not
722
+ controlled by users or sufficiently sanitized.
723
+ category: injection
724
+ severity: high
725
+ confidence: medium
726
+ languages:
727
+ - java
728
+ patterns:
729
+ - regex: .*
730
+ message: >-
731
+ A formatted or concatenated string was detected as input to a java.lang.Runtime call. This is dangerous if a
732
+ variable is controlled by user input and could result in a command injection. Ensure your variables are not
733
+ controlled by users or sufficiently sanitized.
734
+ cwe:
735
+ - CWE-78
736
+ owasp:
737
+ - A01:2017
738
+ - A03:2021
739
+ - A05:2025
740
+ references:
741
+ - https://owasp.org/Top10/A03_2021-Injection
742
+ tags:
743
+ - java
744
+ - id: command-injection-process-builder
745
+ name: command-injection-process-builder
746
+ description: >-
747
+ A formatted or concatenated string was detected as input to a ProcessBuilder call. This is dangerous if a variable
748
+ is controlled by user input and could result in a command injection. Ensure your variables are not controlled by
749
+ users or sufficiently sanitized.
750
+ category: injection
751
+ severity: high
752
+ confidence: medium
753
+ languages:
754
+ - java
755
+ patterns:
756
+ - regex: .*
757
+ message: >-
758
+ A formatted or concatenated string was detected as input to a ProcessBuilder call. This is dangerous if a
759
+ variable is controlled by user input and could result in a command injection. Ensure your variables are not
760
+ controlled by users or sufficiently sanitized.
761
+ cwe:
762
+ - CWE-78
763
+ owasp:
764
+ - A01:2017
765
+ - A03:2021
766
+ - A05:2025
767
+ references:
768
+ - https://owasp.org/Top10/A03_2021-Injection
769
+ tags:
770
+ - java
771
+ - id: cookie-missing-httponly
772
+ name: cookie-missing-httponly
773
+ description: >-
774
+ A cookie was detected without setting the 'HttpOnly' flag. The 'HttpOnly' flag for cookies instructs the browser
775
+ to forbid client-side scripts from reading the cookie. Set the 'HttpOnly' flag by calling
776
+ 'cookie.setHttpOnly(true);'
777
+ category: security
778
+ severity: medium
779
+ confidence: medium
780
+ languages:
781
+ - java
782
+ patterns:
783
+ - regex: .*
784
+ message: >-
785
+ A cookie was detected without setting the 'HttpOnly' flag. The 'HttpOnly' flag for cookies instructs the
786
+ browser to forbid client-side scripts from reading the cookie. Set the 'HttpOnly' flag by calling
787
+ 'cookie.setHttpOnly(true);'
788
+ cwe:
789
+ - CWE-1004
790
+ owasp:
791
+ - A05:2021
792
+ - A02:2025
793
+ references:
794
+ - https://owasp.org/Top10/A05_2021-Security_Misconfiguration
795
+ tags:
796
+ - java
797
+ - id: cookie-missing-secure-flag
798
+ name: cookie-missing-secure-flag
799
+ description: >-
800
+ A cookie was detected without setting the 'secure' flag. The 'secure' flag for cookies prevents the client from
801
+ transmitting the cookie over insecure channels such as HTTP. Set the 'secure' flag by calling
802
+ '$COOKIE.setSecure(true);'
803
+ category: security
804
+ severity: medium
805
+ confidence: medium
806
+ languages:
807
+ - java
808
+ patterns:
809
+ - regex: .*
810
+ message: >-
811
+ A cookie was detected without setting the 'secure' flag. The 'secure' flag for cookies prevents the client
812
+ from transmitting the cookie over insecure channels such as HTTP. Set the 'secure' flag by calling
813
+ '$COOKIE.setSecure(true);'
814
+ cwe:
815
+ - CWE-614
816
+ owasp:
817
+ - A05:2021
818
+ - A02:2025
819
+ references:
820
+ - https://owasp.org/Top10/A05_2021-Security_Misconfiguration
821
+ tags:
822
+ - java
823
+ - id: crlf-injection-logs
824
+ name: crlf-injection-logs
825
+ description: >-
826
+ When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log
827
+ entries or include malicious content.
828
+ category: security
829
+ severity: medium
830
+ confidence: medium
831
+ languages:
832
+ - java
833
+ patterns:
834
+ - regex: .*
835
+ message: >-
836
+ When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge
837
+ log entries or include malicious content.
838
+ cwe:
839
+ - CWE-93
840
+ owasp:
841
+ - A03:2021
842
+ - A05:2025
843
+ references:
844
+ - https://owasp.org/Top10/A03_2021-Injection
845
+ tags:
846
+ - java
847
+ - id: des-is-deprecated
848
+ name: des-is-deprecated
849
+ description: >-
850
+ DES is considered deprecated. AES is the recommended cipher. Upgrade to use AES. See
851
+ https://www.nist.gov/news-events/news/2005/06/nist-withdraws-outdated-data-encryption-standard for more
852
+ information.
853
+ category: security
854
+ severity: medium
855
+ confidence: medium
856
+ languages:
857
+ - java
858
+ - kt
859
+ patterns:
860
+ - regex: .*
861
+ message: >-
862
+ DES is considered deprecated. AES is the recommended cipher. Upgrade to use AES. See
863
+ https://www.nist.gov/news-events/news/2005/06/nist-withdraws-outdated-data-encryption-standard for more
864
+ information.
865
+ cwe:
866
+ - CWE-326
867
+ owasp:
868
+ - A03:2017
869
+ - A02:2021
870
+ - A04:2025
871
+ references:
872
+ - https://www.nist.gov/news-events/news/2005/06/nist-withdraws-outdated-data-encryption-standard
873
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#algorithms
874
+ tags:
875
+ - java
876
+ - id: desede-is-deprecated
877
+ name: desede-is-deprecated
878
+ description: Triple DES (3DES or DESede) is considered deprecated. AES is the recommended cipher. Upgrade to use AES.
879
+ category: security
880
+ severity: medium
881
+ confidence: medium
882
+ languages:
883
+ - java
884
+ - kt
885
+ patterns:
886
+ - regex: .*
887
+ message: Triple DES (3DES or DESede) is considered deprecated. AES is the recommended cipher. Upgrade to use AES.
888
+ cwe:
889
+ - CWE-326
890
+ owasp:
891
+ - A03:2017
892
+ - A02:2021
893
+ - A04:2025
894
+ references:
895
+ - https://csrc.nist.gov/News/2017/Update-to-Current-Use-and-Deprecation-of-TDEA
896
+ tags:
897
+ - java
898
+ - id: ecb-cipher
899
+ name: ecb-cipher
900
+ description: >-
901
+ Cipher in ECB mode is detected. ECB mode produces the same output for the same input each time which allows an
902
+ attacker to intercept and replay the data. Further, ECB mode does not provide any integrity checking. See
903
+ https://find-sec-bugs.github.io/bugs.htm#CIPHER_INTEGRITY.
904
+ category: crypto
905
+ severity: medium
906
+ confidence: medium
907
+ languages:
908
+ - java
909
+ patterns:
910
+ - pattern: |
911
+ Cipher $VAR = $CIPHER.getInstance($MODE);
912
+ message: >-
913
+ Cipher in ECB mode is detected. ECB mode produces the same output for the same input each time which allows an
914
+ attacker to intercept and replay the data. Further, ECB mode does not provide any integrity checking. See
915
+ https://find-sec-bugs.github.io/bugs.htm#CIPHER_INTEGRITY.
916
+ cwe:
917
+ - CWE-327
918
+ owasp:
919
+ - A03:2017
920
+ - A02:2021
921
+ - A04:2025
922
+ references:
923
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
924
+ tags:
925
+ - java
926
+ - id: gcm-detection
927
+ name: gcm-detection
928
+ description: >-
929
+ GCM detected, please check that IV/nonce is not reused, an Initialization Vector (IV) is a nonce used to randomize
930
+ the encryption, so that even if multiple messages with identical plaintext are encrypted, the generated
931
+ corresponding ciphertexts are different. Unlike the Key, the IV usually does not need to be secret, rather it is
932
+ important that it is random and unique. Certain encryption schemes the IV is exchanged in public as part of the
933
+ ciphertext. Reusing same Initialization Vector with the same Key to encrypt multiple plaintext blocks allows an
934
+ attacker to compare the ciphertexts and then, with some assumptions on the content of the messages, to gain
935
+ important information about the data being encrypted.
936
+ category: security
937
+ severity: low
938
+ confidence: medium
939
+ languages:
940
+ - java
941
+ patterns:
942
+ - regex: .*
943
+ message: >-
944
+ GCM detected, please check that IV/nonce is not reused, an Initialization Vector (IV) is a nonce used to
945
+ randomize the encryption, so that even if multiple messages with identical plaintext are encrypted, the
946
+ generated corresponding ciphertexts are different. Unlike the Key, the IV usually does not need to be secret,
947
+ rather it is important that it is random and unique. Certain encryption schemes the IV is exchanged in public
948
+ as part of the ciphertext. Reusing same Initialization Vector with the same Key to encrypt multiple plaintext
949
+ blocks allows an attacker to compare the ciphertexts and then, with some assumptions on the content of the
950
+ messages, to gain important information about the data being encrypted.
951
+ cwe:
952
+ - CWE-323
953
+ owasp:
954
+ - A02:2021
955
+ - A04:2025
956
+ references:
957
+ - https://cwe.mitre.org/data/definitions/323.html
958
+ tags:
959
+ - java
960
+ - id: gcm-nonce-reuse
961
+ name: gcm-nonce-reuse
962
+ description: 'GCM IV/nonce is reused: encryption can be totally useless'
963
+ category: security
964
+ severity: high
965
+ confidence: medium
966
+ languages:
967
+ - java
968
+ patterns:
969
+ - regex: .*
970
+ message: 'GCM IV/nonce is reused: encryption can be totally useless'
971
+ cwe:
972
+ - CWE-323
973
+ owasp:
974
+ - A02:2021
975
+ - A04:2025
976
+ references:
977
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
978
+ tags:
979
+ - java
980
+ - id: no-null-cipher
981
+ name: no-null-cipher
982
+ description: >-
983
+ NullCipher was detected. This will not encrypt anything; the cipher text will be the same as the plain text. Use a
984
+ valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
985
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
986
+ category: crypto
987
+ severity: medium
988
+ confidence: medium
989
+ languages:
990
+ - java
991
+ patterns:
992
+ - regex: .*
993
+ message: >-
994
+ NullCipher was detected. This will not encrypt anything; the cipher text will be the same as the plain text.
995
+ Use a valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
996
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
997
+ cwe:
998
+ - CWE-327
999
+ owasp:
1000
+ - A03:2017
1001
+ - A02:2021
1002
+ - A04:2025
1003
+ references:
1004
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1005
+ tags:
1006
+ - java
1007
+ - id: no-static-initialization-vector
1008
+ name: no-static-initialization-vector
1009
+ description: >-
1010
+ Initialization Vectors (IVs) for block ciphers should be randomly generated each time they are used. Using a
1011
+ static IV means the same plaintext encrypts to the same ciphertext every time, weakening the strength of the
1012
+ encryption.
1013
+ category: security
1014
+ severity: medium
1015
+ confidence: medium
1016
+ languages:
1017
+ - java
1018
+ patterns:
1019
+ - pattern: |
1020
+ byte[] $IV = {
1021
+ ...
1022
+ };
1023
+ ...
1024
+ new IvParameterSpec($IV, ...);
1025
+ message: >-
1026
+ Initialization Vectors (IVs) for block ciphers should be randomly generated each time they are used. Using a
1027
+ static IV means the same plaintext encrypts to the same ciphertext every time, weakening the strength of the
1028
+ encryption.
1029
+ - pattern: |
1030
+ class $CLASS {
1031
+ byte[] $IV = {
1032
+ ...
1033
+ };
1034
+ ...
1035
+ $METHOD(...) {
1036
+ ...
1037
+ new IvParameterSpec($IV, ...);
1038
+ ...
1039
+ }
1040
+ }
1041
+ message: >-
1042
+ Initialization Vectors (IVs) for block ciphers should be randomly generated each time they are used. Using a
1043
+ static IV means the same plaintext encrypts to the same ciphertext every time, weakening the strength of the
1044
+ encryption.
1045
+ cwe:
1046
+ - CWE-329
1047
+ owasp:
1048
+ - A02:2021
1049
+ - A04:2025
1050
+ references:
1051
+ - https://cwe.mitre.org/data/definitions/329.html
1052
+ tags:
1053
+ - java
1054
+ - id: rsa-no-padding
1055
+ name: rsa-no-padding
1056
+ description: Using RSA without OAEP mode weakens the encryption.
1057
+ category: security
1058
+ severity: medium
1059
+ confidence: medium
1060
+ languages:
1061
+ - java
1062
+ - kt
1063
+ patterns:
1064
+ - pattern: $CIPHER.getInstance("=~/RSA/[Nn][Oo][Nn][Ee]/NoPadding/")
1065
+ message: Using RSA without OAEP mode weakens the encryption.
1066
+ cwe:
1067
+ - CWE-326
1068
+ owasp:
1069
+ - A03:2017
1070
+ - A02:2021
1071
+ - A04:2025
1072
+ references:
1073
+ - https://rdist.root.org/2009/10/06/why-rsa-encryption-padding-is-critical/
1074
+ tags:
1075
+ - java
1076
+ - kotlin
1077
+ - id: avoid-implementing-custom-digests
1078
+ name: avoid-implementing-custom-digests
1079
+ description: >-
1080
+ Cryptographic algorithms are notoriously difficult to get right. By implementing a custom message digest, you risk
1081
+ introducing security issues into your program. Use one of the many sound message digests already available to you:
1082
+ MessageDigest sha256Digest = MessageDigest.getInstance("SHA256");
1083
+ category: security
1084
+ severity: medium
1085
+ confidence: medium
1086
+ languages:
1087
+ - java
1088
+ patterns:
1089
+ - pattern: |-
1090
+ class $CLASS extends MessageDigest {
1091
+ ...
1092
+ }
1093
+ message: >-
1094
+ Cryptographic algorithms are notoriously difficult to get right. By implementing a custom message digest, you
1095
+ risk introducing security issues into your program. Use one of the many sound message digests already
1096
+ available to you: MessageDigest sha256Digest = MessageDigest.getInstance("SHA256");
1097
+ cwe:
1098
+ - CWE-327
1099
+ owasp:
1100
+ - A03:2017
1101
+ - A02:2021
1102
+ - A04:2025
1103
+ references:
1104
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#custom-algorithms
1105
+ tags:
1106
+ - java
1107
+ - id: defaulthttpclient-is-deprecated
1108
+ name: defaulthttpclient-is-deprecated
1109
+ description: >-
1110
+ DefaultHttpClient is deprecated. Further, it does not support connections using TLS1.2, which makes using
1111
+ DefaultHttpClient a security hazard. Use HttpClientBuilder instead.
1112
+ category: security
1113
+ severity: medium
1114
+ confidence: medium
1115
+ languages:
1116
+ - java
1117
+ patterns:
1118
+ - pattern: new DefaultHttpClient(...);
1119
+ message: >-
1120
+ DefaultHttpClient is deprecated. Further, it does not support connections using TLS1.2, which makes using
1121
+ DefaultHttpClient a security hazard. Use HttpClientBuilder instead.
1122
+ cwe:
1123
+ - CWE-326
1124
+ owasp:
1125
+ - A03:2017
1126
+ - A02:2021
1127
+ - A04:2025
1128
+ references:
1129
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1130
+ tags:
1131
+ - java
1132
+ - id: insecure-hostname-verifier
1133
+ name: insecure-hostname-verifier
1134
+ description: >-
1135
+ Insecure HostnameVerifier implementation detected. This will accept any SSL certificate with any hostname, which
1136
+ creates the possibility for man-in-the-middle attacks.
1137
+ category: security
1138
+ severity: medium
1139
+ confidence: medium
1140
+ languages:
1141
+ - java
1142
+ patterns:
1143
+ - pattern: |
1144
+ class $CLASS implements HostnameVerifier {
1145
+ ...
1146
+ public boolean verify(...) { return true; }
1147
+ }
1148
+ message: >-
1149
+ Insecure HostnameVerifier implementation detected. This will accept any SSL certificate with any hostname,
1150
+ which creates the possibility for man-in-the-middle attacks.
1151
+ - pattern: |-
1152
+ new HostnameVerifier(...){
1153
+ public boolean verify(...) {
1154
+ return true;
1155
+ }
1156
+ }
1157
+ message: >-
1158
+ Insecure HostnameVerifier implementation detected. This will accept any SSL certificate with any hostname,
1159
+ which creates the possibility for man-in-the-middle attacks.
1160
+ - pattern: import org.apache.http.conn.ssl.NoopHostnameVerifier;
1161
+ message: >-
1162
+ Insecure HostnameVerifier implementation detected. This will accept any SSL certificate with any hostname,
1163
+ which creates the possibility for man-in-the-middle attacks.
1164
+ cwe:
1165
+ - CWE-295
1166
+ owasp:
1167
+ - A03:2017
1168
+ - A07:2021
1169
+ - A07:2025
1170
+ references:
1171
+ - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
1172
+ tags:
1173
+ - java
1174
+ - id: insecure-trust-manager
1175
+ name: insecure-trust-manager
1176
+ description: >-
1177
+ Detected empty trust manager implementations. This is dangerous because it accepts any certificate, enabling
1178
+ man-in-the-middle attacks. Consider using a KeyStore and TrustManagerFactory instead. See
1179
+ https://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https for more
1180
+ information.
1181
+ category: security
1182
+ severity: medium
1183
+ confidence: medium
1184
+ languages:
1185
+ - java
1186
+ patterns:
1187
+ - regex: .*
1188
+ message: >-
1189
+ Detected empty trust manager implementations. This is dangerous because it accepts any certificate, enabling
1190
+ man-in-the-middle attacks. Consider using a KeyStore and TrustManagerFactory instead. See
1191
+ https://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https for more
1192
+ information.
1193
+ cwe:
1194
+ - CWE-295
1195
+ owasp:
1196
+ - A03:2017
1197
+ - A07:2021
1198
+ - A07:2025
1199
+ references:
1200
+ - https://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https
1201
+ tags:
1202
+ - java
1203
+ - id: unencrypted-socket
1204
+ name: unencrypted-socket
1205
+ description: >-
1206
+ Detected use of a Java socket that is not encrypted. As a result, the traffic could be read by an attacker
1207
+ intercepting the network traffic. Use an SSLSocket created by 'SSLSocketFactory' or 'SSLServerSocketFactory'
1208
+ instead.
1209
+ category: security
1210
+ severity: medium
1211
+ confidence: medium
1212
+ languages:
1213
+ - java
1214
+ patterns:
1215
+ - pattern: new ServerSocket(...)
1216
+ message: >-
1217
+ Detected use of a Java socket that is not encrypted. As a result, the traffic could be read by an attacker
1218
+ intercepting the network traffic. Use an SSLSocket created by 'SSLSocketFactory' or 'SSLServerSocketFactory'
1219
+ instead.
1220
+ - pattern: new Socket(...)
1221
+ message: >-
1222
+ Detected use of a Java socket that is not encrypted. As a result, the traffic could be read by an attacker
1223
+ intercepting the network traffic. Use an SSLSocket created by 'SSLSocketFactory' or 'SSLServerSocketFactory'
1224
+ instead.
1225
+ cwe:
1226
+ - CWE-319
1227
+ owasp:
1228
+ - A03:2017
1229
+ - A02:2021
1230
+ - A04:2025
1231
+ references:
1232
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1233
+ tags:
1234
+ - java
1235
+ - id: use-of-aes-ecb
1236
+ name: use-of-aes-ecb
1237
+ description: >-
1238
+ Use of AES with ECB mode detected. ECB doesn't provide message confidentiality and is not semantically secure so
1239
+ should not be used. Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1240
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1241
+ category: security
1242
+ severity: medium
1243
+ confidence: medium
1244
+ languages:
1245
+ - java
1246
+ patterns:
1247
+ - pattern: $CIPHER.getInstance("=~/AES/ECB.*/")
1248
+ message: >-
1249
+ Use of AES with ECB mode detected. ECB doesn't provide message confidentiality and is not semantically secure
1250
+ so should not be used. Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1251
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1252
+ cwe:
1253
+ - CWE-327
1254
+ owasp:
1255
+ - A03:2017
1256
+ - A02:2021
1257
+ - A04:2025
1258
+ references:
1259
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1260
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
1261
+ tags:
1262
+ - java
1263
+ - id: use-of-blowfish
1264
+ name: use-of-blowfish
1265
+ description: >-
1266
+ Use of Blowfish was detected. Blowfish uses a 64-bit block size that makes it vulnerable to birthday attacks, and
1267
+ is therefore considered non-compliant. Instead, use a strong, secure cipher:
1268
+ Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1269
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1270
+ category: security
1271
+ severity: medium
1272
+ confidence: medium
1273
+ languages:
1274
+ - java
1275
+ patterns:
1276
+ - pattern: $CIPHER.getInstance("Blowfish")
1277
+ message: >-
1278
+ Use of Blowfish was detected. Blowfish uses a 64-bit block size that makes it vulnerable to birthday attacks,
1279
+ and is therefore considered non-compliant. Instead, use a strong, secure cipher:
1280
+ Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1281
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1282
+ cwe:
1283
+ - CWE-327
1284
+ owasp:
1285
+ - A03:2017
1286
+ - A02:2021
1287
+ - A04:2025
1288
+ references:
1289
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1290
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
1291
+ tags:
1292
+ - java
1293
+ - id: use-of-default-aes
1294
+ name: use-of-default-aes
1295
+ description: >-
1296
+ Use of AES with no settings detected. By default, java.crypto.Cipher uses ECB mode. ECB doesn't provide message
1297
+ confidentiality and is not semantically secure so should not be used. Instead, use a strong, secure cipher:
1298
+ java.crypto.Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1299
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1300
+ category: security
1301
+ severity: medium
1302
+ confidence: medium
1303
+ languages:
1304
+ - java
1305
+ patterns:
1306
+ - regex: .*
1307
+ message: >-
1308
+ Use of AES with no settings detected. By default, java.crypto.Cipher uses ECB mode. ECB doesn't provide
1309
+ message confidentiality and is not semantically secure so should not be used. Instead, use a strong, secure
1310
+ cipher: java.crypto.Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1311
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1312
+ cwe:
1313
+ - CWE-327
1314
+ owasp:
1315
+ - A03:2017
1316
+ - A02:2021
1317
+ - A04:2025
1318
+ references:
1319
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1320
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
1321
+ tags:
1322
+ - java
1323
+ - id: use-of-md5-digest-utils
1324
+ name: use-of-md5-digest-utils
1325
+ description: >-
1326
+ Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not
1327
+ suitable as a cryptographic signature. Use HMAC instead.
1328
+ category: crypto
1329
+ severity: medium
1330
+ confidence: medium
1331
+ languages:
1332
+ - java
1333
+ patterns:
1334
+ - pattern: |
1335
+ $DU.$GET_ALGO().digest(...)
1336
+ message: >-
1337
+ Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not
1338
+ suitable as a cryptographic signature. Use HMAC instead.
1339
+ cwe:
1340
+ - CWE-328
1341
+ owasp:
1342
+ - A03:2017
1343
+ - A02:2021
1344
+ - A04:2025
1345
+ references:
1346
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1347
+ tags:
1348
+ - java
1349
+ - id: use-of-md5
1350
+ name: use-of-md5
1351
+ description: >-
1352
+ Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not
1353
+ suitable as a cryptographic signature. Use HMAC instead.
1354
+ category: crypto
1355
+ severity: medium
1356
+ confidence: medium
1357
+ languages:
1358
+ - java
1359
+ patterns:
1360
+ - pattern: |
1361
+ java.security.MessageDigest.getInstance($ALGO, ...);
1362
+ message: >-
1363
+ Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not
1364
+ suitable as a cryptographic signature. Use HMAC instead.
1365
+ cwe:
1366
+ - CWE-328
1367
+ owasp:
1368
+ - A03:2017
1369
+ - A02:2021
1370
+ - A04:2025
1371
+ references:
1372
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1373
+ tags:
1374
+ - java
1375
+ - id: use-of-rc2
1376
+ name: use-of-rc2
1377
+ description: >-
1378
+ Use of RC2 was detected. RC2 is vulnerable to related-key attacks, and is therefore considered non-compliant.
1379
+ Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1380
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1381
+ category: security
1382
+ severity: medium
1383
+ confidence: medium
1384
+ languages:
1385
+ - java
1386
+ patterns:
1387
+ - pattern: $CIPHER.getInstance("RC2")
1388
+ message: >-
1389
+ Use of RC2 was detected. RC2 is vulnerable to related-key attacks, and is therefore considered non-compliant.
1390
+ Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1391
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1392
+ cwe:
1393
+ - CWE-327
1394
+ owasp:
1395
+ - A03:2017
1396
+ - A02:2021
1397
+ - A04:2025
1398
+ references:
1399
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1400
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
1401
+ tags:
1402
+ - java
1403
+ - id: use-of-rc4
1404
+ name: use-of-rc4
1405
+ description: >-
1406
+ Use of RC4 was detected. RC4 is vulnerable to several attacks, including stream cipher attacks and bit flipping
1407
+ attacks. Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1408
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1409
+ category: security
1410
+ severity: medium
1411
+ confidence: medium
1412
+ languages:
1413
+ - java
1414
+ patterns:
1415
+ - pattern: $CIPHER.getInstance("RC4")
1416
+ message: >-
1417
+ Use of RC4 was detected. RC4 is vulnerable to several attacks, including stream cipher attacks and bit
1418
+ flipping attacks. Instead, use a strong, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
1419
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
1420
+ cwe:
1421
+ - CWE-327
1422
+ owasp:
1423
+ - A03:2017
1424
+ - A02:2021
1425
+ - A04:2025
1426
+ references:
1427
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1428
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
1429
+ tags:
1430
+ - java
1431
+ - id: use-of-sha1
1432
+ name: use-of-sha1
1433
+ description: >-
1434
+ Detected SHA1 hash algorithm which is considered insecure. SHA1 is not collision resistant and is therefore not
1435
+ suitable as a cryptographic signature. Instead, use PBKDF2 for password hashing or SHA256 or SHA512 for other hash
1436
+ function applications.
1437
+ category: security
1438
+ severity: medium
1439
+ confidence: medium
1440
+ languages:
1441
+ - java
1442
+ patterns:
1443
+ - pattern: |
1444
+ $DU.getSha1Digest().digest(...)
1445
+ message: >-
1446
+ Detected SHA1 hash algorithm which is considered insecure. SHA1 is not collision resistant and is therefore
1447
+ not suitable as a cryptographic signature. Instead, use PBKDF2 for password hashing or SHA256 or SHA512 for
1448
+ other hash function applications.
1449
+ cwe:
1450
+ - CWE-328
1451
+ owasp:
1452
+ - A03:2017
1453
+ - A02:2021
1454
+ - A04:2025
1455
+ references:
1456
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1457
+ tags:
1458
+ - java
1459
+ - id: use-of-sha224
1460
+ name: use-of-sha224
1461
+ description: >-
1462
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1463
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1464
+ category: security
1465
+ severity: medium
1466
+ confidence: medium
1467
+ languages:
1468
+ - java
1469
+ patterns:
1470
+ - pattern: org.apache.commons.codec.digest.DigestUtils.getSha3_224Digest()
1471
+ message: >-
1472
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1473
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1474
+ - pattern: org.apache.commons.codec.digest.DigestUtils.getSha512_224Digest()
1475
+ message: >-
1476
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1477
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1478
+ - pattern: org.apache.commons.codec.digest.DigestUtils.sha3_224(...)
1479
+ message: >-
1480
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1481
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1482
+ - pattern: org.apache.commons.codec.digest.DigestUtils.sha3_224Hex(...)
1483
+ message: >-
1484
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1485
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1486
+ - pattern: org.apache.commons.codec.digest.DigestUtils.sha512_224(...)
1487
+ message: >-
1488
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1489
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1490
+ - pattern: org.apache.commons.codec.digest.DigestUtils.sha512_224Hex(...)
1491
+ message: >-
1492
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1493
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1494
+ - pattern: >-
1495
+ new
1496
+ org.apache.commons.codec.digest.DigestUtils(org.apache.commons.codec.digest.MessageDigestAlgorithms.SHA_224)
1497
+ message: >-
1498
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1499
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1500
+ - pattern: >-
1501
+ new
1502
+ org.apache.commons.codec.digest.DigestUtils(org.apache.commons.codec.digest.MessageDigestAlgorithms.SHA_512_224)
1503
+ message: >-
1504
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1505
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1506
+ - pattern: >-
1507
+ new
1508
+ org.apache.commons.codec.digest.DigestUtils(org.apache.commons.codec.digest.MessageDigestAlgorithms.SHA3_224)
1509
+ message: >-
1510
+ This code uses a 224-bit hash function, which is deprecated or disallowed in some security policies. Consider
1511
+ updating to a stronger hash function such as SHA-384 or higher to ensure compliance and security.
1512
+ cwe:
1513
+ - CWE-328
1514
+ owasp:
1515
+ - A03:2017
1516
+ - A02:2021
1517
+ - A04:2025
1518
+ references:
1519
+ - https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar3.ipd.pdf
1520
+ - >-
1521
+ https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography
1522
+ tags:
1523
+ - java
1524
+ - id: weak-random
1525
+ name: weak-random
1526
+ description: >-
1527
+ Detected use of the functions `Math.random()` or `java.util.Random()`. These are both not cryptographically strong
1528
+ random number generators (RNGs). If you are using these RNGs to create passwords or secret tokens, use
1529
+ `java.security.SecureRandom` instead.
1530
+ category: security
1531
+ severity: medium
1532
+ confidence: medium
1533
+ languages:
1534
+ - java
1535
+ patterns:
1536
+ - pattern: |
1537
+ new java.util.Random(...).$FUNC(...)
1538
+ message: >-
1539
+ Detected use of the functions `Math.random()` or `java.util.Random()`. These are both not cryptographically
1540
+ strong random number generators (RNGs). If you are using these RNGs to create passwords or secret tokens, use
1541
+ `java.security.SecureRandom` instead.
1542
+ - pattern: |
1543
+ java.lang.Math.random(...)
1544
+ message: >-
1545
+ Detected use of the functions `Math.random()` or `java.util.Random()`. These are both not cryptographically
1546
+ strong random number generators (RNGs). If you are using these RNGs to create passwords or secret tokens, use
1547
+ `java.security.SecureRandom` instead.
1548
+ cwe:
1549
+ - CWE-330
1550
+ owasp:
1551
+ - A02:2021
1552
+ - A04:2025
1553
+ references:
1554
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
1555
+ tags:
1556
+ - java
1557
+ - id: use-of-weak-rsa-key
1558
+ name: use-of-weak-rsa-key
1559
+ description: RSA keys should be at least 2048 bits based on NIST recommendation.
1560
+ category: secrets
1561
+ severity: medium
1562
+ confidence: medium
1563
+ languages:
1564
+ - java
1565
+ patterns:
1566
+ - pattern: |
1567
+ KeyPairGenerator $KEY = $G.getInstance("RSA");
1568
+ ...
1569
+ $KEY.initialize($BITS);
1570
+ message: RSA keys should be at least 2048 bits based on NIST recommendation.
1571
+ cwe:
1572
+ - CWE-326
1573
+ owasp:
1574
+ - A03:2017
1575
+ - A02:2021
1576
+ - A04:2025
1577
+ references:
1578
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#algorithms
1579
+ tags:
1580
+ - java
1581
+ - id: dangerous-groovy-shell
1582
+ name: dangerous-groovy-shell
1583
+ description: >-
1584
+ A expression is built with a dynamic value. The source of the value(s) should be verified to avoid that unfiltered
1585
+ values fall into this risky code evaluation.
1586
+ category: security
1587
+ severity: medium
1588
+ confidence: medium
1589
+ languages:
1590
+ - java
1591
+ patterns:
1592
+ - regex: .*
1593
+ message: >-
1594
+ A expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
1595
+ unfiltered values fall into this risky code evaluation.
1596
+ cwe:
1597
+ - CWE-94
1598
+ owasp:
1599
+ - A03:2021
1600
+ - A05:2025
1601
+ references:
1602
+ - https://owasp.org/Top10/A03_2021-Injection
1603
+ tags:
1604
+ - groovy
1605
+ - id: el-injection
1606
+ name: el-injection
1607
+ description: >-
1608
+ An expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
1609
+ unfiltered values fall into this risky code evaluation.
1610
+ category: security
1611
+ severity: medium
1612
+ confidence: medium
1613
+ languages:
1614
+ - java
1615
+ patterns:
1616
+ - regex: .*
1617
+ message: >-
1618
+ An expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
1619
+ unfiltered values fall into this risky code evaluation.
1620
+ cwe:
1621
+ - CWE-94
1622
+ owasp:
1623
+ - A03:2021
1624
+ - A05:2025
1625
+ references:
1626
+ - https://owasp.org/Top10/A03_2021-Injection
1627
+ tags:
1628
+ - java
1629
+ - id: formatted-sql-string
1630
+ name: formatted-sql-string
1631
+ description: >-
1632
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
1633
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
1634
+ PreparedStatement using 'connection.prepareStatement'.
1635
+ category: injection
1636
+ severity: high
1637
+ confidence: medium
1638
+ languages:
1639
+ - java
1640
+ patterns:
1641
+ - regex: .*
1642
+ message: >-
1643
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
1644
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
1645
+ obtain a PreparedStatement using 'connection.prepareStatement'.
1646
+ cwe:
1647
+ - CWE-89
1648
+ owasp:
1649
+ - A01:2017
1650
+ - A03:2021
1651
+ - A05:2025
1652
+ references:
1653
+ - https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html
1654
+ - https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html#create_ps
1655
+ - https://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-using-prepared-callable-statement
1656
+ tags:
1657
+ - java
1658
+ - id: http-response-splitting
1659
+ name: http-response-splitting
1660
+ description: >-
1661
+ Older Java application servers are vulnerable to HTTP response splitting, which may occur if an HTTP request can
1662
+ be injected with CRLF characters. This finding is reported for completeness; it is recommended to ensure your
1663
+ environment is not affected by testing this yourself.
1664
+ category: security
1665
+ severity: low
1666
+ confidence: medium
1667
+ languages:
1668
+ - java
1669
+ patterns:
1670
+ - pattern: |
1671
+ $VAR = $REQ.getParameter(...);
1672
+ ...
1673
+ $COOKIE = new Cookie(..., $VAR, ...);
1674
+ ...
1675
+ $RESP.addCookie($COOKIE, ...);
1676
+ message: >-
1677
+ Older Java application servers are vulnerable to HTTP response splitting, which may occur if an HTTP request
1678
+ can be injected with CRLF characters. This finding is reported for completeness; it is recommended to ensure
1679
+ your environment is not affected by testing this yourself.
1680
+ cwe:
1681
+ - CWE-113
1682
+ owasp:
1683
+ - A03:2021
1684
+ - A05:2025
1685
+ references:
1686
+ - https://www.owasp.org/index.php/HTTP_Response_Splitting
1687
+ tags:
1688
+ - java
1689
+ - id: insecure-smtp-connection
1690
+ name: insecure-smtp-connection
1691
+ description: >-
1692
+ Insecure SMTP connection detected. This connection will trust any SSL certificate. Enable certificate verification
1693
+ by setting 'email.setSSLCheckServerIdentity(true)'.
1694
+ category: security
1695
+ severity: medium
1696
+ confidence: medium
1697
+ languages:
1698
+ - java
1699
+ patterns:
1700
+ - pattern: $EMAIL.send(...);
1701
+ message: >-
1702
+ Insecure SMTP connection detected. This connection will trust any SSL certificate. Enable certificate
1703
+ verification by setting 'email.setSSLCheckServerIdentity(true)'.
1704
+ cwe:
1705
+ - CWE-297
1706
+ owasp:
1707
+ - A07:2021
1708
+ - A07:2025
1709
+ references:
1710
+ - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
1711
+ tags:
1712
+ - java
1713
+ - id: java-reverse-shell
1714
+ name: java-reverse-shell
1715
+ description: Semgrep found potential reverse shell behavior
1716
+ category: security
1717
+ severity: medium
1718
+ confidence: medium
1719
+ languages:
1720
+ - java
1721
+ patterns:
1722
+ - regex: .*
1723
+ message: Semgrep found potential reverse shell behavior
1724
+ cwe:
1725
+ - CWE-78
1726
+ owasp:
1727
+ - A01:2017
1728
+ - A03:2021
1729
+ - A05:2025
1730
+ references:
1731
+ - https://owasp.org/Top10/A03_2021-Injection
1732
+ tags:
1733
+ - java
1734
+ - id: jdbc-sql-formatted-string
1735
+ name: jdbc-sql-formatted-string
1736
+ description: >-
1737
+ Possible JDBC injection detected. Use the parameterized query feature available in queryForObject instead of
1738
+ concatenating or formatting strings: 'jdbc.queryForObject("select * from table where name = ?", Integer.class,
1739
+ parameterName);'
1740
+ category: injection
1741
+ severity: medium
1742
+ confidence: medium
1743
+ languages:
1744
+ - java
1745
+ patterns:
1746
+ - regex: .*
1747
+ message: >-
1748
+ Possible JDBC injection detected. Use the parameterized query feature available in queryForObject instead of
1749
+ concatenating or formatting strings: 'jdbc.queryForObject("select * from table where name = ?", Integer.class,
1750
+ parameterName);'
1751
+ cwe:
1752
+ - CWE-89
1753
+ owasp:
1754
+ - A01:2017
1755
+ - A03:2021
1756
+ - A05:2025
1757
+ references:
1758
+ - https://owasp.org/Top10/A03_2021-Injection
1759
+ tags:
1760
+ - jdbc
1761
+ - id: ldap-entry-poisoning
1762
+ name: ldap-entry-poisoning
1763
+ description: >-
1764
+ An object-returning LDAP search will allow attackers to control the LDAP response. This could lead to Remote Code
1765
+ Execution.
1766
+ category: security
1767
+ severity: medium
1768
+ confidence: medium
1769
+ languages:
1770
+ - java
1771
+ patterns:
1772
+ - pattern: |
1773
+ new SearchControls($S, $CL, $TL, $AT, true, $DEREF)
1774
+ message: >-
1775
+ An object-returning LDAP search will allow attackers to control the LDAP response. This could lead to Remote
1776
+ Code Execution.
1777
+ - pattern: |
1778
+ SearchControls $VAR = new SearchControls();
1779
+ ...
1780
+ $VAR.setReturningObjFlag(true);
1781
+ message: >-
1782
+ An object-returning LDAP search will allow attackers to control the LDAP response. This could lead to Remote
1783
+ Code Execution.
1784
+ cwe:
1785
+ - CWE-90
1786
+ owasp:
1787
+ - A01:2017
1788
+ - A03:2021
1789
+ - A05:2025
1790
+ references:
1791
+ - https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE-wp.pdf
1792
+ - https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html
1793
+ tags:
1794
+ - java
1795
+ - id: ldap-injection
1796
+ name: ldap-injection
1797
+ description: >-
1798
+ Detected non-constant data passed into an LDAP query. If this data can be controlled by an external user, this is
1799
+ an LDAP injection. Ensure data passed to an LDAP query is not controllable; or properly sanitize the data.
1800
+ category: security
1801
+ severity: medium
1802
+ confidence: medium
1803
+ languages:
1804
+ - java
1805
+ patterns:
1806
+ - pattern: |
1807
+ $X $METHOD(...) {
1808
+ ...
1809
+ $CTX.search($Y,$INPUT,...);
1810
+ ...
1811
+ }
1812
+ message: >-
1813
+ Detected non-constant data passed into an LDAP query. If this data can be controlled by an external user, this
1814
+ is an LDAP injection. Ensure data passed to an LDAP query is not controllable; or properly sanitize the data.
1815
+ cwe:
1816
+ - CWE-90
1817
+ owasp:
1818
+ - A01:2017
1819
+ - A03:2021
1820
+ - A05:2025
1821
+ references:
1822
+ - https://owasp.org/Top10/A03_2021-Injection
1823
+ tags:
1824
+ - java
1825
+ - id: md5-used-as-password
1826
+ name: md5-used-as-password
1827
+ description: >-
1828
+ It looks like MD5 is used as a password hash. MD5 is not considered a secure password hash because it can be
1829
+ cracked by an attacker in a short amount of time. Use a suitable password hashing function such as PBKDF2 or
1830
+ bcrypt. You can use `javax.crypto.SecretKeyFactory` with `SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1")` or,
1831
+ if using Spring, `org.springframework.security.crypto.bcrypt`.
1832
+ category: secrets
1833
+ severity: medium
1834
+ confidence: medium
1835
+ languages:
1836
+ - java
1837
+ patterns:
1838
+ - regex: .*
1839
+ message: >-
1840
+ It looks like MD5 is used as a password hash. MD5 is not considered a secure password hash because it can be
1841
+ cracked by an attacker in a short amount of time. Use a suitable password hashing function such as PBKDF2 or
1842
+ bcrypt. You can use `javax.crypto.SecretKeyFactory` with `SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1")`
1843
+ or, if using Spring, `org.springframework.security.crypto.bcrypt`.
1844
+ cwe:
1845
+ - CWE-327
1846
+ owasp:
1847
+ - A03:2017
1848
+ - A02:2021
1849
+ - A04:2025
1850
+ references:
1851
+ - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
1852
+ - https://github.com/returntocorp/semgrep-rules/issues/1609
1853
+ - https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory
1854
+ - >-
1855
+ https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoder.html
1856
+ tags:
1857
+ - java
1858
+ - md5
1859
+ - id: object-deserialization
1860
+ name: object-deserialization
1861
+ description: >-
1862
+ Found object deserialization using ObjectInputStream. Deserializing entire Java objects is dangerous because
1863
+ malicious actors can create Java object streams with unintended consequences. Ensure that the objects being
1864
+ deserialized are not user-controlled. If this must be done, consider using HMACs to sign the data stream to make
1865
+ sure it is not tampered with, or consider only transmitting object fields and populating a new object.
1866
+ category: security
1867
+ severity: medium
1868
+ confidence: medium
1869
+ languages:
1870
+ - java
1871
+ patterns:
1872
+ - pattern: new ObjectInputStream(...);
1873
+ message: >-
1874
+ Found object deserialization using ObjectInputStream. Deserializing entire Java objects is dangerous because
1875
+ malicious actors can create Java object streams with unintended consequences. Ensure that the objects being
1876
+ deserialized are not user-controlled. If this must be done, consider using HMACs to sign the data stream to
1877
+ make sure it is not tampered with, or consider only transmitting object fields and populating a new object.
1878
+ cwe:
1879
+ - CWE-502
1880
+ owasp:
1881
+ - A08:2017
1882
+ - A08:2021
1883
+ - A08:2025
1884
+ references:
1885
+ - https://www.owasp.org/index.php/Deserialization_of_untrusted_data
1886
+ - https://www.oracle.com/java/technologies/javase/seccodeguide.html#8
1887
+ tags:
1888
+ - java
1889
+ - id: ognl-injection
1890
+ name: ognl-injection
1891
+ description: >-
1892
+ A expression is built with a dynamic value. The source of the value(s) should be verified to avoid that unfiltered
1893
+ values fall into this risky code evaluation.
1894
+ category: security
1895
+ severity: medium
1896
+ confidence: medium
1897
+ languages:
1898
+ - java
1899
+ patterns:
1900
+ - regex: .*
1901
+ message: >-
1902
+ A expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
1903
+ unfiltered values fall into this risky code evaluation.
1904
+ cwe:
1905
+ - CWE-94
1906
+ owasp:
1907
+ - A03:2021
1908
+ - A05:2025
1909
+ references:
1910
+ - https://owasp.org/Top10/A03_2021-Injection
1911
+ tags:
1912
+ - ognl
1913
+ - id: overly-permissive-file-permission
1914
+ name: overly-permissive-file-permission
1915
+ description: >-
1916
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad practices
1917
+ to set overly permissive file permission such as read+write+exec for all users. If the file affected is a
1918
+ configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information leakage.
1919
+ Instead, follow the principle of least privilege and give users only the permissions they need.
1920
+ category: file-ops
1921
+ severity: medium
1922
+ confidence: medium
1923
+ languages:
1924
+ - java
1925
+ patterns:
1926
+ - pattern: >-
1927
+ java.nio.file.Files.setPosixFilePermissions($FILE,
1928
+ java.nio.file.attribute.PosixFilePermissions.fromString("=~/(^......r..$)|(^.......w.$)|(^........x$)/"));
1929
+ message: >-
1930
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad
1931
+ practices to set overly permissive file permission such as read+write+exec for all users. If the file affected
1932
+ is a configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information
1933
+ leakage. Instead, follow the principle of least privilege and give users only the permissions they need.
1934
+ - pattern: >
1935
+ $TYPE $P =
1936
+ java.nio.file.attribute.PosixFilePermissions.fromString("=~/(^......r..$)|(^.......w.$)|(^........x$)/");
1937
+
1938
+ ...
1939
+
1940
+ java.nio.file.Files.setPosixFilePermissions($FILE, $P);
1941
+ message: >-
1942
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad
1943
+ practices to set overly permissive file permission such as read+write+exec for all users. If the file affected
1944
+ is a configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information
1945
+ leakage. Instead, follow the principle of least privilege and give users only the permissions they need.
1946
+ - pattern: |
1947
+ $P.add(java.nio.file.attribute.PosixFilePermission.OTHERS_READ);
1948
+ ...
1949
+ java.nio.file.Files.setPosixFilePermissions($FILE, $P);
1950
+ message: >-
1951
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad
1952
+ practices to set overly permissive file permission such as read+write+exec for all users. If the file affected
1953
+ is a configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information
1954
+ leakage. Instead, follow the principle of least privilege and give users only the permissions they need.
1955
+ - pattern: |
1956
+ $P.add(java.nio.file.attribute.PosixFilePermission.OTHERS_WRITE);
1957
+ ...
1958
+ java.nio.file.Files.setPosixFilePermissions($FILE, $P);
1959
+ message: >-
1960
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad
1961
+ practices to set overly permissive file permission such as read+write+exec for all users. If the file affected
1962
+ is a configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information
1963
+ leakage. Instead, follow the principle of least privilege and give users only the permissions they need.
1964
+ - pattern: |-
1965
+ $P.add(java.nio.file.attribute.PosixFilePermission.OTHERS_EXECUTE);
1966
+ ...
1967
+ java.nio.file.Files.setPosixFilePermissions($FILE, $P);
1968
+ message: >-
1969
+ Detected file permissions that are overly permissive (read, write, and execute). It is generally a bad
1970
+ practices to set overly permissive file permission such as read+write+exec for all users. If the file affected
1971
+ is a configuration, a binary, a script or sensitive data, it can lead to privilege escalation or information
1972
+ leakage. Instead, follow the principle of least privilege and give users only the permissions they need.
1973
+ cwe:
1974
+ - CWE-276
1975
+ owasp:
1976
+ - A01:2021
1977
+ - A01:2025
1978
+ references:
1979
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
1980
+ tags:
1981
+ - java
1982
+ - id: permissive-cors
1983
+ name: permissive-cors
1984
+ description: >-
1985
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious application
1986
+ to communicate with the victim application in an inappropriate way, leading to spoofing, data theft, relay and
1987
+ other attacks.
1988
+ category: api-security
1989
+ severity: medium
1990
+ confidence: medium
1991
+ languages:
1992
+ - java
1993
+ patterns:
1994
+ - pattern: |
1995
+ HttpServletResponse $RES = ...;
1996
+ ...
1997
+ $RES.addHeader("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
1998
+ message: >-
1999
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2000
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2001
+ theft, relay and other attacks.
2002
+ - pattern: |
2003
+ HttpServletResponse $RES = ...;
2004
+ ...
2005
+ $RES.setHeader("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2006
+ message: >-
2007
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2008
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2009
+ theft, relay and other attacks.
2010
+ - pattern: |
2011
+ ServerHttpResponse $RES = ...;
2012
+ ...
2013
+ $RES.getHeaders().add("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2014
+ message: >-
2015
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2016
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2017
+ theft, relay and other attacks.
2018
+ - pattern: |
2019
+ HttpHeaders $HEADERS = ...;
2020
+ ...
2021
+ $HEADERS.set("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2022
+ message: >-
2023
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2024
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2025
+ theft, relay and other attacks.
2026
+ - pattern: |
2027
+ ServerWebExchange $SWE = ...;
2028
+ ...
2029
+ $SWE.getResponse().getHeaders().add("Access-Control-Allow-Origin", "*");
2030
+ message: >-
2031
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2032
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2033
+ theft, relay and other attacks.
2034
+ - pattern: |
2035
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2036
+ ...
2037
+ $RES.addHeader("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2038
+ ...
2039
+ }
2040
+ message: >-
2041
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2042
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2043
+ theft, relay and other attacks.
2044
+ - pattern: |
2045
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2046
+ ...
2047
+ $RES.setHeader("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2048
+ ...
2049
+ }
2050
+ message: >-
2051
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2052
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2053
+ theft, relay and other attacks.
2054
+ - pattern: |
2055
+ $X $METHOD(...,ServerHttpResponse $RES,...) {
2056
+ ...
2057
+ $RES.getHeaders().add("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2058
+ ...
2059
+ }
2060
+ message: >-
2061
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2062
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2063
+ theft, relay and other attacks.
2064
+ - pattern: |
2065
+ $X $METHOD(...,ServerWebExchange $SWE,...) {
2066
+ ...
2067
+ $SWE.getResponse().getHeaders().add("=~/access-control-allow-origin/i", "=~/^\*|null$/i");
2068
+ ...
2069
+ }
2070
+ message: >-
2071
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2072
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2073
+ theft, relay and other attacks.
2074
+ - pattern: ResponseEntity.$RES().header("=~/access-control-allow-origin/i", "=~/^\*|null$/i")
2075
+ message: >-
2076
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2077
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2078
+ theft, relay and other attacks.
2079
+ - pattern: ServerResponse.$RES().header("=~/access-control-allow-origin/i", "=~/^\*|null$/i")
2080
+ message: >-
2081
+ https://find-sec-bugs.github.io/bugs.htm#PERMISSIVE_CORS Permissive CORS policy will allow a malicious
2082
+ application to communicate with the victim application in an inappropriate way, leading to spoofing, data
2083
+ theft, relay and other attacks.
2084
+ cwe:
2085
+ - CWE-183
2086
+ owasp:
2087
+ - A04:2021
2088
+ - A06:2025
2089
+ references:
2090
+ - https://owasp.org/Top10/A04_2021-Insecure_Design
2091
+ tags:
2092
+ - java
2093
+ - id: script-engine-injection
2094
+ name: script-engine-injection
2095
+ description: >-
2096
+ Detected potential code injection using ScriptEngine. Ensure user-controlled data cannot enter '.eval()',
2097
+ otherwise, this is a code injection vulnerability.
2098
+ category: security
2099
+ severity: medium
2100
+ confidence: medium
2101
+ languages:
2102
+ - java
2103
+ patterns:
2104
+ - pattern: |
2105
+ $X $METHOD(...) {
2106
+ ...
2107
+ $SE.eval(...);
2108
+ ...
2109
+ }
2110
+ message: >-
2111
+ Detected potential code injection using ScriptEngine. Ensure user-controlled data cannot enter '.eval()',
2112
+ otherwise, this is a code injection vulnerability.
2113
+ cwe:
2114
+ - CWE-94
2115
+ owasp:
2116
+ - A03:2021
2117
+ - A05:2025
2118
+ references:
2119
+ - https://owasp.org/Top10/A03_2021-Injection
2120
+ tags:
2121
+ - java
2122
+ - id: hibernate-sqli
2123
+ name: hibernate-sqli
2124
+ description: >-
2125
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2126
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2127
+ PreparedStatement using 'connection.prepareStatement'.
2128
+ category: injection
2129
+ severity: medium
2130
+ confidence: medium
2131
+ languages:
2132
+ - java
2133
+ patterns:
2134
+ - pattern: org.hibernate.criterion.Restrictions.sqlRestriction(String.format(...),...)
2135
+ message: >-
2136
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2137
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2138
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2139
+ cwe:
2140
+ - CWE-89
2141
+ owasp:
2142
+ - A01:2017
2143
+ - A03:2021
2144
+ - A05:2025
2145
+ references:
2146
+ - https://owasp.org/Top10/A03_2021-Injection
2147
+ tags:
2148
+ - hibernate
2149
+ - id: jdbc-sqli
2150
+ name: jdbc-sqli
2151
+ description: >-
2152
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2153
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2154
+ PreparedStatement using 'connection.prepareStatement'.
2155
+ category: injection
2156
+ severity: medium
2157
+ confidence: medium
2158
+ languages:
2159
+ - java
2160
+ patterns:
2161
+ - regex: .*
2162
+ message: >-
2163
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2164
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2165
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2166
+ cwe:
2167
+ - CWE-89
2168
+ owasp:
2169
+ - A01:2017
2170
+ - A03:2021
2171
+ - A05:2025
2172
+ references:
2173
+ - https://owasp.org/Top10/A03_2021-Injection
2174
+ tags:
2175
+ - jdbc
2176
+ - id: jdo-sqli
2177
+ name: jdo-sqli
2178
+ description: >-
2179
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2180
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2181
+ PreparedStatement using 'connection.prepareStatement'.
2182
+ category: injection
2183
+ severity: medium
2184
+ confidence: medium
2185
+ languages:
2186
+ - java
2187
+ patterns:
2188
+ - regex: .*
2189
+ message: >-
2190
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2191
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2192
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2193
+ cwe:
2194
+ - CWE-89
2195
+ owasp:
2196
+ - A01:2017
2197
+ - A03:2021
2198
+ - A05:2025
2199
+ references:
2200
+ - https://owasp.org/Top10/A03_2021-Injection
2201
+ tags:
2202
+ - java
2203
+ - id: jpa-sqli
2204
+ name: jpa-sqli
2205
+ description: >-
2206
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2207
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2208
+ PreparedStatement using 'connection.prepareStatement'.
2209
+ category: injection
2210
+ severity: medium
2211
+ confidence: medium
2212
+ languages:
2213
+ - java
2214
+ patterns:
2215
+ - regex: .*
2216
+ message: >-
2217
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2218
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2219
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2220
+ cwe:
2221
+ - CWE-89
2222
+ owasp:
2223
+ - A01:2017
2224
+ - A03:2021
2225
+ - A05:2025
2226
+ references:
2227
+ - https://owasp.org/Top10/A03_2021-Injection
2228
+ tags:
2229
+ - jpa
2230
+ - id: tainted-sql-from-http-request
2231
+ name: tainted-sql-from-http-request
2232
+ description: >-
2233
+ Detected input from a HTTPServletRequest going into a SQL sink or statement. This could lead to SQL injection if
2234
+ variables in the SQL statement are not properly sanitized. Use parameterized SQL queries or properly sanitize user
2235
+ input instead.
2236
+ category: injection
2237
+ severity: medium
2238
+ confidence: medium
2239
+ languages:
2240
+ - java
2241
+ patterns:
2242
+ - regex: .*
2243
+ message: >-
2244
+ Detected input from a HTTPServletRequest going into a SQL sink or statement. This could lead to SQL injection
2245
+ if variables in the SQL statement are not properly sanitized. Use parameterized SQL queries or properly
2246
+ sanitize user input instead.
2247
+ cwe:
2248
+ - CWE-89
2249
+ owasp:
2250
+ - A01:2017
2251
+ - A03:2021
2252
+ - A05:2025
2253
+ references:
2254
+ - https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html
2255
+ - https://owasp.org/www-community/attacks/SQL_Injection
2256
+ tags:
2257
+ - sql
2258
+ - java
2259
+ - servlets
2260
+ - spring
2261
+ - id: turbine-sqli
2262
+ name: turbine-sqli
2263
+ description: >-
2264
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2265
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2266
+ PreparedStatement using 'connection.prepareStatement'.
2267
+ category: injection
2268
+ severity: medium
2269
+ confidence: medium
2270
+ languages:
2271
+ - java
2272
+ patterns:
2273
+ - regex: .*
2274
+ message: >-
2275
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2276
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2277
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2278
+ cwe:
2279
+ - CWE-89
2280
+ owasp:
2281
+ - A01:2017
2282
+ - A03:2021
2283
+ - A05:2025
2284
+ references:
2285
+ - https://owasp.org/Top10/A03_2021-Injection
2286
+ tags:
2287
+ - turbine
2288
+ - id: vertx-sqli
2289
+ name: vertx-sqli
2290
+ description: >-
2291
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
2292
+ are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a
2293
+ PreparedStatement using 'connection.prepareStatement'.
2294
+ category: injection
2295
+ severity: medium
2296
+ confidence: medium
2297
+ languages:
2298
+ - java
2299
+ patterns:
2300
+ - regex: .*
2301
+ message: >-
2302
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
2303
+ statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can
2304
+ obtain a PreparedStatement using 'connection.prepareStatement'.
2305
+ cwe:
2306
+ - CWE-89
2307
+ owasp:
2308
+ - A01:2017
2309
+ - A03:2021
2310
+ - A05:2025
2311
+ references:
2312
+ - https://owasp.org/Top10/A03_2021-Injection
2313
+ tags:
2314
+ - vertx
2315
+ - id: tainted-cmd-from-http-request
2316
+ name: tainted-cmd-from-http-request
2317
+ description: >-
2318
+ Detected input from a HTTPServletRequest going into a 'ProcessBuilder' or 'exec' command. This could lead to
2319
+ command injection if variables passed into the exec commands are not properly sanitized. Instead, avoid using
2320
+ these OS commands with user-supplied input, or, if you must use these commands, use a whitelist of specific
2321
+ values.
2322
+ category: security
2323
+ severity: high
2324
+ confidence: medium
2325
+ languages:
2326
+ - java
2327
+ patterns:
2328
+ - regex: .*
2329
+ message: >-
2330
+ Detected input from a HTTPServletRequest going into a 'ProcessBuilder' or 'exec' command. This could lead to
2331
+ command injection if variables passed into the exec commands are not properly sanitized. Instead, avoid using
2332
+ these OS commands with user-supplied input, or, if you must use these commands, use a whitelist of specific
2333
+ values.
2334
+ cwe:
2335
+ - CWE-78
2336
+ owasp:
2337
+ - A01:2017
2338
+ - A03:2021
2339
+ - A05:2025
2340
+ references:
2341
+ - https://owasp.org/Top10/A03_2021-Injection
2342
+ tags:
2343
+ - java
2344
+ - id: tainted-env-from-http-request
2345
+ name: tainted-env-from-http-request
2346
+ description: >-
2347
+ Detected input from a HTTPServletRequest going into the environment variables of an 'exec' command. Instead, call
2348
+ the command with user-supplied arguments by using the overloaded method with one String array as the argument.
2349
+ `exec({"command", "arg1", "arg2"})`.
2350
+ category: security
2351
+ severity: high
2352
+ confidence: medium
2353
+ languages:
2354
+ - java
2355
+ patterns:
2356
+ - regex: .*
2357
+ message: >-
2358
+ Detected input from a HTTPServletRequest going into the environment variables of an 'exec' command. Instead,
2359
+ call the command with user-supplied arguments by using the overloaded method with one String array as the
2360
+ argument. `exec({"command", "arg1", "arg2"})`.
2361
+ cwe:
2362
+ - CWE-454
2363
+ owasp:
2364
+ - A01:2017
2365
+ - A03:2021
2366
+ - A05:2025
2367
+ references:
2368
+ - https://owasp.org/Top10/A03_2021-Injection
2369
+ tags:
2370
+ - java
2371
+ - id: tainted-ldapi-from-http-request
2372
+ name: tainted-ldapi-from-http-request
2373
+ description: >-
2374
+ Detected input from a HTTPServletRequest going into an LDAP query. This could lead to LDAP injection if the input
2375
+ is not properly sanitized, which could result in attackers modifying objects in the LDAP tree structure. Ensure
2376
+ data passed to an LDAP query is not controllable or properly sanitize the data.
2377
+ category: security
2378
+ severity: medium
2379
+ confidence: medium
2380
+ languages:
2381
+ - java
2382
+ patterns:
2383
+ - regex: .*
2384
+ message: >-
2385
+ Detected input from a HTTPServletRequest going into an LDAP query. This could lead to LDAP injection if the
2386
+ input is not properly sanitized, which could result in attackers modifying objects in the LDAP tree structure.
2387
+ Ensure data passed to an LDAP query is not controllable or properly sanitize the data.
2388
+ cwe:
2389
+ - CWE-90
2390
+ owasp:
2391
+ - A01:2017
2392
+ - A03:2021
2393
+ - A05:2025
2394
+ references:
2395
+ - https://sensei.securecodewarrior.com/recipes/scw%3Ajava%3ALDAP-injection
2396
+ tags:
2397
+ - java
2398
+ - id: tainted-session-from-http-request
2399
+ name: tainted-session-from-http-request
2400
+ description: >-
2401
+ Detected input from a HTTPServletRequest going into a session command, like `setAttribute`. User input into such a
2402
+ command could lead to an attacker inputting malicious code into your session parameters, blurring the line between
2403
+ what's trusted and untrusted, and therefore leading to a trust boundary violation. This could lead to programmers
2404
+ trusting unvalidated data. Instead, thoroughly sanitize user input before passing it into such function calls.
2405
+ category: auth
2406
+ severity: medium
2407
+ confidence: medium
2408
+ languages:
2409
+ - java
2410
+ patterns:
2411
+ - regex: .*
2412
+ message: >-
2413
+ Detected input from a HTTPServletRequest going into a session command, like `setAttribute`. User input into
2414
+ such a command could lead to an attacker inputting malicious code into your session parameters, blurring the
2415
+ line between what's trusted and untrusted, and therefore leading to a trust boundary violation. This could
2416
+ lead to programmers trusting unvalidated data. Instead, thoroughly sanitize user input before passing it into
2417
+ such function calls.
2418
+ cwe:
2419
+ - CWE-501
2420
+ owasp:
2421
+ - A04:2021
2422
+ - A06:2025
2423
+ references:
2424
+ - https://owasp.org/Top10/A04_2021-Insecure_Design
2425
+ tags:
2426
+ - java
2427
+ - id: tainted-xpath-from-http-request
2428
+ name: tainted-xpath-from-http-request
2429
+ description: >-
2430
+ Detected input from a HTTPServletRequest going into a XPath evaluate or compile command. This could lead to xpath
2431
+ injection if variables passed into the evaluate or compile commands are not properly sanitized. Xpath injection
2432
+ could lead to unauthorized access to sensitive information in XML documents. Instead, thoroughly sanitize user
2433
+ input or use parameterized xpath queries if you can.
2434
+ category: file-ops
2435
+ severity: medium
2436
+ confidence: medium
2437
+ languages:
2438
+ - java
2439
+ patterns:
2440
+ - regex: .*
2441
+ message: >-
2442
+ Detected input from a HTTPServletRequest going into a XPath evaluate or compile command. This could lead to
2443
+ xpath injection if variables passed into the evaluate or compile commands are not properly sanitized. Xpath
2444
+ injection could lead to unauthorized access to sensitive information in XML documents. Instead, thoroughly
2445
+ sanitize user input or use parameterized xpath queries if you can.
2446
+ cwe:
2447
+ - CWE-643
2448
+ owasp:
2449
+ - A03:2021
2450
+ - A05:2025
2451
+ references:
2452
+ - https://owasp.org/Top10/A03_2021-Injection
2453
+ tags:
2454
+ - java
2455
+ - id: unsafe-reflection
2456
+ name: unsafe-reflection
2457
+ description: >-
2458
+ If an attacker can supply values that the application then uses to determine which class to instantiate or which
2459
+ method to invoke, the potential exists for the attacker to create control flow paths through the application that
2460
+ were not intended by the application developers. This attack vector may allow the attacker to bypass
2461
+ authentication or access control checks or otherwise cause the application to behave in an unexpected manner.
2462
+ category: security
2463
+ severity: medium
2464
+ confidence: medium
2465
+ languages:
2466
+ - java
2467
+ patterns:
2468
+ - pattern: |
2469
+ Class.forName($CLASS,...)
2470
+ message: >-
2471
+ If an attacker can supply values that the application then uses to determine which class to instantiate or
2472
+ which method to invoke, the potential exists for the attacker to create control flow paths through the
2473
+ application that were not intended by the application developers. This attack vector may allow the attacker to
2474
+ bypass authentication or access control checks or otherwise cause the application to behave in an unexpected
2475
+ manner.
2476
+ cwe:
2477
+ - CWE-470
2478
+ owasp:
2479
+ - A03:2021
2480
+ - A05:2025
2481
+ references:
2482
+ - https://owasp.org/Top10/A03_2021-Injection
2483
+ tags:
2484
+ - java
2485
+ - id: unvalidated-redirect
2486
+ name: unvalidated-redirect
2487
+ description: >-
2488
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2489
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2490
+ category: security
2491
+ severity: medium
2492
+ confidence: medium
2493
+ languages:
2494
+ - java
2495
+ patterns:
2496
+ - pattern: |
2497
+ $X $METHOD(...,HttpServletResponse $RES,...,String $URL,...) {
2498
+ ...
2499
+ $RES.sendRedirect($URL);
2500
+ ...
2501
+ }
2502
+ message: >-
2503
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2504
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2505
+ - pattern: |
2506
+ $X $METHOD(...,String $URL,...,HttpServletResponse $RES,...) {
2507
+ ...
2508
+ $RES.sendRedirect($URL);
2509
+ ...
2510
+ }
2511
+ message: >-
2512
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2513
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2514
+ - pattern: |
2515
+ $X $METHOD(...,HttpServletRequest $REQ,...,HttpServletResponse $RES,...) {
2516
+ ...
2517
+ String $URL = $REQ.getParameter(...);
2518
+ ...
2519
+ $RES.sendRedirect($URL);
2520
+ ...
2521
+ }
2522
+ message: >-
2523
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2524
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2525
+ - pattern: |
2526
+ $X $METHOD(...,HttpServletResponse $RES,...,HttpServletRequest $REQ,...) {
2527
+ ...
2528
+ String $URL = $REQ.getParameter(...);
2529
+ ...
2530
+ $RES.sendRedirect($URL);
2531
+ ...
2532
+ }
2533
+ message: >-
2534
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2535
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2536
+ - pattern: |
2537
+ $X $METHOD(...,String $URL,...) {
2538
+ ...
2539
+ HttpServletResponse $RES = ...;
2540
+ ...
2541
+ $RES.sendRedirect($URL);
2542
+ ...
2543
+ }
2544
+ message: >-
2545
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2546
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2547
+ - pattern: |
2548
+ $X $METHOD(...,HttpServletRequest $REQ,...,HttpServletResponse $RES,...) {
2549
+ ...
2550
+ $RES.sendRedirect($REQ.getParameter(...));
2551
+ ...
2552
+ }
2553
+ message: >-
2554
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2555
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2556
+ - pattern: |
2557
+ $X $METHOD(...,HttpServletResponse $RES,...,HttpServletRequest $REQ,...) {
2558
+ ...
2559
+ $RES.sendRedirect($REQ.getParameter(...));
2560
+ ...
2561
+ }
2562
+ message: >-
2563
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2564
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2565
+ - pattern: |
2566
+ $X $METHOD(...,HttpServletResponse $RES,...,String $URL,...) {
2567
+ ...
2568
+ $RES.addHeader("Location",$URL);
2569
+ ...
2570
+ }
2571
+ message: >-
2572
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2573
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2574
+ - pattern: |
2575
+ $X $METHOD(...,String $URL,...,HttpServletResponse $RES,...) {
2576
+ ...
2577
+ $RES.addHeader("Location",$URL);
2578
+ ...
2579
+ }
2580
+ message: >-
2581
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2582
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2583
+ - pattern: |
2584
+ $X $METHOD(...,HttpServletRequest $REQ,...,HttpServletResponse $RES,...) {
2585
+ ...
2586
+ String $URL = $REQ.getParameter(...);
2587
+ ...
2588
+ $RES.addHeader("Location",$URL);
2589
+ ...
2590
+ }
2591
+ message: >-
2592
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2593
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2594
+ - pattern: |
2595
+ $X $METHOD(...,HttpServletResponse $RES,...,HttpServletRequest $REQ,...) {
2596
+ ...
2597
+ String $URL = $REQ.getParameter(...);
2598
+ ...
2599
+ $RES.addHeader("Location",$URL);
2600
+ ...
2601
+ }
2602
+ message: >-
2603
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2604
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2605
+ - pattern: |
2606
+ $X $METHOD(...,String $URL,...) {
2607
+ ...
2608
+ HttpServletResponse $RES = ...;
2609
+ ...
2610
+ $RES.addHeader("Location",$URL);
2611
+ ...
2612
+ }
2613
+ message: >-
2614
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2615
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2616
+ - pattern: |
2617
+ $X $METHOD(...,HttpServletRequest $REQ,...,HttpServletResponse $RES,...) {
2618
+ ...
2619
+ $RES.addHeader("Location",$REQ.getParameter(...));
2620
+ ...
2621
+ }
2622
+ message: >-
2623
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2624
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2625
+ - pattern: |-
2626
+ $X $METHOD(...,HttpServletResponse $RES,...,HttpServletRequest $REQ,...) {
2627
+ ...
2628
+ $RES.addHeader("Location",$REQ.getParameter(...));
2629
+ ...
2630
+ }
2631
+ message: >-
2632
+ Application redirects to a destination URL specified by a user-supplied parameter that is not validated. This
2633
+ could direct users to malicious locations. Consider using an allowlist to validate URLs.
2634
+ cwe:
2635
+ - CWE-601
2636
+ owasp:
2637
+ - A01:2021
2638
+ - A01:2025
2639
+ references:
2640
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
2641
+ tags:
2642
+ - java
2643
+ - id: url-rewriting
2644
+ name: url-rewriting
2645
+ description: >-
2646
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by third
2647
+ parties.
2648
+ category: security
2649
+ severity: medium
2650
+ confidence: medium
2651
+ languages:
2652
+ - java
2653
+ patterns:
2654
+ - pattern: |
2655
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2656
+ ...
2657
+ $RES.encodeURL(...);
2658
+ ...
2659
+ }
2660
+ message: >-
2661
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2662
+ third parties.
2663
+ - pattern: |
2664
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2665
+ ...
2666
+ $RES.encodeUrl(...);
2667
+ ...
2668
+ }
2669
+ message: >-
2670
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2671
+ third parties.
2672
+ - pattern: |
2673
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2674
+ ...
2675
+ $RES.encodeRedirectURL(...);
2676
+ ...
2677
+ }
2678
+ message: >-
2679
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2680
+ third parties.
2681
+ - pattern: |
2682
+ $X $METHOD(...,HttpServletResponse $RES,...) {
2683
+ ...
2684
+ $RES.encodeRedirectUrl(...);
2685
+ ...
2686
+ }
2687
+ message: >-
2688
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2689
+ third parties.
2690
+ - pattern: |
2691
+ $X $METHOD(...) {
2692
+ ...
2693
+ HttpServletResponse $RES = ...;
2694
+ ...
2695
+ $RES.encodeURL(...);
2696
+ ...
2697
+ }
2698
+ message: >-
2699
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2700
+ third parties.
2701
+ - pattern: |
2702
+ $X $METHOD(...) {
2703
+ ...
2704
+ HttpServletResponse $RES = ...;
2705
+ ...
2706
+ $RES.encodeUrl(...);
2707
+ ...
2708
+ }
2709
+ message: >-
2710
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2711
+ third parties.
2712
+ - pattern: |
2713
+ $X $METHOD(...) {
2714
+ ...
2715
+ HttpServletResponse $RES = ...;
2716
+ ...
2717
+ $RES.encodeRedirectURL(...);
2718
+ ...
2719
+ }
2720
+ message: >-
2721
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2722
+ third parties.
2723
+ - pattern: |-
2724
+ $X $METHOD(...) {
2725
+ ...
2726
+ HttpServletResponse $RES = ...;
2727
+ ...
2728
+ $RES.encodeRedirectUrl(...);
2729
+ ...
2730
+ }
2731
+ message: >-
2732
+ URL rewriting has significant security risks. Since session ID appears in the URL, it may be easily seen by
2733
+ third parties.
2734
+ cwe:
2735
+ - CWE-200
2736
+ owasp:
2737
+ - A01:2021
2738
+ - A01:2025
2739
+ references:
2740
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
2741
+ tags:
2742
+ - java
2743
+ - id: weak-ssl-context
2744
+ name: weak-ssl-context
2745
+ description: >-
2746
+ An insecure SSL context was detected. TLS versions 1.0, 1.1, and all SSL versions are considered weak encryption
2747
+ and are deprecated. Use SSLContext.getInstance("TLSv1.2") for the best security.
2748
+ category: security
2749
+ severity: medium
2750
+ confidence: medium
2751
+ languages:
2752
+ - java
2753
+ patterns:
2754
+ - pattern: SSLContext.getInstance("...")
2755
+ message: >-
2756
+ An insecure SSL context was detected. TLS versions 1.0, 1.1, and all SSL versions are considered weak
2757
+ encryption and are deprecated. Use SSLContext.getInstance("TLSv1.2") for the best security.
2758
+ cwe:
2759
+ - CWE-326
2760
+ owasp:
2761
+ - A03:2017
2762
+ - A02:2021
2763
+ - A04:2025
2764
+ references:
2765
+ - https://tools.ietf.org/html/rfc7568
2766
+ - https://tools.ietf.org/id/draft-ietf-tls-oldversions-deprecate-02.html
2767
+ tags:
2768
+ - java
2769
+ - id: xml-decoder
2770
+ name: xml-decoder
2771
+ description: >-
2772
+ XMLDecoder should not be used to parse untrusted data. Deserializing user input can lead to arbitrary code
2773
+ execution. Use an alternative and explicitly disable external entities. See
2774
+ https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html for alternatives
2775
+ and vulnerability prevention.
2776
+ category: security
2777
+ severity: medium
2778
+ confidence: medium
2779
+ languages:
2780
+ - java
2781
+ patterns:
2782
+ - pattern: |
2783
+ $X $METHOD(...) {
2784
+ ...
2785
+ new XMLDecoder(...);
2786
+ ...
2787
+ }
2788
+ message: >-
2789
+ XMLDecoder should not be used to parse untrusted data. Deserializing user input can lead to arbitrary code
2790
+ execution. Use an alternative and explicitly disable external entities. See
2791
+ https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html for
2792
+ alternatives and vulnerability prevention.
2793
+ cwe:
2794
+ - CWE-611
2795
+ owasp:
2796
+ - A04:2017
2797
+ - A05:2021
2798
+ - A02:2025
2799
+ references:
2800
+ - https://semgrep.dev/blog/2022/xml-security-in-java
2801
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
2802
+ - https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html
2803
+ tags:
2804
+ - java
2805
+ - id: no-direct-response-writer
2806
+ name: no-direct-response-writer
2807
+ description: >-
2808
+ Detected a request with potential user-input going into a OutputStream or Writer object. This bypasses any view or
2809
+ template environments, including HTML escaping, which may expose this application to cross-site scripting (XSS)
2810
+ vulnerabilities. Consider using a view technology such as JavaServer Faces (JSFs) which automatically escapes HTML
2811
+ views.
2812
+ category: security
2813
+ severity: medium
2814
+ confidence: medium
2815
+ languages:
2816
+ - java
2817
+ patterns:
2818
+ - regex: .*
2819
+ message: >-
2820
+ Detected a request with potential user-input going into a OutputStream or Writer object. This bypasses any
2821
+ view or template environments, including HTML escaping, which may expose this application to cross-site
2822
+ scripting (XSS) vulnerabilities. Consider using a view technology such as JavaServer Faces (JSFs) which
2823
+ automatically escapes HTML views.
2824
+ cwe:
2825
+ - CWE-79
2826
+ owasp:
2827
+ - A07:2017
2828
+ - A03:2021
2829
+ - A05:2025
2830
+ references:
2831
+ - https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaServerFaces.html
2832
+ tags:
2833
+ - java
2834
+ - servlets
2835
+ - id: xssrequestwrapper-is-insecure
2836
+ name: xssrequestwrapper-is-insecure
2837
+ description: >-
2838
+ It looks like you're using an implementation of XSSRequestWrapper from dzone.
2839
+ (https://www.javacodegeeks.com/2012/07/anti-cross-site-scripting-xss-filter.html) The XSS filtering in this code
2840
+ is not secure and can be bypassed by malicious actors. It is recommended to use a stack that automatically escapes
2841
+ in your view or templates instead of filtering yourself.
2842
+ category: xss
2843
+ severity: medium
2844
+ confidence: medium
2845
+ languages:
2846
+ - java
2847
+ patterns:
2848
+ - pattern: |
2849
+ class XSSRequestWrapper extends HttpServletRequestWrapper {
2850
+ ...
2851
+ }
2852
+ message: >-
2853
+ It looks like you're using an implementation of XSSRequestWrapper from dzone.
2854
+ (https://www.javacodegeeks.com/2012/07/anti-cross-site-scripting-xss-filter.html) The XSS filtering in this
2855
+ code is not secure and can be bypassed by malicious actors. It is recommended to use a stack that
2856
+ automatically escapes in your view or templates instead of filtering yourself.
2857
+ - pattern: |-
2858
+ $P = $X.compile("</script>", $X.CASE_INSENSITIVE);
2859
+ $V = $P.matcher(...).replaceAll("");
2860
+ message: >-
2861
+ It looks like you're using an implementation of XSSRequestWrapper from dzone.
2862
+ (https://www.javacodegeeks.com/2012/07/anti-cross-site-scripting-xss-filter.html) The XSS filtering in this
2863
+ code is not secure and can be bypassed by malicious actors. It is recommended to use a stack that
2864
+ automatically escapes in your view or templates instead of filtering yourself.
2865
+ cwe:
2866
+ - CWE-79
2867
+ owasp:
2868
+ - A07:2017
2869
+ - A03:2021
2870
+ - A05:2025
2871
+ references:
2872
+ - https://owasp.org/Top10/A03_2021-Injection
2873
+ tags:
2874
+ - java
2875
+ - id: documentbuilderfactory-disallow-doctype-decl-false
2876
+ name: documentbuilderfactory-disallow-doctype-decl-false
2877
+ description: >-
2878
+ DOCTYPE declarations are enabled for $DBFACTORY. Without prohibiting external entity declarations, this is
2879
+ vulnerable to XML external entity attacks. Disable this by setting the feature
2880
+ "http://apache.org/xml/features/disallow-doctype-decl" to true. Alternatively, allow DOCTYPE declarations and only
2881
+ prohibit external entities declarations. This can be done by setting the features
2882
+ "http://xml.org/sax/features/external-general-entities" and
2883
+ "http://xml.org/sax/features/external-parameter-entities" to false.
2884
+ category: security
2885
+ severity: high
2886
+ confidence: medium
2887
+ languages:
2888
+ - java
2889
+ patterns:
2890
+ - pattern: $DBFACTORY.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
2891
+ message: >-
2892
+ DOCTYPE declarations are enabled for $DBFACTORY. Without prohibiting external entity declarations, this is
2893
+ vulnerable to XML external entity attacks. Disable this by setting the feature
2894
+ "http://apache.org/xml/features/disallow-doctype-decl" to true. Alternatively, allow DOCTYPE declarations and
2895
+ only prohibit external entities declarations. This can be done by setting the features
2896
+ "http://xml.org/sax/features/external-general-entities" and
2897
+ "http://xml.org/sax/features/external-parameter-entities" to false.
2898
+ cwe:
2899
+ - CWE-611
2900
+ owasp:
2901
+ - A04:2017
2902
+ - A05:2021
2903
+ - A02:2025
2904
+ references:
2905
+ - https://semgrep.dev/blog/2022/xml-security-in-java
2906
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
2907
+ - https://blog.sonarsource.com/secure-xml-processor
2908
+ - https://xerces.apache.org/xerces2-j/features.html
2909
+ tags:
2910
+ - java
2911
+ - xml
2912
+ - id: documentbuilderfactory-disallow-doctype-decl-missing
2913
+ name: documentbuilderfactory-disallow-doctype-decl-missing
2914
+ description: >-
2915
+ DOCTYPE declarations are enabled for this DocumentBuilderFactory. This is vulnerable to XML external entity
2916
+ attacks. Disable this by setting the feature "http://apache.org/xml/features/disallow-doctype-decl" to true.
2917
+ Alternatively, allow DOCTYPE declarations and only prohibit external entities declarations. This can be done by
2918
+ setting the features "http://xml.org/sax/features/external-general-entities" and
2919
+ "http://xml.org/sax/features/external-parameter-entities" to false.
2920
+ category: security
2921
+ severity: high
2922
+ confidence: medium
2923
+ languages:
2924
+ - java
2925
+ patterns:
2926
+ - regex: .*
2927
+ message: >-
2928
+ DOCTYPE declarations are enabled for this DocumentBuilderFactory. This is vulnerable to XML external entity
2929
+ attacks. Disable this by setting the feature "http://apache.org/xml/features/disallow-doctype-decl" to true.
2930
+ Alternatively, allow DOCTYPE declarations and only prohibit external entities declarations. This can be done
2931
+ by setting the features "http://xml.org/sax/features/external-general-entities" and
2932
+ "http://xml.org/sax/features/external-parameter-entities" to false.
2933
+ cwe:
2934
+ - CWE-611
2935
+ owasp:
2936
+ - A04:2017
2937
+ - A05:2021
2938
+ - A02:2025
2939
+ references:
2940
+ - https://semgrep.dev/blog/2022/xml-security-in-java
2941
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
2942
+ - https://blog.sonarsource.com/secure-xml-processor
2943
+ - https://xerces.apache.org/xerces2-j/features.html
2944
+ tags:
2945
+ - java
2946
+ - xml
2947
+ - id: documentbuilderfactory-external-general-entities-true
2948
+ name: documentbuilderfactory-external-general-entities-true
2949
+ description: >-
2950
+ External entities are allowed for $DBFACTORY. This is vulnerable to XML external entity attacks. Disable this by
2951
+ setting the feature "http://xml.org/sax/features/external-general-entities" to false.
2952
+ category: security
2953
+ severity: high
2954
+ confidence: medium
2955
+ languages:
2956
+ - java
2957
+ patterns:
2958
+ - pattern: $DBFACTORY.setFeature("http://xml.org/sax/features/external-general-entities", true);
2959
+ message: >-
2960
+ External entities are allowed for $DBFACTORY. This is vulnerable to XML external entity attacks. Disable this
2961
+ by setting the feature "http://xml.org/sax/features/external-general-entities" to false.
2962
+ cwe:
2963
+ - CWE-611
2964
+ owasp:
2965
+ - A04:2017
2966
+ - A05:2021
2967
+ - A02:2025
2968
+ references:
2969
+ - https://semgrep.dev/blog/2022/xml-security-in-java
2970
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
2971
+ - https://blog.sonarsource.com/secure-xml-processor
2972
+ tags:
2973
+ - java
2974
+ - xml
2975
+ - id: documentbuilderfactory-external-parameter-entities-true
2976
+ name: documentbuilderfactory-external-parameter-entities-true
2977
+ description: >-
2978
+ External entities are allowed for $DBFACTORY. This is vulnerable to XML external entity attacks. Disable this by
2979
+ setting the feature "http://xml.org/sax/features/external-parameter-entities" to false.
2980
+ category: security
2981
+ severity: high
2982
+ confidence: medium
2983
+ languages:
2984
+ - java
2985
+ patterns:
2986
+ - pattern: $DBFACTORY.setFeature("http://xml.org/sax/features/external-parameter-entities", true);
2987
+ message: >-
2988
+ External entities are allowed for $DBFACTORY. This is vulnerable to XML external entity attacks. Disable this
2989
+ by setting the feature "http://xml.org/sax/features/external-parameter-entities" to false.
2990
+ cwe:
2991
+ - CWE-611
2992
+ owasp:
2993
+ - A04:2017
2994
+ - A05:2021
2995
+ - A02:2025
2996
+ references:
2997
+ - https://semgrep.dev/blog/2022/xml-security-in-java
2998
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
2999
+ - https://blog.sonarsource.com/secure-xml-processor
3000
+ tags:
3001
+ - java
3002
+ - xml
3003
+ - id: saxparserfactory-disallow-doctype-decl-missing
3004
+ name: saxparserfactory-disallow-doctype-decl-missing
3005
+ description: >-
3006
+ DOCTYPE declarations are enabled for this SAXParserFactory. This is vulnerable to XML external entity attacks.
3007
+ Disable this by setting the feature `http://apache.org/xml/features/disallow-doctype-decl` to true. Alternatively,
3008
+ allow DOCTYPE declarations and only prohibit external entities declarations. This can be done by setting the
3009
+ features `http://xml.org/sax/features/external-general-entities` and
3010
+ `http://xml.org/sax/features/external-parameter-entities` to false. NOTE - The previous links are not meant to be
3011
+ clicked. They are the literal config key values that are supposed to be used to disable these features. For more
3012
+ information, see https://semgrep.dev/docs/cheat-sheets/java-xxe/#3a-documentbuilderfactory.
3013
+ category: security
3014
+ severity: high
3015
+ confidence: medium
3016
+ languages:
3017
+ - java
3018
+ patterns:
3019
+ - regex: .*
3020
+ message: >-
3021
+ DOCTYPE declarations are enabled for this SAXParserFactory. This is vulnerable to XML external entity attacks.
3022
+ Disable this by setting the feature `http://apache.org/xml/features/disallow-doctype-decl` to true.
3023
+ Alternatively, allow DOCTYPE declarations and only prohibit external entities declarations. This can be done
3024
+ by setting the features `http://xml.org/sax/features/external-general-entities` and
3025
+ `http://xml.org/sax/features/external-parameter-entities` to false. NOTE - The previous links are not meant to
3026
+ be clicked. They are the literal config key values that are supposed to be used to disable these features. For
3027
+ more information, see https://semgrep.dev/docs/cheat-sheets/java-xxe/#3a-documentbuilderfactory.
3028
+ cwe:
3029
+ - CWE-611
3030
+ owasp:
3031
+ - A04:2017
3032
+ - A05:2021
3033
+ - A02:2025
3034
+ references:
3035
+ - https://semgrep.dev/blog/2022/xml-security-in-java
3036
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
3037
+ - https://blog.sonarsource.com/secure-xml-processor
3038
+ - https://xerces.apache.org/xerces2-j/features.html
3039
+ tags:
3040
+ - java
3041
+ - xml
3042
+ - id: transformerfactory-dtds-not-disabled
3043
+ name: transformerfactory-dtds-not-disabled
3044
+ description: >-
3045
+ DOCTYPE declarations are enabled for this TransformerFactory. This is vulnerable to XML external entity attacks.
3046
+ Disable this by setting the attributes "accessExternalDTD" and "accessExternalStylesheet" to "".
3047
+ category: security
3048
+ severity: high
3049
+ confidence: medium
3050
+ languages:
3051
+ - java
3052
+ patterns:
3053
+ - regex: .*
3054
+ message: >-
3055
+ DOCTYPE declarations are enabled for this TransformerFactory. This is vulnerable to XML external entity
3056
+ attacks. Disable this by setting the attributes "accessExternalDTD" and "accessExternalStylesheet" to "".
3057
+ cwe:
3058
+ - CWE-611
3059
+ owasp:
3060
+ - A04:2017
3061
+ - A05:2021
3062
+ - A02:2025
3063
+ references:
3064
+ - https://semgrep.dev/blog/2022/xml-security-in-java
3065
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
3066
+ - https://blog.sonarsource.com/secure-xml-processor
3067
+ - https://xerces.apache.org/xerces2-j/features.html
3068
+ tags:
3069
+ - java
3070
+ - xml
3071
+ - id: do-privileged-use
3072
+ name: do-privileged-use
3073
+ description: >-
3074
+ Marking code as privileged enables a piece of trusted code to temporarily enable access to more resources than are
3075
+ available directly to the code that called it. Be very careful in your use of the privileged construct, and always
3076
+ remember to make the privileged code section as small as possible.
3077
+ category: security
3078
+ severity: medium
3079
+ confidence: medium
3080
+ languages:
3081
+ - java
3082
+ patterns:
3083
+ - regex: .*
3084
+ message: >-
3085
+ Marking code as privileged enables a piece of trusted code to temporarily enable access to more resources than
3086
+ are available directly to the code that called it. Be very careful in your use of the privileged construct,
3087
+ and always remember to make the privileged code section as small as possible.
3088
+ cwe:
3089
+ - CWE-269
3090
+ owasp:
3091
+ - A04:2021
3092
+ - A06:2025
3093
+ references:
3094
+ - https://docs.oracle.com/javase/8/docs/technotes/guides/security/doprivileged.html
3095
+ - https://wiki.sei.cmu.edu/confluence/display/java/Privilege+Escalation
3096
+ - http://phrack.org/papers/escaping_the_java_sandbox.html
3097
+ tags:
3098
+ - java
3099
+ - id: httpservlet-path-traversal
3100
+ name: httpservlet-path-traversal
3101
+ description: >-
3102
+ Detected a potential path traversal. A malicious actor could control the location of this file, to include going
3103
+ backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are
3104
+ sanitized. You may also consider using a utility method such as org.apache.commons.io.FilenameUtils.getName(...)
3105
+ to only retrieve the file name from the path.
3106
+ category: file-ops
3107
+ severity: high
3108
+ confidence: medium
3109
+ languages:
3110
+ - java
3111
+ patterns:
3112
+ - regex: .*
3113
+ message: >-
3114
+ Detected a potential path traversal. A malicious actor could control the location of this file, to include
3115
+ going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file
3116
+ paths are sanitized. You may also consider using a utility method such as
3117
+ org.apache.commons.io.FilenameUtils.getName(...) to only retrieve the file name from the path.
3118
+ cwe:
3119
+ - CWE-22
3120
+ owasp:
3121
+ - A05:2017
3122
+ - A01:2021
3123
+ - A01:2025
3124
+ references:
3125
+ - https://www.owasp.org/index.php/Path_Traversal
3126
+ tags:
3127
+ - java
3128
+ - id: insecure-jms-deserialization
3129
+ name: insecure-jms-deserialization
3130
+ description: >-
3131
+ JMS Object messages depend on Java Serialization for marshalling/unmarshalling of the message payload when
3132
+ ObjectMessage.getObject() is called. Deserialization of untrusted data can lead to security flaws; a remote
3133
+ attacker could via a crafted JMS ObjectMessage to execute arbitrary code with the permissions of the application
3134
+ listening/consuming JMS Messages. In this case, the JMS MessageListener consume an ObjectMessage type received
3135
+ inside the onMessage method, which may lead to arbitrary code execution when calling the $Y.getObject method.
3136
+ category: security
3137
+ severity: medium
3138
+ confidence: medium
3139
+ languages:
3140
+ - java
3141
+ patterns:
3142
+ - regex: .*
3143
+ message: >-
3144
+ JMS Object messages depend on Java Serialization for marshalling/unmarshalling of the message payload when
3145
+ ObjectMessage.getObject() is called. Deserialization of untrusted data can lead to security flaws; a remote
3146
+ attacker could via a crafted JMS ObjectMessage to execute arbitrary code with the permissions of the
3147
+ application listening/consuming JMS Messages. In this case, the JMS MessageListener consume an ObjectMessage
3148
+ type received inside the onMessage method, which may lead to arbitrary code execution when calling the
3149
+ $Y.getObject method.
3150
+ cwe:
3151
+ - CWE-502
3152
+ owasp:
3153
+ - A08:2017
3154
+ - A08:2021
3155
+ - A08:2025
3156
+ references:
3157
+ - >-
3158
+ https://www.blackhat.com/docs/us-16/materials/us-16-Kaiser-Pwning-Your-Java-Messaging-With-Deserialization-Vulnerabilities-wp.pdf
3159
+ tags:
3160
+ - java
3161
+ - id: jackson-unsafe-deserialization
3162
+ name: jackson-unsafe-deserialization
3163
+ description: >-
3164
+ When using Jackson to marshall/unmarshall JSON to Java objects, enabling default typing is dangerous and can lead
3165
+ to RCE. If an attacker can control `$JSON` it might be possible to provide a malicious JSON which can be used to
3166
+ exploit unsecure deserialization. In order to prevent this issue, avoid to enable default typing (globally or by
3167
+ using "Per-class" annotations) and avoid using `Object` and other dangerous types for member variable declaration
3168
+ which creating classes for Jackson based deserialization.
3169
+ category: security
3170
+ severity: medium
3171
+ confidence: medium
3172
+ languages:
3173
+ - java
3174
+ patterns:
3175
+ - regex: .*
3176
+ message: >-
3177
+ When using Jackson to marshall/unmarshall JSON to Java objects, enabling default typing is dangerous and can
3178
+ lead to RCE. If an attacker can control `$JSON` it might be possible to provide a malicious JSON which can be
3179
+ used to exploit unsecure deserialization. In order to prevent this issue, avoid to enable default typing
3180
+ (globally or by using "Per-class" annotations) and avoid using `Object` and other dangerous types for member
3181
+ variable declaration which creating classes for Jackson based deserialization.
3182
+ cwe:
3183
+ - CWE-502
3184
+ owasp:
3185
+ - A8:2017
3186
+ - A8:2021
3187
+ references:
3188
+ - https://swapneildash.medium.com/understanding-insecure-implementation-of-jackson-deserialization-7b3d409d2038
3189
+ - https://cowtowncoder.medium.com/on-jackson-cves-dont-panic-here-is-what-you-need-to-know-54cd0d6e8062
3190
+ - https://adamcaudill.com/2017/10/04/exploiting-jackson-rce-cve-2017-7525/
3191
+ tags:
3192
+ - jackson
3193
+ - id: java-pattern-from-string-parameter
3194
+ name: java-pattern-from-string-parameter
3195
+ description: >-
3196
+ A regular expression is being used directly from a String method parameter. This could be a Regular Expression
3197
+ Denial of Service (ReDoS) vulnerability if the parameter is user-controlled and not properly validated. Ensure
3198
+ that a validation is in place to prevent evaluation using a regular expression prone to ReDoS.
3199
+ category: security
3200
+ severity: low
3201
+ confidence: medium
3202
+ languages:
3203
+ - java
3204
+ patterns:
3205
+ - regex: .*
3206
+ message: >-
3207
+ A regular expression is being used directly from a String method parameter. This could be a Regular Expression
3208
+ Denial of Service (ReDoS) vulnerability if the parameter is user-controlled and not properly validated. Ensure
3209
+ that a validation is in place to prevent evaluation using a regular expression prone to ReDoS.
3210
+ cwe:
3211
+ - CWE-1333
3212
+ owasp:
3213
+ - A03:2021
3214
+ references:
3215
+ - https://en.wikipedia.org/wiki/ReDoS
3216
+ - https://learn.snyk.io/lesson/redos
3217
+ tags:
3218
+ - java
3219
+ - id: servletresponse-writer-xss
3220
+ name: servletresponse-writer-xss
3221
+ description: >-
3222
+ Cross-site scripting detected in HttpServletResponse writer with variable '$VAR'. User input was detected going
3223
+ directly from the HttpServletRequest into output. Ensure your data is properly encoded using
3224
+ org.owasp.encoder.Encode.forHtml: 'Encode.forHtml($VAR)'.
3225
+ category: xss
3226
+ severity: high
3227
+ confidence: medium
3228
+ languages:
3229
+ - java
3230
+ patterns:
3231
+ - regex: .*
3232
+ message: >-
3233
+ Cross-site scripting detected in HttpServletResponse writer with variable '$VAR'. User input was detected
3234
+ going directly from the HttpServletRequest into output. Ensure your data is properly encoded using
3235
+ org.owasp.encoder.Encode.forHtml: 'Encode.forHtml($VAR)'.
3236
+ cwe:
3237
+ - CWE-79
3238
+ owasp:
3239
+ - A07:2017
3240
+ - A03:2021
3241
+ - A05:2025
3242
+ references:
3243
+ - https://owasp.org/Top10/A03_2021-Injection
3244
+ tags:
3245
+ - java
3246
+ - id: use-snakeyaml-constructor
3247
+ name: use-snakeyaml-constructor
3248
+ description: >-
3249
+ Used SnakeYAML org.yaml.snakeyaml.Yaml() constructor with no arguments, which is vulnerable to deserialization
3250
+ attacks. Use the one-argument Yaml(...) constructor instead, with SafeConstructor or a custom Constructor as the
3251
+ argument.
3252
+ category: secrets
3253
+ severity: medium
3254
+ confidence: medium
3255
+ languages:
3256
+ - java
3257
+ patterns:
3258
+ - pattern: |
3259
+ $Y = new org.yaml.snakeyaml.Yaml();
3260
+ ...
3261
+ $Y.load(...);
3262
+ message: >-
3263
+ Used SnakeYAML org.yaml.snakeyaml.Yaml() constructor with no arguments, which is vulnerable to deserialization
3264
+ attacks. Use the one-argument Yaml(...) constructor instead, with SafeConstructor or a custom Constructor as
3265
+ the argument.
3266
+ cwe:
3267
+ - CWE-502
3268
+ owasp:
3269
+ - A08:2017
3270
+ - A08:2021
3271
+ - A08:2025
3272
+ references:
3273
+ - >-
3274
+ https://securitylab.github.com/research/swagger-yaml-parser-vulnerability/#snakeyaml-deserialization-vulnerability
3275
+ tags:
3276
+ - snakeyaml
3277
+ - id: xmlinputfactory-external-entities-enabled
3278
+ name: xmlinputfactory-external-entities-enabled
3279
+ description: >-
3280
+ XML external entities are enabled for this XMLInputFactory. This is vulnerable to XML external entity attacks.
3281
+ Disable external entities by setting "javax.xml.stream.isSupportingExternalEntities" to false.
3282
+ category: security
3283
+ severity: high
3284
+ confidence: medium
3285
+ languages:
3286
+ - java
3287
+ patterns:
3288
+ - regex: .*
3289
+ message: >-
3290
+ XML external entities are enabled for this XMLInputFactory. This is vulnerable to XML external entity attacks.
3291
+ Disable external entities by setting "javax.xml.stream.isSupportingExternalEntities" to false.
3292
+ cwe:
3293
+ - CWE-611
3294
+ owasp:
3295
+ - A04:2017
3296
+ - A05:2021
3297
+ - A02:2025
3298
+ references:
3299
+ - https://semgrep.dev/blog/2022/xml-security-in-java
3300
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
3301
+ - https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf
3302
+ tags:
3303
+ - java
3304
+ - id: xmlinputfactory-possible-xxe
3305
+ name: xmlinputfactory-possible-xxe
3306
+ description: >-
3307
+ XML external entities are not explicitly disabled for this XMLInputFactory. This could be vulnerable to XML
3308
+ external entity vulnerabilities. Explicitly disable external entities by setting
3309
+ "javax.xml.stream.isSupportingExternalEntities" to false.
3310
+ category: api-security
3311
+ severity: medium
3312
+ confidence: medium
3313
+ languages:
3314
+ - java
3315
+ patterns:
3316
+ - regex: .*
3317
+ message: >-
3318
+ XML external entities are not explicitly disabled for this XMLInputFactory. This could be vulnerable to XML
3319
+ external entity vulnerabilities. Explicitly disable external entities by setting
3320
+ "javax.xml.stream.isSupportingExternalEntities" to false.
3321
+ cwe:
3322
+ - CWE-611
3323
+ owasp:
3324
+ - A04:2017
3325
+ - A05:2021
3326
+ - A02:2025
3327
+ references:
3328
+ - https://semgrep.dev/blog/2022/xml-security-in-java
3329
+ - https://semgrep.dev/docs/cheat-sheets/java-xxe/
3330
+ - https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf
3331
+ - >-
3332
+ https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser
3333
+ tags:
3334
+ - java
3335
+ - id: mongodb-nosqli
3336
+ name: mongodb-nosqli
3337
+ description: >-
3338
+ Detected non-constant data passed into a NoSQL query using the 'where' evaluation operator. If this data can be
3339
+ controlled by an external user, this is a NoSQL injection. Ensure data passed to the NoSQL query is not user
3340
+ controllable, or properly sanitize the data. Ideally, avoid using the 'where' operator at all and instead use the
3341
+ helper methods provided by com.mongodb.client.model.Filters with comparative operators such as eq, ne, lt, gt,
3342
+ etc.
3343
+ category: injection
3344
+ severity: medium
3345
+ confidence: medium
3346
+ languages:
3347
+ - java
3348
+ patterns:
3349
+ - regex: .*
3350
+ message: >-
3351
+ Detected non-constant data passed into a NoSQL query using the 'where' evaluation operator. If this data can
3352
+ be controlled by an external user, this is a NoSQL injection. Ensure data passed to the NoSQL query is not
3353
+ user controllable, or properly sanitize the data. Ideally, avoid using the 'where' operator at all and instead
3354
+ use the helper methods provided by com.mongodb.client.model.Filters with comparative operators such as eq, ne,
3355
+ lt, gt, etc.
3356
+ cwe:
3357
+ - CWE-943
3358
+ owasp:
3359
+ - A01:2017
3360
+ - A03:2021
3361
+ - A05:2025
3362
+ references:
3363
+ - https://owasp.org/Top10/A03_2021-Injection
3364
+ - https://www.mongodb.com/docs/manual/tutorial/query-documents/
3365
+ - https://www.mongodb.com/docs/manual/reference/operator/query/where/
3366
+ tags:
3367
+ - nosql
3368
+ - mongodb
3369
+ - id: server-dangerous-class-deserialization
3370
+ name: server-dangerous-class-deserialization
3371
+ description: >-
3372
+ Using a non-primitive class with Java RMI may be an insecure deserialization vulnerability. Depending on the
3373
+ underlying implementation. This object could be manipulated by a malicious actor allowing them to execute code on
3374
+ your system. Instead, use an integer ID to look up your object, or consider alternative serialization schemes such
3375
+ as JSON.
3376
+ category: security
3377
+ severity: medium
3378
+ confidence: medium
3379
+ languages:
3380
+ - java
3381
+ patterns:
3382
+ - pattern: |
3383
+ interface $INTERFACE extends Remote {
3384
+ $RETURNTYPE $METHOD($CLASS $PARAM) throws RemoteException;
3385
+ }
3386
+ message: >-
3387
+ Using a non-primitive class with Java RMI may be an insecure deserialization vulnerability. Depending on the
3388
+ underlying implementation. This object could be manipulated by a malicious actor allowing them to execute code
3389
+ on your system. Instead, use an integer ID to look up your object, or consider alternative serialization
3390
+ schemes such as JSON.
3391
+ cwe:
3392
+ - CWE-502
3393
+ owasp:
3394
+ - A08:2017
3395
+ - A08:2021
3396
+ - A08:2025
3397
+ references:
3398
+ - https://mogwailabs.de/blog/2019/03/attacking-java-rmi-services-after-jep-290/
3399
+ tags:
3400
+ - rmi
3401
+ - id: server-dangerous-object-deserialization
3402
+ name: server-dangerous-object-deserialization
3403
+ description: >-
3404
+ Using an arbitrary object ('$PARAMTYPE $PARAM') with Java RMI is an insecure deserialization vulnerability. This
3405
+ object can be manipulated by a malicious actor allowing them to execute code on your system. Instead, use an
3406
+ integer ID to look up your object, or consider alternative serialization schemes such as JSON.
3407
+ category: security
3408
+ severity: high
3409
+ confidence: medium
3410
+ languages:
3411
+ - java
3412
+ patterns:
3413
+ - pattern: |
3414
+ interface $INTERFACE extends Remote {
3415
+ $RETURNTYPE $METHOD($PARAMTYPE $PARAM) throws RemoteException;
3416
+ }
3417
+ message: >-
3418
+ Using an arbitrary object ('$PARAMTYPE $PARAM') with Java RMI is an insecure deserialization vulnerability.
3419
+ This object can be manipulated by a malicious actor allowing them to execute code on your system. Instead, use
3420
+ an integer ID to look up your object, or consider alternative serialization schemes such as JSON.
3421
+ cwe:
3422
+ - CWE-502
3423
+ owasp:
3424
+ - A08:2017
3425
+ - A08:2021
3426
+ - A08:2025
3427
+ references:
3428
+ - https://frohoff.github.io/appseccali-marshalling-pickles/
3429
+ - https://book.hacktricks.xyz/network-services-pentesting/1099-pentesting-java-rmi
3430
+ - https://youtu.be/t_aw1mDNhzI
3431
+ - https://github.com/qtc-de/remote-method-guesser
3432
+ - https://github.com/openjdk/jdk/blob/master/src/java.rmi/share/classes/sun/rmi/server/UnicastRef.java#L303C4-L331
3433
+ tags:
3434
+ - rmi
3435
+ - id: cookie-issecure-false
3436
+ name: cookie-issecure-false
3437
+ description: >-
3438
+ Default session middleware settings: `setSecure` not set to true. This ensures that the cookie is sent only over
3439
+ HTTPS to prevent cross-site scripting attacks.
3440
+ category: security
3441
+ severity: medium
3442
+ confidence: medium
3443
+ languages:
3444
+ - java
3445
+ patterns:
3446
+ - pattern: $COOKIE = new Cookie($...ARGS);
3447
+ message: >-
3448
+ Default session middleware settings: `setSecure` not set to true. This ensures that the cookie is sent only
3449
+ over HTTPS to prevent cross-site scripting attacks.
3450
+ cwe:
3451
+ - CWE-319
3452
+ owasp:
3453
+ - A03:2017
3454
+ - A02:2021
3455
+ - A04:2025
3456
+ references:
3457
+ - https://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html#setSecure(boolean)
3458
+ - https://owasp.org/www-community/controls/SecureCookieAttribute
3459
+ tags:
3460
+ - java
3461
+ - cookie
3462
+ - id: cookie-setSecure
3463
+ name: cookie-setSecure
3464
+ description: >-
3465
+ Default session middleware settings: `setSecure` not set to true. This ensures that the cookie is sent only over
3466
+ HTTPS to prevent cross-site scripting attacks.
3467
+ category: security
3468
+ severity: medium
3469
+ confidence: medium
3470
+ languages:
3471
+ - java
3472
+ patterns:
3473
+ - regex: .*
3474
+ message: >-
3475
+ Default session middleware settings: `setSecure` not set to true. This ensures that the cookie is sent only
3476
+ over HTTPS to prevent cross-site scripting attacks.
3477
+ cwe:
3478
+ - CWE-319
3479
+ owasp:
3480
+ - A03:2017
3481
+ - A02:2021
3482
+ - A04:2025
3483
+ references:
3484
+ - https://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html#setSecure(boolean)
3485
+ - https://owasp.org/www-community/controls/SecureCookieAttribute
3486
+ tags:
3487
+ - java
3488
+ - cookie
3489
+ - id: spel-injection
3490
+ name: spel-injection
3491
+ description: >-
3492
+ A Spring expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
3493
+ unfiltered values fall into this risky code evaluation.
3494
+ category: security
3495
+ severity: medium
3496
+ confidence: medium
3497
+ languages:
3498
+ - java
3499
+ patterns:
3500
+ - pattern: |
3501
+ $X $METHOD(...) {
3502
+ ...
3503
+ $PARSER.parseExpression(...);
3504
+ ...
3505
+ }
3506
+ message: >-
3507
+ A Spring expression is built with a dynamic value. The source of the value(s) should be verified to avoid that
3508
+ unfiltered values fall into this risky code evaluation.
3509
+ cwe:
3510
+ - CWE-94
3511
+ owasp:
3512
+ - A03:2021
3513
+ - A05:2025
3514
+ references:
3515
+ - https://owasp.org/Top10/A03_2021-Injection
3516
+ tags:
3517
+ - spring
3518
+ - id: spring-csrf-disabled
3519
+ name: spring-csrf-disabled
3520
+ description: CSRF protection is disabled for this configuration. This is a security risk.
3521
+ category: api-security
3522
+ severity: medium
3523
+ confidence: medium
3524
+ languages:
3525
+ - java
3526
+ patterns:
3527
+ - pattern: $OBJ.csrf(...).disable(...)
3528
+ message: CSRF protection is disabled for this configuration. This is a security risk.
3529
+ cwe:
3530
+ - CWE-352
3531
+ owasp:
3532
+ - A01:2021
3533
+ - A01:2025
3534
+ references:
3535
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
3536
+ tags:
3537
+ - spring
3538
+ - id: spring-sqli
3539
+ name: spring-sqli
3540
+ description: >-
3541
+ Detected a string argument from a public method contract in a raw SQL statement. This could lead to SQL injection
3542
+ if variables in the SQL statement are not properly sanitized. Use a prepared statements
3543
+ (java.sql.PreparedStatement) instead. You can obtain a PreparedStatement using 'connection.prepareStatement'.
3544
+ category: injection
3545
+ severity: medium
3546
+ confidence: medium
3547
+ languages:
3548
+ - java
3549
+ patterns:
3550
+ - regex: .*
3551
+ message: >-
3552
+ Detected a string argument from a public method contract in a raw SQL statement. This could lead to SQL
3553
+ injection if variables in the SQL statement are not properly sanitized. Use a prepared statements
3554
+ (java.sql.PreparedStatement) instead. You can obtain a PreparedStatement using 'connection.prepareStatement'.
3555
+ cwe:
3556
+ - CWE-89
3557
+ owasp:
3558
+ - A01:2017
3559
+ - A03:2021
3560
+ - A05:2025
3561
+ references:
3562
+ - https://owasp.org/Top10/A03_2021-Injection
3563
+ tags:
3564
+ - spring
3565
+ - id: spring-unvalidated-redirect
3566
+ name: spring-unvalidated-redirect
3567
+ description: Application redirects a user to a destination URL specified by a user supplied parameter that is not validated.
3568
+ category: security
3569
+ severity: medium
3570
+ confidence: medium
3571
+ languages:
3572
+ - java
3573
+ patterns:
3574
+ - pattern: |
3575
+ $X $METHOD(...,String $URL,...) {
3576
+ return "redirect:" + $URL;
3577
+ }
3578
+ message: >-
3579
+ Application redirects a user to a destination URL specified by a user supplied parameter that is not
3580
+ validated.
3581
+ - pattern: |
3582
+ $X $METHOD(...,String $URL,...) {
3583
+ ...
3584
+ String $REDIR = "redirect:" + $URL;
3585
+ ...
3586
+ return $REDIR;
3587
+ ...
3588
+ }
3589
+ message: >-
3590
+ Application redirects a user to a destination URL specified by a user supplied parameter that is not
3591
+ validated.
3592
+ - pattern: |
3593
+ $X $METHOD(...,String $URL,...) {
3594
+ ...
3595
+ new ModelAndView("redirect:" + $URL);
3596
+ ...
3597
+ }
3598
+ message: >-
3599
+ Application redirects a user to a destination URL specified by a user supplied parameter that is not
3600
+ validated.
3601
+ - pattern: |-
3602
+ $X $METHOD(...,String $URL,...) {
3603
+ ...
3604
+ String $REDIR = "redirect:" + $URL;
3605
+ ...
3606
+ new ModelAndView($REDIR);
3607
+ ...
3608
+ }
3609
+ message: >-
3610
+ Application redirects a user to a destination URL specified by a user supplied parameter that is not
3611
+ validated.
3612
+ cwe:
3613
+ - CWE-601
3614
+ owasp:
3615
+ - A01:2021
3616
+ - A01:2025
3617
+ references:
3618
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
3619
+ tags:
3620
+ - spring
3621
+ - id: tainted-file-path
3622
+ name: tainted-file-path
3623
+ description: >-
3624
+ Detected user input controlling a file path. An attacker could control the location of this file, to include going
3625
+ backwards in the directory with '../'. To address this, ensure that user-controlled variables in file paths are
3626
+ sanitized. You may also consider using a utility method such as org.apache.commons.io.FilenameUtils.getName(...)
3627
+ to only retrieve the file name from the path.
3628
+ category: file-ops
3629
+ severity: high
3630
+ confidence: medium
3631
+ languages:
3632
+ - java
3633
+ patterns:
3634
+ - regex: .*
3635
+ message: >-
3636
+ Detected user input controlling a file path. An attacker could control the location of this file, to include
3637
+ going backwards in the directory with '../'. To address this, ensure that user-controlled variables in file
3638
+ paths are sanitized. You may also consider using a utility method such as
3639
+ org.apache.commons.io.FilenameUtils.getName(...) to only retrieve the file name from the path.
3640
+ cwe:
3641
+ - CWE-23
3642
+ owasp:
3643
+ - A01:2021
3644
+ - A01:2025
3645
+ references:
3646
+ - https://owasp.org/www-community/attacks/Path_Traversal
3647
+ tags:
3648
+ - java
3649
+ - spring
3650
+ - id: tainted-html-string
3651
+ name: tainted-html-string
3652
+ description: >-
3653
+ Detected user input flowing into a manually constructed HTML string. You may be accidentally bypassing secure
3654
+ methods of rendering HTML by manually constructing HTML and this could create a cross-site scripting
3655
+ vulnerability, which could let attackers steal sensitive user data. To be sure this is safe, check that the HTML
3656
+ is rendered safely. You can use the OWASP ESAPI encoder if you must render user data.
3657
+ category: security
3658
+ severity: high
3659
+ confidence: medium
3660
+ languages:
3661
+ - java
3662
+ patterns:
3663
+ - regex: .*
3664
+ message: >-
3665
+ Detected user input flowing into a manually constructed HTML string. You may be accidentally bypassing secure
3666
+ methods of rendering HTML by manually constructing HTML and this could create a cross-site scripting
3667
+ vulnerability, which could let attackers steal sensitive user data. To be sure this is safe, check that the
3668
+ HTML is rendered safely. You can use the OWASP ESAPI encoder if you must render user data.
3669
+ cwe:
3670
+ - CWE-79
3671
+ owasp:
3672
+ - A07:2017
3673
+ - A03:2021
3674
+ - A05:2025
3675
+ references:
3676
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
3677
+ tags:
3678
+ - java
3679
+ - spring
3680
+ - id: tainted-system-command
3681
+ name: tainted-system-command
3682
+ description: >-
3683
+ Detected user input entering a method which executes a system command. This could result in a command injection
3684
+ vulnerability, which allows an attacker to inject an arbitrary system command onto the server. The attacker could
3685
+ download malware onto or steal data from the server. Instead, use ProcessBuilder, separating the command into
3686
+ individual arguments, like this: `new ProcessBuilder("ls", "-al", targetDirectory)`. Further, make sure you
3687
+ hardcode or allowlist the actual command so that attackers can't run arbitrary commands.
3688
+ category: security
3689
+ severity: high
3690
+ confidence: medium
3691
+ languages:
3692
+ - java
3693
+ patterns:
3694
+ - regex: .*
3695
+ message: >-
3696
+ Detected user input entering a method which executes a system command. This could result in a command
3697
+ injection vulnerability, which allows an attacker to inject an arbitrary system command onto the server. The
3698
+ attacker could download malware onto or steal data from the server. Instead, use ProcessBuilder, separating
3699
+ the command into individual arguments, like this: `new ProcessBuilder("ls", "-al", targetDirectory)`. Further,
3700
+ make sure you hardcode or allowlist the actual command so that attackers can't run arbitrary commands.
3701
+ cwe:
3702
+ - CWE-78
3703
+ owasp:
3704
+ - A01:2017
3705
+ - A03:2021
3706
+ - A05:2025
3707
+ references:
3708
+ - https://www.stackhawk.com/blog/command-injection-java/
3709
+ - https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html
3710
+ - https://github.com/github/codeql/blob/main/java/ql/src/Security/CWE/CWE-078/ExecUnescaped.java
3711
+ tags:
3712
+ - java
3713
+ - spring
3714
+ - id: tainted-url-host
3715
+ name: tainted-url-host
3716
+ description: >-
3717
+ User data flows into the host portion of this manually-constructed URL. This could allow an attacker to send data
3718
+ to their own server, potentially exposing sensitive data such as cookies or authorization information sent with
3719
+ this request. They could also probe internal servers or other resources that the server running this code can
3720
+ access. (This is called server-side request forgery, or SSRF.) Do not allow arbitrary hosts. Instead, create an
3721
+ allowlist for approved hosts, hardcode the correct host, or ensure that the user data can only affect the path or
3722
+ parameters.
3723
+ category: security
3724
+ severity: high
3725
+ confidence: medium
3726
+ languages:
3727
+ - java
3728
+ patterns:
3729
+ - regex: .*
3730
+ message: >-
3731
+ User data flows into the host portion of this manually-constructed URL. This could allow an attacker to send
3732
+ data to their own server, potentially exposing sensitive data such as cookies or authorization information
3733
+ sent with this request. They could also probe internal servers or other resources that the server running this
3734
+ code can access. (This is called server-side request forgery, or SSRF.) Do not allow arbitrary hosts. Instead,
3735
+ create an allowlist for approved hosts, hardcode the correct host, or ensure that the user data can only
3736
+ affect the path or parameters.
3737
+ cwe:
3738
+ - CWE-918
3739
+ owasp:
3740
+ - A10:2021
3741
+ - A01:2025
3742
+ references:
3743
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
3744
+ tags:
3745
+ - java
3746
+ - spring
3747
+ - id: unrestricted-request-mapping
3748
+ name: unrestricted-request-mapping
3749
+ description: >-
3750
+ Detected a method annotated with 'RequestMapping' that does not specify the HTTP method. CSRF protections are not
3751
+ enabled for GET, HEAD, TRACE, or OPTIONS, and by default all HTTP methods are allowed when the HTTP method is not
3752
+ explicitly specified. This means that a method that performs state changes could be vulnerable to CSRF attacks. To
3753
+ mitigate, add the 'method' field and specify the HTTP method (such as 'RequestMethod.POST').
3754
+ category: security
3755
+ severity: medium
3756
+ confidence: medium
3757
+ languages:
3758
+ - java
3759
+ patterns:
3760
+ - pattern: |
3761
+ RequestMapping
3762
+ message: >-
3763
+ Detected a method annotated with 'RequestMapping' that does not specify the HTTP method. CSRF protections are
3764
+ not enabled for GET, HEAD, TRACE, or OPTIONS, and by default all HTTP methods are allowed when the HTTP method
3765
+ is not explicitly specified. This means that a method that performs state changes could be vulnerable to CSRF
3766
+ attacks. To mitigate, add the 'method' field and specify the HTTP method (such as 'RequestMethod.POST').
3767
+ cwe:
3768
+ - CWE-352
3769
+ owasp:
3770
+ - A01:2021
3771
+ - A01:2025
3772
+ references:
3773
+ - https://find-sec-bugs.github.io/bugs.htm#SPRING_CSRF_UNRESTRICTED_REQUEST_MAPPING
3774
+ tags:
3775
+ - spring
3776
+ - id: bypass-tls-verification
3777
+ name: bypass-tls-verification
3778
+ description: >-
3779
+ Checks for redefinitions of functions that check TLS/SSL certificate verification. This can lead to
3780
+ vulnerabilities, as simple errors in the code can result in lack of proper certificate validation. This should
3781
+ only be used for debugging purposes because it leads to vulnerability to MTM attacks.
3782
+ category: security
3783
+ severity: medium
3784
+ confidence: medium
3785
+ languages:
3786
+ - java
3787
+ patterns:
3788
+ - pattern: |
3789
+ new HostnameVerifier() {
3790
+ ...
3791
+ public boolean verify(String hostname, SSLSession session) {
3792
+ ...
3793
+ }
3794
+ ...
3795
+ };
3796
+ message: >-
3797
+ Checks for redefinitions of functions that check TLS/SSL certificate verification. This can lead to
3798
+ vulnerabilities, as simple errors in the code can result in lack of proper certificate validation. This should
3799
+ only be used for debugging purposes because it leads to vulnerability to MTM attacks.
3800
+ - pattern: >
3801
+ public RestTemplate restTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException
3802
+ {
3803
+ ...
3804
+ TrustStrategy $FUNCNAME = (X509Certificate[] chain, String authType) -> ...;
3805
+ ...
3806
+ }
3807
+ message: >-
3808
+ Checks for redefinitions of functions that check TLS/SSL certificate verification. This can lead to
3809
+ vulnerabilities, as simple errors in the code can result in lack of proper certificate validation. This should
3810
+ only be used for debugging purposes because it leads to vulnerability to MTM attacks.
3811
+ - pattern: |
3812
+ TrustStrategy $FUNCNAME= new TrustStrategy() {
3813
+ ...
3814
+ public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
3815
+ ...
3816
+ }
3817
+ ...
3818
+ };
3819
+ message: >-
3820
+ Checks for redefinitions of functions that check TLS/SSL certificate verification. This can lead to
3821
+ vulnerabilities, as simple errors in the code can result in lack of proper certificate validation. This should
3822
+ only be used for debugging purposes because it leads to vulnerability to MTM attacks.
3823
+ cwe:
3824
+ - CWE-319
3825
+ owasp:
3826
+ - A03:2017
3827
+ references:
3828
+ - https://stackoverflow.com/questions/4072585/disabling-ssl-certificate-validation-in-spring-resttemplate
3829
+ - >-
3830
+ https://stackoverflow.com/questions/35530558/how-to-fix-unsafe-implementation-of-x509trustmanager-in-android-app?rq=1
3831
+ tags:
3832
+ - spring
3833
+ - id: spring-ftp-request
3834
+ name: spring-ftp-request
3835
+ description: >-
3836
+ Checks for outgoing connections to ftp servers via Spring plugin ftpSessionFactory. FTP does not encrypt traffic,
3837
+ possibly leading to PII being sent plaintext over the network.
3838
+ category: security
3839
+ severity: medium
3840
+ confidence: medium
3841
+ languages:
3842
+ - java
3843
+ patterns:
3844
+ - pattern: |
3845
+ $SF = new DefaultFtpSessionFactory(...);
3846
+ ...
3847
+ $SF.setHost("=~/^[fF][tT][pP]://.*/");
3848
+ ...
3849
+ $SF.$FUNC(...);
3850
+ message: >-
3851
+ Checks for outgoing connections to ftp servers via Spring plugin ftpSessionFactory. FTP does not encrypt
3852
+ traffic, possibly leading to PII being sent plaintext over the network.
3853
+ - pattern: |
3854
+ $SF = new DefaultFtpSessionFactory(...);
3855
+ ...
3856
+ String $URL = "=~/^[fF][tT][pP]://.*/";
3857
+ ...
3858
+ $SF.setHost($URL);
3859
+ ...
3860
+ $SF.$FUNC(...);
3861
+ message: >-
3862
+ Checks for outgoing connections to ftp servers via Spring plugin ftpSessionFactory. FTP does not encrypt
3863
+ traffic, possibly leading to PII being sent plaintext over the network.
3864
+ cwe:
3865
+ - CWE-319
3866
+ owasp:
3867
+ - A03:2017
3868
+ references:
3869
+ - >-
3870
+ https://docs.spring.io/spring-integration/api/org/springframework/integration/ftp/session/AbstractFtpSessionFactory.html#setClientMode-int-
3871
+ tags:
3872
+ - spring
3873
+ - id: spring-http-request
3874
+ name: spring-http-request
3875
+ description: >-
3876
+ Checks for requests sent via Java Spring RestTemplate API to http:// URLS. This is dangerous because the server is
3877
+ attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https://
3878
+ URLS.
3879
+ category: security
3880
+ severity: medium
3881
+ confidence: medium
3882
+ languages:
3883
+ - java
3884
+ patterns:
3885
+ - regex: .*
3886
+ message: >-
3887
+ Checks for requests sent via Java Spring RestTemplate API to http:// URLS. This is dangerous because the
3888
+ server is attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests
3889
+ only to https:// URLS.
3890
+ cwe:
3891
+ - CWE-319
3892
+ owasp:
3893
+ - A03:2017
3894
+ references:
3895
+ - >-
3896
+ https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html#delete-java.lang.String-java.util.Map-
3897
+ - https://www.baeldung.com/rest-template
3898
+ tags:
3899
+ - spring
3900
+ - id: disallow-old-tls-versions1
3901
+ name: disallow-old-tls-versions1
3902
+ description: >-
3903
+ Detects direct creations of SSLConnectionSocketFactories that don't disallow SSL v2, SSL v3, and TLS v1.
3904
+ SSLSocketFactory can be used to validate the identity of the HTTPS server against a list of trusted certificates.
3905
+ These protocols are deprecated due to POODLE, man in the middle attacks, and other vulnerabilities.
3906
+ category: security
3907
+ severity: medium
3908
+ confidence: medium
3909
+ languages:
3910
+ - java
3911
+ patterns:
3912
+ - pattern: |
3913
+ new SSLConnectionSocketFactory(...);
3914
+ message: >-
3915
+ Detects direct creations of SSLConnectionSocketFactories that don't disallow SSL v2, SSL v3, and TLS v1.
3916
+ SSLSocketFactory can be used to validate the identity of the HTTPS server against a list of trusted
3917
+ certificates. These protocols are deprecated due to POODLE, man in the middle attacks, and other
3918
+ vulnerabilities.
3919
+ cwe:
3920
+ - CWE-319
3921
+ owasp:
3922
+ - A03:2017
3923
+ references:
3924
+ - https://stackoverflow.com/questions/26429751/java-http-clients-and-poodle
3925
+ tags:
3926
+ - java
3927
+ - id: disallow-old-tls-versions2
3928
+ name: disallow-old-tls-versions2
3929
+ description: >-
3930
+ Detects setting client protocols to insecure versions of TLS and SSL. These protocols are deprecated due to
3931
+ POODLE, man in the middle attacks, and other vulnerabilities.
3932
+ category: security
3933
+ severity: medium
3934
+ confidence: medium
3935
+ languages:
3936
+ - java
3937
+ patterns:
3938
+ - pattern: $VALUE. ... .setProperty("jdk.tls.client.protocols", "$PATTERNS");
3939
+ message: >-
3940
+ Detects setting client protocols to insecure versions of TLS and SSL. These protocols are deprecated due to
3941
+ POODLE, man in the middle attacks, and other vulnerabilities.
3942
+ cwe:
3943
+ - CWE-319
3944
+ owasp:
3945
+ - A03:2017
3946
+ references:
3947
+ - https://stackoverflow.com/questions/26504653/is-it-possible-to-disable-sslv3-for-all-java-applications
3948
+ tags:
3949
+ - java
3950
+ - id: ftp-request
3951
+ name: ftp-request
3952
+ description: >-
3953
+ Checks for outgoing connections to ftp servers. FTP does not encrypt traffic, possibly leading to PII being sent
3954
+ plaintext over the network.
3955
+ category: security
3956
+ severity: medium
3957
+ confidence: medium
3958
+ languages:
3959
+ - java
3960
+ patterns:
3961
+ - pattern: |
3962
+ FTPClient $FTPCLIENT = new FTPClient();
3963
+ ...
3964
+ $FTPCLIENT.connect(...);
3965
+ message: >-
3966
+ Checks for outgoing connections to ftp servers. FTP does not encrypt traffic, possibly leading to PII being
3967
+ sent plaintext over the network.
3968
+ - pattern: |
3969
+ URL $URL = new URL("=~/^[fF][tT][pP]://.*/");
3970
+ ...
3971
+ URLConnection $CONN = $URL.openConnection(...);
3972
+ message: >-
3973
+ Checks for outgoing connections to ftp servers. FTP does not encrypt traffic, possibly leading to PII being
3974
+ sent plaintext over the network.
3975
+ cwe:
3976
+ - CWE-319
3977
+ owasp:
3978
+ - A03:2017
3979
+ references:
3980
+ - https://www.codejava.net/java-se/ftp/connect-and-login-to-a-ftp-server
3981
+ - https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html
3982
+ tags:
3983
+ - java
3984
+ - id: http-components-request
3985
+ name: http-components-request
3986
+ description: >-
3987
+ Checks for requests sent via Apache HTTP Components to http:// URLS. This is dangerous because the server is
3988
+ attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https://
3989
+ URLS.
3990
+ category: security
3991
+ severity: medium
3992
+ confidence: medium
3993
+ languages:
3994
+ - java
3995
+ patterns:
3996
+ - pattern: |
3997
+ $HTTPCLIENT = HttpClients.$CREATE(...);
3998
+ ...
3999
+ $HTTPREQ = new $HTTPFUNC("=~/[hH][tT][tT][pP]://.*/");
4000
+ ...
4001
+ $RESPONSE = $HTTPCLIENT.execute($HTTPREQ);
4002
+ message: >-
4003
+ Checks for requests sent via Apache HTTP Components to http:// URLS. This is dangerous because the server is
4004
+ attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests only to
4005
+ https:// URLS.
4006
+ - pattern: |
4007
+ $HTTPCLIENT = HttpClients.$CREATE(...);
4008
+ ...
4009
+ $RESPONSE = $HTTPCLIENT.execute(new $HTTPFUNC("=~/[hH][tT][tT][pP]://.*/"));
4010
+ message: >-
4011
+ Checks for requests sent via Apache HTTP Components to http:// URLS. This is dangerous because the server is
4012
+ attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests only to
4013
+ https:// URLS.
4014
+ cwe:
4015
+ - CWE-319
4016
+ owasp:
4017
+ - A03:2017
4018
+ references:
4019
+ - https://hc.apache.org/httpcomponents-client-ga/quickstart.html
4020
+ tags:
4021
+ - java
4022
+ - id: httpclient-http-request
4023
+ name: httpclient-http-request
4024
+ description: >-
4025
+ Checks for requests sent via HttpClient to http:// URLS. This is dangerous because the server is attempting to
4026
+ connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS.
4027
+ category: security
4028
+ severity: medium
4029
+ confidence: medium
4030
+ languages:
4031
+ - java
4032
+ patterns:
4033
+ - regex: .*
4034
+ message: >-
4035
+ Checks for requests sent via HttpClient to http:// URLS. This is dangerous because the server is attempting to
4036
+ connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS.
4037
+ cwe:
4038
+ - CWE-319
4039
+ owasp:
4040
+ - A03:2017
4041
+ references:
4042
+ - https://openjdk.java.net/groups/net/httpclient/intro.html
4043
+ tags:
4044
+ - java
4045
+ - id: httpget-http-request
4046
+ name: httpget-http-request
4047
+ description: >-
4048
+ Detected an HTTP request sent via HttpGet. This could lead to sensitive information being sent over an insecure
4049
+ channel. Instead, it is recommended to send requests over HTTPS.
4050
+ category: security
4051
+ severity: medium
4052
+ confidence: medium
4053
+ languages:
4054
+ - java
4055
+ patterns:
4056
+ - pattern: |
4057
+ "=~/[Hh][Tt][Tt][Pp]://.*/"
4058
+ message: >-
4059
+ Detected an HTTP request sent via HttpGet. This could lead to sensitive information being sent over an
4060
+ insecure channel. Instead, it is recommended to send requests over HTTPS.
4061
+ cwe:
4062
+ - CWE-319
4063
+ owasp:
4064
+ - A03:2017
4065
+ references:
4066
+ - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URLConnection.html
4067
+ - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html#openConnection()
4068
+ tags:
4069
+ - java
4070
+ - id: httpurlconnection-http-request
4071
+ name: httpurlconnection-http-request
4072
+ description: >-
4073
+ Detected an HTTP request sent via HttpURLConnection. This could lead to sensitive information being sent over an
4074
+ insecure channel. Instead, it is recommended to send requests over HTTPS.
4075
+ category: security
4076
+ severity: medium
4077
+ confidence: medium
4078
+ languages:
4079
+ - java
4080
+ patterns:
4081
+ - pattern: |
4082
+ "=~/[Hh][Tt][Tt][Pp]://.*/"
4083
+ message: >-
4084
+ Detected an HTTP request sent via HttpURLConnection. This could lead to sensitive information being sent over
4085
+ an insecure channel. Instead, it is recommended to send requests over HTTPS.
4086
+ cwe:
4087
+ - CWE-319
4088
+ owasp:
4089
+ - A03:2017
4090
+ references:
4091
+ - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URLConnection.html
4092
+ - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html#openConnection()
4093
+ tags:
4094
+ - java
4095
+ - id: socket-request
4096
+ name: socket-request
4097
+ description: >-
4098
+ Insecure transport rules to catch socket connections to http, telnet, and ftp servers. This is dangerous because
4099
+ these are protocols that do not encrypt traffic.
4100
+ category: security
4101
+ severity: medium
4102
+ confidence: medium
4103
+ languages:
4104
+ - java
4105
+ patterns:
4106
+ - pattern: |
4107
+ $SOCKET = new Socket("=~/[tT][eE][lL][nN][eE][tT]://.*/", ...);
4108
+ ...
4109
+ $OUT = new PrintWriter($SOCKET.getOutputStream(...), ...);
4110
+ ...
4111
+ $OUT.$FUNC(...);
4112
+ message: >-
4113
+ Insecure transport rules to catch socket connections to http, telnet, and ftp servers. This is dangerous
4114
+ because these are protocols that do not encrypt traffic.
4115
+ - pattern: |
4116
+ $SOCKET = new Socket("=~/^[fF][tT][pP]://.*/", ...);
4117
+ ...
4118
+ $OUT = new PrintWriter($SOCKET.getOutputStream(...), ...);
4119
+ ...
4120
+ $OUT.$FUNC(...);
4121
+ message: >-
4122
+ Insecure transport rules to catch socket connections to http, telnet, and ftp servers. This is dangerous
4123
+ because these are protocols that do not encrypt traffic.
4124
+ - pattern: |
4125
+ $SOCKET = new Socket("=~/[hH][tT][tT][pP]://.*/", ...);
4126
+ ...
4127
+ $OUT = new PrintWriter($SOCKET.getOutputStream(...), ...);
4128
+ ...
4129
+ $OUT.$FUNC(...);
4130
+ message: >-
4131
+ Insecure transport rules to catch socket connections to http, telnet, and ftp servers. This is dangerous
4132
+ because these are protocols that do not encrypt traffic.
4133
+ cwe:
4134
+ - CWE-319
4135
+ owasp:
4136
+ - A03:2017
4137
+ references:
4138
+ - https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html
4139
+ tags:
4140
+ - java
4141
+ - id: telnet-request
4142
+ name: telnet-request
4143
+ description: >-
4144
+ Checks for attempts to connect through telnet. This is insecure as the telnet protocol supports no encryption, and
4145
+ data passes through unencrypted.
4146
+ category: security
4147
+ severity: medium
4148
+ confidence: medium
4149
+ languages:
4150
+ - java
4151
+ patterns:
4152
+ - pattern: |
4153
+ $TELNETCLIENT = new TelnetClient(...);
4154
+ ...
4155
+ $TELNETCLIENT.connect(...);
4156
+ message: >-
4157
+ Checks for attempts to connect through telnet. This is insecure as the telnet protocol supports no encryption,
4158
+ and data passes through unencrypted.
4159
+ cwe:
4160
+ - CWE-319
4161
+ owasp:
4162
+ - A03:2017
4163
+ references:
4164
+ - https://commons.apache.org/proper/commons-net/javadocs/api-3.6/org/apache/commons/net/telnet/TelnetClient.html
4165
+ tags:
4166
+ - java
4167
+ - id: tls-renegotiation
4168
+ name: tls-renegotiation
4169
+ description: >-
4170
+ Checks for cases where java applications are allowing unsafe renegotiation. This leaves the application vulnerable
4171
+ to a man-in-the-middle attack where chosen plain text is injected as prefix to a TLS connection.
4172
+ category: security
4173
+ severity: medium
4174
+ confidence: medium
4175
+ languages:
4176
+ - java
4177
+ patterns:
4178
+ - pattern: |
4179
+ java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", true);
4180
+ message: >-
4181
+ Checks for cases where java applications are allowing unsafe renegotiation. This leaves the application
4182
+ vulnerable to a man-in-the-middle attack where chosen plain text is injected as prefix to a TLS connection.
4183
+ cwe:
4184
+ - CWE-319
4185
+ owasp:
4186
+ - A03:2017
4187
+ references:
4188
+ - https://www.oracle.com/java/technologies/javase/tlsreadme.html
4189
+ tags:
4190
+ - java
4191
+ - id: unirest-http-request
4192
+ name: unirest-http-request
4193
+ description: >-
4194
+ Checks for requests sent via Unirest to http:// URLS. This is dangerous because the server is attempting to
4195
+ connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS.
4196
+ category: security
4197
+ severity: medium
4198
+ confidence: medium
4199
+ languages:
4200
+ - java
4201
+ patterns:
4202
+ - pattern: |
4203
+ Unirest.get("=~/[hH][tT][tT][pP]://.*/")
4204
+ message: >-
4205
+ Checks for requests sent via Unirest to http:// URLS. This is dangerous because the server is attempting to
4206
+ connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS.
4207
+ - pattern: |
4208
+ Unirest.post("=~/[hH][tT][tT][pP]://.*/")
4209
+ message: >-
4210
+ Checks for requests sent via Unirest to http:// URLS. This is dangerous because the server is attempting to
4211
+ connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS.
4212
+ cwe:
4213
+ - CWE-319
4214
+ owasp:
4215
+ - A03:2017
4216
+ references:
4217
+ - https://kong.github.io/unirest-java/#requests
4218
+ tags:
4219
+ - unirest