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,1046 @@
1
+ rules:
2
+ - id: use-abi-encodecall-instead-of-encodewithselector
3
+ name: use-abi-encodecall-instead-of-encodewithselector
4
+ description: To guarantee arguments type safety it is recommended to use `abi.encodeCall` instead of `abi.encodeWithSelector`.
5
+ category: security
6
+ severity: low
7
+ confidence: medium
8
+ languages:
9
+ - solidity
10
+ patterns:
11
+ - pattern: |
12
+ abi.encodeWithSelector(...);
13
+ message: >-
14
+ To guarantee arguments type safety it is recommended to use `abi.encodeCall` instead of
15
+ `abi.encodeWithSelector`.
16
+ cwe: []
17
+ owasp: []
18
+ references:
19
+ - https://blog.soliditylang.org/2021/12/20/solidity-0.8.11-release-announcement/
20
+ tags:
21
+ - solidity
22
+ - id: use-ownable2step
23
+ name: use-ownable2step
24
+ description: >-
25
+ By demanding that the receiver of the owner permissions actively accept via a contract call of its own,
26
+ `Ownable2Step` and `Ownable2StepUpgradeable` prevent the contract ownership from accidentally being transferred
27
+ to an address that cannot handle it.
28
+ category: security
29
+ severity: low
30
+ confidence: medium
31
+ languages:
32
+ - solidity
33
+ patterns:
34
+ - regex: .*
35
+ message: >-
36
+ By demanding that the receiver of the owner permissions actively accept via a contract call of its own,
37
+ `Ownable2Step` and `Ownable2StepUpgradeable` prevent the contract ownership from accidentally being
38
+ transferred to an address that cannot handle it.
39
+ cwe: []
40
+ owasp: []
41
+ references:
42
+ - https://docs.openzeppelin.com/contracts/4.x/api/access#Ownable2Step
43
+ - https://www.rareskills.io/post/openzeppelin-ownable2step
44
+ tags:
45
+ - solidity
46
+ - id: array-length-outside-loop
47
+ name: array-length-outside-loop
48
+ description: >-
49
+ Caching the array length outside a loop saves reading it on each iteration, as long as the array's length is not
50
+ changed during the loop.
51
+ category: security
52
+ severity: low
53
+ confidence: medium
54
+ languages:
55
+ - solidity
56
+ patterns:
57
+ - pattern: |
58
+ $VAR.length
59
+ message: >-
60
+ Caching the array length outside a loop saves reading it on each iteration, as long as the array's length is
61
+ not changed during the loop.
62
+ cwe: []
63
+ owasp: []
64
+ references:
65
+ - >-
66
+ https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g002---cache-array-length-outside-of-loop
67
+ tags:
68
+ - solidity
69
+ - id: inefficient-state-variable-increment
70
+ name: inefficient-state-variable-increment
71
+ description: <x> += <y> costs more gas than <x> = <x> + <y> for state variables.
72
+ category: security
73
+ severity: low
74
+ confidence: medium
75
+ languages:
76
+ - solidity
77
+ patterns:
78
+ - regex: .*
79
+ message: <x> += <y> costs more gas than <x> = <x> + <y> for state variables.
80
+ cwe: []
81
+ owasp: []
82
+ references:
83
+ - https://gist.github.com/IllIllI000/cbbfb267425b898e5be734d4008d4fe8
84
+ tags:
85
+ - solidity
86
+ - id: init-variables-with-default-value
87
+ name: init-variables-with-default-value
88
+ description: >-
89
+ Uninitialized variables are assigned with the types default value. Explicitly initializing a variable with its
90
+ default value costs unnecessary gas.
91
+ category: security
92
+ severity: low
93
+ confidence: medium
94
+ languages:
95
+ - solidity
96
+ patterns:
97
+ - regex: .*
98
+ message: >-
99
+ Uninitialized variables are assigned with the types default value. Explicitly initializing a variable with its
100
+ default value costs unnecessary gas.
101
+ cwe: []
102
+ owasp: []
103
+ references:
104
+ - >-
105
+ https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g001---dont-initialize-variables-with-default-value
106
+ tags:
107
+ - solidity
108
+ - id: non-optimal-variables-swap
109
+ name: non-optimal-variables-swap
110
+ description: Consider swapping variables using `($VAR1, $VAR2) = ($VAR2, $VAR1)` to save gas
111
+ category: security
112
+ severity: low
113
+ confidence: medium
114
+ languages:
115
+ - solidity
116
+ patterns:
117
+ - pattern: |
118
+ $TMP = $VAR1;
119
+ ...
120
+ $VAR1 = $VAR2;
121
+ ...
122
+ $VAR2 = $TMP;
123
+ message: Consider swapping variables using `($VAR1, $VAR2) = ($VAR2, $VAR1)` to save gas
124
+ cwe: []
125
+ owasp: []
126
+ references:
127
+ - https://dev.to/oliverjumpertz/solidity-quick-tip-efficiently-swap-two-variables-1f8i
128
+ tags:
129
+ - solidity
130
+ - id: non-payable-constructor
131
+ name: non-payable-constructor
132
+ description: Consider making costructor payable to save gas.
133
+ category: security
134
+ severity: low
135
+ confidence: medium
136
+ languages:
137
+ - solidity
138
+ patterns:
139
+ - pattern: |
140
+ constructor(...){
141
+ ...
142
+ }
143
+ message: Consider making costructor payable to save gas.
144
+ cwe: []
145
+ owasp: []
146
+ references:
147
+ - https://twitter.com/0xAsm0d3us/status/1518960704271056897
148
+ tags:
149
+ - solidity
150
+ - id: state-variable-read-in-a-loop
151
+ name: state-variable-read-in-a-loop
152
+ description: Replace state variable reads and writes within loops with local variable reads and writes.
153
+ category: security
154
+ severity: low
155
+ confidence: medium
156
+ languages:
157
+ - solidity
158
+ patterns:
159
+ - pattern: $X
160
+ message: Replace state variable reads and writes within loops with local variable reads and writes.
161
+ cwe: []
162
+ owasp: []
163
+ references:
164
+ - >-
165
+ https://github.com/devanshbatham/Solidity-Gas-Optimization-Tips#10--replace-state-variable-reads-and-writes-within-loops-with-local-variable-reads-and-writes
166
+ tags:
167
+ - solidity
168
+ - id: unnecessary-checked-arithmetic-in-loop
169
+ name: unnecessary-checked-arithmetic-in-loop
170
+ description: >-
171
+ A lot of times there is no risk that the loop counter can overflow. Using Solidity's unchecked block saves the
172
+ overflow checks.
173
+ category: security
174
+ severity: low
175
+ confidence: medium
176
+ languages:
177
+ - solidity
178
+ patterns:
179
+ - regex: .*
180
+ message: >-
181
+ A lot of times there is no risk that the loop counter can overflow. Using Solidity's unchecked block saves
182
+ the overflow checks.
183
+ cwe: []
184
+ owasp: []
185
+ references:
186
+ - >-
187
+ https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g011---unnecessary-checked-arithmetic-in-for-loop
188
+ tags:
189
+ - solidity
190
+ - id: use-custom-error-not-require
191
+ name: use-custom-error-not-require
192
+ description: >-
193
+ Consider using custom errors as they are more gas efficient while allowing developers to describe the error in
194
+ detail using NatSpec.
195
+ category: security
196
+ severity: low
197
+ confidence: medium
198
+ languages:
199
+ - solidity
200
+ patterns:
201
+ - regex: .*
202
+ message: >-
203
+ Consider using custom errors as they are more gas efficient while allowing developers to describe the error
204
+ in detail using NatSpec.
205
+ cwe: []
206
+ owasp: []
207
+ references:
208
+ - https://blog.soliditylang.org/2021/04/21/custom-errors/
209
+ tags:
210
+ - solidity
211
+ - id: use-multiple-require
212
+ name: use-multiple-require
213
+ description: >-
214
+ Using multiple require statements is cheaper than using && multiple check combinations. There are more
215
+ advantages, such as easier to read code and better coverage reports.
216
+ category: security
217
+ severity: low
218
+ confidence: medium
219
+ languages:
220
+ - solidity
221
+ patterns:
222
+ - pattern: |
223
+ require (<... $X && $Y ...>, ...);
224
+ message: >-
225
+ Using multiple require statements is cheaper than using && multiple check combinations. There are more
226
+ advantages, such as easier to read code and better coverage reports.
227
+ cwe: []
228
+ owasp: []
229
+ references:
230
+ - >-
231
+ https://code4rena.com/reports/2023-01-ondo#g-15-splitting-require-statements-that-use--saves-gas---saves-8-gas-per-
232
+ tags:
233
+ - solidity
234
+ - id: use-nested-if
235
+ name: use-nested-if
236
+ description: >-
237
+ Using nested is cheaper than using && multiple check combinations. There are more advantages, such as easier to
238
+ read code and better coverage reports.
239
+ category: security
240
+ severity: low
241
+ confidence: medium
242
+ languages:
243
+ - solidity
244
+ patterns:
245
+ - pattern: |
246
+ if (<... $X && $Y ...>) {
247
+ ...
248
+ }
249
+ message: >-
250
+ Using nested is cheaper than using && multiple check combinations. There are more advantages, such as easier
251
+ to read code and better coverage reports.
252
+ cwe: []
253
+ owasp: []
254
+ references:
255
+ - https://code4rena.com/reports/2023-01-biconomy#g-18-use-nested-if-and-avoid-multiple-check-combinations
256
+ tags:
257
+ - solidity
258
+ - id: use-prefix-decrement-not-postfix
259
+ name: use-prefix-decrement-not-postfix
260
+ description: >-
261
+ Consider using the prefix decrement expression whenever the return value is not needed. The prefix decrement
262
+ expression is cheaper in terms of gas.
263
+ category: security
264
+ severity: low
265
+ confidence: medium
266
+ languages:
267
+ - solidity
268
+ patterns:
269
+ - pattern: $VAR--
270
+ message: >-
271
+ Consider using the prefix decrement expression whenever the return value is not needed. The prefix decrement
272
+ expression is cheaper in terms of gas.
273
+ cwe: []
274
+ owasp: []
275
+ references:
276
+ - >-
277
+ https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g012---use-prefix-increment-instead-of-postfix-increment-if-possible
278
+ tags:
279
+ - solidity
280
+ - id: use-prefix-increment-not-postfix
281
+ name: use-prefix-increment-not-postfix
282
+ description: >-
283
+ Consider using the prefix increment expression whenever the return value is not needed. The prefix increment
284
+ expression is cheaper in terms of gas.
285
+ category: security
286
+ severity: low
287
+ confidence: medium
288
+ languages:
289
+ - solidity
290
+ patterns:
291
+ - pattern: $VAR++
292
+ message: >-
293
+ Consider using the prefix increment expression whenever the return value is not needed. The prefix increment
294
+ expression is cheaper in terms of gas.
295
+ cwe: []
296
+ owasp: []
297
+ references:
298
+ - >-
299
+ https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g012---use-prefix-increment-instead-of-postfix-increment-if-possible
300
+ tags:
301
+ - solidity
302
+ - id: use-short-revert-string
303
+ name: use-short-revert-string
304
+ description: >-
305
+ Shortening revert strings to fit in 32 bytes will decrease gas costs for deployment and gas costs when the revert
306
+ condition has been met.
307
+ category: security
308
+ severity: low
309
+ confidence: medium
310
+ languages:
311
+ - solidity
312
+ patterns:
313
+ - regex: .*
314
+ message: >-
315
+ Shortening revert strings to fit in 32 bytes will decrease gas costs for deployment and gas costs when the
316
+ revert condition has been met.
317
+ cwe: []
318
+ owasp: []
319
+ references:
320
+ - https://github.com/byterocket/c4-common-issues/blob/main/0-Gas-Optimizations.md/#g007---long-revert-strings
321
+ tags:
322
+ - solidity
323
+ - id: accessible-selfdestruct
324
+ name: accessible-selfdestruct
325
+ description: Contract can be destructed by anyone in $FUNC
326
+ category: security
327
+ severity: high
328
+ confidence: medium
329
+ languages:
330
+ - solidity
331
+ patterns:
332
+ - regex: .*
333
+ message: Contract can be destructed by anyone in $FUNC
334
+ cwe:
335
+ - CWE-284
336
+ owasp: []
337
+ references:
338
+ - https://www.parity.io/blog/a-postmortem-on-the-parity-multi-sig-library-self-destruct/
339
+ tags:
340
+ - solidity
341
+ - id: arbitrary-low-level-call
342
+ name: arbitrary-low-level-call
343
+ description: An attacker may perform call() to an arbitrary address with controlled calldata
344
+ category: security
345
+ severity: high
346
+ confidence: medium
347
+ languages:
348
+ - solidity
349
+ patterns:
350
+ - regex: .*
351
+ message: An attacker may perform call() to an arbitrary address with controlled calldata
352
+ cwe:
353
+ - CWE-20
354
+ owasp: []
355
+ references:
356
+ - https://twitter.com/CertiKAlert/status/1512198846343954445
357
+ - https://twitter.com/SlowMist_Team/status/1508787862791069700
358
+ - https://twitter.com/Beosin_com/status/1509099103401127942
359
+ - >-
360
+ https://blocksecteam.medium.com/li-fi-attack-a-cross-chain-bridge-vulnerability-no-its-due-to-unchecked-external-call-c31e7dadf60f
361
+ - https://etherscan.io/address/0xe7597f774fd0a15a617894dc39d45a28b97afa4f
362
+ - https://etherscan.io/address/0x73a499e043b03fc047189ab1ba72eb595ff1fc8e
363
+ tags:
364
+ - solidity
365
+ - id: arbitrary-send-erc20
366
+ name: arbitrary-send-erc20
367
+ description: >-
368
+ msg.sender is not being used when calling erc20.transferFrom. Example - Alice approves this contract to spend her
369
+ ERC20 tokens. Bob can call function 'a' and specify Alice's address as the from parameter in transferFrom,
370
+ allowing him to transfer Alice's tokens to himself.
371
+ category: security
372
+ severity: medium
373
+ confidence: medium
374
+ languages:
375
+ - solidity
376
+ patterns:
377
+ - pattern: $FUNC.transferFrom(...)
378
+ message: >-
379
+ msg.sender is not being used when calling erc20.transferFrom. Example - Alice approves this contract to spend
380
+ her ERC20 tokens. Bob can call function 'a' and specify Alice's address as the from parameter in transferFrom,
381
+ allowing him to transfer Alice's tokens to himself.
382
+ cwe:
383
+ - CWE-285
384
+ owasp:
385
+ - A01:2021
386
+ - A01:2025
387
+ references:
388
+ - https://github.com/crytic/slither/wiki/Detector-Documentation#arbitrary-from-in-transferfrom
389
+ - https://cwe.mitre.org/data/definitions/285.html
390
+ tags:
391
+ - solidity
392
+ - id: balancer-readonly-reentrancy-getpooltokens
393
+ name: balancer-readonly-reentrancy-getpooltokens
394
+ description: $VAULT.getPoolTokens() call on a Balancer pool is not protected from the read-only reentrancy.
395
+ category: secrets
396
+ severity: high
397
+ confidence: medium
398
+ languages:
399
+ - solidity
400
+ patterns:
401
+ - regex: .*
402
+ message: $VAULT.getPoolTokens() call on a Balancer pool is not protected from the read-only reentrancy.
403
+ cwe:
404
+ - CWE-841
405
+ owasp: []
406
+ references:
407
+ - https://quillaudits.medium.com/decoding-sentiment-protocols-1-million-exploit-quillaudits-f36bee77d376
408
+ - https://hackmd.io/@sentimentxyz/SJCySo1z2
409
+ tags:
410
+ - solidity
411
+ - id: balancer-readonly-reentrancy-getrate
412
+ name: balancer-readonly-reentrancy-getrate
413
+ description: $VAR.getRate() call on a Balancer pool is not protected from the read-only reentrancy.
414
+ category: security
415
+ severity: high
416
+ confidence: medium
417
+ languages:
418
+ - solidity
419
+ patterns:
420
+ - pattern: |
421
+ function $F(...) {
422
+ ...
423
+ $VAR.getRate();
424
+ ...
425
+ }
426
+ message: $VAR.getRate() call on a Balancer pool is not protected from the read-only reentrancy.
427
+ cwe:
428
+ - CWE-841
429
+ owasp: []
430
+ references:
431
+ - https://forum.balancer.fi/t/reentrancy-vulnerability-scope-expanded/4345
432
+ tags:
433
+ - solidity
434
+ - id: basic-arithmetic-underflow
435
+ name: basic-arithmetic-underflow
436
+ description: Possible arithmetic underflow
437
+ category: security
438
+ severity: low
439
+ confidence: medium
440
+ languages:
441
+ - solidity
442
+ patterns:
443
+ - regex: .*
444
+ message: Possible arithmetic underflow
445
+ cwe:
446
+ - CWE-191
447
+ owasp: []
448
+ references:
449
+ - https://medium.com/@Knownsec_Blockchain_Lab/knownsec-blockchain-lab-umbnetwork-attack-event-analysis-9bae1141e58
450
+ - https://twitter.com/danielvf/status/1497194778278174724
451
+ - https://etherscan.io/address/0xbbc3a290c7d2755b48681c87f25f9d7f480ad42f
452
+ tags:
453
+ - solidity
454
+ - id: basic-oracle-manipulation
455
+ name: basic-oracle-manipulation
456
+ description: Price oracle can be manipulated via flashloan
457
+ category: security
458
+ severity: low
459
+ confidence: medium
460
+ languages:
461
+ - solidity
462
+ patterns:
463
+ - regex: .*
464
+ message: Price oracle can be manipulated via flashloan
465
+ cwe:
466
+ - CWE-682
467
+ owasp: []
468
+ references:
469
+ - https://medium.com/oneringfinance/onering-finance-exploit-post-mortem-after-oshare-hack-602a529db99b
470
+ - https://twitter.com/peckshield/status/1506090607059431427
471
+ - https://pwned-no-more.notion.site/The-Deus-Hack-Explained-647bf97afa2b4e4e9e8b882e68a75c0b
472
+ - https://twitter.com/peckshield/status/1519530463337250817
473
+ - https://ftmscan.com/address/0xc06826f52f29b34c5d8b2c61abf844cebcf78abf
474
+ - https://ftmscan.com/address/0x5CEB2b0308a7f21CcC0915DB29fa5095bEAdb48D
475
+ - https://ftmscan.com/address/0x8129026c585bcfa530445a6267f9389057761a00
476
+ tags:
477
+ - solidity
478
+ - id: compound-borrowfresh-reentrancy
479
+ name: compound-borrowfresh-reentrancy
480
+ description: Function borrowFresh() in Compound performs state update after doTransferOut()
481
+ category: security
482
+ severity: medium
483
+ confidence: medium
484
+ languages:
485
+ - solidity
486
+ patterns:
487
+ - pattern: doTransferOut(...);
488
+ message: Function borrowFresh() in Compound performs state update after doTransferOut()
489
+ cwe:
490
+ - CWE-841
491
+ owasp: []
492
+ references:
493
+ - https://twitter.com/peckshield/status/1509431646818234369
494
+ - https://twitter.com/blocksecteam/status/1509466576848064512
495
+ - https://slowmist.medium.com/another-day-another-reentrancy-attack-5cde10bbb2b4
496
+ - https://explorer.fuse.io/address/0x139Eb08579eec664d461f0B754c1F8B569044611
497
+ tags:
498
+ - solidity
499
+ - id: compound-sweeptoken-not-restricted
500
+ name: compound-sweeptoken-not-restricted
501
+ description: Function sweepToken is allowed to be called by anyone
502
+ category: secrets
503
+ severity: medium
504
+ confidence: medium
505
+ languages:
506
+ - solidity
507
+ patterns:
508
+ - pattern: token.transfer(...);
509
+ message: Function sweepToken is allowed to be called by anyone
510
+ cwe:
511
+ - CWE-284
512
+ owasp: []
513
+ references:
514
+ - https://medium.com/chainsecurity/trueusd-compound-vulnerability-bc5b696d29e2
515
+ - https://chainsecurity.com/security-audit/compound-ctoken/
516
+ - https://blog.openzeppelin.com/compound-comprehensive-protocol-audit/
517
+ - https://etherscan.io/address/0xa035b9e130f2b1aedc733eefb1c67ba4c503491f
518
+ tags:
519
+ - solidity
520
+ - id: curve-readonly-reentrancy
521
+ name: curve-readonly-reentrancy
522
+ description: $POOL.get_virtual_price() call on a Curve pool is not protected from the read-only reentrancy.
523
+ category: security
524
+ severity: high
525
+ confidence: medium
526
+ languages:
527
+ - solidity
528
+ patterns:
529
+ - pattern: |
530
+ $POOL.get_virtual_price()
531
+ message: $POOL.get_virtual_price() call on a Curve pool is not protected from the read-only reentrancy.
532
+ cwe:
533
+ - CWE-841
534
+ owasp: []
535
+ references:
536
+ - https://chainsecurity.com/heartbreaks-curve-lp-oracles/
537
+ - https://chainsecurity.com/curve-lp-oracle-manipulation-post-mortem/
538
+ tags:
539
+ - solidity
540
+ - id: delegatecall-to-arbitrary-address
541
+ name: delegatecall-to-arbitrary-address
542
+ description: An attacker may perform delegatecall() to an arbitrary address.
543
+ category: security
544
+ severity: high
545
+ confidence: medium
546
+ languages:
547
+ - solidity
548
+ patterns:
549
+ - regex: .*
550
+ message: An attacker may perform delegatecall() to an arbitrary address.
551
+ cwe:
552
+ - CWE-20
553
+ owasp: []
554
+ references:
555
+ - https://entethalliance.org/specs/ethtrust-sl/v1/#req-1-delegatecall
556
+ tags:
557
+ - solidity
558
+ - id: encode-packed-collision
559
+ name: encode-packed-collision
560
+ description: abi.encodePacked hash collision with variable length arguments in $F()
561
+ category: security
562
+ severity: high
563
+ confidence: medium
564
+ languages:
565
+ - solidity
566
+ patterns:
567
+ - regex: .*
568
+ message: abi.encodePacked hash collision with variable length arguments in $F()
569
+ cwe:
570
+ - CWE-20
571
+ owasp: []
572
+ references:
573
+ - https://swcregistry.io/docs/SWC-133
574
+ tags:
575
+ - solidity
576
+ - id: erc20-public-burn
577
+ name: erc20-public-burn
578
+ description: Anyone can burn tokens of other accounts
579
+ category: security
580
+ severity: high
581
+ confidence: medium
582
+ languages:
583
+ - solidity
584
+ patterns:
585
+ - regex: .*
586
+ message: Anyone can burn tokens of other accounts
587
+ cwe:
588
+ - CWE-284
589
+ owasp: []
590
+ references:
591
+ - https://twitter.com/danielvf/status/1511013322015051797
592
+ - https://etherscan.io/address/0xf15ead6acb8ab52a1e335671a48f3a99e991614c
593
+ tags:
594
+ - solidity
595
+ - id: erc20-public-transfer
596
+ name: erc20-public-transfer
597
+ description: Custom ERC20 implementation exposes _transfer() as public
598
+ category: security
599
+ severity: medium
600
+ confidence: medium
601
+ languages:
602
+ - solidity
603
+ patterns:
604
+ - regex: .*
605
+ message: Custom ERC20 implementation exposes _transfer() as public
606
+ cwe:
607
+ - CWE-284
608
+ owasp: []
609
+ references:
610
+ - >-
611
+ https://medium.com/@Knownsec_Blockchain_Lab/creat-future-was-tragically-transferred-coins-at-will-who-is-the-mastermind-behind-the-scenes-8ad42a7af814
612
+ - https://bscscan.com/address/0x8B7218CF6Ac641382D7C723dE8aA173e98a80196
613
+ tags:
614
+ - solidity
615
+ - id: erc677-reentrancy
616
+ name: erc677-reentrancy
617
+ description: ERC677 callAfterTransfer() reentrancy
618
+ category: security
619
+ severity: medium
620
+ confidence: medium
621
+ languages:
622
+ - solidity
623
+ patterns:
624
+ - pattern: callAfterTransfer(...);
625
+ message: ERC677 callAfterTransfer() reentrancy
626
+ cwe:
627
+ - CWE-841
628
+ owasp: []
629
+ references:
630
+ - https://twitter.com/peckshield/status/1509431646818234369
631
+ - https://twitter.com/blocksecteam/status/1509466576848064512
632
+ - https://explorer.fuse.io/address/0x139Eb08579eec664d461f0B754c1F8B569044611
633
+ - https://explorer.fuse.io/address/0x5De15b5543c178C111915d6B8ae929Af01a8cC58
634
+ tags:
635
+ - solidity
636
+ - id: erc721-arbitrary-transferfrom
637
+ name: erc721-arbitrary-transferfrom
638
+ description: Custom ERC721 implementation lacks access control checks in _transfer()
639
+ category: security
640
+ severity: medium
641
+ confidence: medium
642
+ languages:
643
+ - solidity
644
+ patterns:
645
+ - pattern: _approve(...);
646
+ message: Custom ERC721 implementation lacks access control checks in _transfer()
647
+ cwe:
648
+ - CWE-284
649
+ owasp: []
650
+ references:
651
+ - https://twitter.com/BlockSecAlert/status/1516289618605654024
652
+ - https://etherscan.io/address/0xf3821adaceb6500c0a202971aecf840a033f236b
653
+ tags:
654
+ - solidity
655
+ - id: erc721-reentrancy
656
+ name: erc721-reentrancy
657
+ description: ERC721 onERC721Received() reentrancy
658
+ category: security
659
+ severity: medium
660
+ confidence: medium
661
+ languages:
662
+ - solidity
663
+ patterns:
664
+ - pattern: _checkOnERC721Received(...)
665
+ message: ERC721 onERC721Received() reentrancy
666
+ cwe:
667
+ - CWE-841
668
+ owasp: []
669
+ references:
670
+ - >-
671
+ https://blocksecteam.medium.com/when-safemint-becomes-unsafe-lessons-from-the-hypebears-security-incident-2965209bda2a
672
+ - https://etherscan.io/address/0x14e0a1f310e2b7e321c91f58847e98b8c802f6ef
673
+ tags:
674
+ - solidity
675
+ - id: erc777-reentrancy
676
+ name: erc777-reentrancy
677
+ description: ERC777 tokensReceived() reentrancy
678
+ category: security
679
+ severity: medium
680
+ confidence: medium
681
+ languages:
682
+ - solidity
683
+ patterns:
684
+ - pattern: $X.tokensReceived(...);
685
+ message: ERC777 tokensReceived() reentrancy
686
+ cwe:
687
+ - CWE-841
688
+ owasp: []
689
+ references:
690
+ - https://mirror.xyz/baconcoin.eth/LHaPiX38mnx8eJ2RVKNXHttHfweQMKNGmEnX4KUksk0
691
+ - https://etherscan.io/address/0xf53f00f844b381963a47fde3325011566870b31f
692
+ tags:
693
+ - solidity
694
+ - id: gearbox-tokens-path-confusion
695
+ name: gearbox-tokens-path-confusion
696
+ description: UniswapV3 adapter implemented incorrect extraction of path parameters
697
+ category: secrets
698
+ severity: medium
699
+ confidence: medium
700
+ languages:
701
+ - solidity
702
+ patterns:
703
+ - pattern: $PATH.toAddress($PATH.length - $ADDR_SIZE);
704
+ message: UniswapV3 adapter implemented incorrect extraction of path parameters
705
+ cwe:
706
+ - CWE-1285
707
+ owasp: []
708
+ references:
709
+ - https://medium.com/@nnez/different-parsers-different-results-acecf84dfb0c
710
+ - https://etherscan.io/address/0xbA7B57D7E4d4A7516FC1CbfF1CA5182eBC0c1491
711
+ tags:
712
+ - solidity
713
+ - id: incorrect-use-of-blockhash
714
+ name: incorrect-use-of-blockhash
715
+ description: blockhash(block.number) and blockhash(block.number + N) always returns 0.
716
+ category: crypto
717
+ severity: high
718
+ confidence: medium
719
+ languages:
720
+ - solidity
721
+ patterns:
722
+ - regex: .*
723
+ message: blockhash(block.number) and blockhash(block.number + N) always returns 0.
724
+ cwe:
725
+ - CWE-341
726
+ owasp: []
727
+ references:
728
+ - https://blog.positive.com/predicting-random-numbers-in-ethereum-smart-contracts-e5358c6b8620
729
+ tags:
730
+ - solidity
731
+ - id: keeper-network-oracle-manipulation
732
+ name: keeper-network-oracle-manipulation
733
+ description: >-
734
+ Keep3rV2.current() call has high data freshness, but it has low security, an exploiter simply needs to manipulate
735
+ 2 data points to be able to impact the feed.
736
+ category: security
737
+ severity: medium
738
+ confidence: medium
739
+ languages:
740
+ - solidity
741
+ patterns:
742
+ - pattern: $KEEPER.current($TOKENIN, $AMOUNTIN, $TOKENOUT);
743
+ message: >-
744
+ Keep3rV2.current() call has high data freshness, but it has low security, an exploiter simply needs to
745
+ manipulate 2 data points to be able to impact the feed.
746
+ cwe:
747
+ - CWE-682
748
+ owasp: []
749
+ references:
750
+ - https://twitter.com/peckshield/status/1510232640338608131
751
+ - https://twitter.com/FrankResearcher/status/1510239094777032713
752
+ - https://twitter.com/larry0x/status/1510263618180464644
753
+ - https://andrecronje.medium.com/keep3r-network-on-chain-oracle-price-feeds-3c67ed002a9
754
+ - https://etherscan.io/address/0x210ac53b27f16e20a9aa7d16260f84693390258f
755
+ tags:
756
+ - solidity
757
+ - id: missing-self-transfer-check-ercx
758
+ name: missing-self-transfer-check-ercx
759
+ description: >-
760
+ Missing check for 'from' and 'to' being the same before updating balances could lead to incorrect balance
761
+ manipulation on self-transfers. Include a check to ensure 'from' and 'to' are not the same before updating
762
+ balances to prevent balance manipulation during self-transfers.
763
+ category: security
764
+ severity: high
765
+ confidence: medium
766
+ languages:
767
+ - solidity
768
+ patterns:
769
+ - regex: .*
770
+ message: >-
771
+ Missing check for 'from' and 'to' being the same before updating balances could lead to incorrect balance
772
+ manipulation on self-transfers. Include a check to ensure 'from' and 'to' are not the same before updating
773
+ balances to prevent balance manipulation during self-transfers.
774
+ cwe:
775
+ - CWE-682
776
+ owasp:
777
+ - A7:2021
778
+ references:
779
+ - https://blog.verichains.io/p/miner-project-attacked-by-vulnerabilities
780
+ - https://x.com/shoucccc/status/1757777764646859121
781
+ tags:
782
+ - blockchain
783
+ - solidity
784
+ - id: msg-value-multicall
785
+ name: msg-value-multicall
786
+ description: $F with constant msg.value can be called multiple times
787
+ category: security
788
+ severity: high
789
+ confidence: medium
790
+ languages:
791
+ - solidity
792
+ patterns:
793
+ - pattern: msg.value
794
+ message: $F with constant msg.value can be called multiple times
795
+ cwe:
796
+ - CWE-837
797
+ owasp: []
798
+ references:
799
+ - https://github.com/Uniswap/v3-periphery/issues/52
800
+ - https://www.paradigm.xyz/2021/08/two-rights-might-make-a-wrong
801
+ tags:
802
+ - solidity
803
+ - id: no-bidi-characters
804
+ name: no-bidi-characters
805
+ description: The code must not contain any of Unicode Direction Control Characters
806
+ category: security
807
+ severity: medium
808
+ confidence: medium
809
+ languages:
810
+ - solidity
811
+ patterns:
812
+ - regex: .*
813
+ message: The code must not contain any of Unicode Direction Control Characters
814
+ cwe:
815
+ - CWE-837
816
+ owasp: []
817
+ references:
818
+ - https://entethalliance.org/specs/ethtrust-sl/v1/#req-1-unicode-bdo
819
+ tags:
820
+ - solidity
821
+ - id: no-slippage-check
822
+ name: no-slippage-check
823
+ description: No slippage check in a Uniswap v2/v3 trade
824
+ category: security
825
+ severity: high
826
+ confidence: medium
827
+ languages:
828
+ - solidity
829
+ patterns:
830
+ - regex: .*
831
+ message: No slippage check in a Uniswap v2/v3 trade
832
+ cwe:
833
+ - CWE-682
834
+ owasp: []
835
+ references:
836
+ - https://uniswapv3book.com/docs/milestone_3/slippage-protection/
837
+ tags:
838
+ - solidity
839
+ - id: openzeppelin-ecdsa-recover-malleable
840
+ name: openzeppelin-ecdsa-recover-malleable
841
+ description: Potential signature malleability in $F
842
+ category: security
843
+ severity: medium
844
+ confidence: medium
845
+ languages:
846
+ - solidity
847
+ patterns:
848
+ - pattern: |
849
+ function $F(..., bytes $Y, ...) {
850
+ ...
851
+ $Z = ECDSA.recover(..., $Y);
852
+ ...
853
+ $A[$Y] = ...;
854
+ ...
855
+ }
856
+ message: Potential signature malleability in $F
857
+ - pattern: |
858
+ function $F(..., bytes $Y, ...) {
859
+ ...
860
+ $Z = ECDSA.recover(..., $Y);
861
+ ...
862
+ $A[$B][$Y] = ...;
863
+ ...
864
+ }
865
+ message: Potential signature malleability in $F
866
+ cwe:
867
+ - CWE-347
868
+ owasp: []
869
+ references:
870
+ - https://github.com/advisories/GHSA-4h98-2769-gh6h
871
+ tags:
872
+ - solidity
873
+ - id: oracle-price-update-not-restricted
874
+ name: oracle-price-update-not-restricted
875
+ description: Oracle price data can be submitted by anyone
876
+ category: security
877
+ severity: high
878
+ confidence: medium
879
+ languages:
880
+ - solidity
881
+ patterns:
882
+ - regex: .*
883
+ message: Oracle price data can be submitted by anyone
884
+ cwe:
885
+ - CWE-284
886
+ owasp: []
887
+ references:
888
+ - https://twitter.com/BlockSecTeam/status/1514815673800663045
889
+ - https://twitter.com/CertiKAlert/status/1514831117169405953
890
+ - https://medium.com/@hacxyk/aave-v3s-price-oracle-manipulation-vulnerability-168e44e9e374
891
+ - https://bscscan.com/address/0xd55f01b4b51b7f48912cd8ca3cdd8070a1a9dba5
892
+ - https://polygonscan.com/address/0xaA5890362f36FeaAe91aF248e84e287cE6eCD1A9
893
+ tags:
894
+ - solidity
895
+ - id: proxy-storage-collision
896
+ name: proxy-storage-collision
897
+ description: Proxy declares a state var that may override a storage slot of the implementation
898
+ category: security
899
+ severity: medium
900
+ confidence: medium
901
+ languages:
902
+ - solidity
903
+ patterns:
904
+ - regex: .*
905
+ message: Proxy declares a state var that may override a storage slot of the implementation
906
+ cwe:
907
+ - CWE-787
908
+ owasp: []
909
+ references:
910
+ - https://blog.audius.co/article/audius-governance-takeover-post-mortem-7-23-22
911
+ tags:
912
+ - solidity
913
+ - id: redacted-cartel-custom-approval-bug
914
+ name: redacted-cartel-custom-approval-bug
915
+ description: transferFrom() can steal allowance of other accounts
916
+ category: security
917
+ severity: high
918
+ confidence: medium
919
+ languages:
920
+ - solidity
921
+ patterns:
922
+ - pattern: _approve(..., allowance(sender, recipient).sub(amount, ...), ...);
923
+ message: transferFrom() can steal allowance of other accounts
924
+ cwe:
925
+ - CWE-688
926
+ owasp: []
927
+ references:
928
+ - https://medium.com/immunefi/redacted-cartel-custom-approval-logic-bugfix-review-9b2d039ca2c5
929
+ - https://etherscan.io/address/0x186E55C0BebD2f69348d94C4A27556d93C5Bd36C
930
+ tags:
931
+ - solidity
932
+ - id: rigoblock-missing-access-control
933
+ name: rigoblock-missing-access-control
934
+ description: setMultipleAllowances() is missing onlyOwner modifier
935
+ category: security
936
+ severity: high
937
+ confidence: medium
938
+ languages:
939
+ - solidity
940
+ patterns:
941
+ - pattern: function setMultipleAllowances(...) {...}
942
+ message: setMultipleAllowances() is missing onlyOwner modifier
943
+ cwe:
944
+ - CWE-284
945
+ owasp: []
946
+ references:
947
+ - https://twitter.com/danielvf/status/1494317265835147272
948
+ - https://etherscan.io/address/0x876b9ebd725d1fa0b879fcee12560a6453b51dc8
949
+ - https://play.secdim.com/game/dapp/challenge/rigoownsol
950
+ tags:
951
+ - solidity
952
+ - id: sense-missing-oracle-access-control
953
+ name: sense-missing-oracle-access-control
954
+ description: Oracle update is not restricted in $F()
955
+ category: security
956
+ severity: high
957
+ confidence: medium
958
+ languages:
959
+ - solidity
960
+ patterns:
961
+ - regex: .*
962
+ message: Oracle update is not restricted in $F()
963
+ cwe:
964
+ - CWE-284
965
+ owasp: []
966
+ references:
967
+ - https://medium.com/immunefi/sense-finance-access-control-issue-bugfix-review-32e0c806b1a0
968
+ tags:
969
+ - solidity
970
+ - id: superfluid-ctx-injection
971
+ name: superfluid-ctx-injection
972
+ description: A specially crafted calldata may be used to impersonate other accounts
973
+ category: security
974
+ severity: high
975
+ confidence: medium
976
+ languages:
977
+ - solidity
978
+ patterns:
979
+ - pattern: $T.decodeCtx(ctx);
980
+ message: A specially crafted calldata may be used to impersonate other accounts
981
+ cwe:
982
+ - CWE-20
983
+ owasp: []
984
+ references:
985
+ - https://rekt.news/superfluid-rekt/
986
+ - https://medium.com/superfluid-blog/08-02-22-exploit-post-mortem-15ff9c97cdd
987
+ - https://polygonscan.com/address/0x07711bb6dfbc99a1df1f2d7f57545a67519941e7
988
+ tags:
989
+ - solidity
990
+ - id: tecra-coin-burnfrom-bug
991
+ name: tecra-coin-burnfrom-bug
992
+ description: Parameter "from" is checked at incorrect position in "_allowances" mapping
993
+ category: security
994
+ severity: high
995
+ confidence: medium
996
+ languages:
997
+ - solidity
998
+ patterns:
999
+ - regex: .*
1000
+ message: Parameter "from" is checked at incorrect position in "_allowances" mapping
1001
+ cwe:
1002
+ - CWE-688
1003
+ owasp: []
1004
+ references:
1005
+ - https://twitter.com/Mauricio_0218/status/1490082073096462340
1006
+ - https://etherscan.io/address/0xe38b72d6595fd3885d1d2f770aa23e94757f91a1
1007
+ tags:
1008
+ - solidity
1009
+ - id: uniswap-callback-not-protected
1010
+ name: uniswap-callback-not-protected
1011
+ description: Uniswap callback is not protected
1012
+ category: security
1013
+ severity: medium
1014
+ confidence: medium
1015
+ languages:
1016
+ - solidity
1017
+ patterns:
1018
+ - pattern: |
1019
+ function $CALLBACK(...) { ... }
1020
+ message: Uniswap callback is not protected
1021
+ cwe:
1022
+ - CWE-284
1023
+ owasp: []
1024
+ references:
1025
+ - https://docs.uniswap.org/contracts/v3/guides/flash-integrations/flash-callback
1026
+ tags:
1027
+ - solidity
1028
+ - id: unrestricted-transferownership
1029
+ name: unrestricted-transferownership
1030
+ description: Unrestricted transferOwnership
1031
+ category: security
1032
+ severity: high
1033
+ confidence: medium
1034
+ languages:
1035
+ - solidity
1036
+ patterns:
1037
+ - regex: .*
1038
+ message: Unrestricted transferOwnership
1039
+ cwe:
1040
+ - CWE-284
1041
+ owasp: []
1042
+ references:
1043
+ - https://medium.com/quillhash/decoding-ragnarok-online-invasion-44k-exploit-quillaudits-261b7e23b55
1044
+ - https://www.bscscan.com/address/0xe48b75dc1b131fd3a8364b0580f76efd04cf6e9c
1045
+ tags:
1046
+ - solidity