|
1 | | -# React2Shell |
| 1 | +<p align="center"> |
| 2 | + <img src="docs/images/spring2shell_logo.png" alt="Spring2Shell Logo" width="450" style="border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);"/> |
| 3 | +</p> |
2 | 4 |
|
3 | | -React2Shell is a Python-based scanner and exploitation toolkit targeting React/Spring/GraphQL stacks. It mixes endpoint discovery, stealthy HTTP behavior, and payload mutation to exercise potentially vulnerable deployments, including routines tuned for the documented CVE-2025-55182 and CVE-2025-66478 vectors. |
| 5 | +<h1 align="center">⚡ Spring2Shell ⚡</h1> |
4 | 6 |
|
5 | | -## Features |
6 | | -- Multi-mode CLI supporting bulk scanning, direct exploitation, CVE-focused sweeps, and an interactive menu. |
7 | | -- Endpoint discovery via sitemap parsing, JavaScript analysis, and curated actuator/GraphQL paths. |
8 | | -- WAF-evasion helpers that randomize headers, mutate payloads, and add jitter between requests. |
9 | | -- Protocol hopping (HTTP/HTTPS), tech fingerprinting, and subdomain probing to widen coverage. |
10 | | -- Built-in payload sets for command execution and CVE-specific exploitation attempts. |
11 | | -- Safe non-exploit audit family: encoding behavior, dependency leakage, misconfiguration, and Log2Shell/Log4Shell risk indicators. |
12 | | -- Structured SIEM/CI-ready JSON reporting with confidence, reason codes, and unverified status semantics. |
| 7 | +<p align="center"> |
| 8 | + <strong>A premium, modular vulnerability scanner and exploitation framework targeting Spring, GraphQL, and React Server Components (RSC) stacks.</strong> |
| 9 | +</p> |
13 | 10 |
|
14 | | -## Requirements |
15 | | -- Python 3.8+ |
16 | | -- Dependencies: `requests`, `urllib3` (others in the standard library) |
| 11 | +<p align="center"> |
| 12 | + <a href="https://python.org"><img src="https://img.shields.io/badge/Python-3.8+-blue?logo=python" alt="Python 3.8+"></a> |
| 13 | + <a href="https://github.com/C00LN3T/Spring2Shell/releases"><img src="https://img.shields.io/badge/Version-2.0.0-emerald?style=flat" alt="Version 2.0.0"></a> |
| 14 | + <a href="file:///home/arch/WORKSPACE/WORK/PROJECTS/Spring2Shell-1/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow" alt="License MIT"></a> |
| 15 | + <a href="https://linux.org"><img src="https://img.shields.io/badge/Platform-Linux-lightgrey?logo=linux" alt="Platform Linux"></a> |
| 16 | + <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff Linter"></a> |
| 17 | + <a href="#automated-tests"><img src="https://img.shields.io/badge/Tests-247%20Passed-brightgreen" alt="247 Tests Passed"></a> |
| 18 | +</p> |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 📖 Table of Contents |
| 23 | +- [✨ Key Features](#-key-features) |
| 24 | +- [⚙️ Architecture & Data Flow](#️-architecture--data-flow) |
| 25 | +- [🛡️ CVE & Vulnerability Coverage Matrix](#️-cve--vulnerability-coverage-matrix) |
| 26 | +- [🚀 Installation & Setup](#-installation--setup) |
| 27 | +- [💻 CLI Usage Guide](#-cli-usage-guide) |
| 28 | + - [Global Flags](#global-flags) |
| 29 | + - [Subcommands](#subcommands) |
| 30 | +- [🖥️ Interactive TUI Menu](#️-interactive-tui-menu) |
| 31 | +- [🛠️ Developer Workflows (Makefile)](#️-developer-workflows-makefile) |
| 32 | +- [⚖️ Legal & Ethical Warning](#️-legal--ethical-warning) |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## ✨ Key Features |
| 37 | + |
| 38 | +- **🚀 Dual-Engine Execution**: High-concurrency `async` network engine (powered by `aiohttp`) for bulk scans, alongside a robust synchronous thread-pool worker engine. |
| 39 | +- **🕵️ Deep Endpoint Discovery**: Parses `sitemaps`, processes `__NEXT_DATA__` structures inside Next.js pages, extracts React Server Action mappings (`Next-Action`), analyzes JavaScript routes, and tests actuator/GraphQL paths. |
| 40 | +- **👺 Advanced WAF Evasion**: Dynamic header randomization, junk query parameters/body padding, Base64 & Hex payload mutations, character encoding bypasses, and intelligent rate limiting (jitter). |
| 41 | +- **🔎 Safe Auditing Modes**: Fully passive checks (no commands executed) testing for vulnerable encoding behaviors, configuration leakage (e.g. Actuators, log4j core libraries), and estimation of Log2Shell/Log4Shell risks. |
| 42 | +- **📡 OOB & Blind Verification**: Fully integrates with self-hosted `Interactsh` OOB servers to detect blind RCE via DNS/HTTP call-backs, plus dual-marker echo validation. |
| 43 | +- **🔌 Enterprise Reporting & Integrations**: Generates clean TXT, JSON, HTML (interactive charts), and SARIF files. Easily uploads scan data to **DefectDojo** or exports templates into **Nuclei v3** format. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## ⚙️ Architecture & Data Flow |
| 48 | + |
| 49 | +`Spring2Shell` uses a clean **src-layout package** structure separating core logic, payloads, configuration profiles, and reporting: |
| 50 | + |
| 51 | +``` |
| 52 | +src/spring2shell/ |
| 53 | +├── cli.py # Argparse dispatching & runtime bootstrapping |
| 54 | +├── core/ # Scan engine, exploiter, OOB, and reporter logic |
| 55 | +├── discovery/ # Sitemap/JS analyzers, actuator/GraphQL endpoint lists |
| 56 | +├── evasion/ # WAF engine, header generators, payload mutation |
| 57 | +├── audit/ # Passive auditing & Log4j dependency analyzers |
| 58 | +├── react2shell/ # Next.js Server Actions & React RSC scanning |
| 59 | +└── utils/ # DefectDojo upload, Nuclei exporting, auth, network helpers |
| 60 | +``` |
| 61 | + |
| 62 | +### 🔁 Execution Pipeline |
| 63 | +The diagram below details the data flow from command execution to final reporting: |
| 64 | + |
| 65 | +```mermaid |
| 66 | +graph TD |
| 67 | + CLI[CLI / TUI Input] --> Boot[cli.py: configure_runtime & signals] |
| 68 | + Boot --> Conf{YAML Configuration} |
| 69 | + Conf -->|1. Build Session| Session[core/session: Stealth Session] |
| 70 | + Conf -->|2. Evasion Config| Evasion[evasion/waf_engine: Payload Mutations] |
| 71 | + Conf -->|3. Discovery Scan| Discov[discovery/endpoints: Parse Sitemap/JS] |
| 72 | + |
| 73 | + Session & Evasion & Discov --> Engine[core/scanner: Bulk or Direct Engine] |
| 74 | + |
| 75 | + Engine -->|Payload DB| PL[data/payloads/cve_payloads.json] |
| 76 | + Engine -->|Run Probes| Network[Target HTTP/S Endpoints] |
| 77 | + |
| 78 | + Network -->|Echo Marker / OOB| Verify[core/verifier: RCE Verification] |
| 79 | + Verify -->|Build Findings| Rep[core/reporter: Output Builder] |
| 80 | + |
| 81 | + Rep -->|JSON / HTML| Reports[reports/scan_results.json] |
| 82 | + Rep -->|SARIF Export| SARIF[reports/results.sarif] |
| 83 | + Rep -->|Nuclei YAML| Nuclei[nuclei_templates/] |
| 84 | + Rep -->|DefectDojo API| DefectDojo[DefectDojo Server] |
| 85 | +``` |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## 🛡️ CVE & Vulnerability Coverage Matrix |
| 90 | + |
| 91 | +`Spring2Shell` contains an externalized, up-to-date payload database (`data/payloads/cve_payloads.json`) targeting the following vectors: |
| 92 | + |
| 93 | +| CVE ID | Vulnerability / Description | Affected Technology | Type | Variants | |
| 94 | +| :--- | :--- | :--- | :--- | :---: | |
| 95 | +| **CVE-2025-55182** | SpEL Injection (GraphQL/Spring Endpoints) | Spring Framework | Remote Code Execution | 8 | |
| 96 | +| **CVE-2025-66478** | GraphQL-specific SpEL injection vectors | Spring + GraphQL | Remote Code Execution | 3 | |
| 97 | +| **CVE-2022-22965** | Spring4Shell (ClassLoader Data Binding RCE) | Spring Framework | Remote Code Execution | 2 | |
| 98 | +| **CVE-2021-44228** | Log4Shell (JNDI LDAP/RMI Injection) | Apache Log4j 2 | Remote Code Execution | 6 | |
| 99 | +| **CVE-2022-42889** | Text4Shell (Commons Text Interpolation) | Apache Commons Text | Remote Code Execution | 3 | |
| 100 | +| **CVE-2023-46604** | ActiveMQ OpenWire Deserialization RCE | Apache ActiveMQ | Remote Code Execution | 4 | |
| 101 | +| **CVE-2024-22243** | Spring Web SSRF via UriComponentsBuilder | Spring Framework | SSRF | 7 | |
| 102 | +| **CVE-2024-38816** | WebFlux Directory Traversal (Linux pathing) | Spring Framework | Path Traversal | 7 | |
| 103 | +| **CVE-2024-4577** | PHP CGI Argument Injection (Windows/XAMPP) | PHP CGI | Remote Code Execution | 4 | |
| 104 | +| **CVE-2023-34104** | fast-xml-parser ReDoS / Prototype Pollution | fast-xml-parser | ReDoS / Pollution | 3 | |
| 105 | +| **CVE-2024-21626** | runc Container Escape (/proc/self/fd leak) | runc | Container Escape | 3 | |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## 🚀 Installation & Setup |
| 110 | + |
| 111 | +Ensure you have **Python 3.8+** installed. Set up the environment using the virtual environment helper: |
17 | 112 |
|
18 | | -Install the dependencies with: |
19 | 113 | ```bash |
| 114 | +# Clone the repository |
| 115 | +git clone https://github.com/C00LN3T/Spring2Shell.git |
| 116 | +cd Spring2Shell-1 |
| 117 | + |
| 118 | +# Create and activate virtual environment |
20 | 119 | python3 -m venv .venv |
21 | 120 | source .venv/bin/activate |
22 | | -pip install requests urllib3 |
| 121 | + |
| 122 | +# Install development dependencies and editable package |
| 123 | +make install-dev |
23 | 124 | ``` |
24 | 125 |
|
25 | | -## Usage |
26 | | -Display the built-in help: |
| 126 | +--- |
| 127 | + |
| 128 | +## 💻 CLI Usage Guide |
| 129 | + |
| 130 | +### Global Flags |
| 131 | +These arguments apply to all subcommands and modify connection and diagnostic behaviors: |
| 132 | +* `--insecure`: Disables TLS certificate validation (not recommended). |
| 133 | +* `--verbose-errors`: Logs swallowed network exceptions to screen for diagnostics. |
| 134 | +* `--profile {default,aggressive,safe-audit,stealth}`: Selects connection timeout, retry limits, and delays. |
| 135 | +* `--dry-run`: Performs a dry-run showing what payloads and paths WOULD be sent, without making network requests. |
| 136 | +* `--proxy URL`: Directs traffic through HTTP/SOCKS5 proxy (e.g. `http://127.0.0.1:8080` or `socks5://127.0.0.1:9050`). |
| 137 | +* `--rate N`: Throttles scanner to a maximum of `N` requests per second (`0` = unlimited). |
| 138 | +* `--config FILE`: Custom config path (defaults to `./config.yaml` if it exists). |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +### Subcommands |
| 143 | + |
| 144 | +#### 1. Passive Security Audit (`safe-audit`) |
| 145 | +Runs passive encoding checks, exposed actuators, and misconfiguration scans without exploiting. |
27 | 146 | ```bash |
28 | | -python cracker.py -h |
| 147 | +spring2shell safe-audit https://target.example -o reports/audit.json --html-report |
29 | 148 | ``` |
30 | 149 |
|
31 | | -Global runtime flags: |
| 150 | +#### 2. Log4j Dependency Leak Audit (`log-audit`) |
| 151 | +Checks exposed paths and class definitions to estimate Log2Shell / Log4Shell risks. |
32 | 152 | ```bash |
33 | | -python cracker.py --insecure direct https://target.example |
34 | | -python cracker.py --verbose-errors safe-audit https://target.example |
| 153 | +spring2shell log-audit https://target.example -o reports/log_audit.json |
35 | 154 | ``` |
36 | | -- `--insecure` disables TLS certificate verification (legacy behavior, not recommended for trusted audit results). |
37 | | -- `--verbose-errors` logs swallowed network exceptions to improve troubleshooting and explainability. |
38 | 155 |
|
39 | | -### Scan a list of targets |
| 156 | +#### 3. Single Target Exploitation (`direct`) |
| 157 | +Launches direct exploitation against a single host. You can customize the command payload or scope. |
40 | 158 | ```bash |
41 | | -python cracker.py scan targets.txt reports/prefix |
| 159 | +# Auto-detect endpoints and execute command |
| 160 | +spring2shell direct https://target.example --find-endpoints -c "whoami" |
| 161 | + |
| 162 | +# Exploit a specific endpoint using aggressive WAF bypass mutations |
| 163 | +spring2shell direct https://target.example -e /api/graphql -c "id" --aggressive |
42 | 164 | ``` |
43 | | -- Reads URLs from `targets.txt` and writes JSON reports using the given prefix. |
44 | 165 |
|
45 | | -### Exploit from a saved report |
| 166 | +#### 4. Bulk Target Scanner (`scan`) |
| 167 | +Scans a list of target URLs. Supports resuming from checkpoints, report formatting, and encryption. |
46 | 168 | ```bash |
47 | | -python cracker.py exploit reports/prefix.json |
| 169 | +# Run scan with 15 concurrent threads, generate JSON/TXT/HTML reports, and encrypt output |
| 170 | +spring2shell scan targets.txt reports/bulk_run -t 15 --html-report --encrypt-reports |
48 | 171 | ``` |
49 | | -- Loads a previously generated report and reruns exploitation attempts. |
50 | 172 |
|
51 | | -### Direct exploitation |
| 173 | +#### 5. High-Concurrency CVE Mass Scan (`cve-scan`) |
| 174 | +Runs targeted CVE-specific probes across a targets list using the high-performance async engine. |
52 | 175 | ```bash |
53 | | -python cracker.py direct https://target.example --test-all |
| 176 | +spring2shell --rate 30 cve-scan targets.txt -o reports/cve_mass.json --async |
54 | 177 | ``` |
55 | | -- Probes all known endpoints for the target. Add options such as `-e /api/graphql` to focus on one path, `-c "whoami"` to change the command, `--aggressive` to enable stronger WAF bypassing, or `--no-strict-verify` to disable strict replay verification. |
56 | 178 |
|
57 | | -- Findings now use strict statuses (`confirmed`, `unverified`, `not_vulnerable`) with confidence and reason codes in JSON reports. |
| 179 | +#### 6. SSRF & SSTI Specialized Probes (`ssrf-scan` / `ssti-scan`) |
| 180 | +Scans target for Server-Side Request Forgery or Server-Side Template Injection vulnerabilities. |
| 181 | +```bash |
| 182 | +spring2shell ssrf-scan https://target.example -o reports/ssrf.json --html-report |
| 183 | +spring2shell ssti-scan https://target.example -o reports/ssti.json |
| 184 | +``` |
| 185 | + |
| 186 | +#### 7. Web Application Firewall Profiler (`profile-waf`) |
| 187 | +Safely tests target behaviors to determine which characters/HTTP methods trigger WAF blocks. |
| 188 | +```bash |
| 189 | +spring2shell profile-waf https://target.example -o reports/waf_profile.json |
| 190 | +``` |
58 | 191 |
|
59 | | -### CVE-focused mass scan |
| 192 | +#### 8. Verify Vulnerability (`verify`) |
| 193 | +Reruns an echo-marker and blind time-delay check to verify if a reported finding is an active vulnerable endpoint. |
60 | 194 | ```bash |
61 | | -python cracker.py cve-scan targets.txt -o cve_results.txt |
| 195 | +spring2shell verify https://target.example -e /api/graphql --method POST |
62 | 196 | ``` |
63 | | -- Runs payloads tailored to CVE-2025-55182 and CVE-2025-66478 across the provided targets. |
64 | 197 |
|
65 | | -### Interactive menu |
| 198 | +#### 9. Export Findings to Nuclei Templates (`nuclei-export`) |
| 199 | +Converts findings in a JSON report into custom Nuclei v3 YAML templates. |
66 | 200 | ```bash |
67 | | -python cracker.py menu |
| 201 | +spring2shell nuclei-export reports/bulk_run_combined.json nuclei_templates/ |
68 | 202 | ``` |
69 | | -- Launches an interactive workflow for discovery, exploitation, and persistence checks. |
70 | 203 |
|
71 | | -### Safe encoding audit (no RCE payloads) |
| 204 | +#### 10. DefectDojo Integration (`defectdojo-upload`) |
| 205 | +Uploads scan results directly to your DefectDojo console. |
72 | 206 | ```bash |
73 | | -python cracker.py safe-audit https://target.example -o safe_audit.json |
| 207 | +spring2shell defectdojo-upload reports/bulk_run_combined.json \ |
| 208 | + --url https://defectdojo.corp.internal \ |
| 209 | + --api-key "APITOKENEXAMPLE12345" \ |
| 210 | + --engagement-id 42 |
74 | 211 | ``` |
75 | | -- Runs a full passive audit family (encoding + dependency leakage + misconfiguration + log risk) with strict aggregated risk summary, without executing commands. |
76 | 212 |
|
77 | | -### Safe Log2Shell/Log4Shell risk audit (no exploit payloads) |
| 213 | +--- |
| 214 | + |
| 215 | +## 🖥️ Interactive TUI Menu |
| 216 | + |
| 217 | +Run the terminal user interface menu to drive discovery, auditing, and exploitation interactively: |
78 | 218 | ```bash |
79 | | -python cracker.py log-audit https://target.example -o log_audit.json |
| 219 | +spring2shell menu |
| 220 | +``` |
| 221 | + |
| 222 | +### Menu Structure |
| 223 | +``` |
| 224 | +====================================================================== |
| 225 | +ULTIMATE REACT4SHELL / REACT2SHELL FRAMEWORK |
| 226 | +CVE-2025-55182, CVE-2025-66478, Log4Shell, Spring4Shell, Text4Shell |
| 227 | +====================================================================== |
| 228 | + 1. Scan new targets (bulk) ← Enter target file and threads |
| 229 | + 2. Load and exploit from existing report ← Feed JSON report to shell driver |
| 230 | + 3. Direct exploitation (manual target) ← Target URL, endpoint, and command |
| 231 | + 4. Verify RCE (echo-marker + blind test) ← In-depth active vulnerability verify |
| 232 | + 5. Aggressive exploitation (WAF bypass) ← Focuses mutations & encoding bypasses |
| 233 | + 6. CVE-specific scan ← Run precise payload tests on target |
| 234 | + 7. Find working endpoints (quick probe) ← Run endpoint checkers |
| 235 | + 8. Safe full audit (encoding + logs + deps)← Aggregates non-intrusive risk checks |
| 236 | + 9. Log4Shell risk audit ← Run passive Log4j checks |
| 237 | + 10. React2Shell probe ← Specific Next.js/React SA check |
| 238 | + 11. SSRF scan ← Out-of-band/local SSRF probing |
| 239 | + 12. SSTI scan ← Template injection payload scans |
| 240 | + 13. Exit ← Close TUI |
80 | 241 | ``` |
81 | | -- Performs passive checks for exposed management endpoints and log4j version indicators to estimate Log2Shell/Log4Shell risk. |
82 | 242 |
|
83 | | -## Notes |
84 | | -- TLS certificate verification is enabled by default. Use `--insecure` only in controlled environments when needed. |
85 | | -- Use `--verbose-errors` if you need detailed diagnostics for swallowed network exceptions during discovery/audit phases. |
86 | | -- Commands are for educational and authorized testing purposes. Ensure you have permission before scanning or exploiting any target. |
| 243 | +--- |
| 244 | + |
| 245 | +## 🛠️ Developer Workflows (Makefile) |
| 246 | + |
| 247 | +Ensure code quality, execute tests, and manage local deployments using the configured `Makefile` targets: |
| 248 | + |
| 249 | +* **Setup Development Environment**: |
| 250 | + ```bash |
| 251 | + make venv |
| 252 | + source .venv/bin/activate |
| 253 | + make install-dev |
| 254 | + ``` |
| 255 | +* **Linting & Code Formatting** (uses `ruff` for fast linting/formatting checks): |
| 256 | + ```bash |
| 257 | + make lint # Inspect codebase |
| 258 | + make format # Reformat code automatically |
| 259 | + ``` |
| 260 | +* **Type checking**: |
| 261 | + ```bash |
| 262 | + make typecheck # Run mypy static type checking |
| 263 | + ``` |
| 264 | +* **Running Tests** (runs 247 unit tests and generates code coverage report): |
| 265 | + ```bash |
| 266 | + make test # Full suite with coverage |
| 267 | + make test-unit # Unit tests only |
| 268 | + ``` |
| 269 | + |
| 270 | +--- |
| 271 | + |
| 272 | +## ⚖️ Legal & Ethical Warning |
87 | 273 |
|
88 | | -## License |
89 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 274 | +> [!WARNING] |
| 275 | +> **This tool is for authorized penetration testing and security research only.** |
| 276 | +> Scanning or attempting to exploit targets without explicit, written, prior authorization from the system owner is a criminal offense in most jurisdictions. The developers assume no liability and are not responsible for any misuse, damage, or legal consequences resulting from this tool. |
0 commit comments