Leveraging Snort for Enhanced Network Intrusion Detection

Ionut Vasile
3 min readJul 15, 2023

--

Source: Snort Blog

As cybersecurity professionals, we are continually seeking robust and effective tools to fortify our network defenses. One such tool is Snort, an open-source network Intrusion Detection System (IDS) that has proven to be an invaluable asset in threat detection. This article aims to provide a comprehensive guide on how to optimally utilize Snort 2, with a focus on its user-friendly signature language, packet capture analysis using Wireshark, and the application of Docker for running Snort.

Snort can be installed through your Linux distribution’s package manager, which conveniently resolves dependencies such as libpcap, libpcre, and libdnet. For BSD users, a Snort port is available. Alternatively, the more technically inclined may opt to compile Snort from the source, enabling additional debugging features and providing a deeper understanding of the system.

To streamline the setup process, I created a Docker container based on Debian. This container serves as an easy starting point for the deployment.

The effectiveness of Snort is contingent on its rule set. These rules can be obtained from the Snort website, which offers three categories: Community, Registered, and Subscriber. The Community rule set comprises rules submitted by community users, while the Registered rule set includes all of the Talos rules. The Subscriber rule set, a premium service, provides the latest rules as soon as they are published.

After downloading and decompressing the rule set, several directories become available. The ‘etc’ directory contains all the necessary configuration files for Snort, including the main configuration file, snort.conf. The ‘rules’ folder houses all the Snort textual files, which are categorized based on different rule categories.

Snort also needs to be directed to the location of compiled shared object files. This is achieved with the dynamic detection directory line in the configuration file.

Once the snort.conf is set up and the rules are correctly placed, it is beneficial to familiarize oneself with a few Snort command-line arguments. The ‘-C’ argument directs Snort to the location of the snort.conf file. The ‘-A’ argument selects an alert style, and ‘-Q’ configures Snort for inline mode, the recommended mode for running Snort.

In a practical application, I tested the new Snort configuration using a Docker container. The Docker image was built using the build.sh script, and the connect.sh script was used to mount the Snort ‘etc’ folder virtually into the Docker container. The configuration was then tested by instructing Snort to load the config without inspecting traffic. A successful validation of the Snort configuration was achieved, indicating a correct setup.

In a final piece, I enabled an HTTP inspect option that allows inspection inside compressed flash files. This was done by adding ‘decompress_SWF deflate lzma’ to the HTTP inspect preprocessor configuration section in the snort.conf file. After running Snort, an alert was generated, indicating that Snort was able to decompress the flash file and alert on the static key in the file data buffer.

Conclusion

Snort is a powerful tool in the arsenal of a cybersecurity expert. Its flexibility, open-source nature, and robust rule set make it an invaluable asset in network intrusion detection. By understanding its intricacies and leveraging its capabilities, we can significantly enhance our network defenses and stay one step ahead of potential threats.

--

--

Ionut Vasile
Ionut Vasile

Written by Ionut Vasile

An eager learner with a wide range area of understanding in different technologies.

No responses yet