Skip to content

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cybersecurity Lab Environment

License: MIT Version

A comprehensive, modular cybersecurity testing environment using Multipass VMs with intentionally vulnerable services designed for hands-on educational purposes.

🎯 Overview

This project creates a controlled, isolated environment where students and cybersecurity professionals can practice penetration testing techniques safely. It features two VMs: an Attacker machine with testing tools and a Target machine running vulnerable services.

Key Features

  • πŸ”§ Modular Architecture: Separated scripts, services, and templates for easy maintenance
  • 🎨 Dynamic MOTD System: Immersive ASCII art banners with real-time system information
  • πŸ› οΈ Advanced Testing Tools: Port scanner, web fuzzer, interactive client with exploitation hints
  • πŸ“Š Comprehensive Logging: Structured logs with JSON export capabilities
  • πŸŽ“ Educational Focus: Built-in guidance and security reminders

πŸš€ Quick Setup

git clone https://github.com/manzolo/cybersecurity-lab
cd cybersecurity-lab

Prerequisites

  • Multipass - Cross-platform VM manager
  • 4GB RAM minimum (8GB recommended)
  • 20GB free disk space
  • Linux, macOS, or Windows with WSL

Initial Setup

  1. Create the complete environment:

    ./lab.sh create             # Creates VMs, deploys scripts, configures services
  2. Run automated vulnerability tests:

    ./lab.sh test               # Comprehensive security assessment
  3. Access interactive testing:

    ./lab.sh client             # Connect to vulnerable TCP server
    multipass shell attacker   # Direct access to attacker VM

πŸ“– Usage Guide

Main Commands

Command Description
./lab.sh Launch interactive menu
./lab.sh create Create complete lab environment
./lab.sh test Run automated vulnerability tests
./lab.sh client Interactive TCP client session
./lab.sh status Show detailed VM and service status
./lab.sh destroy Clean up all resources

Advanced Management

Command Description
./lab.sh restart-services Restart all lab services
./lab.sh service-status Detailed service health check
./lab.sh preview-motd Preview welcome screens for both VMs

Attacker VM Tools

Once connected to the attacker VM (multipass shell attacker), use these aliases:

  • lab-help - Show all available lab commands
  • lab-test - Run comprehensive vulnerability test suite
  • lab-connect - Interactive TCP client with exploitation hints
  • lab-scan <ip> - Advanced port scanner with service detection
  • lab-web <ip> - Web vulnerability fuzzer (XSS, directory traversal)
  • lab-logs - View recent attack logs and statistics

🎯 Implemented Vulnerabilities

TCP Server (Port 9000)

  • Command Injection: exec command executes arbitrary system commands
  • Directory Traversal: file command reads arbitrary files
  • Information Disclosure: Various commands leak system information

Web Application (Port 8080)

  • Cross-Site Scripting (XSS): /echo endpoint reflects input without sanitization
  • Directory Traversal: /file endpoint allows reading arbitrary files
  • Remote Code Execution: /exec endpoint executes system commands
  • Information Disclosure: /config, /debug, and /info endpoints

Testing Examples

# XSS Testing
curl 'http://target_ip:8080/echo?msg=<script>alert(1)</script>'

# Directory Traversal
curl 'http://target_ip:8080/file?name=../../../etc/passwd'

# Command Injection via TCP
nc target_ip 9000
> exec whoami
> file /etc/passwd

πŸ—οΈ Project Structure

cybersecurity-lab/
β”œβ”€β”€ lab.sh                    # Main orchestration script
β”œβ”€β”€ README.md                 # This documentation
β”œβ”€β”€ config/                   # Generated configurations (auto-created)
β”œβ”€β”€ logs/                     # System logs (auto-created)
β”œβ”€β”€ scripts/                  # Modular bash components
β”‚   β”œβ”€β”€ menu.sh              # Interactive menu system
β”‚   β”œβ”€β”€ vm_management.sh     # VM lifecycle management
β”‚   β”œβ”€β”€ testing.sh           # Test execution framework
β”‚   └── utils.sh             # Common utilities
β”œβ”€β”€ templates/                # Cloud-init templates
β”‚   β”œβ”€β”€ target-cloud-init.yaml
β”‚   └── attacker-cloud-init.yaml
β”œβ”€β”€ target-scripts/           # Python scripts for target VM
β”‚   β”œβ”€β”€ vulnerable-server.py  # Intentionally vulnerable TCP server
β”‚   β”œβ”€β”€ web-server.py         # Vulnerable web application
β”‚   └── monitor.sh            # System monitoring script
β”œβ”€β”€ attacker-scripts/         # Python scripts for attacker VM
β”‚   β”œβ”€β”€ port-scanner.py       # Advanced port scanner
β”‚   β”œβ”€β”€ connection-tester.py  # Connection reliability tester
β”‚   β”œβ”€β”€ interactive-client.py # Interactive exploitation client
β”‚   └── web-fuzzer.py        # Web vulnerability fuzzer
└── services/                 # Systemd service definitions
    β”œβ”€β”€ vulnerable-server.service
    β”œβ”€β”€ vulnerable-web.service
    └── target-monitor.service

πŸŽ“ Learning Objectives

This lab environment is designed to teach:

  • Network Reconnaissance: Port scanning and service enumeration
  • Vulnerability Assessment: Automated and manual vulnerability discovery
  • Web Application Security: XSS, directory traversal, and injection attacks
  • System Exploitation: Command injection and privilege escalation techniques
  • Logging and Monitoring: Understanding attack patterns and detection
  • Secure Development: Learning from intentionally vulnerable code

πŸ–ΌοΈ Screenshots

Attacker VM Welcome Screen

Attacker VM MOTD with ASCII art and system information

Interactive Testing Suite

image

Web Vulnerability Scanner

image

Port Scanner Results

image

Interactive TCP Client

image

SSH Interface

image

System Status Overview

image

πŸ›‘οΈ Security Notice

⚠️ EDUCATIONAL USE ONLY

This environment contains intentional security vulnerabilities and should:

  • βœ… Only be used in isolated, controlled environments
  • βœ… Never be deployed on production networks
  • βœ… Be destroyed after use: ./lab.sh destroy
  • βœ… Only be used on systems you own or have explicit permission to test

πŸ› Troubleshooting

Common Issues

VMs won't start:

multipass info --all       # Check VM status
multipass purge           # Clean up orphaned VMs

Services not running:

./lab.sh service-status   # Check detailed service status
./lab.sh restart-services # Restart all services

Scripts not working:

./lab.sh update-scripts   # Redeploy all scripts

Multipass issues:

# On Ubuntu/Debian
sudo snap refresh multipass

# On macOS
brew upgrade --cask multipass

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Test your changes: ./lab.sh test
  4. Commit your changes: git commit -m 'Add feature'
  5. Push to the branch: git push origin feature-name
  6. Create a Pull Request

Development Setup

git clone https://github.com/manzolo/cybersecurity-lab
cd cybersecurity-lab
./lab.sh create    # Test the environment
./lab.sh test      # Run the test suite

πŸ“„ License

This project is licensed under the MIT License

πŸ™ Acknowledgments

  • Built with Multipass by Canonical
  • Inspired by various cybersecurity training platforms
  • Educational methodology influenced by OWASP guidelines

πŸ“š Educational Resources

For additional learning, check out:


πŸŽ“ Happy Ethical Hacking!

Remember: The best way to learn cybersecurity is through hands-on practice in controlled environments like this one.

About

A comprehensive cybersecurity testing environment using Multipass VMs with vulnerable services for educational purposes.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages