SOC Automation Project - Wazuh, TheHive, Shuffle
This project consists of building a SOC (Security Operations Center) automation lab from scratch, aimed at gaining hands-on experience in the field. The project involves setting up various tools such as Wazuh (SIEM and XDR), TheHive (for case management), and Shuffle (for SOAR capabilities).
The project includes 5 different parts:
Part 1: Creating a logical diagram to visualize the lab and project.
Part 2: Installing necessary components and setting up the lab in the cloud and virtual machines (VM).
Part 3: Configuring servers and endpoints for seamless communication with each other.
Part 4: Generating telemetry related to Mimikatz to trigger alerts.
Part 5: Setting up SOAR, integrating all tools, and automating responses and alerts.
Part 1:
In the first part of the project, the focus is on creating a logical diagram to visualize the lab setup, which would help to understand data flow and identify necessary components. I used a free tool called draw.io to build this diagram, by connecting elements such as the PC, router, internet, Wazuh manager, Shuffle, and TheHive.
The diagram serves as a reference for the project, outlining the sequence of actions like sending events, triggering alerts, and performing responsive actions.
Part 2:
In part two, the focus is on installing necessary applications and virtual machines. By the end of this part, there should be a Windows 10 machine with Sysmon installed, a Wazuh server, and a Hive server set up.
Overview of Tools:
Wazuh: Described as an open-source cybersecurity platform that integrates Security Information and Event Management (SIEM) and Extended Detection and Response (XDR) capabilities. It offers features like security analytics, intrusion detection, and incident response. Wazuh comprises three main components: the indexer, server, and dashboard.
TheHive: Introduced as a 4-in-1 open-source security incident response platform. It will be used as the case management system for this project.
Virtual Machine Setup: The lab uses Windows 10 as the client PC, and Ubuntu 22.04 for both Wazuh and TheHive servers. The instructor mentions that while they are using an ESXi server for the Windows 10 VM, you can also use VirtualBox or a cloud provider.
Part 4: Generating Telemetry and Creating Alerts
Objective:
In this part, we will generate telemetry from the Windows 10 machine and ensure it's being ingested into Wazuh. You'll have successfully configured and sent telemetry containing Mimikatz by the end, triggering a custom alert.
Configuring Windows 10 Telemetry
Start by locating the Wazuh configuration file on your Windows 10 machine under Program Files (x86)
. The file you need to modify is ossec.conf
. Open it with administrative privileges using Notepad. You'll be editing the file to ensure Wazuh ingests Sysmon logs, which are critical for detecting Mimikatz.
First, back up the original configuration file by copying and renaming it. Then, scroll down to the log analysis section in ossec.conf
, and replace the default application logs with the Sysmon channel name. You can find the correct channel name by opening Windows Event Viewer, navigating to Applications and Services Logs > Microsoft > Windows > Sysmon > Operational, and copying the full name from the properties.
After updating the configuration, save the file and restart the Wazuh service to apply the changes. This ensures Wazuh begins ingesting Sysmon logs, including any Mimikatz activity.
Verifying Ingestion in Wazuh Dashboard
Go to the Wazuh dashboard, search for Sysmon events under the alerts index, and confirm that the logs are being ingested. If no events appear, the logs may take a few moments to process. Next, disable Windows Defender for the Downloads folder to prevent interference and download Mimikatz. Run Mimikatz and check the Wazuh dashboard for related events. If no Mimikatz events are visible, adjust Wazuh to log everything by editing the ossec.conf
file on the Wazuh manager and setting logall
and logall_json
to "yes."
archives
directory. Ensure the Filebeat configuration is also set to true for archives, then restart the Filebeat service. Create a new index for archives in the Wazuh dashboard to view all ingested logs.Testing and Creating a Custom Alert
To create a custom alert for Mimikatz, start by accessing the rules section in the Wazuh dashboard. Use a built-in Sysmon rule as a reference, copying it into the custom rules section. Modify the rule to focus on the original_file_name
field, ensuring it detects Mimikatz even if the executable is renamed. Set the rule ID, severity level, and field details, ensuring the field names are case-sensitive. Save the rule and restart the Wazuh manager.
Test the new rule by renaming Mimikatz to a different name and running it. Check the Wazuh dashboard to verify that the custom alert triggers based on the original file name, demonstrating the effectiveness of your configuration.
Objective:
In this final part of the SOC automation project series, I aim to connect Shuffle, the SOAR (Security Orchestration, Automation, and Response) platform, to The Hive and Wazuh. By the end of this part, I will have a fully functional lab that integrates Wazuh, The Hive, and Shuffle. While Wazuh alone has many capabilities, using a SOAR platform like Shuffle alongside a case management system like The Hive offers additional benefits.
Setting Up Shuffle:
To start, I headed over to Shuffle's site and created an account. Once logged in, I bypassed the initial setup and went straight to creating a workflow. I named the workflow "SOC Automation Project" and added a description. The workspace allowed me to add apps and triggers. I dragged a webhook trigger onto the workspace and named it "Wazuh Alerts." After copying the webhook URL, I moved to the Wazuh manager to integrate this webhook.
Integrating Wazuh with Shuffle:
In the Wazuh manager, I opened the ossec.conf
file to add the integration tag with the webhook URL. I made sure the URL was correctly formatted and changed the tag from level
to rule_id
so that only alerts with a specific rule ID, in this case, the custom rule I created earlier, would be sent to Shuffle. After saving the configuration, I restarted the Wazuh manager service to apply the changes.
Testing the Integration:
To test the integration, I regenerated Mimikatz telemetry on my Windows client machine and then checked Shuffle to see if the alerts were received. Initially, nothing appeared in Shuffle due to a URL formatting issue in the Wazuh configuration. I corrected this by removing the http://
portion from the webhook URL and restarted the Wazuh manager. After running Mimikatz again, Shuffle successfully received the alert, and I could see the relevant information in the execution arguments.
Parsing Hash Values with Shuffle:
Next, I needed to parse out the SHA-256 hash value from the alert before sending it to VirusTotal. I used regular expressions (regex) to capture just the hash value, excluding any additional text like sha1=
or sha256=
that might be included. I utilized ChatGPT to generate the regex, which I then implemented in Shuffle. After running the workflow again, the hash value was correctly parsed and ready for submission to VirusTotal.
Checking Hash Reputation with VirusTotal:
I integrated VirusTotal into the Shuffle workflow to automatically check the reputation of the parsed hash. After configuring VirusTotal with my API key, I encountered a 404 error due to an outdated API endpoint in Shuffle's VirusTotal app. I resolved this by editing the app's URL to match the current VirusTotal API documentation, replacing /report
it with /ID
. After making this change, VirusTotal successfully returned the reputation score for the hash.
Creating an Alert in The Hive:
With the VirusTotal integration working, I connected Shuffle to The Hive to create an alert for case management. I configured the alert to include relevant information, such as the detection time, hostname, and user account. I also added MITRE ATT&CK tags and specified the alert's severity level. Before running the workflow, I temporarily modified my cloud firewall to allow inbound traffic on port 9000, which The Hive uses. After running the workflow, I verified that the alert was successfully created in The Hive, complete with all the necessary details.
Sending Email Notifications: To keep analysts informed, I set up an email notification step in Shuffle. I used SquareX’s disposable email service to test the functionality. I configured the email to include the alert's title, detection time, and host information, ensuring that analysts would have all the details they need to investigate further. After running the workflow, I confirmed that the email was sent and contained all the relevant information.
Conclusion:
At the end of the project, I successfully integrated Wazuh, The Hive, and Shuffle into a cohesive automation workflow. I demonstrated how to parse telemetry data, check it against VirusTotal, create an alert in The Hive, and notify analysts via email. This project has provided me with a robust platform for automating incident response tasks, improving efficiency, and ensuring that critical alerts are managed effectively.
Comments
Post a Comment