Hacking Linux Lab
Ubuntu Linux Hacking Lab Activity for Cybersecurity
Objective
This advanced lab activity builds upon the previous Ubuntu 22 Server lab, focusing on more complex ethical hacking techniques targeting Ubuntu Linux systems. Students will explore vulnerable web applications, container escapes, and advanced privilege escalation techniques.
Prerequisites
Completed basic Ubuntu 22 Server lab
VMware Workstation Player with Ubuntu Server 22.04 LTS installed
Basic familiarity with Linux command line and web technologies
Important Note
This lab is for educational purposes only. Always obtain proper authorization before attempting any hacking techniques on systems you do not own or have explicit permission to test.
Part 1: Setting Up Vulnerable Applications
Step 1: Install DVWA (Damn Vulnerable Web Application)
SSH into your Ubuntu Server VM
Install necessary packages:
Download and set up DVWA:
Configure DVWA:
Set up the DVWA database:
Access DVWA at http://DVWA and click "Create / Reset Database"
Step 2: Set Up a Vulnerable Container
Install Docker:
Pull and run a vulnerable container:
Part 2: Web Application Attacks
Exercise 1: SQL Injection
Access DVWA and navigate to the "SQL Injection" page
Try to bypass login using SQL injection
Attempt to extract database information using UNION-based SQL injection
Exercise 2: Cross-Site Scripting (XSS)
Navigate to the "XSS (Reflected)" page in DVWA
Craft a payload to display an alert box
Create a more complex XSS payload that steals cookies
Exercise 3: File Inclusion
Explore the "File Inclusion" page in DVWA
Attempt to read sensitive system files using LFI (Local File Inclusion)
If possible, achieve RFI (Remote File Inclusion) to execute remote code
Part 3: Advanced Privilege Escalation
Exercise 1: Kernel Exploitation
Check the kernel version of your Ubuntu Server:
Research and attempt to find a kernel exploit for this version
Compile and run the exploit to gain root privileges
Exercise 2: SUID Binary Exploitation
Find SUID binaries on the system:
Identify a vulnerable SUID binary (you may need to intentionally install one for this exercise)
Exploit the SUID binary to gain root access
Exercise 3: Exploiting Cron Jobs
View the system-wide crontab:
Identify a writable script that runs as root
Modify the script to add a backdoor or elevate privileges
Part 4: Network-Level Attacks
Exercise 1: ARP Spoofing
Install Ettercap:
Perform ARP spoofing between two VMs or containers:
Analyze the intercepted traffic
Exercise 2: Setting Up a Rogue Access Point
Install hostapd and dnsmasq:
Configure a rogue access point
Implement a captive portal to capture credentials
Part 5: Forensics and Incident Response
Exercise 1: Log Analysis
Intentionally generate suspicious activities on the server
Analyze logs in /var/log to detect the malicious activities
Create a bash script to automate log analysis and alert on suspicious activities
Exercise 2: Memory Forensics
Install Volatility:
Capture a memory dump of a running process
Analyze the memory dump to find hidden processes or injected code
Conclusion
This advanced lab has provided hands-on experience with complex ethical hacking techniques targeting Ubuntu Linux systems. You've explored web application vulnerabilities, advanced privilege escalation methods, container security, network-level attacks, and basic forensics. Remember to always apply these skills ethically and legally.
Last updated