# iltosec/whitebox-webapp-pentest-chainlab-exploit architecture

> Architecture diagram of the GitHub repository iltosec/whitebox-webapp-pentest-chainlab-exploit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iltosec/whitebox-webapp-pentest-chainlab-exploit
- Repository: https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Internal Script Modules (Blue)
    CLI["CLI Interface & Argument Parser"]:::internal
    HTTP["HTTP Client Module"]:::internal

    subgraph "Recon & Access"
        LFI["LFI Exploit Phase"]:::internal
        SQLi["SQL Injection Phase"]:::internal
        Auth["Session Authentication Phase"]:::internal
    end

    subgraph "Post-Auth Exploitation"
        RCE["RCE Payload & Reverse Shell Phase"]:::internal
    end

    %% Offline / File I/O (Orange)
    Crack["Password Cracking Phase"]:::offline
    Wordlist["Wordlist File"]:::offline
    README["Usage & Prerequisites\n(README.md)"]:::offline

    %% External Systems (Green)
    Target["Target Flask Web App"]:::external
    Netcat["Netcat Listener"]:::external

    %% Flow
    README -->|provides parameters| CLI
    CLI -->|passes args| HTTP
    HTTP -->|executes LFI| LFI
    LFI -->|HTTP GET exploit| Target
    Target -->|file contents| HTTP
    HTTP -->|executes SQLi| SQLi
    SQLi -->|HTTP POST exploit| Target
    Target -->|user hashes| HTTP
    HTTP -->|calls Crack| Crack
    Crack -->|reads wordlist| Wordlist
    Crack -->|outputs credentials| Auth
    Auth -->|HTTP POST login| Target
    Target -->|session cookie| HTTP
    HTTP -->|executes RCE| RCE
    RCE -->|HTTP payload| Target
    Target -->|reverse shell| Netcat

    %% Click Events
    click CLI "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click HTTP "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click LFI "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click SQLi "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click Crack "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click Auth "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click RCE "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/poc.py"
    click README "https://github.com/iltosec/whitebox-webapp-pentest-chainlab-exploit/blob/main/README.md"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px
    classDef offline fill:#FFA500,stroke:#000,stroke-width:1px
```
