# Building a Detection Engineering Home-lab

This article will cover the following information:

* *How to build a standalone instance of Security Onion in VMware 17.5.0.*&#x20;
* *How to install VMware tools on the windows instance.*
* *How to verify the Security Onion install by pinging the gateway.*&#x20;
* *How to confirm access to the Security Onion instance via the web browser.*&#x20;

## Introduction

A few weeks ago, I had the pleasure of speaking with a senior cybersecurity professional and he brought up the concept of Detection Engineering.  Detection Engineers help identify detection gaps in IDS/IDP/EDR systems, and then help the SOC analysts tune those defensive systems to close the detection gaps. \
\
There is a trade-off between security and convenience for the user that Detection Engineers have to balance. If you are too strict on your rules, then you run the risk of swamping the SOC Analysts with false positives. If you are too loose with your rules, there is a strong chance that a real alert might be missed. That is why Detection Engineering is both a science and an art.\
\
As someone who does cybersecurity research and analysis for fun, this role seemed really interesting and I started to dig into the internet. I came across a GIAC Gold Certification paper from 2021 titled, "Detection Engineering: Defending Networks with Purpose" by Peter Di Giorgio (<https://www.sans.org/white-papers/40400/>). After I read through the paper, I realized that all the materials Mr. Di Giorgio used to run his experiment are free and open sourced. What better way to learn than to build a home-lab specific to this paper and try to reproduce the scholarly work!

## Purpose

The purpose of this project is to reproduce the research conducted by Peter Di Giorgio. I will be using the following tools:

* VMware Workstation Pro version 17.5.0 build - 22583795
* Security Onion (SO) 2.4.20
* Wazuh
* Sysmon
* Sigma
* AtomicRedTeam&#x20;

At the conclusion of this project I will have hands on experience with building a network and integrating it into a SIEM. I will be able to run Adversary Emulation using Atomic Red Team and I will be able to build sigma rules to tune detection systems. I will have hands on experience working through the MITRE ATT\&CK framework and a better understanding of how to new threats to improve overall detection rates.&#x20;

## Building the Home-lab&#x20;

### Security Onion 2.4.20

I'll preface this with there was a lot of Layer 8 (human) error when it came to my initial install of security onion. While I do understand networking, each hypervisor (Virtual Box, and VMware) has some nuances which make them unique.\
\
My hope is that as I go through my own steps for building the lab, you will be able to successfully build a lab too.&#x20;

*A special thanks goes out to* [*<mark style="color:blue;">**David Pennock**</mark>*](https://www.linkedin.com/in/davidrpennock/) *and* [*<mark style="color:blue;">**Lazaro Rivera**</mark>*](https://www.linkedin.com/in/lazaro-rivera/) *for their help in troubleshooting the security onion install. They taught me a lot about how to approach the install and helped me explore different configurations until we got the right set up to replicate the findings as close as possible.*

*So what is this lab going to look like?*&#x20;

<figure><img src="/files/xjWTyh0cCrhn7bFruu0o" alt=""><figcaption><p>The original structure was pulled from Peter Di Giorgio's paper located at <a href="https://www.sans.org/white-papers/40400/">https://www.sans.org/white-papers/40400/</a></p></figcaption></figure>

This structure is meant to replicate how Peter Di Giorgio built his lab. In future iterations, I will include an outside Linux aggressor that will be used to attack the gateway and the Windows 11 nodes to generate alerts.

### Initial Install of the ISO

#### Materials Required:

* [<mark style="color:blue;">**VMware Workstation 17.X**</mark>](https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html) installed on your computer (Eval version is fine)
* [<mark style="color:blue;">**Latest Security Onion ISO**</mark>](https://github.com/Security-Onion-Solutions/securityonion/blob/2.4/main/DOWNLOAD_AND_VERIFY_ISO.md) (I used 2.4.20 for this experiment)
* Around 5-6 hours and a lot of patience
* Minimum HW Requirements:<br>

  <figure><img src="/files/swVkU4aW3kGiO2km6S51" alt=""><figcaption><p><a href="https://docs.securityonion.net/en/2.4/hardware.html">https://docs.securityonion.net/en/2.4/hardware.html</a></p></figcaption></figure>

  \*\*\*Note: While the minimum requirements state 16GB RAM minimum for a Standalone SO Install, Security Onion will have an error and state it actually needs 24GB RAM.

### Step 1. Establish the HW for your Standalone SecurityOnion VM

* Open VMware Workstation and select create new VM

<figure><img src="/files/L3tPZSNLPrDsLVKFcEna" alt=""><figcaption><p>Select the Create a New Virtual Machine</p></figcaption></figure>

* Use the typical install.

<figure><img src="/files/x4NfudFjISoybwrAyinZ" alt=""><figcaption></figcaption></figure>

* Click Installer disc image file (iso) and identify the location of the ISO you download before starting this build.

<figure><img src="/files/9MkjiE4lqALXr3uhcybs" alt=""><figcaption><p>Use Installer Disc Image</p></figcaption></figure>

* Name the server and set up a saved location if you want the VM stored somewhere other than the default location.

<figure><img src="/files/VJ7i8UXdn5yMP1GB7RgM" alt=""><figcaption></figcaption></figure>

* It is recommended in the [<mark style="color:blue;">**Security Onion Documentation**</mark>](https://docs.securityonion.net/en/2.4/partitioning.html) to have at a minimum 200GB of space on the VM. I personally like to store my VMs as a single file to assist in movement from desktop to storage or cloud whenever I want to keep a VM but don't need immediate access to it.

<figure><img src="/files/ABUilgSI3vGaDKrpkHC0" alt=""><figcaption><p>200GB Minimum required</p></figcaption></figure>

* After this point, you need to click the customize hardware button.

<figure><img src="/files/87HwzEl8EQ6Be73NvlG9" alt=""><figcaption></figcaption></figure>

* For a standalone instance you need at a minimum 16GB (24576MB) of memory to dedicate to the SO Instance...  I prefer 32GB (32768MB) for mine.

  <figure><img src="/files/hlBAFUbmcwb662z1dwGl" alt=""><figcaption></figcaption></figure>
* Update Processor cores to 4&#x20;

<figure><img src="/files/GnI2qDFKkTROYEm7FLCr" alt=""><figcaption></figcaption></figure>

* Add a Network Adapter and set it to NAT.

<figure><img src="/files/OrWwBLCHeQYI4DBsYDJK" alt=""><figcaption><p>Click Add</p></figcaption></figure>

<figure><img src="/files/YSdJO5HXjG0K3OZlUKcC" alt=""><figcaption><p>Select Network Adapter and click finish</p></figcaption></figure>

* Make sure that the second network adapter is on NAT as well. This second adapter will be your listening adapter for the SO instance.

<figure><img src="/files/GrazIEPJUSTLQnJh48Vd" alt=""><figcaption></figcaption></figure>

* With the above hardware settings complete click finish and begin your install.

### Step 2. Run initial install

* During this step you will initiate the ISO, establish a admin username and password, and then wait a long time for the application to set itself up. The following are the basic inputs needed to get the SecurityOnion instance installing.
* Select the first line.

<figure><img src="/files/do5nUWaTogu4iTcJ4G7U" alt=""><figcaption></figcaption></figure>

* Type yes to proceed, set up your admin username, and make a memorable password. This is how you will access the web interface for Security Onion.

<figure><img src="/files/FwQ4fIrXqkKjotzUfnOq" alt=""><figcaption></figcaption></figure>

* Observe that Security Onion is going to install a ton of applications. This can take a while. It may look like it is hanging up on the "Running post-installation scripts" phase, but that is normal and takes a long time (5-6 hours it seems). Once it is done you will see the following message:

<figure><img src="/files/R0XZnlqsUFbq1H9xiuyX" alt=""><figcaption></figcaption></figure>

### **Step 3. Configure Your Security Onion Instance.**

In this step, we will configure both the management node and the sensor node as DHCP instead of Static IP. As the hypervisor sees NAT based VMs as using the same IP range, it ensures that the VMs do not have any issues communicating to each-other. In other articles authors encourage the use of bridging and host-only settings on network adapters. I understand why it would make sense to isolate the VM from outside influence, but for this particular exercise, DHCP is controlled within the hypervisor making two NAT adapters more viable.

\*\*\*NOTE: Before you begin, go to the dropdown menus, select edit-->Virtual Network Editor and open that instance. Observer the subnet address for VMnet8 (192.168.246.0). Highlight that line and select NAT Settings. Note that the Subnet IP, Subnet Mask, and Gateway IP are all identified here. you will need this information later in the install process.

<figure><img src="/files/3WG3AJ2IAvFBjWgAtCZT" alt=""><figcaption><p>Network Settings</p></figcaption></figure>

* Login with previously created credentials:

<figure><img src="/files/fqu8bLQUTcBB9RarxkIB" alt=""><figcaption></figcaption></figure>

* The server will spin up an install gui to walk you through the process of installing and configuring Security Onion.&#x20;

<figure><img src="/files/xrvNL68Mh8ERwEJYiQDv" alt=""><figcaption><p>Click Yes</p></figcaption></figure>

<figure><img src="/files/m5hjzBznWbcyVo2z4tMC" alt=""><figcaption><p>Click Install</p></figcaption></figure>

* Select Standalone as the installation type. This is the same type of installation previously used by Peter Di Giorgio for this exercise. Standalone is a full production install

<figure><img src="/files/VIp4kGExVdJtlu1dEBzb" alt=""><figcaption></figcaption></figure>

* Select the first Network Interface Card (NIC) that you will use for the Management Interface and select DHCP to configure the management interface.

<figure><img src="/files/4hB2FR2omzrvIVuLrJL0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/uDoMvIWThBlB7kjSLErm" alt=""><figcaption></figcaption></figure>

* Select Direct connection to the internet and keep docker ip range in the next setting:<br>

<figure><img src="/files/7pFrgYlA8rS380shuTZA" alt=""><figcaption></figcaption></figure>

* Add the NIC for the Monitor Interface, then enter an e-mail for logging into Elastic Search and Kibana. It must have an @blank.com added to the username or the interface might not work. Set your password after that point.

<figure><img src="/files/1X0rHSLx0oe1AzECao7y" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Lxt2Z57nFwm0eSEVr7F4" alt=""><figcaption></figcaption></figure>

* This part is important. Remember when I reminded you to get your gateway IP and the IP range? We're going to use that information now.

<figure><img src="/files/dpPbDDzLHvfCiBRNGACK" alt=""><figcaption></figcaption></figure>

* Select IP. IP is the easiest to get to work on the Windows Node

<figure><img src="/files/U5bFcgo3sGpEXAfeoAAy" alt=""><figcaption><p>Select yes</p></figcaption></figure>

* Select yes.
* Pick an interface IP within your IP range that you will access from the windows machine.

<figure><img src="/files/r62cSVfwYxiDaZ9b2Aur" alt=""><figcaption></figcaption></figure>

* Confirm your settings and click OK. Then go do something else.... lift weights, play D\&D, get some coffee... It's going to be a bit. When the setup is complete you will see the following screen. When you press ok, the command prompt will be pulled up.

<figure><img src="/files/90fwdI3UKqddawAxDUXq" alt=""><figcaption></figcaption></figure>

* run the following command:

```bash
sudo so-status
```

* you should see the following output:

<figure><img src="/files/rsFsntCwYaKEw80MTQXR" alt=""><figcaption></figcaption></figure>

## <mark style="color:green;">Congratulations! Your Security Onion is running</mark>

### Step 4. Building a Windows 11 Node.&#x20;

* For this step you will build a Windows 11 test VM. This VM will be used to access the SO instance via web browser and run the AtomicRedTeam.
* The best way to approach this process is to download an ISO and install the Windows VM as if you were installing windows off-line on your computer. John Hammond does a fantastic walkthrough here:

{% embed url="<https://youtu.be/EMuw_IN-UOU?si=Afa7p9r2SsyeAqyA>" %}

### Step 5. Install VMware tools

* Make sure your Windows VM is fully shut down. Right click the Windows 11 VM in VMware and select Settings.
* Select CD/DVD(SATA) and click use ISO Image. Navigate to where you installed VMware Workstation (by default it is here: C:\Program Files(x86)\VMware\VMware Workstation)\
  &#x20;

  <figure><img src="/files/eM8N96bCQijEAuyBL2XU" alt=""><figcaption></figcaption></figure>
* Log on to the Windows VM and open explorer. You should be able to select the C drive and run the Windows.exe. You should see the following set up. Just go by the defaults.

<figure><img src="/files/qRrllVsjvjI6Avrevj6Y" alt=""><figcaption></figcaption></figure>

* Once the set up is complete. Open a powershell instance. Ping your gateway. For example:

```bash
ping 192.168.246.2 
```

* This will confirm you have a connection as well as create some traffic for you to observe on the web interface. Once it is successful, open your web browser and put <http://managerIP> (ex. 192.168.246.131) and access the web terminal.

<figure><img src="/files/3YFIbxJKLxrvB286h9cc" alt=""><figcaption><p>Webapp access control interface</p></figcaption></figure>

* Input the username and password that you use for the security onion server. You should be greeted with the following dashboard:

<figure><img src="/files/BHUUzOlPBXHfJeVotFHl" alt=""><figcaption></figcaption></figure>

The two VMs are operational and in place!!!&#x20;

## Conclusion

In this article we outlined the the process we are going to take to recreate Peter Di Giorgio's Detection Engineering research project from 2021.&#x20;

* We walked through the process of building a standalone instance of Security Onion.&#x20;
* We installed VMware tools on the windows instance.&#x20;
* We verified the SO install with our Windows VM system by pinging the gateway.
* We connected to the Security Onion Dashboard.&#x20;

For Part 2 we will install Wazuh and integrate it into the Security Onion tool suite on Windows 11. We'll also build an AtomicRedTeam instance on the Windows vm  and run our first test.\
\
Thank you very much for joining me on this journey and I hope to share more of what I am learning in the future.

[<mark style="color:blue;">**Return to the Archive**</mark>](broken://pages/6gP4djnMmP1naeLO35MJ)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.cybersleuthchronicles.com/landing/building-a-detection-engineering-home-lab.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
