Building My Own Cybersecurity Virtual Lab: Pentesting, SOC Analysis, and Threat Detection
After enrolling in the Practical SOC Analysis Associate (PSAA) course by TCM Security and successfully passing the exam, I decided to enhance my practical learning experience by building a Virtual Lab at home. This lab serves as a dual-purpose environment: a space for honing pentesting skills and creating a detection lab to simulate real-world SOC analyst scenarios. My goal is to apply the knowledge gained from the course and stay up-to-date in the ever-evolving field of cybersecurity.
Leveraging my current experience as a network engineer, I was able to design and set up a simple yet effective home lab. On a side note, I firmly believe that having a strong foundation in networking provides a significant advantage when transitioning into the cybersecurity domain.
Here’s a list of tools and resources I used to build my Cybersecurity Virtual Lab, along with their purposes:
- VMware Workstation: Virtualization platform used to create and run multiple virtual machines on a single physical machine, simulating various environments for testing and experimentation.
- EVE-NG (Emulated Virtual Environment Next Generation): A network emulation platform used for designing, testing, and practicing complex network topologies in a virtualized environment.
- OPNsense Firewall ISO: An open-source firewall distribution, used to simulate and configure network security policies within the lab.
- Kali Linux ISO: A widely used Linux distribution specifically designed for penetration testing and ethical hacking.
- Windows Software ISO: For creating Windows-based virtual machines, useful for testing exploits, malware analysis, or setting up targets.
- Ubuntu ISO: A versatile Linux distribution for creating server environments, testing, and running SOC analysis tools.
- Pre-configured VM Images: Ready-to-use vulnerable systems such as Metasploitable, bWAPP, and others, designed to practice ethical hacking, exploit testing, and vulnerability analysis.
Network Topology
I will be using an open-source firewall, OPNsense FW, as a core component of my lab setup. In this simple virtual lab, OPNsense FW will function as the gateway for each VLAN. The lab is designed with two subnets: one for the attacker's network and another for the server environment.
As the gateway, OPNsense FW will handle all traffic between the subnets, allowing me to monitor and log network activity effectively. Additionally, I will enable its Intrusion Detection System (IDS) capabilities, a crucial network security technology that every SOC analyst needs to understand and utilize. This setup not only enhances security monitoring but also provides a practical environment to analyze and respond to potential threats.
Once the initial setup of our Cybersecurity Virtual Lab is complete, we will configure Suricata rules to align with the Intrusion Detection and Prevention System (IDS/IPS). This will enhance our lab's security monitoring capabilities and provide a more comprehensive environment for testing and analysis.10. Next, configure the IP address according to the requirements specified in the Network Topology diagram.
Now, we will create the VLANs. Specifically, VLAN 100 will be assigned to the Server VLAN, and VLAN 200 will be designated for the attack machine. And assign the vtnet2 as parent as it is the interface facing our LAN.
VLANs (Virtual Local Area Networks) are used to segment network traffic, improving security, performance, and management. By isolating devices into different VLANs, network administrators can control traffic flow, reduce broadcast traffic, and enhance overall network security.
Now, navigate to Interfaces > Assignments, and add VLAN 100, naming it ServerVLAN, and VLAN 200, naming it AttackersVLAN.- Enable the interface
- Add description
- Config as Static IPv4
- Assign the IP Address as our requirement
- And click Save
Next, we will enable DHCP for both VLAN 100 and VLAN 200. In a production environment, DHCP would typically be disabled on the Server VLAN to ensure static IP addresses, preventing the servers' IPs from changing over time. However, in this lab environment, we will enable DHCP to facilitate communication and ensure that the OPNsense firewall can properly interact with hosts beyond the switches.
And now we need to configure the LAN switch:
++++Creation of VLANs at Switch 1 directly connected to the OPNSENSE FW++++
#Vlan 100
#name Server_VLAN
#end
#config t
#Vlan 200
#name Attackers_VLAN
#end
++++Assigning a hostname for the SW 1++++
#hostname
#LAN-SW
#end
++++Assigning ports to its proper VLAN as per our diagram++++
#interface fa2/0
#switchport mode access
#switchport access vlan 200
#no shut
#exit
#interface fa2/1
#switchport mode access
#switchport access vlan 100
#no shut
#end
++++Assigning ports as Trunk ports++++
#interface range fa2/2, fa2/15
#switchport mode trunk
#switchport trunk allowed vlan all
#no shut
++++Creation of VLANs at Switch 2 directly connected to the LAN-SW++++
#Vlan 100
#name Server_VLAN
#end
#config t
#Vlan 200
#name Attackers_VLAN
#end
++++Assigning a hostname for the SW 1++++
#hostname
#LAN-SW-02
#end
++++Assigning ports to its proper VLAN as per our diagram++++
#interface range fa2/0 - 4
#switchport mode access
#switchport access vlan 100
#no shut
++++Assigning ports as Trunk ports++++
#interface range fa2/15
#switchport mode trunk
#switchport trunk allowed vlan all
#no shut
After configuring the LAN switches and assigning the appropriate ports to their respective VLANs, both Kali Linux and Windows hosts will be able to obtain IP addresses from the OPNsense firewall.
For simplicity in this lab environment, I will allow all traffic between Kali Linux and Windows hosts, as the primary goal here in our Lab is to ensure that Kali Linux can successfully communicate and perform penetration testing on servers within VLAN 200. Additionally, we will set up detection mechanisms such as IDS and IPS technologies to monitor network activity. To further enhance our security and monitoring capabilities, we will implement Splunk SIEM to collect logs, track event data, and create alerts. This will help us practice our investigation skills by correlating the information gathered and identifying potential threats.
| Ping test from Windows to Kali Linux |
| IP Address obtain by the Windows host |
| Ping test from Kali Linux to Windows host |
| IP address obtain by Kali Linux |
After we confirm that Kali Linux can successfully reach the Windows host as shown above, we can conclude that the Virtual Lab has been set up correctly. In the next blog post, I will walk you through the process of enabling the IDS capabilities on OPNsense, creating Suricata rules, and applying them to the IDS configuration in OPNsense.
Comments
Post a Comment