How iltosec/whitebox-webapp-pentest-chainlab-exploit works
Project type and purpose
• This is an open-source, standalone CLI exploit tool (written in a single poc.py script) whose sole purpose is to automate a chained vulnerability exploit against a Flask web application (LFI → SQLi → password hash cracking → session hijack → RCE via reverse shell).
File structure
• At the top level you have:
• README.md – describes usage, prerequisites, and the attack chain.
• poc.py – the entire exploit logic in one script.
README for additional insights
• The script takes five CLI arguments (target URL, target port, wordlist path, attacker IP, attacker port).
• It expects a running netcat listener on the attacker machine for the reverse shell.
• Attack phases are clearly defined: LFI → enumerate credentials with SQLi → crack password offline → authenticate to obtain a session cookie → deliver RCE payload.
Main components
a. CLI Interface & Argument Parser
– Reads and validates input parameters.
b. HTTP Client Module
– Encapsulates all HTTP GET/POST logic, handles cookies and sessions.
c. LFI Exploit Phase
– Crafts a malicious URL to include local files and harvest credentials or source.
d. SQL Injection Phase
– Sends parameterized requests to enumerate user hashes.
e. Password Cracking Phase
– Invokes an external crack routine (e.g., Python’s hashing libs or calls out to hashcat), using the supplied wordlist.
f. Session Authentication Phase
– Submits broken credentials to authenticate and captures session cookies.
g. RCE Payload & Reverse Shell Phase
– Generates a one-liner reverse shell payload, injects via a vulnerable endpoint, triggers callback to a netcat listener.
h. External Dependencies & Resources
– Target Flask Web App (HTTP server)
– Wordlist file on disk
– Netcat listener on attacker machine
Relationships and data flows
• The CLI component feeds parameters into the HTTP Client.
• The HTTP Client module orchestrates each exploit phase in sequence.
• Offline cracking step separate from HTTP flows (e.g., a side channel that reads from the wordlist file, outputs cleartext passwords).
Architectural patterns and design principles
• Linear pipeline: each stage’s output becomes the next stage’s input.
• Single responsibility: even though poc.py lumps everything together, conceptually each exploit phase is its own component.
• External integration points: file I/O for wordlist, network calls to target and listener.
Technologies, frameworks, and libraries
• Python3 standard library: requests (or urllib), hashlib, argparse, subprocess (if shelling out).
• External tools: nc (netcat) listener.
• Target: Flask web app (vulnerable endpoints).
Final recommendation
• Lay out the components left to right in execution order.
• Every component and data flow is explicitly labeled, capturing the essential architecture of this exploit automation tool.