standinglynx

Secure Sand box Network Set up Lab for malware analisys VLAN 99

Hola!

When I did the installation of the network I went full focused and I managed to do all in a roll (including the typical ups and downs in relation to being one self as the designer and the executor) ༼ಠ ل ಠ༽

I want to help myself of the future and dive deeper into creating a highly secure and isolated environment specifically for malware analysis using VLAN 999.... in a different post.

Description of GIF

This setup ensures that malicious code can be safely analyzed without risking your host system, other virtual machines, or production networks.

in this series i am doing my own adaptation of this lab[https://facyber.me/posts/blue-team-lab-guide-part-5/]

Why Segment Networks for Malware Analysis?

Network segmentation is a cornerstone of secure lab environments, and it becomes even more critical when dealing with malware. By isolating specific network zones, you can achieve the following benefits tailored to malware analysis:

Tools Used

This setup leverages the same robust toolkit introduced in our series, ensuring consistency and compatibility with your existing Proxmox environment:

Lab Topology

Our lab topology, as outlined in the series, includes multiple VLANs simulating different security zones. For this article, we focus on VLAN 999, dedicated exclusively to malware analysis, while maintaining the broader context of the environment:

VLAN ID Purpose Sample CIDR
100 Management 192.168.X.0/24
200 External Simulation 10.100.X.0/24
300 Internal Services 172.16.X.0/24
400 Security Operations 10.50.X.0/24
999 Malware Analysis 192.168.254.0/30

Note: X represents variable octets for anonymization.

VLAN 999 is designed as a fully isolated segment with no connectivity to other VLANs or external networks, creating a secure "digital containment chamber" for analyzing malicious code.

Expected Traffic Flow

The traffic flow rules established in our series remain intact, with specific emphasis on VLAN 999’s isolation:

This strict isolation ensures that malware samples executed within VLAN 999 cannot communicate with external command-and-control servers or spread to other parts of your lab or production environment.

Step-by-Step Setup for VLAN 999 Malware Analysis Lab

Building on the general segmentation setup from our series, the following steps focus on configuring VLAN 999 for secure malware analysis within your Proxmox environment.

1. Create a Dedicated Namespace for Malware Analysis

Start by creating a separate network namespace for the malware analysis environment to ensure complete isolation from other network stacks.

# Create an isolated namespace for malware analysis
ip netns add malware-lab

Tip: Using a dedicated namespace like malware-lab simulates a standalone network environment within your Proxmox host.

2. Set Up a Virtual Bridge for VLAN 999

Create a bridge within the namespace to connect virtual interfaces for VMs or containers used in malware analysis.

# Set up a virtual bridge for VLAN 999
ip link add malware-br type bridge
ip link set malware-br netns malware-lab
ip netns exec malware-lab ip link set malware-br up

Note: This bridge will serve as the internal network hub for VLAN 999, ensuring all traffic remains contained within the namespace.

3. Connect with veth Pairs

Use virtual Ethernet (veth) pairs to link the host to the namespace, acting as a virtual cable for internal connectivity.

# Create a veth pair to connect host to namespace
ip link add veth-mal0 type veth peer name veth-mal1
ip link set veth-mal1 netns malware-lab
ip link set veth-mal0 up
ip netns exec malware-lab ip link set veth-mal1 up
ip netns exec malware-lab ip link set veth-mal1 master malware-br

Tip: Ensure no external interfaces are connected to this bridge to maintain isolation.

4. Configure VLAN 999

Define VLAN 999 on the bridge to logically separate its traffic from other network segments.

# Create VLAN 999 interface within the namespace
ip netns exec malware-lab ip link add link malware-br name vlan999 type vlan id 999
ip netns exec malware-lab ip link set vlan999 up

Recommendation: Script this step if you plan to rebuild the environment frequently for clean analysis sessions.

Description of GIF

5. Assign IP Addressing for VLAN 999

Assign a static IP range to VLAN 999 based on our topology. This small subnet (/30) limits the number of devices, further reducing risk.

# Assign IP for VLAN 999
ip netns exec malware-lab ip addr add 192.168.254.1/30 dev vlan999

Note: Avoid using DHCP within VLAN 999 to prevent any potential leakage or misconfiguration.

6. Set Up Strict Firewall Rules for Isolation

Implement iptables rules to enforce a default-deny policy, ensuring no traffic can enter or leave VLAN 999.

# Set default policies to DROP
ip netns exec malware-lab iptables -P INPUT DROP
ip netns exec malware-lab iptables -P FORWARD DROP
ip netns exec malware-lab iptables -P OUTPUT DROP

# Allow only local traffic within the namespace
ip netns exec malware-lab iptables -A INPUT -i lo -j ACCEPT
ip netns exec malware-lab iptables -A OUTPUT -o lo -j ACCEPT

Recommendation: Regularly audit these rules to ensure no accidental allowances are introduced during testing. Description of GIF

7. Deploy Analysis VMs in VLAN 999

Create and configure virtual machines for malware analysis within Proxmox, ensuring their network interfaces are connected exclusively to VLAN 999.

Tip: Take snapshots of these VMs before each analysis session to revert to a clean state after testing.

Validation of Isolation

Verify the isolation of VLAN 999 to ensure no traffic can escape or enter this segment. Use the following commands within the malware-lab namespace:

# Check IP configuration
ip netns exec malware-lab ip addr show

# Verify no external routes exist
ip netns exec malware-lab ip route show

# Confirm firewall rules are in place
ip netns exec malware-lab iptables -L -v -n

Additionally, test connectivity using ping or traceroute from within VLAN 999 to external addresses (e.g., 8.8.8.8) and other VLANs (e.g., VLAN 200) to confirm isolation. Use Wireshark or tcpdump within VLAN 999 to monitor for any unexpected traffic.

Tip: If any connectivity is detected, revisit your iptables rules and bridge configuration to identify and close gaps.

Best Practices for Malware Analysis in VLAN 999

Stay tuned for my article Advanced Network Segmentation in Proxmox series, where we’ll explore additional use cases and advanced configurations for your segmented lab environment. If you’re in Lucerne, Switzerland, or nearby, consider joining local tech meetups to discuss Proxmox setups and network security with fellow enthusiasts!

Discuss this post: Bluesky It was challenging keep track of the "right recipe" let me know if you find a issue we could work it together!

Description of GIF

Assisted by AI