Snort Lab
Snort Lab
Objective: Understand the concept of Intrusion Detection System, particularly installation and setup of
SNORT.
Topology
The following will be the topology used for this lab. Note that the IP addresses are examples only. When
working on the lab, use the actual IP addresses as indicated by the instructors. For the purpose of this
guide, the IP address of 192.168.30.X or 2001:db8:1::X will refer to your Virtual Machine (VM).
[group1.apnictraining.net] [192.168.30.1]
[group2.apnictraining.net] [192.168.30.2]
[group3.apnictraining.net] [192.168.30.3]
...................
[group30.apnictraining.net] [192.168.30.30]
Lab Notes
ifconfig
OR
ip route show | grep " src " | cut -d " " -f 3,12
In this guide the interface name is eth0 . Depending on the version of Ubuntu the interface
name may be enp0s3 or something different. Where eth0 is used in this guide replace it
with your interface name.
Install SNORT
1. Update the list of Ubuntu repos to download resources from.
3. Install snort.
It will ask for your HOME_NET address. For this lab define it as your host IP. Example, for group 11 it
will be 192.168.30.11/32 . If required it can be changed by modifying the snort.debian.conf file.
whereis snort
snort -? | more
-? display options and help
Configure SNORT
1. During installation process you defined the HOME_NET. To confirm the HOME_NET and Interface
related configuration from /etc/snort/snort.debian.conf
3. For the purpose of this lab, disable all predefined rules (ruleset) except local.rules from the
snort.conf file:
sudo vi /etc/snort/snort.conf
This is a big configuration file. To disable (put # ) on all the line having include $RULE_PATH (in Step 7
of configuration file) except include $RULE_PATH/local.rules . We will put all our local rules
in the include $RULE_PATH/local.rules file.
To enable alert log; comment out the following line (by adding # before the line and is in Step 6 in the
configuration file):
4. Save and quit editing the snort.conf file, by pressing ESC then :wq key combination.
6. Start SNORT.
or
SNORT rules
Snort rules are divided into two logical sections:
1. Rule Header: The rule header contains the rule's action, protocol, source and destination IP
addresses and netmasks, and the source and destination ports information.
2. Rule Options: The rule option section contains alert messages and information on which parts of the
packet should be inspected to determine if the rule action should be taken.
http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node28.html
sudo vi /etc/snort/rules/local.rules
alert ip any any -> any any (msg: "IP Packet detected"; sid: 10000;)
ping 127.0.0.1
sudo su
tail -f /var/log/snort/alert
6. REMOVE (or comment out) the bad rule from local.rules once you have seen the alert!
SNORT Exercises
Exercise 1 : Write a rule to check XMAS scan on your server from external network
Exercise 2 : Write a rule to check any external network access to the webserver /admin pages
Content matching
Exercise 3 : Write a rule to check SSH brute force attack and log IP trying to connect more than 3 times in
60 seconds (the threshold option may be deprecated*)
Detection Filter
***END OF EXERCISE***
version: 20201105