Skip to content

xhzeem/TechFlow-lab

Repository files navigation

🎯 Penetration Testing Lab

A comprehensive Docker-based penetration testing lab featuring vulnerable web applications, network services, and multiple exploitation paths across public and internal networks.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      PUBLIC NETWORK                          β”‚
β”‚                     (172.20.0.0/24)                         β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚   Web Server     β”‚         β”‚   FTP Server     β”‚         β”‚
β”‚  β”‚  Port: 8080      β”‚         β”‚   Port: 2121     β”‚         β”‚
β”‚  β”‚  - PHP App       β”‚         β”‚   - Anonymous    β”‚         β”‚
β”‚  β”‚  - 10+ Vulns     β”‚         β”‚   - Sensitive    β”‚         β”‚
β”‚  β”‚  - 3 RCE paths   β”‚         β”‚     Files        β”‚         β”‚
β”‚  β”‚  - Chisel        β”‚         β”‚                  β”‚         β”‚
β”‚  β”‚  - Nmap          β”‚         β”‚                  β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚           β”‚                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚ PIVOT REQUIRED
            β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           β”‚         INTERNAL NETWORK                         β”‚
β”‚           β”‚        (10.10.10.0/24)                          β”‚
β”‚           β”‚                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Internal-1      β”‚  β”‚ Internal-2   β”‚  β”‚ Internal-3   β”‚ β”‚
β”‚  β”‚  10.10.10.2      β”‚  β”‚ 10.10.10.3   β”‚  β”‚ 10.10.10.4   β”‚ β”‚
β”‚  β”‚  - Web (80)      β”‚  β”‚ - Web (80)   β”‚  β”‚ - Web (80)   β”‚ β”‚
β”‚  β”‚  - SSH (22)      β”‚  β”‚ - SMB (445)  β”‚  β”‚ - Tomcat     β”‚ β”‚
β”‚  β”‚  - SSH Key       β”‚  β”‚ - Weak Auth  β”‚  β”‚   (8080)     β”‚ β”‚
β”‚  β”‚    Exposed       β”‚  β”‚              β”‚  β”‚ - MySQL      β”‚ β”‚
β”‚  β”‚                  β”‚  β”‚              β”‚  β”‚ - ProFTPD    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Prerequisites

  • Docker Engine 20.10+
  • Docker Compose 1.29+
  • At least 4GB RAM
  • 10GB free disk space

πŸš€ Quick Start

1. Clone or Navigate to Lab Directory

cd /Users/user/Desktop/TechFlow

2. Start the Lab

docker-compose up -d

3. Verify All Services Are Running

docker-compose ps

You should see all 6 containers running:

  • pentest-db - MySQL database
  • pentest-web - Main vulnerable web server
  • pentest-ftp - FTP server
  • internal-web-ssh - Internal server 1
  • internal-smb-web - Internal server 2
  • internal-multi-service - Internal server 3

4. Access the Lab

Public Web Server: http://localhost:8080
FTP Server: ftp localhost 2121 (anonymous access)

🎯 Lab Objectives

Phase 1: Initial Reconnaissance

  • Enumerate public services
  • Identify vulnerabilities in the web application
  • Gain initial access to the web server

Phase 2: Exploitation

  • Exploit web vulnerabilities for RCE
  • Extract sensitive information from FTP
  • Establish persistence

Phase 3: Pivoting

  • Use chisel or SSH tunneling to access internal network
  • Scan internal network from compromised web server
  • Map internal services

Phase 4: Internal Exploitation

  • Extract SSH key from internal-server-1
  • Exploit SMB vulnerabilities on internal-server-2
  • Exploit CVEs on internal-server-3
  • Achieve root access on all internal servers

πŸ”“ Vulnerability Summary

Public Web Server (10+ Vulnerabilities)

Vulnerability Severity Location RCE
SQL Injection Critical Login, Search ❌
Command Injection Critical Admin Panel βœ… RCE #1
File Upload Critical Upload Page βœ… RCE #2
LFI to RCE Critical File Viewer βœ… RCE #3
Stored XSS High Comments ❌
Reflected XSS Medium Search ❌
IDOR High Profile View ❌
Auth Bypass Critical SQL Injection ❌
SSRF High Admin Panel ❌
Weak Passwords Medium MD5 Hashing ❌
Session Issues Medium Various ❌

FTP Server

  • Anonymous access enabled
  • Sensitive files exposed
  • Network information leaked

Internal Server 1

  • SSH private key exposed in web application
  • Root access via SSH key
  • Network information disclosure

Internal Server 2

  • SMB shares with weak authentication
  • Null session enumeration
  • Sensitive data in shares

Internal Server 3

  • Tomcat 8.5.50 - CVE-2020-1938 (Ghostcat)
  • ProFTPD 1.3.5 - CVE-2015-3306
  • MySQL - Weak root password (toor)
  • Tomcat Manager - Default credentials (admin:tomcat)

πŸ› οΈ Pre-installed Tools (Web Server)

Access the web server container:

docker exec -it pentest-web /bin/bash

Available tools:

  • chisel - Tunneling tool (/usr/local/bin/chisel)
  • nmap - Network scanner
  • ip - Network configuration
  • netcat - Network utility
  • curl/wget - HTTP clients
  • python3 - Python interpreter for scripting and reverse shells

πŸ”§ Useful Commands

Start the Lab

docker-compose up -d

Stop the Lab

docker-compose down

Reset the Lab (Delete All Data)

docker-compose down -v
docker-compose up -d

View Logs

docker-compose logs -f [service-name]

Access Container Shell

docker exec -it [container-name] /bin/bash

Network Scanning from Web Server

docker exec -it pentest-web nmap -sn 10.10.10.0/24

🌐 Network Information

Public Network (172.20.0.0/24)

  • Web Server: 172.20.0.x
  • FTP Server: 172.20.0.x
  • Database: 172.20.0.x

Internal Network (10.10.10.0/24)

  • Internal Server 1: 10.10.10.2
  • Internal Server 2: 10.10.10.3
  • Internal Server 3: 10.10.10.4

πŸŽ“ Learning Paths

Beginner Path

  1. SQL injection in login form
  2. File upload vulnerability
  3. FTP enumeration
  4. Basic network scanning

Intermediate Path

  1. Command injection
  2. LFI to RCE via log poisoning
  3. Chisel tunneling
  4. SSH key extraction
  5. SMB enumeration

Advanced Path

  1. SSRF exploitation
  2. Multi-hop pivoting
  3. CVE exploitation (Ghostcat, ProFTPD)
  4. Custom exploit development
  5. Full network compromise

⚠️ Security Warning

CRITICAL: This lab contains intentionally vulnerable services.

  • NEVER expose these containers to the internet
  • ONLY run in isolated lab environments
  • DO NOT use on production networks
  • ALWAYS run behind a firewall
  • FOR EDUCATIONAL PURPOSES ONLY

πŸ› Troubleshooting

Containers Won't Start

docker-compose down
docker-compose up -d --force-recreate

Database Connection Issues

docker-compose restart db
docker-compose restart web-server

Port Conflicts

Edit docker-compose.yml and change the host ports:

ports:
  - "8080:80"  # Change 8080 to another port

Can't Access Internal Network

Make sure you've compromised the web server first and are using it as a pivot point.

Permission Denied on File Upload

If you get "Permission denied" errors when uploading files:

  1. Ensure you used ./start-lab.sh which pre-configures permissions.
  2. Manually set permissions on the host:
    mkdir -p web-server/www/uploads
    chmod 777 web-server/www/uploads
  3. Restart the containers: docker-compose restart web-server

πŸ“š Additional Resources

πŸ“ Hints

For progressive hints without spoilers, see HINTS.md

πŸ† Flags

Throughout the lab, you'll find flags in the format: FLAG{description}

Collect all flags to complete the lab!

πŸ“„ License

This lab is provided for educational purposes only. Use responsibly.

🀝 Contributing

Found a bug or want to add more vulnerabilities? Feel free to contribute!


Happy Hacking! πŸŽ‰

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published