solidity-argus 0.1.8 → 0.3.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 (178) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +229 -13
  3. package/package.json +37 -8
  4. package/skills/INVENTORY.md +88 -57
  5. package/skills/README.md +72 -6
  6. package/skills/case-studies/beanstalk-governance/SKILL.md +52 -0
  7. package/skills/case-studies/bzx-flash-loan/SKILL.md +53 -0
  8. package/skills/case-studies/cream-finance/SKILL.md +52 -0
  9. package/skills/case-studies/curve-reentrancy/SKILL.md +52 -0
  10. package/skills/case-studies/dao-hack/SKILL.md +51 -0
  11. package/skills/case-studies/euler-finance/SKILL.md +52 -0
  12. package/skills/case-studies/harvest-finance/SKILL.md +52 -0
  13. package/skills/case-studies/level-finance/SKILL.md +51 -0
  14. package/skills/case-studies/mango-markets/SKILL.md +53 -0
  15. package/skills/case-studies/nomad-bridge/SKILL.md +51 -0
  16. package/skills/case-studies/parity-multisig/SKILL.md +55 -0
  17. package/skills/case-studies/poly-network/SKILL.md +51 -0
  18. package/skills/case-studies/rari-fuse/SKILL.md +51 -0
  19. package/skills/case-studies/ronin-bridge/SKILL.md +52 -0
  20. package/skills/case-studies/wormhole-bridge/SKILL.md +51 -0
  21. package/skills/checklists/cyfrin-defi-core/SKILL.md +3 -0
  22. package/skills/manifests/cyfrin.json +16 -0
  23. package/skills/manifests/defifofum.json +25 -0
  24. package/skills/manifests/kadenzipfel.json +48 -0
  25. package/skills/manifests/scvd.json +9 -0
  26. package/skills/manifests/smartbugs.json +9 -0
  27. package/skills/manifests/solodit.json +9 -0
  28. package/skills/manifests/sunweb3sec.json +9 -0
  29. package/skills/manifests/trailofbits.json +9 -0
  30. package/skills/methodology/audit-workflow/SKILL.md +3 -0
  31. package/skills/protocol-patterns/amm-dex/SKILL.md +3 -0
  32. package/skills/references/exploit-reference/SKILL.md +3 -0
  33. package/skills/vulnerability-patterns/access-control/SKILL.md +27 -0
  34. package/skills/vulnerability-patterns/arbitrary-storage-location/SKILL.md +13 -1
  35. package/skills/vulnerability-patterns/assert-violation/SKILL.md +8 -1
  36. package/skills/vulnerability-patterns/asserting-contract-from-code-size/SKILL.md +12 -1
  37. package/skills/vulnerability-patterns/authorization-txorigin/SKILL.md +8 -1
  38. package/skills/vulnerability-patterns/cross-chain-bridge-vulnerabilities/SKILL.md +217 -0
  39. package/skills/vulnerability-patterns/default-visibility/SKILL.md +13 -1
  40. package/skills/vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md +8 -1
  41. package/skills/vulnerability-patterns/dos-gas-limit/SKILL.md +8 -1
  42. package/skills/vulnerability-patterns/dos-revert/SKILL.md +14 -1
  43. package/skills/vulnerability-patterns/erc4626-exchange-rate-manipulation/SKILL.md +64 -0
  44. package/skills/vulnerability-patterns/fee-on-transfer-tokens/SKILL.md +93 -0
  45. package/skills/vulnerability-patterns/flash-loan-attacks/SKILL.md +13 -0
  46. package/skills/vulnerability-patterns/floating-pragma/SKILL.md +8 -1
  47. package/skills/vulnerability-patterns/front-running-attacks/SKILL.md +209 -0
  48. package/skills/vulnerability-patterns/gas-optimization-patterns/SKILL.md +203 -0
  49. package/skills/vulnerability-patterns/governance-attacks/SKILL.md +208 -0
  50. package/skills/vulnerability-patterns/hash-collision/SKILL.md +8 -1
  51. package/skills/vulnerability-patterns/inadherence-to-standards/SKILL.md +12 -1
  52. package/skills/vulnerability-patterns/incorrect-constructor/SKILL.md +8 -1
  53. package/skills/vulnerability-patterns/incorrect-inheritance-order/SKILL.md +8 -1
  54. package/skills/vulnerability-patterns/insufficient-gas-griefing/SKILL.md +12 -1
  55. package/skills/vulnerability-patterns/lack-of-precision/SKILL.md +7 -1
  56. package/skills/vulnerability-patterns/logic-errors/SKILL.md +10 -0
  57. package/skills/vulnerability-patterns/missing-parameter-bounds/SKILL.md +44 -0
  58. package/skills/vulnerability-patterns/missing-protection-signature-replay/SKILL.md +17 -1
  59. package/skills/vulnerability-patterns/msgvalue-loop/SKILL.md +12 -1
  60. package/skills/vulnerability-patterns/off-by-one/SKILL.md +7 -1
  61. package/skills/vulnerability-patterns/oracle-manipulation/SKILL.md +22 -0
  62. package/skills/vulnerability-patterns/outdated-compiler-version/SKILL.md +8 -1
  63. package/skills/vulnerability-patterns/overflow-underflow/SKILL.md +11 -1
  64. package/skills/vulnerability-patterns/proxy-vulnerabilities/SKILL.md +209 -0
  65. package/skills/vulnerability-patterns/reentrancy/SKILL.md +22 -0
  66. package/skills/vulnerability-patterns/shadowing-state-variables/SKILL.md +8 -1
  67. package/skills/vulnerability-patterns/share-accounting-desynchronization/SKILL.md +44 -0
  68. package/skills/vulnerability-patterns/signature-malleability/SKILL.md +11 -1
  69. package/skills/vulnerability-patterns/stateful-parameter-update-drift/SKILL.md +44 -0
  70. package/skills/vulnerability-patterns/unbounded-return-data/SKILL.md +12 -1
  71. package/skills/vulnerability-patterns/unchecked-return-values/SKILL.md +13 -1
  72. package/skills/vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md +8 -1
  73. package/skills/vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md +8 -1
  74. package/skills/vulnerability-patterns/uninitialized-storage-pointer/SKILL.md +8 -1
  75. package/skills/vulnerability-patterns/unsafe-erc20-transfers/SKILL.md +132 -0
  76. package/skills/vulnerability-patterns/unsafe-low-level-call/SKILL.md +12 -1
  77. package/skills/vulnerability-patterns/unsecure-signatures/SKILL.md +12 -1
  78. package/skills/vulnerability-patterns/unsupported-opcodes/SKILL.md +11 -1
  79. package/skills/vulnerability-patterns/unused-variables/SKILL.md +8 -1
  80. package/skills/vulnerability-patterns/use-of-deprecated-functions/SKILL.md +8 -1
  81. package/skills/vulnerability-patterns/weak-sources-randomness/SKILL.md +8 -1
  82. package/skills/vulnerability-patterns/weird-tokens/SKILL.md +10 -0
  83. package/skills/vulnerability-patterns/zero-address-misconfiguration/SKILL.md +48 -0
  84. package/src/agents/argus-prompt.ts +27 -10
  85. package/src/agents/pythia-prompt.ts +7 -8
  86. package/src/agents/scribe-prompt.ts +10 -5
  87. package/src/agents/sentinel-prompt.ts +36 -7
  88. package/src/cli/cli-output.ts +16 -0
  89. package/src/cli/cli-program.ts +29 -22
  90. package/src/cli/commands/check-skills.ts +135 -0
  91. package/src/cli/commands/doctor.ts +303 -23
  92. package/src/cli/commands/init.ts +8 -6
  93. package/src/cli/commands/install.ts +10 -8
  94. package/src/cli/commands/lint-skills.ts +118 -0
  95. package/src/cli/index.ts +5 -5
  96. package/src/cli/tui-prompts.ts +4 -2
  97. package/src/cli/types.ts +3 -3
  98. package/src/config/index.ts +1 -1
  99. package/src/config/loader.ts +4 -6
  100. package/src/config/schema.ts +6 -5
  101. package/src/config/types.ts +2 -2
  102. package/src/constants/defaults.ts +2 -0
  103. package/src/create-hooks.ts +225 -29
  104. package/src/create-managers.ts +10 -8
  105. package/src/create-tools.ts +14 -8
  106. package/src/features/background-agent/background-manager.ts +93 -87
  107. package/src/features/background-agent/index.ts +1 -1
  108. package/src/features/context-monitor/context-monitor.ts +3 -3
  109. package/src/features/context-monitor/index.ts +2 -2
  110. package/src/features/error-recovery/session-recovery.ts +2 -4
  111. package/src/features/error-recovery/tool-error-recovery.ts +79 -19
  112. package/src/features/index.ts +5 -5
  113. package/src/features/persistent-state/audit-state-manager.ts +158 -52
  114. package/src/features/persistent-state/global-run-index.ts +38 -0
  115. package/src/features/persistent-state/index.ts +1 -1
  116. package/src/features/persistent-state/run-journal.ts +86 -0
  117. package/src/hooks/agent-tracker.ts +53 -0
  118. package/src/hooks/compaction-hook.ts +46 -37
  119. package/src/hooks/config-handler.ts +31 -11
  120. package/src/hooks/context-budget.ts +42 -0
  121. package/src/hooks/event-hook.ts +48 -23
  122. package/src/hooks/hook-system.ts +4 -4
  123. package/src/hooks/index.ts +5 -5
  124. package/src/hooks/knowledge-sync-hook.ts +19 -21
  125. package/src/hooks/recon-context-builder.ts +66 -0
  126. package/src/hooks/safe-create-hook.ts +9 -11
  127. package/src/hooks/system-prompt-hook.ts +128 -0
  128. package/src/hooks/tool-tracking-hook.ts +162 -29
  129. package/src/hooks/types.ts +2 -1
  130. package/src/index.ts +23 -13
  131. package/src/knowledge/retry.ts +53 -0
  132. package/src/knowledge/scvd-client.ts +103 -83
  133. package/src/knowledge/scvd-errors.ts +89 -0
  134. package/src/knowledge/scvd-index.ts +110 -62
  135. package/src/knowledge/scvd-sync.ts +223 -47
  136. package/src/knowledge/source-manifest.ts +102 -0
  137. package/src/managers/index.ts +1 -1
  138. package/src/managers/types.ts +19 -14
  139. package/src/plugin-interface.ts +19 -8
  140. package/src/shared/binary-utils.ts +44 -34
  141. package/src/shared/deep-merge.ts +55 -36
  142. package/src/shared/file-utils.ts +21 -19
  143. package/src/shared/index.ts +11 -5
  144. package/src/shared/jsonc-parser.ts +123 -28
  145. package/src/shared/logger.ts +91 -17
  146. package/src/shared/project-utils.ts +30 -0
  147. package/src/skills/analysis/cluster.ts +414 -0
  148. package/src/skills/analysis/gates.ts +227 -0
  149. package/src/skills/analysis/index.ts +33 -0
  150. package/src/skills/analysis/normalize.ts +217 -0
  151. package/src/skills/analysis/similarity.ts +224 -0
  152. package/src/skills/argus-skill-resolver.ts +237 -0
  153. package/src/skills/skill-schema.ts +99 -0
  154. package/src/solodit-lifecycle.ts +202 -0
  155. package/src/state/audit-state.ts +10 -8
  156. package/src/state/finding-store.ts +68 -55
  157. package/src/state/types.ts +96 -44
  158. package/src/tools/argus-skill-load-tool.ts +78 -0
  159. package/src/tools/contract-analyzer-tool.ts +60 -77
  160. package/src/tools/forge-coverage-tool.ts +226 -0
  161. package/src/tools/forge-fuzz-tool.ts +127 -127
  162. package/src/tools/forge-test-tool.ts +153 -157
  163. package/src/tools/gas-analysis-tool.ts +264 -0
  164. package/src/tools/pattern-checker-tool.ts +206 -167
  165. package/src/tools/pattern-loader.ts +77 -0
  166. package/src/tools/pattern-schema.ts +51 -0
  167. package/src/tools/proxy-detection-tool.ts +224 -0
  168. package/src/tools/report-generator-tool.ts +333 -142
  169. package/src/tools/slither-tool.ts +300 -210
  170. package/src/tools/solodit-search-tool.ts +255 -80
  171. package/src/tools/sync-knowledge-tool.ts +7 -11
  172. package/src/utils/audit-artifact-detector.ts +118 -0
  173. package/src/utils/dependency-scanner.ts +93 -0
  174. package/src/utils/project-detector.ts +175 -86
  175. package/src/utils/solidity-parser.ts +112 -67
  176. package/src/utils/solodit-health.ts +29 -0
  177. package/src/hooks/event-hook-v2.ts +0 -99
  178. package/src/state/plugin-state.ts +0 -14
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: parity-multisig
3
+ description: "Case study of the 2017 Parity Multisig Freeze: delegatecall + self-destruct exploit freezing ~$150M"
4
+ category: reference
5
+ source_url: "https://rekt.news/parity-rekt/"
6
+ source_license: "CC0"
7
+ imported_at: "2025-02-20T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'delegatecall\(.*\)'
10
+ severity: "High"
11
+ description: "Detects use of delegatecall, which can be dangerous if the target contract is not trusted or can be modified."
12
+ - regex: 'selfdestruct\(.*\)'
13
+ severity: "High"
14
+ description: "Detects use of selfdestruct, which can be used to destroy a contract and freeze funds if not properly protected."
15
+ ---
16
+ <!-- Source: rekt.news (CC0) -->
17
+ <!-- Source: SunWeb3Sec/DeFiHackLabs (Reference) -->
18
+
19
+ # Parity Multisig Freeze (2017)
20
+
21
+ ## Overview
22
+ In November 2017, a user accidentally triggered a vulnerability in the Parity Multisig wallet library contract. By calling an uninitialized `initWallet` function, the user became the owner of the library contract and subsequently called `kill()`, which executed `selfdestruct`. This froze approximately 513,000 ETH (worth ~$150M at the time) across 587 wallets that depended on this library.
23
+
24
+ ## Root Cause
25
+ The Parity Multisig wallets used `delegatecall` to execute logic from a shared library contract. However, the library contract itself was not initialized. This allowed any user to call the `initWallet` function on the library contract directly, making them the owner of the library. Once they were the owner, they could call the `kill` function, which contained a `selfdestruct` instruction.
26
+
27
+ ## Attack Flow
28
+ 1. A user (devops199) found the uninitialized library contract.
29
+ 2. The user called `initWallet()` on the library contract, becoming its owner.
30
+ 3. The user then called `kill()` on the library contract.
31
+ 4. The library contract executed `selfdestruct`, removing its code from the blockchain.
32
+ 5. All multisig wallets that used `delegatecall` to this library now had no logic to execute, effectively freezing all funds held in them.
33
+
34
+ ## Impact
35
+ - **Loss**: ~$150M (513k ETH)
36
+ - **Protocol**: Parity Multisig
37
+ - **Chain**: Ethereum
38
+ - **Date**: 2017-11-06
39
+
40
+ ## Key Transactions
41
+ - Initialization tx: `0x05f5c113c130f928d4d0d261046c5511846909b77060ef6568bf9158ad312a06`
42
+ - Kill tx: `0x47f7cff3ad8733831a0e273108ef239bb0d0657da3a4279b1d17ac2616a12487`
43
+
44
+ ## Detection Heuristics
45
+ - Pattern 1: Uninitialized library contracts that contain sensitive functions like `selfdestruct` or `init`.
46
+ - Pattern 2: Use of `delegatecall` to a contract that can be destroyed or modified by unauthorized users.
47
+
48
+ ## Remediation
49
+ - Fix 1: Initialize library contracts during deployment or use a constructor to disable initialization functions.
50
+ - Fix 2: Avoid using `selfdestruct` in library contracts.
51
+ - Fix 3: Use static libraries or ensure the target of `delegatecall` is immutable and properly initialized.
52
+
53
+ ## References
54
+ - [rekt.news/parity-rekt/](https://rekt.news/parity-rekt/)
55
+ - [paritytech.io/blog/security-alert-heavy-update/](https://www.parity.io/blog/security-alert-heavy-update/)
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: poly-network
3
+ description: "Case study of the 2021 Poly Network exploit: cross-chain relay manipulation draining ~$600M"
4
+ category: reference
5
+ source_url: "https://rekt.news/polynetwork-rekt/"
6
+ source_license: "CC0"
7
+ imported_at: "2025-02-20T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'putCurEpochConPubKeyBytes'
10
+ severity: "High"
11
+ description: "Detects functions that can modify the public keys of cross-chain relayers/keepers."
12
+ ---
13
+ <!-- Source: rekt.news (CC0) -->
14
+ <!-- Source: SunWeb3Sec/DeFiHackLabs (Reference) -->
15
+
16
+ # Poly Network (2021)
17
+
18
+ ## Overview
19
+ In August 2021, Poly Network, a cross-chain interoperability protocol, was exploited for approximately $611 million across Ethereum, Binance Smart Chain, and Polygon. The attacker was able to manipulate the protocol's "keeper" role, allowing them to sign and execute arbitrary cross-chain transactions.
20
+
21
+ ## Root Cause
22
+ The vulnerability was in the `EthCrossChainManager` contract. The contract had a function `crossChain` that could call any contract on the target chain. The attacker used this to call the `EthCrossChainData` contract's `putCurEpochConPubKeyBytes` function. This function was intended to update the public keys of the "keepers" (the entities that sign cross-chain messages). Because the `EthCrossChainManager` was the owner of the `EthCrossChainData` contract, the call was authorized, allowing the attacker to replace the official keeper keys with their own.
23
+
24
+ ## Attack Flow
25
+ 1. Attacker crafted a cross-chain message on a source chain (e.g., Ontology).
26
+ 2. The message was designed to trigger a call to `putCurEpochConPubKeyBytes` on the target chain (Ethereum/BSC/Polygon).
27
+ 3. The `EthCrossChainManager` received the message and, because it was the owner of the data contract, executed the call.
28
+ 4. The attacker's public key was now registered as the only valid keeper key.
29
+ 5. The attacker then crafted and signed withdrawal transactions for the bridge's assets using their own key.
30
+ 6. The bridge accepted these transactions as valid and released the funds.
31
+
32
+ ## Impact
33
+ - **Loss**: ~$611M (Most was later returned by the attacker)
34
+ - **Protocol**: Poly Network
35
+ - **Chain**: Ethereum, BSC, Polygon
36
+ - **Date**: 2021-08-10
37
+
38
+ ## Key Transactions
39
+ - Attack tx (Ethereum): `0xb1f3535b698f3a0917a219673e7c0e1501c35f9bb8a2811b7a781363bd23c228`
40
+
41
+ ## Detection Heuristics
42
+ - Pattern 1: Cross-chain managers that can call arbitrary functions on internal data or configuration contracts.
43
+ - Pattern 2: Lack of strict access control on functions that modify critical system roles (like keepers or validators).
44
+
45
+ ## Remediation
46
+ - Fix 1: Implement a whitelist of allowed functions that can be called via cross-chain messages.
47
+ - Fix 2: Ensure that critical configuration functions (like updating keeper keys) require multi-signature authorization or a time-lock, and cannot be triggered by a single cross-chain call.
48
+
49
+ ## References
50
+ - [rekt.news/polynetwork-rekt/](https://rekt.news/polynetwork-rekt/)
51
+ - [slowmist.medium.com/the-analysis-and-q-a-of-poly-network-hack-8112a353e439](https://slowmist.medium.com/the-analysis-and-q-a-of-poly-network-hack-8112a353e439)
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: rari-fuse
3
+ description: "Case study of the 2022 Rari Fuse exploit: reentrancy in Compound fork draining ~$80M"
4
+ category: reference
5
+ source_url: "https://rekt.news/rari-fuse-rekt/"
6
+ source_license: "CC0"
7
+ imported_at: "2025-02-20T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'CEther|CToken'
10
+ severity: "Medium"
11
+ description: "Detects usage of Compound-style lending tokens. Forks must ensure reentrancy guards are applied to all sensitive functions."
12
+ ---
13
+ <!-- Source: rekt.news (CC0) -->
14
+ <!-- Source: SunWeb3Sec/DeFiHackLabs (Reference) -->
15
+
16
+ # Rari Fuse (2022)
17
+
18
+ ## Overview
19
+ In April 2022, several Rari Fuse lending pools were exploited for approximately $80 million. The attack targeted a reentrancy vulnerability in the protocol's `CEther` contract, which was a fork of Compound. The attacker was able to borrow assets against their collateral and then re-enter the contract to withdraw the collateral before the borrow was recorded.
20
+
21
+ ## Root Cause
22
+ The vulnerability was a classic reentrancy bug in the `exitMarket` function of the `Comptroller` or the `redeem` function of the `CEther` contract. When a user withdrew ETH, the contract made an external call to the user's address before updating the internal state. Because Rari's fork of Compound did not have a reentrancy guard on these specific functions (or the guard was bypassed), the attacker could recursively call the contract to drain funds.
23
+
24
+ ## Attack Flow
25
+ 1. Attacker deposited collateral into a Rari Fuse pool.
26
+ 2. Attacker initiated a withdrawal of their collateral (ETH).
27
+ 3. The `CEther` contract sent ETH to the attacker's malicious contract via a low-level call.
28
+ 4. The attacker's fallback function triggered a call to borrow other assets from the same pool.
29
+ 5. Because the collateral withdrawal was not yet finalized in the state, the protocol still saw the attacker as having full collateral, allowing the borrow to succeed.
30
+ 6. The attacker effectively withdrew their collateral AND borrowed assets against it, leaving the pool with bad debt.
31
+
32
+ ## Impact
33
+ - **Loss**: ~$80M
34
+ - **Protocol**: Rari Capital (Fuse)
35
+ - **Chain**: Ethereum
36
+ - **Date**: 2022-04-30
37
+
38
+ ## Key Transactions
39
+ - Attack tx: `0xab4860125185a341599c543974807217b3911714771725567b746761632a2939`
40
+
41
+ ## Detection Heuristics
42
+ - Pattern 1: Compound forks that lack reentrancy guards on `redeem`, `borrow`, or `exitMarket` functions.
43
+ - Pattern 2: External calls (especially ETH transfers) made before state updates in lending protocols.
44
+
45
+ ## Remediation
46
+ - Fix 1: Apply the `nonReentrant` modifier to all functions that involve external calls or state changes.
47
+ - Fix 2: Use the Checks-Effects-Interactions pattern to ensure state is updated before any external interaction.
48
+
49
+ ## References
50
+ - [rekt.news/rari-fuse-rekt/](https://rekt.news/rari-fuse-rekt/)
51
+ - [twitter.com/BlockSecTeam/status/1520351351111651328](https://twitter.com/BlockSecTeam/status/1520351351111651328)
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: ronin-bridge
3
+ description: "Case study of the 2022 Ronin Bridge exploit: compromised validator keys draining ~$625M"
4
+ category: reference
5
+ source_url: "https://rekt.news/ronin-rekt/"
6
+ source_license: "CC0"
7
+ imported_at: "2025-02-20T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'onlyValidator'
10
+ severity: "Low"
11
+ description: "Detects validator-only functions. While not a bug, it highlights the critical trust points in the system."
12
+ ---
13
+ <!-- Source: rekt.news (CC0) -->
14
+ <!-- Source: SunWeb3Sec/DeFiHackLabs (Reference) -->
15
+
16
+ # Ronin Bridge (2022)
17
+
18
+ ## Overview
19
+ In March 2022, the Ronin Network, an Ethereum-linked sidechain for the Axie Infinity game, was exploited for 173,600 ETH and 25.5M USDC (worth ~$625M). This was not a smart contract bug but a social engineering attack that led to the compromise of 5 out of 9 validator private keys.
20
+
21
+ ## Root Cause
22
+ The Ronin bridge required 5 out of 9 validator signatures to authorize withdrawals. The attacker (Lazarus Group) used a fake job offer to compromise a developer's computer, gaining access to 4 validator keys held by Sky Mavis. They also gained access to a 5th validator key held by the Axie DAO, which had been granted a temporary "allowance" to sign on behalf of Sky Mavis during a period of high traffic and was never revoked.
23
+
24
+ ## Attack Flow
25
+ 1. Attacker used social engineering (fake job interview/PDF) to plant malware on a Sky Mavis engineer's laptop.
26
+ 2. Attacker extracted 4 validator private keys from Sky Mavis infrastructure.
27
+ 3. Attacker discovered an RPC backdoor to the Axie DAO validator, which had been authorized to sign for Sky Mavis months earlier.
28
+ 4. With 5 keys, the attacker had the supermajority needed to sign withdrawal transactions.
29
+ 5. Attacker submitted two withdrawal transactions to the Ronin bridge on Ethereum, draining the funds.
30
+
31
+ ## Impact
32
+ - **Loss**: ~$625M
33
+ - **Protocol**: Ronin Bridge (Sky Mavis)
34
+ - **Chain**: Ronin / Ethereum
35
+ - **Date**: 2022-03-23 (Discovered 2022-03-29)
36
+
37
+ ## Key Transactions
38
+ - Withdrawal tx 1: `0xc28fad5e8d5e0ce6a2eaf67b6687be5d58113e16be590824d6cfa1a691f6d7b3`
39
+ - Withdrawal tx 2: `0xed2c1225a57b6811c570930c7e9996a8a18b19a472f5502013f80f53c7a32730`
40
+
41
+ ## Detection Heuristics
42
+ - Pattern 1: Low validator count (centralization risk).
43
+ - Pattern 2: Long-standing "temporary" permissions or allowances in governance/bridge contracts.
44
+
45
+ ## Remediation
46
+ - Fix 1: Increase the number of validators and the threshold for consensus (Ronin moved to 21 validators).
47
+ - Fix 2: Implement strict security protocols for validator key management (HSMs, multi-party computation).
48
+ - Fix 3: Regular audits of off-chain infrastructure and social engineering training for employees.
49
+
50
+ ## References
51
+ - [rekt.news/ronin-rekt/](https://rekt.news/ronin-rekt/)
52
+ - [roninchain.com/blog/posts/community-alert-ronin-bridge-exploit-post-mortem](https://roninchain.com/blog/posts/community-alert-ronin-bridge-exploit-post-mortem)
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: wormhole-bridge
3
+ description: "Case study of the 2022 Wormhole Bridge exploit: missing signature validation draining ~$320M"
4
+ category: reference
5
+ source_url: "https://rekt.news/wormhole-rekt/"
6
+ source_license: "CC0"
7
+ imported_at: "2025-02-20T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'load_instruction_at'
10
+ severity: "High"
11
+ description: "Detects usage of deprecated or dangerous instruction loading in Solana programs which can be used to spoof sysvars."
12
+ ---
13
+ <!-- Source: rekt.news (CC0) -->
14
+ <!-- Source: SunWeb3Sec/DeFiHackLabs (Reference) -->
15
+
16
+ # Wormhole Bridge (2022)
17
+
18
+ ## Overview
19
+ In February 2022, the Wormhole bridge was exploited for 120,000 wETH (worth ~$320M) on the Solana side. The attacker was able to bypass the signature verification process and mint wETH without providing any collateral on the Ethereum side.
20
+
21
+ ## Root Cause
22
+ The vulnerability existed in the Wormhole's Solana program. Specifically, the `verify_signatures` function used a deprecated Solana system function `load_instruction_at` to verify the `instructions` sysvar. The attacker provided a spoofed sysvar account that mimicked the real sysvar but contained fake data, allowing them to bypass the signature check.
23
+
24
+ ## Attack Flow
25
+ 1. Attacker identified that the `verify_signatures` function did not properly validate the `instructions` sysvar account.
26
+ 2. Attacker created a malicious account that mimicked the `instructions` sysvar.
27
+ 3. Attacker called `post_vaa` with the spoofed sysvar, which made the program believe the signatures were valid.
28
+ 4. Attacker then called `complete_wrapped_eth` to mint 120,000 wETH on Solana.
29
+ 5. Attacker bridged some of the wETH back to Ethereum and swapped the rest on Solana.
30
+
31
+ ## Impact
32
+ - **Loss**: ~$320M
33
+ - **Protocol**: Wormhole Bridge
34
+ - **Chain**: Solana / Ethereum
35
+ - **Date**: 2022-02-02
36
+
37
+ ## Key Transactions
38
+ - Solana Attack tx: `2thJ77y986Yfs4S6996Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9` (Example representation)
39
+ - Mint tx: `399986Yfs4S6996Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9Yv9`
40
+
41
+ ## Detection Heuristics
42
+ - Pattern 1: Use of `load_instruction_at` or other deprecated sysvar loading methods in Solana without proper account validation.
43
+ - Pattern 2: Missing checks to ensure that system accounts (like `sysvar::instructions`) are actually the official system accounts.
44
+
45
+ ## Remediation
46
+ - Fix 1: Use the modern `get_instruction_relative` or properly validate the sysvar account address.
47
+ - Fix 2: Ensure all system accounts passed to the program are checked against their known addresses.
48
+
49
+ ## References
50
+ - [rekt.news/wormhole-rekt/](https://rekt.news/wormhole-rekt/)
51
+ - [jumpcrypto.com/wormhole-exploit-post-mortem/](https://jumpcrypto.com/wormhole-exploit-post-mortem/)
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: cyfrin-defi-core
3
3
  description: Cyfrin DeFi checklist covering attacker mindset and protocol-level DeFi primitives
4
+ source_url: https://github.com/Cyfrin/audit-checklist
5
+ source_license: unspecified
6
+ imported_at: "2025-01-15T00:00:00Z"
4
7
  ---
5
8
  <!-- Source: Cyfrin/audit-checklist -->
6
9
  <!-- Auto-generated from https://github.com/Cyfrin/audit-checklist -->
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "cyfrin",
3
+ "mode": "baked-in",
4
+ "url": "https://github.com/Cyfrin/audit-checklist",
5
+ "license": "unspecified",
6
+ "updateCadence": "per-release",
7
+ "lastVerified": "2026-02-19",
8
+ "files": [
9
+ "checklists/cyfrin-best-practices-runtime/SKILL.md",
10
+ "checklists/cyfrin-best-practices-upgrades/SKILL.md",
11
+ "checklists/cyfrin-defi-core/SKILL.md",
12
+ "checklists/cyfrin-defi-integrations/SKILL.md",
13
+ "checklists/cyfrin-gas/SKILL.md",
14
+ "checklists/general-audit/SKILL.md"
15
+ ]
16
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "defifofum",
3
+ "mode": "baked-in",
4
+ "url": "https://github.com/DeFiFoFum/fofum-solidity-skills",
5
+ "license": "MIT",
6
+ "updateCadence": "per-release",
7
+ "lastVerified": "2026-02-19",
8
+ "files": [
9
+ "vulnerability-patterns/access-control/SKILL.md",
10
+ "vulnerability-patterns/flash-loan-attacks/SKILL.md",
11
+ "vulnerability-patterns/logic-errors/SKILL.md",
12
+ "vulnerability-patterns/oracle-manipulation/SKILL.md",
13
+ "vulnerability-patterns/reentrancy/SKILL.md",
14
+ "vulnerability-patterns/weird-tokens/SKILL.md",
15
+ "methodology/audit-workflow/SKILL.md",
16
+ "methodology/report-template/SKILL.md",
17
+ "methodology/severity-classification/SKILL.md",
18
+ "protocol-patterns/amm-dex/SKILL.md",
19
+ "protocol-patterns/bridges-cross-chain/SKILL.md",
20
+ "protocol-patterns/dao-governance/SKILL.md",
21
+ "protocol-patterns/lending-borrowing/SKILL.md",
22
+ "protocol-patterns/staking-vesting/SKILL.md",
23
+ "checklists/general-audit/SKILL.md"
24
+ ]
25
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "kadenzipfel",
3
+ "mode": "baked-in",
4
+ "url": "https://github.com/kadenzipfel/smart-contract-vulnerabilities",
5
+ "license": "MIT",
6
+ "updateCadence": "per-release",
7
+ "lastVerified": "2026-02-19",
8
+ "files": [
9
+ "vulnerability-patterns/access-control/SKILL.md",
10
+ "vulnerability-patterns/arbitrary-storage-location/SKILL.md",
11
+ "vulnerability-patterns/assert-violation/SKILL.md",
12
+ "vulnerability-patterns/asserting-contract-from-code-size/SKILL.md",
13
+ "vulnerability-patterns/authorization-txorigin/SKILL.md",
14
+ "vulnerability-patterns/default-visibility/SKILL.md",
15
+ "vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md",
16
+ "vulnerability-patterns/dos-gas-limit/SKILL.md",
17
+ "vulnerability-patterns/dos-revert/SKILL.md",
18
+ "vulnerability-patterns/flash-loan-attacks/SKILL.md",
19
+ "vulnerability-patterns/floating-pragma/SKILL.md",
20
+ "vulnerability-patterns/hash-collision/SKILL.md",
21
+ "vulnerability-patterns/inadherence-to-standards/SKILL.md",
22
+ "vulnerability-patterns/incorrect-constructor/SKILL.md",
23
+ "vulnerability-patterns/incorrect-inheritance-order/SKILL.md",
24
+ "vulnerability-patterns/insufficient-gas-griefing/SKILL.md",
25
+ "vulnerability-patterns/lack-of-precision/SKILL.md",
26
+ "vulnerability-patterns/logic-errors/SKILL.md",
27
+ "vulnerability-patterns/missing-protection-signature-replay/SKILL.md",
28
+ "vulnerability-patterns/msgvalue-loop/SKILL.md",
29
+ "vulnerability-patterns/off-by-one/SKILL.md",
30
+ "vulnerability-patterns/oracle-manipulation/SKILL.md",
31
+ "vulnerability-patterns/outdated-compiler-version/SKILL.md",
32
+ "vulnerability-patterns/overflow-underflow/SKILL.md",
33
+ "vulnerability-patterns/reentrancy/SKILL.md",
34
+ "vulnerability-patterns/shadowing-state-variables/SKILL.md",
35
+ "vulnerability-patterns/signature-malleability/SKILL.md",
36
+ "vulnerability-patterns/unbounded-return-data/SKILL.md",
37
+ "vulnerability-patterns/unchecked-return-values/SKILL.md",
38
+ "vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md",
39
+ "vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md",
40
+ "vulnerability-patterns/uninitialized-storage-pointer/SKILL.md",
41
+ "vulnerability-patterns/unsafe-low-level-call/SKILL.md",
42
+ "vulnerability-patterns/unsecure-signatures/SKILL.md",
43
+ "vulnerability-patterns/unsupported-opcodes/SKILL.md",
44
+ "vulnerability-patterns/unused-variables/SKILL.md",
45
+ "vulnerability-patterns/use-of-deprecated-functions/SKILL.md",
46
+ "vulnerability-patterns/weak-sources-randomness/SKILL.md"
47
+ ]
48
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "scvd",
3
+ "mode": "hybrid",
4
+ "url": "https://api.scvd.dev",
5
+ "license": "CC0",
6
+ "updateCadence": "on-sync",
7
+ "lastVerified": "2026-02-19",
8
+ "files": []
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "smartbugs",
3
+ "mode": "baked-in",
4
+ "url": "https://github.com/smartbugs/smartbugs-curated",
5
+ "license": "Apache-2.0",
6
+ "updateCadence": "per-release",
7
+ "lastVerified": "2026-02-19",
8
+ "files": ["references/smartbugs-examples/SKILL.md"]
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "solodit",
3
+ "mode": "on-demand",
4
+ "url": "https://solodit.xyz",
5
+ "license": "varies",
6
+ "updateCadence": "per-request",
7
+ "lastVerified": "2026-02-19",
8
+ "files": []
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "sunweb3sec",
3
+ "mode": "baked-in",
4
+ "url": "https://github.com/SunWeb3Sec/DeFiHackLabs",
5
+ "license": "reference-only",
6
+ "updateCadence": "per-release",
7
+ "lastVerified": "2026-02-19",
8
+ "files": ["references/exploit-reference/SKILL.md"]
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "trailofbits",
3
+ "mode": "hybrid",
4
+ "url": "https://github.com/trailofbits/solidity-security-research",
5
+ "license": "varies",
6
+ "updateCadence": "on-install",
7
+ "lastVerified": "2026-02-19",
8
+ "files": []
9
+ }
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: audit-workflow
3
3
  description: Five-phase Solidity audit workflow covering recon, static analysis, manual review, verification, and reporting.
4
+ source_url: https://github.com/DeFiFoFum/fofum-solidity-skills
5
+ source_license: MIT
6
+ imported_at: "2025-01-15T00:00:00Z"
4
7
  ---
5
8
  <!-- Source: DeFiFoFum/fofum-solidity-skills (MIT) -->
6
9
 
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: amm-dex
3
3
  description: AMM and DEX security patterns covering pricing, LP accounting, MEV, and swap invariants.
4
+ source_url: https://github.com/DeFiFoFum/fofum-solidity-skills
5
+ source_license: MIT
6
+ imported_at: "2025-01-15T00:00:00Z"
4
7
  ---
5
8
  <!-- Source: DeFiFoFum/fofum-solidity-skills (MIT) -->
6
9
 
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: exploit-reference
3
3
  description: Reference guide to major DeFi exploits and reproducible Foundry workflows from DeFiHackLabs
4
+ source_url: https://github.com/SunWeb3Sec/DeFiHackLabs
5
+ source_license: reference-only
6
+ imported_at: "2025-01-15T00:00:00Z"
4
7
  ---
5
8
  <!-- Source: SunWeb3Sec/DeFiHackLabs (reference only, no license) -->
6
9
 
@@ -1,6 +1,33 @@
1
1
  ---
2
2
  name: access-control
3
3
  description: Access-control exploit patterns and secure authorization approaches for privileged Solidity functions.
4
+ pattern_category: access-control
5
+ source_url: https://github.com/kadenzipfel/smart-contract-vulnerabilities
6
+ source_license: MIT
7
+ imported_at: "2025-01-15T00:00:00Z"
8
+ detection_rules:
9
+ - regex: 'onlyOwner'
10
+ severity: Medium
11
+ confidence: Medium
12
+ description: Privileged modifier usage that requires authorization review
13
+ - regex: 'require\(msg\.sender'
14
+ severity: Medium
15
+ confidence: Medium
16
+ swc: SWC-105
17
+ description: Inline sender authorization check on sensitive paths
18
+ - regex: 'function\s+initialize'
19
+ severity: Critical
20
+ confidence: High
21
+ description: Initializer function detected — if missing initializer modifier, anyone can take ownership
22
+ - regex: 'selfdestruct\(|suicide\('
23
+ severity: High
24
+ confidence: High
25
+ description: Contract uses selfdestruct — can destroy contract and send ETH to arbitrary address
26
+ - regex: 'function\s+\w+\s*\([^)]*\)\s+(external|public)'
27
+ severity: High
28
+ confidence: Low
29
+ swc: SWC-105
30
+ description: External/public function — verify appropriate access control modifiers are applied
4
31
  ---
5
32
 
6
33
  <!-- Source: DeFiFoFum/fofum-solidity-skills (MIT) -->
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  name: arbitrary-storage-location
3
- description: - Contract has a dynamic array in storage
3
+ description: '- Contract has a dynamic array in storage'
4
+ pattern_category: logic-error
5
+ detection_rules:
6
+ - regex: 'assembly\s*\{'
7
+ severity: Medium
8
+ confidence: Low
9
+ swc: SWC-124
10
+ description: Inline assembly context where arbitrary storage writes may occur
11
+ - regex: 'sstore\('
12
+ severity: High
13
+ confidence: Low
14
+ swc: SWC-124
15
+ description: Direct storage slot writes require strict slot provenance checks
4
16
  ---
5
17
  <!-- Source: kadenzipfel/smart-contract-vulnerabilities (MIT) -->
6
18
 
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: assert-violation
3
- description: - Contract uses `assert()` statements
3
+ description: '- Contract uses `assert()` statements'
4
+ pattern_category: logic-error
5
+ detection_rules:
6
+ - regex: 'assert\('
7
+ severity: Low
8
+ confidence: Medium
9
+ swc: SWC-110
10
+ description: assert used in code path that may be user reachable
4
11
  ---
5
12
  <!-- Source: kadenzipfel/smart-contract-vulnerabilities (MIT) -->
6
13
 
@@ -1,6 +1,17 @@
1
1
  ---
2
2
  name: asserting-contract-from-code-size
3
- description: - Contract uses `extcodesize` or `address.code.length` to check whether an address is an EOA vs. a contract
3
+ description: '- Contract uses `extcodesize` or `address.code.length` to check whether an address is an EOA vs. a contract'
4
+ pattern_category: logic-error
5
+ detection_rules:
6
+ - regex: 'extcodesize'
7
+ severity: Medium
8
+ confidence: Medium
9
+ swc: SWC-113
10
+ description: extcodesize-based contract detection can be bypassed in constructors
11
+ - regex: 'isContract\('
12
+ severity: Medium
13
+ confidence: Medium
14
+ description: isContract helper usage should not gate security decisions
4
15
  ---
5
16
  <!-- Source: kadenzipfel/smart-contract-vulnerabilities (MIT) -->
6
17
 
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: authorization-txorigin
3
- description: - Contract uses `tx.origin` for authorization or access control checks (e.g., `require(tx.origin == owner)`)
3
+ description: "Contract uses tx.origin for authorization or access control checks (e.g., require(tx.origin == owner))"
4
+ pattern_category: access-control
5
+ detection_rules:
6
+ - regex: 'tx\.origin'
7
+ severity: High
8
+ confidence: High
9
+ swc: SWC-115
10
+ description: tx.origin usage in authorization logic is phishing-prone
4
11
  ---
5
12
  <!-- Source: kadenzipfel/smart-contract-vulnerabilities (MIT) -->
6
13