I created a Simple Elastic SIEM
I had a little bit of extra time over the weekend and so I thought I would run through creating a SIEM from scratch to use on my home lab. Through a little bit of help from documentation and Google I was able to get it up in running in no time. This article details the steps I took to create a SIEM using the Elastic Stack. If you like the project I would suggest setting it up on your own home lab.
Prerequisites
So there are a number of ways to do this, but the way I found (from others who have done it) is to just use a simple VM. If you have a dedicated machine you'd like to run this on more power to you. I might do that later on, but for now the VM does it's job
Also, as a side note, some of the help I found online were from older posts, so the Elastic web console looks a little different from what other guides/tutorials might have and layout of the console may change.
Set up an Elastic Account
The first thing I did was create a free account to set Elastic instance here: Free Trial, really its just a 2-week trial, but that's plenty of time to play around with the platform. If you find you want to do more I think the monthly subscription isn't too much we can run the SIEM on.
Once that was set, it took me to a setup screen to "Create Deployment" and gave me three options, I choose Elasticsearch as it had the SIEM tools option in the description
Once, that was done you go through a few more prompts to setup and then you are in the deployment.
Setting up the Linux VM
Now that I have the instance deployed I can turn my focus to the Kali Machine. Keep in mind you can use any OS you choose (Linux Preferred), but I would recommend Kali Linux.
Setup steps:
Note: Once you are logged in I would recommend running the following command to ensure you vm is fully updated:
sudo apt-get update && upgrade -y
Setting up the Agent to Collect Logs
Now, that we Elastic SIEM, an agent is used to collect and forward security-related events from your endpoints to your Elastic SIEM instance.
To set up the agent to collect logs from your Kali VM and forward them to your Elastic SIEM instance, follow these steps:
2. After that you can use the search bar on the right side to search for “Elastic Defend” and click on it to open the integration page.
3. After that I was taken through the wizard to install the agent. You would just need to click “Install Elastic Defend” and follow the instructions provided on the integration page to install the agent on your Kali VM.
4. Once you get to the end of the installation process, you'll be presented with a cURL command, as well as other commands to install the agent on the Kali machine.
Installing Agent on the Kali VM
5. There are four commands that you’ll see in the run once everything is pasted in your terminal. The first is the cURL command that will grab the Elastic agent.
The second is a tar command, which is just a command to unzip the file you just downloaded from the cURL command.
The third command is cd that moves you into the unzipped folder (Known as directory on Linux)
The last command is the install command to install the agent. You will need to run this in sudo (super user do) in order to run the installation.
Once that finally command has been executed you will be presented with the following statement “Elastic Agent has been successfully installed.”
Once the agent was installed I verified the agent was installed correctly, (after remembering my password) by running this command: sudo systemctl status elastic-agent.service
Recommended by LinkedIn
Generating Security Events on the Kali VM
Since this SIEM is for a personal project and not a businesses environment, I needed to generate some security events in order to generate logs on the SIEM. The simplest way to do so is running a networking scanning tool like Nmap (Network Mapper), which is a free and open-source utility used for network exploration, management, and security auditing. When you perform general scans on Nmap you create logs (noise) from your machine on the network. I'll work on a project where I go over silent scans later on.
Run an Nmap scan:
They I ran a few more scans to generate some logs to pull from.
Querying Security Events
Now that I have some data created from the logs from the Kali VM to the SIEM, I can go back to Elastic to start querying and analyzing the logs in the SIEM.
Now back inside the Elastic Deployment, I go back to the “Logs” tab under “Observability” to view the logs from the Kali VM.
In the search bar, I can search query to filter the logs. For example, to search for all logs related to Nmap scans, enter the query: event.action: “nmap_scan” or process.args: “sudo”.
The results of the search query will be displayed in the table below. Now I have a platform to generating and analyzing different types of security events in Elastic SIEM such as, authentication failures by typing in the wrong password for a user or attempting SSH logins an incorrect password, which gives me a better understanding of how security incidents are detected, investigated, and responded to in real-world environments.
Dashboard to Visualize the Events
Part of being a SOC analysts is presenting this information to stakeholders and creating a big picture story for external team. So, I practiced created visualizations and dashboards in the SIEM app to analyze the logs and identify patterns or anomalies in the data.
Here’s how did that I that:
4. Click on the “Create Visualization” button to add a new visualization to the dashboard.
4. Select “Area” or “Line” as the visualization type, depending on your preference. This will create a chart that shows the count of events over time.
6. In the “Metrics” section of the visualization editor on the right, select “Count” as the vertical field type and “Timestamp” for the horizontal field. This will show the count of events over time.
7. Click on the “Save” button to save the visualization and then complete the rest of the settings.
Create an Alert
In a SIEM environments, alerts are a crucial feature for detecting security incidents and responding to them in a timely manner. Alerts are created based on predefined rules or custom queries, and can be configured to trigger specific actions when certain conditions are met. In my last step, I created a simple alert for my nmap logs.
Here are the steps:
Closing Paragraph
Setting up Elastic SIEM has been a game-changer for enhancing my ability to monitor and respond to security threats effectively. By creating alerts, like the one I configured for Nmap scans, I’ve ensured that potential threats can be detected in real time, giving me the opportunity to take action before an incident escalates. The flexibility of Elastic SIEM allows me to customize monitoring and alerting to meet the unique needs of my environment, making it an essential tool in my cybersecurity toolkit. With each rule and alert I set up, I’m building a stronger, more proactive defense against ever-evolving cyber threats. This journey has shown me the importance of starting small, refining as I go, and continuously improving my SIEM capabilities to stay ahead of potential risks.