top of page

Suricata Log Demonstration

Updated: May 25, 2024

Suricata Logo.

In this blog:


Installing Suricata:


I will be installing Suricata in Kali Linux, based on Debian 6.3.7.

Linux version command.
Linux version command.
Suricata user guide page.
Click here to see the Suricata user guide page.

There are different methods of installing Suricata; one of which includes downloading from source. This involves getting the source code from Suricata and building it. We will be focusing on binary package installations, which is far easier.  

Installing Suricata for Debian.
Installing Suricata for Debian.

Run Sudo apt update first, then run Sudo apt-get install suricata from the screenshot.

Click ‘y’ to confirm the download.

Installing Suricata command.
Installing Suricata command.

To confirm that Suricata has been installed, type Suricata -V to show its version number.

Suricata version command.
Suricata version command.
Suricata Release version.
Suricata Release version.

Managing permissions:


Before managing rule sets and sources, we need to set up permissions, according to the documentation. I will use the script from jstrosch on GitHub.

jstrosch GitHub page.
jstrosch GitHub page.

Copy the raw code into a bash script in terminal, with sudo permissions, otherwise you will not be able to save the file.

Bash script terminal.
Bash script terminal.

In order to execute the bash script, we need to modify its executable permissions using the ‘chmod’ command. Find the path to where you saved the bash script using ‘readlink -f’.

Finding path of saved bash script.
Finding path of saved bash script.

Run the chmod command to make the script executable.

Adding executable permissions on the file
Adding executable permissions on the file

Run the script with sudo.

Running the file.
Running the file.

Now we have the permissions set up. We can now continue to the next step, which is to run Suricata-update.

Rule sets and sources:


Run suricata-update list-sources. This lets us see our sources – where we are getting our rules from. We can get rules from vendors, GitHub or even use personal rules.

Listing the sources that Suricata uses.
Listing the sources that Suricata uses.

We can see the enabled sources by typing suricata-update list-enabled-sources. As you can see, we have no enabled sources.

Enabled sources in our Suricata environment.
Enabled sources in our Suricata environment.

Let’s say we want to enable the ‘et/open’ rule which is the Emerging Threats Open Ruleset.

Type suricata-update enable-source et/open.

Enabling 'et/open' service.
Enabling 'et/open' service.

Type suricata-update update-sources now to update the source list.

Listing enabled sources now gives us the et/open source we just added. 

Updating our source list.
Updating our source list.

Another great resource for open source Suricata rules is from Abuse.ch. Let’s add this as well.

Abuse.ch JA3 fingerprint ruleset.
Abuse.ch JA3 fingerprint ruleset.

The ja3 fingerprints are hashes generated from a TLS handshake. It is one way to try to fingerprint TLS handshakes, particularly those used by malware actors.

Enabling abuse.ch source.
Enabling abuse.ch source.

Type suricata-update disable-source [name of source] to remove a source list.

Disabling Abuse.ch source.
Disabling Abuse.ch source.

Adding different sources and rulesets allows Suricata to take advantage of the different sets out there and make more efficient decisions when creating alerts. This is not the case 100% of the time when new sources are added, however.

Ingesting Wireshark PCAP logs


I will demonstrate Suricata ingesting logs based on a malicious PCAP file. This shows Suricata performing an offline detection scan, which can be done on your personal files to check for malicious activity. Of course, for production environments, an online, real-time intrusion detection system is more effective.

I will use a malicious PCAP file from jstrosch’s GitHub, which also has other malware samples. 

Betabot malware docs GitHub repository.
Click here to see the Betabot malware docs GitHub repository.

Download both archive.zip and pcap.zip files. To open them, you will need the password ‘infected’. Move these files to the Suricata directory.

Extract the zip files to the Suricata directory.

Download both archive.zip and pcap.zip files. To open them, you will need the password ‘infected’. Move these files to the suricata directory.  Extract the zip files to the Suricata directory.
Extracting zip files to the Suricata directory.

This is the PCAP file.

PCAP file that we will be analysing.
PCAP file that we will be analysing.

Click the image below, to copy the raw pcap.sh script.

Click to see the raw script.
Click to see the raw script.

Copy the script into a bash script.

Change the permissions to executable as we did before, and run it in sudo mode.   

Copying script into a bash script.
Copying script into a bash script.

Run the command sudo ./[name of your file].sh betabot.pcap. If you get a no rule files error, run suricata-update and then try again. 

If you get an error saying jq can’t be found, that means you need to install jq.

JQ error.
JQ error.

Run sudo apt update and sudo apt install jq.

Run the command again.

Suricata has now given us alerts based on the malicious pcap file. 

Analysing network logs using Suricata.
Analysing network logs using Suricata.

Thanks for reading!


1 Comment

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Guest
May 25, 2024
Rated 4 out of 5 stars.

nice blog

Like
  • GitHub
  • Twitter
  • LinkedIn
bottom of page