SnortCP - 20 - Lab Answers
SnortCP - 20 - Lab Answers
com
. Snort
Successful completion of this exercise would yield a fully functional Snort installation with a GUI application
(BASE) to view alert data and a database with which to store alert data.
_
- Module 4: Managing Unified Output with Barnyard2
o Set the hostname and interface directive in the Barnyard2 configuration file as follows:
config hostname: snortbox
config interface: ethl
o Uncomment the following entries and modify as needed:
confi g wa ldo_file: /tm p/wa ldo
config archivedir: /tmp
confi g process_new_records_on ly
barnyard2 \
-c / etc/ snortlbarnYard2' conf \
-d, /var/Loglsnort \
-f merged. log
. Locate the Snort@ startup script and review - lssue the command shown below and observe the
configuration options.
. Test the Snorto configuration file - Use the command shown below to test the Snort@
configuration.
o One that triggers a rule with client-side reassembly enabled and a client-side content match
o One that triggers a rule with server-side reassembly enabled and a server-side content match
To perform this lab, you issue a command that displays the alert data in the console window with a
command line switch that shows the reassembled session data along with the alert. The ctient-side alert
shows the reassembled client-side session data, and the server-side alert shows the reassembled server-side
session data.
http://it4training.com
- . The other file contains a session from a host that uses the first packet it sees for TCP reassembly and
ignores subsequent packets if there is an overlap (several operating systems exhibit this behavior)
Since the Snort reassembly policy is set to perform BSD-style reassembly, the alert data displayed in the
console after running the command shows a correctly reassembled session as indicated by the complete
alphabet in the session payload. The alert that triggers for the first-style PCAP shows that some of the letters
- of the alphabet are missing from the session payload. This indicates that with Snort correctly configured, the
session is rebuilt properly whereas the session data from the other host is not.
- . Configure the PulledPork configuration file to grab an updated rule set from the host Snortbox in
your virtual network infrastructure. Make the entries outlined in the lab section of the student
guide.
The -w allows us to see the actions that are occuring. Restart Barnyard2 and Snort.
http://it4training.com
ftIcdeule *: Rules
Lab #7: Writing Custom Rules
Edit your local-. rul-es file on snortbox so it contains the following rules:
o A second rulethat matches on your first name and is several bytes deeper into the payload.
Augment the rule with offset and depth constraints.
o A third rule with multiple content statements using your first and last name. Place the second
content statement a distance of 2 bytes from the first content statement. Constrain the first content
with offset/depth and the second with distance/within,
o Move the content in the payload to see what it takes to break the rule.
You will use the UDPflood tool on student desktop to enter content into the payload and deliver the
packets.
1. Assuming your name is Joe Smith, the first rule would look as follows:
al-ert udp any any -> any any (msg:"Lab ru1e L"; content:,,joe,,; \
nocase; sid:1000000; )
2. Assuming you have moved the content to start at the 3td byte in the payload, your next rule would
look as follows:
J o e
alert udp any any -> any any (msg:"Lab rule 2"; content:"joe",. \
offset:2; depth:3; nocase; sid:1000001; )
http://it4training.com
3. Assuming you keep your content in the same position and you put the next content statement a
distance of 2 from the previous content statement, your rule would look as follows:
J o e s m I t h
afert udp any any -> any any (msg:"Lab rule 2"; content:"joe"; \
offset:2; depth:3,' nocasei content:"smith"; distance:2; within:5; \
nocase; sid:1000002; )
4. For the last portion of the lab, experiment with moving the content to different parts of the payload
and adjusting your rule accordingly.
You want to identify when someone tries to obfuscate a directory change within FTP. The command in question would
normally be transmitted as CWD test. Someone is trying to bypass detection by doing the following:
CWD /./test
CWD /././test
cw} l./.l.ltest
al_ert tcp any any -> any 21, (msg:,,pCRE Rule Lab,, ; \
pcre: "/CIdD\s (\/\. ) +\/tesL/,, ; sid: 1000004; )
o To test the rule, you can use the directions in the lab to verify if the rule triggers.
. /\di3) (t -l?)\d{2}\1\d{4}/
Module 12: Basic Snort Tuning
v
Lab #3: Execute a Scriptwith Swatch
Assuming you have Swatch and Snort working together property, this lab gives you an opportunity to
execute a preconfigured script in response to an alert. Follow the instructions in the manual to create an
lPTables entry automaticly. Be sure to execute swatch from the /etc/snort directory.
:
http://it4training.com
This module provides explicit step-by-step instructions for building an inline Snort IPS installation. Carefully
review each of the steps to make sure everything you need is in ptace and configured correctly.
This lab demonstrates one of the key capabilities of an intine installation which is the ability to block or drop
offending connections.
drop icmp SfXff nruRl_NET any -> 192.168.10.90 any ( msg/'Drop ping to Bleda"; sid:1000010;)
With this rule, you should be able to ping lamp, but not bleda.
Another interesting capability of and inline sensor is the ability to replace content as it passes through the
sensor if a rule is triggered. This lab demonstrates that capability. ln this lab, you will write a rule that
triggers when it detects an FTP connection in which the client attempts to enter the 'test' directory on
bleda's FTP server. When this condition is detected, it will replace the string 'test' with the string 'best'.
This module provides detailed instructions on how to build a distributed installation in which multiple
Snort
sensors report back to a common database. This installation includes secure, encrypted communications
between allof the hosts in this framework.
Once the
Using the procedures outlined in the student guide, perform the distributed installation.
installation is complete, you can test it as described in the module by sending scans from attila and student
desktop, and using the class_test.pl script on attila to generate alerts'
in the BASE
lf the installation is working properly, you should see alerts from both of the sensors displayed
interface on the LAMP server.
The goat of this lab is to use the host attribute table to define a host that is running
multiple HTTP services
on different ports and implement a rule that triggers on any of the HTTP services
running on that host even
192.158.133.253 as
The Host Attribute Table file is already configured. lt has defined a host at lP address
having HTTP services on ports 80 and 10000.
The rule you would write to trigger events on either of the ports is as follows:
Use the examples given in the student guide under the Basic MySQL Commands section to explore the
database schema for the Snort database on lamp.
The student guide provides detailed step-by-step instructions on how to perform a backup. Reference the
guide to perform this lab.
Use the procedure outlined in the student guide under the Archive Database section to create an archive
database. When the archive database is ready, use the BASE interface to move alert data into and out of the
archive database.
Use the procedures outlined in the student guide under the General Alert Management section to create
and use an alert group.
Use the information provided in the Performance Profiling section to configure both rule and preprocessor
profiling.
Use the instructions outlined in the student guide for testing the perfprofiling features
http://it4training.com
Linux Commands
- Svstem Commands
.- date [MMDDhhmm] - Set system date and time to the curent month, day, hour, minute.
ifconfig -a -
List information for all Ethernet interfaces.
ifconfig ethO - List information for just eth0.
man <cmd> - Open the help file for the specified command.
netstat Jtn - Show which processes are running, their names and ports.
ps -ef I grep <string> - Used to search to see if a process is running; i.e., snort.
pgrep <string> - A shortened version of the above command; shows only the PID.
less <filename> - Open a file (read only) with the ability to scroll 'up' and 'down'.
.. more <filename> - Open a file (read only) and format (size) to window.
rm [filename] [directory] - Delete the listed file or directory.
rm -rf rfirenamel rdirectorvl same
: fr'.'k*J:.3trj1"i:i"[:J1lll1"Jl"#l'.'"tilr,
mv </path/file> </path/file> - To rename a file.
:
http://it4training.com
Command Operation
File Actions:
l-----/etc/snort
I
l-----/etc/snort/rules
I
l..-- /bin
l--.- /sbin
I
Folder File(s)
/etclsnort Contains the Snort configuration file 'snort.conf' as well as several
'x.config' and '*.map' files. Barnyard 'conf' file will also be place here.
/etcisysconfig Contains the 'snort' file used at Snort startup. Read by the snortd script.
letclrcl.d Startup folder with the S99snortd entry that is linked to letclinrt.d/snortd to
start Snort at system startup.
lvarllog The "messages" file can be read to see latest process activity.
/varllog/snort Location of Snort 'Alert', 'Log' and 'Unified' files.
letclirnt.d Linux startup scripts, e.g. mysql, snortd
/etc/snort/rules Default Snort rule files as well as the "local.rules" file
/varllog/snort Location of Snort 'Alert', 'Log', and 'Unified' files
/usr/local Location of untar'd applications (Snort, PCRE, libpcap, libnet, etc.)
/usr/local/src Location of all the S/W we use in class
/usr/local/bin Location of the Snort binary. Linked to iusr/sbin.
lbin & /sbin System O/S binaries
http://it4training.com
Thank you for selecting Sourcefire as your security education patner. We hope you found this class
informative and enjoyable. In order to keep Sourcefire training at the security forefront, please complete
this evaluation form. For additional questions or comments email [email protected] or call 734-
743-6550.
1. Name:
4. The training team was helpful and courteous during the registration process.
6. The course provided "real world" examples that I can use in my day-to-day
environment.
7. The classroom labs were challenging and helped me better understand the
product features and functionality.
10. The training room was technically well equipped and functioned well.
12. The overall atmosphere of the training room was very comfortable and promoted
a good learning environment.
13. I clearly understood the objectives of this course and my expectations were met.
[]StronglyAgree []Agree IlDisagree Il StronglyDisagree t] N/A
16, Do you have any suggestions on what should be added or removed from this
course?
17. Would you be willing to act as a reference for this training program? ff yes,
please provide your contact information below.