ISL Lab Manual
ISL Lab Manual
ISL Lab Manual
Lab Manual
Semester-VI
Subject: Information Security Lab
Even Semester
1
List of Experiments
Sr. No. Experiments Name
Implementation of DES algorithm for data encryption
1
2 Implementation of Asymmetric Encryption Scheme – RSA
4 Study the use of network reconnaissance tools like WHOIS, dig, traceroute, nslookup
to gather information about networks and domain registrars.
5 Study of packet sniffer tools like wireshark, ethereal, tcpdump etc. Use the tools to do
the following
1. Observer performance in promiscuous as well as non-promiscous mode.
2. Show that packets can be traced based on different filters.
6 Download and install nmap. Use it with different options to scan open ports,perform
OS fingerprinting, do a ping scan, tcp port scan, udp port scan, etc.
7 Detect ARP spoofing using open source tool ARPWATCH.
13 Mini project
2
3
Information Security Laboratory
Experiment No. : 1
4
Experiment No. 1
1. Aim: Study the use of network reconnaissance tools like WHOIS, dig, traceroute,
nslookup to gather information about networks and domain registers
2. Objectives: To know how to gather information about the networks by using different
n/w reconnaissance tools.
Understand, identify, analyze and design the problem, implement the same
using current techniques, skills, and tools and validate the solution
including both hardware and software.
Use network-based tools for network analysis.
5. Theory:
Examples:
2. Dig - Dig is a networking tool that can query DNS servers for information. It can
be very helpful for diagnosing problems with domain pointing and is a
5
good way to verify that your configuration is working. The most basic way to
use dig is to specify the domain we wish to query: dig example.com
3. Traceroute - Traceroute prints the route that packets take to a network host.
Traceroute utility uses the TTL field in the IP header to achieve its operation. For
users who are new to TTL field, this field describes how much hops a particular
packet will take while traveling on network. So, this effectively outlines the
lifetime of the packet on network. This field is usually set to 32 or 64. Each
time the packet is held on an intermediate router, it decreases the TTL value by 1.
When a router finds the TTL value of 1 in a received packet then that packet
is not forwarded but instead discarded. After discarding the packet, router sends
an ICMP error message of ―Time exceeded‖ back to the source from where
packet generated. The ICMP packet that is sent back contains the IP address of the
router. So now it can be easily understood that traceroute operates by sending
packets with TTL value starting from 1 and then incrementing by one each time.
Each time a router receives the packet, it checks the TTL field, if TTL field is 1
then it discards the packet and sends the ICMP error packet containing its IP
address and this is what traceroute requires. So traceroute incrementally fetches
the IP of all the routers between the source and the destination.
6
the IP address of microsoft.com is, you could run the command:
nslookup microsoft.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative
answer: Name:
microsoft.com
Address: 134.170.185.46
Name:
microsoft.com
Address: 134.170.188.221
Here, 8.8.8.8 is the address of our system's Domain Name Server. This is the server our
system is configured to use to translate domain names into IP addresses. "#53" indicates that
we are communicating with it on port 53, which is the standard port number domain name
servers use to accept queries. Below this, we have our lookup information for
microsoft.com. Our name server returned two entries, 134.170.185.46 and 134.170.188.221.
This indicates that microsoft.com uses a round robin setup to distribute server load. When
you accessmicrsoft.com, you may be directed to either of these servers and your packets
will be routed to the correct destination.You can see that we have received a "Non-
authoritative answer" to our query. An answer is "authoritative" only if our DNS has the
complete zone file information for the domain in question. More often, our DNS will have
a cache of information representing the last authoritative answer it received when it made
a similar query, this information is passed on to you, but the server qualifies it as "non-
authoritative": the information was recently received from an authoritative source, but the
DNS server is not itself thatauthority.
7
Using nslookup to enumerate basic mx records
4. Conclusion:
In this experiment you learned how to take the first steps toward ethical hacking.
Information gathering, in the form of reconnaissance, foot printing, and social
engineering, is necessary to learn as much about the target as possible. By
following the information-gathering methodology, ethical hackers can ensure they
are not missing any steps and valuable information.Time spent in the information-
gathering phase is well worth it to speed up and produce successful hacking
exploits.
5. Viva Questions:
8
6. References:
http://www.howtogeek.com/134132/how-to-use-traceroute-to-identify-network-
problems/
http://www.networksolutions.com/whois/index.jsp?bookmarked=84d1182fe7fc4e
af63cca54a21b1:9jF4
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=r
ja&uact=8&ved=0ahUKEwig2r6Fnc3NAhUBsI8KHVIWBd4QFggmMAI&url=h
ttp%3A%2F%2Fwww.tecmint.com%2F10-linux-dig-domain-information-groper-
commands-to-query-
dns%2F&usg=AFQjCNGQMPoL_ye2s1WW8UMerEFnSX_Xfw&sig2=38vl1gO
rm3zmMkLN7RVHBw
https://technet.microsoft.com/en-us/library/aa997324(v=exchg.65).aspx
9
Information Security Laboratory
Experiment No. : 2
10
Experiment No. 2
1. Aim: Study of packet sniffer tools like wireshark, ethereal, tcpdump etc
Identify different packets moving in/out of network using packet sniffer for
network analysis.
Understand professional, ethical, legal, security and social issues and
responsibilities. Also will be able to analyze the local and global impact of
computing on individuals, organizations, and society.
Match the industry requirements in the domains of Database management,
Programming and Networking with the required management skills.
5. Theory:
Wireshark, a network analysis tool formerly known as Ethereal, captures packets in real
time and display them in human-readable format. Wireshark includes filters, color-coding
and other features that let you dig deep into network traffic and inspect individual packets.
Applications:
Network administrators use it to troubleshoot network problems
Network security engineers use it to examine security problems
Developers use it to debug protocol implementations
People use it to learn network protocol internals beside these examples can be
helpful in many other situations too.
11
Features:
Capturing Packets
After downloading and installing wireshark, you can launch it and click the name of an
interface under Interface List to start capturing packets on that interface. For example, if you
want to capture traffic on the wireless network, click your wireless interface. You can
configure advanced features by clicking Capture Options.
12
As soon as you click the interface‘s name, you‘ll see the packets start to appear in real time.
Wireshark captures each packet sent to or from your system. If you‘re capturing on a
wireless interface and have promiscuous mode enabled in your capture options, you‘ll also
see other the other packets on the network.
13
Click the stop capture button near the top left corner of the window when you want to stop
capturing traffic.
14
Wireshark uses colors to help you identify the types of traffic at a glance. By default,
green is TCP traffic, dark blue is DNS traffic, light blue is UDP traffic, and black identifies
TCP packets with problems — for example, they could have been deliveredout-of-order.
15
Filtering Packets
If you‘re trying to inspect something specific, such as the traffic a program sends when
phoning home, it helps to close down all other applications using the network so you can
narrow down the traffic. Still, you‘ll likely have a large amount of packets to sift through.
That‘s where Wireshark‘s filters come in.
The most basic way to apply a filter is by typing it into the filter box at the top of the
window and clicking Apply (or pressing Enter). For example, type ―dns‖ and you‘ll see
only DNS packets. When you start typing, Wireshark will help you autocomplete your
filter.
16
Another interesting thing you can do is right-click a packet and select Follow TCPStream
17
You‘ll see the full conversation between the client and the server.
18
Close the window and you‘ll find a filter has been applied automatically — Wireshark is
showing you the packets that make up the conversation.
19
Inspecting Packets
Click a packet to select it and you can dig down to view its details.
20
You can also create filters from here — just right-click one of the details and use the
Apply as Filter submenu to create a filter based on it.
21
Wireshark is an extremely powerful tool, and this tutorial is just scratching the surface of
what you can do with it. Professionals use it to debug network protocol implementations,
examine security problems and inspect network protocol internals.
6. Conclusion:
In this experiment we analyze various packet sniffing tools that monitor network
traffic transmitted between legitimate users or in the network. The packet sniffer is
network monitoring tool. It is opted for network monitoring, traffic analysis,
troubleshooting, Packet grapping, message, protocol analysis, penetration testing and
many other purposes.
7. Viva Questions:
22
How to sniff passwords with wireshark?
List packet sniffing tools other than mentioned above?
8. References:
http://netsecurity.about.com/od/informationresources/a/What-Is-A-Packet-
Sniffer.htm
https://samsclass.info/120/proj/p3-wireshark.htm
http://sectools.org/tag/sniffers/
23
Information Security Laboratory
Experiment No. : 3
24
Experiment No. 3
1. Aim: Download and install nmap. Use it with different options to scan open
ports,perform OS fingerprinting, do a ping scan, tcp port scan, udp port scan, etc.
2. Objectives: objective of this module to learn nmap installation & use this to scan
different ports.
Host Discovery – Identifying hosts on a network. For example, listing the hosts which
respond to pings or have a particular port open.
Port Scanning – Enumerating the open ports on one or more target hosts.
25
Version Detection – Interrogating listening network services listening on remote devices
to determine the application name and version number.
SYN scan is the default and most popular scan option for good reasons. It can be
performed quickly, scanning thousands of ports per second on a fast network not
hampered by restrictive firewalls. It is also relatively unobtrusive and stealthy since it never
completes TCP connections.
26
FIN scan (-sF)
27
-sV (Version detection) :Enables version detection, as discussed above. Alternatively, we can
use -A, which enables version detection among other things.
28
-PO protocol list (IP Protocol Ping) :
The newest host discovery option is the IP protocol ping, which sends IP packets with the
specified protocol number set in their IP header. The protocol list takes the same format as do
port lists in the previously discussed TCP, UDP and SCTP host discovery options.
29
-p port ranges (Only scan specified ports) .
This option specifies which ports you want to scan and overrides the default. Individual port
numbers are OK, as are ranges separated by a hyphen (e.g. 1-1023). The beginning and/or
end values of a range may be omitted, causing Nmap to use 1 and 65535, respectively.
30
-sO (IP protocol scan) .
IP protocol scan allows you to determine which IP protocols (TCP, ICMP, IGMP, etc.) are
supported by target machines. This isn´t technically a port scan, since it cycles through IP
protocol numbers rather than TCP or UDP port numbers.
31
--open (Show only open (or possibly open) ports) .
Sometimes you only care about ports you can actually connect to (open ones), and don´t want
results cluttered with closed, filtered, and closed|filtered ports.
32
-p port ranges (Only scan specified ports) .
This option specifies which ports you want to scan and overrides the default. Individual port
numbers are OK, as are ranges separated by a hyphen (e.g. 1-1023). The beginning and/or
end values of a range may be omitted, causing Nmap to use 1 and 65535, respectively.
33
-sT (TCP connect scan) .
TCP connect scan is the default TCP scan type when SYN scan is not an option. This is the
case when a user does not have raw packet privileges or is scanning IPv6 networks. Instead
of writing raw packets as most other scan types do, Nmap asks the underlying operating
system to establish a connection with the target machine and port by issuing the connect
system call. Along with spoofing.
34
Null scan (-sN):
35
--top-ports <integer of 1 or greater>
36
-PS port list (TCP SYN Ping) .
This option sends an empty TCP packet with the SYN flag set. The default destination port is
80 (configurable at compile time by changing DEFAULT_TCP_PROBE_PORT_SPEC
innmap.h). Alternate ports can be specified as a parameter. The syntax is the same as for the
-p except that port type specifiers like T: are not allowed.
37
nmap –iflist
host interface and route information with nmap by using ―–iflist‖ option.
38
6. Conclusion:
Network scanning provides a wealth of information about the target network, which is
valuable regardless of whether you're trying to attack the network or protect it from
attack. While performing a basic scan is a simple matter, the network scanners
covered in this experiment provide a wide array of options to tweak your scan to
achieve the best results. Nmap is used to detect IP spoofing and port scanning.
7. Viva Questions:
8. References:
https://nmap.org/docs/discovery.pdf
https://nmap.org/book/install.html#inst-already
39
https://books.google.co.in/books?id=hyi5BgAAQBAJ&pg=PA205&lpg=PA205&
dq=phases+of+nmap&source=bl&ots=BCACFIV8by&sig=QQ6BLonVo1UBblw
rdogaNJ_1FKI&hl=en&sa=X&ved=0ahUKEwiDjofJoc3NAhUESI8KHa1rBqsQ6
AEITTAJ#v=onepage&q=phases%20of%20nmap&f=false
40
Information Security Laboratory
Experiment No. : 4
41
Experiment No. 4
1. Aim: Detect ARP spoofing using open source tool ARPWATCH.
2. Objectives: Objective of the module to find ARP spoofing using open source.
5. Theory:
To watch a specific interface, type the following command with ‗-i‗ and device name.
So, whenever a new MAC is plugged or a particular IP is changing his MAC address on the
network, you will notice syslog entries at ‗/var/log/syslog‗ or ‗/var/log/message‗ file.
Sample Output
42
The above output displays new workstation. If any changes are made, you will get following
output.
You can also check current ARP table, by using following command.
Sample Output:
If you want to send alerts to your custom email id, then open the main configuration
file‗/etc/sysconfig/arpwatch‗ and add the email as shown below.
43
6. Conclusion:
Arpwatch is a software or program tool for monitoring Address Resolution
Protocol traffic on a computer network. Its main goal is to detect arp poisoning
attacks like (e.g. ARP Poisoning, Ettercap, and Netcut) also detect intruders in your
network by sending an email to an administrator when new Ethernet MAC addresses
seen on the network.
7. Viva Questions:
8. References:
http://www.veracode.com/security/arp-spoofing
http://searchsecurity.techtarget.com/definition/IP-spoofing
44
Information Security Laboratory
Experiment No. : 5
45
Experiment No. 5
1. Aim: Use the Nessus tool to scan the network for vulnerabilities.
5. Theory:
Nessus is a proprietary comprehensive vulnerability scanner which is developed by Tenable
Operation
Default passwords, a few common passwords, and blank/absent passwords on some system
accounts. Nessus can also call Hydra (an external tool) to launch a dictionary attack.Denials
of service against the TCP/IP stack by using malformed packets
On UNIX (including Mac OS X), it consists of nessusd, the Nessus daemon, which does the
scanning, and nessus, the client, which controls scans and presents the vulnerability results to
the user. In typical operation, Nessus begins by doing a port scan with one of its four internal
46
port scanners (or it can optionally use AmapM[4] or Nmap[5]) to determine which ports are
open on the target and then tries various exploits on the open ports. The vulnerability tests,
available as subscriptions, are written in NASL(Nessus Attack Scripting Language), a
scripting language optimized for custom network interaction. Tenable Network Security
produces several dozen new vulnerability checks (called plugins) each week, usually on a
daily basis. These checks are available for free to the general public; commercial customers
are not allowed to use this Home Feed any more. The Professional Feed (which is not free)
also give access to support and additional scripts (e.g. audit files, compliance tests, additional
vulnerability detection plugins). Optionally, the results of the scan can be reported in various
formats, such as plain text, XML, HTML and LaTeX. The results can also be saved in a
knowledge base for debugging. On UNIX, scanning can be automated through the use of a
command-line client. There exist many different commercial, free and open source tools for
both UNIX and Windows to manage individual or distributed Nessus scanners. If the user
chooses to do so (by disabling the option 'safe checks'), some of Nessus' vulnerability test
may try to cause vulnerable services or operating systems to crash. This lets a user test the
resistance of a device before putting it in production. Nessus provides additional functionality
beyond testing for known network vulnerabilities. For instance, it can use Windows
credentials to examine patch levels on computers running the Windows operating system, and
can perform password auditing using dictionary and brute force methods. Nessus 3 and later
can also audit systems to make sure they have been configured per a specific policy, such as
the NSA's guide for hardening Windows servers.
47
Basic Network scanning:
48
Ntstat port scanning:
49
Vulnerability Mapping:
50
Policies:
Plugins:
51
General Scanning:
52
Port Scanning:
6. Conclusion:
Running a security scanner against your systems is a very important part of the job. It is a
system administrator or security officer‘s job to keep their systems secure and the data
contained in them safe. Hackers have access to all the same information and tools that the rest
of us do. Hackers run the very same tools and it is advantageous to know what the results are
that they see if they scan your system. They find time to do the research, so we must also.
Nessus provides a lot of functionality in one tool. It utilizes Nmap, easy to update plug-ins,
and nice reporting tools for upper management. It is has repeatedly scored high on
comparisons between scanners including commercial scanners that come with a hefty price
tag. And of course as budgets tighten, remember Nessus is a free tool. The only cost is the
users time in learning it and using it, but that is a cost associated with all tools. And luckily
53
Nessus is an easy to learn tool. Using this tool and seeing the vulnerabilities will help you
gain knowledge of your systems and help teach you how to protect them.
7. Viva Questions:
8. References:
http://www.tenable.com/products/nessus/nessus-faq
https://docs.tenable.com/nessus/6_7/index.htm#getting_started/hardware.htm
http://www.symarntec.com/connect/articles/introduction-nessus
https://docs.tenable.com/nessus/6_7/index.htm#getting_started/Browsers.htm%3F
TocPath%3DGetting%2520Started%7CSystem%2520Requirements%7C 3
54
Information Security Laboratory
Experiment No. : 6
55
Experiment No. 6
1. Aim: Implement a code to simulate buffer overflow attack.
5. Theory:
A buffer overflow, or buffer overrun, is an anomaly where a program, while writing data to a
buffer, overruns the buffer's boundary and overwrites adjacent memory locations. This is a
special case of the violation of memory safety.
A buffer overflow occurs when a program or process tries to store more data in a buffer
(temporary data storage area) than it was intended to hold.
Buffer overflow:
Code:
#include <stdio.h>
#include <string.h>
56
int main(void)
char buff[15];
int pass = 0;
gets(buff);
if(strcmp(buff, "thecorrectpaswd"))
else
pass = 1;
if(pass)
return 0;
Output :
57
>>administrator@PIIT-05:~/Desktop/me CS pracs$ gcc -Wall -fno-stack-protector
bufferoverflow.c -o
>>bufferoverflow
The above command deactivates the default GC Compiler's flag which detects Stack
Smashing
thewrong
Wrong Password
thecorrectpaswd
Correct Password
thewrongpasswordentered
Wrong Password
Here, the entered password length is above the permissible length with wrong contents still
the user is given the ROOT PRIVILEDGES. This demonstrates the Buffer Overflow.
58
6. Conclusion:
Buffer overflow has been the most exploited vulnerability for more than a decade.
Buffer overflow vulnerabilities are the most common way to gain control of a remote
host. Attacker can insert and execute attack code. Error is made at program creation,
is invisible to user. StackGuard is a systematic compiler tool that prevents a broad
class of buffer overflow security attacks from succeeding.
7. Viva Questions:
8. References:
http://www.windowsecurity.com/articles-
tutorials/windows_os_security/Analysis_of_Buffer_Overflow_Attacks.html
http://searchsecurity.techtarget.com/news/1048483/Buffer-overflow-attacks-How-
do-they-work
https://www.owasp.org/index.php/Buffer_overflow_attack
59
Information Security Laboratory
Experiment No. : 7
60
Experiment No. 7
1. Aim: Set up IPSEC under LINUX.
5. Theory:
Internet Protocol Security (IPsec) is a protocol suite for securing Internet Protocol (IP)
communications by authenticating and encrypting each IP packet of a communication
session. IPsec includes protocols for establishing mutual authentication between agents at the
beginning of the session and negotiation of cryptographic keys to be used during the session.
IPsec can be used in protecting data flows between a pair of hosts (host-to-host), between a
pair of security gateways (network-to-network), or between a security gateway and a host
(network-to-host).
Internet Protocol security (IPsec) uses cryptographic security services to protect
communications over Internet Protocol (IP) networks. IPsec supports network-level peer
authentication, data origin authentication, data integrity, data confidentiality (encryption), and
replay protection.
IPsec is an end-to-end security scheme operating in the Internet Layer of the Internet Protocol
Suite, while some other Internet security systems in widespread use, such as Transport Layer
Security (TLS) and Secure Shell (SSH), operate in the upper layers at Application layer.
Hence, only IPsec protects any application traffic over an IP network. Applications can be
automatically secured by IPsec at the IP layer.
61
The following commands will add the werner-jaeger PPA into your repo's, and then install
the 'l2tp-ipsec-vpn' package:
>>sudo apt-add-repository ppa:werner-jaeger/ppa-werner-vpn
>>sudo apt-get update
>>sudo apt-get install l2tp-ipsec-vpn
· Now, we will whitelist our system tray which will allow our newly installed package to
show up on our system tray:
After whitelisting our system tray, it's imperative that you reboot/restart your
machine.
Once your machine has rebooted, click on the new icon, and click 'Edit
Connections ...' from the menu.
This will show the "VPN Connections" window. Click the "Add ..." button
and set the connection name to anything you'd like, e.g. "HostVPN-L2TP",
and click "OK".
62
Now select your newly added connection, and click "Edit ...".
On the IPSec tab, set the remote server to the server name from your HostVPN
e-mail. Select the "Use pre-shared key for authentication" and enter your PSK
from the HostVPN e-mail.
63
On the PPP tab, select "Allow these protocols", and ensure all are selected
except "Microsoft CHAP Version 2 (MS-CHAPv2)". Fill in the "User name:"
and "Password:" fields with your HostVPN username and password, and then
click "OK". Now click "Close" on the "VPN Connections" window.
64
Click on the L2TP/IPSec VPN icon in the systray again and click on the
connection name that we just created.
65
6. Conclusion:
IPsec is an end-to-end security scheme operating in the Internet Layer of the Internet
Protocol Suite. IPsec protects all application traffic over an IP network. Also IPsec
supports network-level peer authentication, data origin authentication, data integrity,
data confidentiality (encryption), and replay protection.
7. Viva Questions:
8. References:
http://www.ciscopress.com/articles/article.asp?p=24833&seqNum=6
https://raymii.org/s/tutorials/IPSEC_L2TP_vpn_with_Ubuntu_14.04.html
https://riobard.com/2010/04/30/l2tp-over-ipsec-ubuntu/
66
Information Security Laboratory
Experiment No. : 8
67
Experiment No. 8
1. Aim: Install IDS (e.g. SNORT) and study the logs.
5. Theory:
Snort is an intrusion detection system written by Martin Roesch. Snort is a lightweight
network intrusion detection system, capable of performing real-time traffic analysis and
packet logging on IP networks. It can perform protocol analysis, content searching/matching
and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth
port scans, CGI attacks, SMB probes, OS fingerprinting attempts, and much more. Snort uses
a flexible rules language to describe traffic that it should collect or pass, as well as a detection
engine that utilizes a modular plugin architecture.
Sniffer mode, which simply reads the packets off of the network and displays them
for you in a continuous stream on the console (screen).
Packet Logger mode, which logs the packets to disk.
Network Intrusion Detection System (NIDS) mode, the most complex and
configurable configuration, which allows Snort to analyze network traffic for matches
against a user-defined rule set and performs several actions based upon what it sees.
68
Inline mode, which obtains packets from iptables instead of from libpcap and then
causes iptables to drop or pass packets based on Snort rules that use inline-specific
rule types
Sniffer Mode:
If you just want to print out the TCP/IP packet headers to the screen (i.e. sniffer mode), try
following, this command will run Snort and just show the IP and TCP/UDP/ICMP headers,
nothing else.
./snort –v
If you want to see the application data in transit, try the following, this instructs Snort to
display the packet data as well as the headers.
./snort –vd
If you want an even more descriptive display, showing the data link layer headers, do this:
./snort -vde
If you just specify a plain -l switch, you may notice that Snort sometimes uses the address of
the remote computer as the directory in which it places packets and sometimes it uses the
local host address. In order to log relative to the home network, you need to tell Snort which
network is the home network:
69
./snort -dev -l ./log -h 192.168.1.0/24
This rule tells Snort that you want to print out the data link and TCP/IP headers as well as
application data into the directory ./log, and you want to log the packets relative to the
192.168.1.0 class C network. All incoming packets will be recorded into subdirectories of the
log directory, with the directory names being based on the address of the remote (non-
192.168.1) host.
Note: Note that if both the source and destination hosts are on the home network, they are
logged to a directory with a name based on the higher of the two port numbers or, in the case
of a tie, the source address.
Once the packets have been logged to the binary file, you can read the packets back out of the
file with any sniffer that supports the tcpdump binary format (such as tcpdump or Ethereal).
Snort can also read the packets back by using the -r switch, which puts it into playback mode.
Packets from any tcpdump formatted file can be processed through Snort in any of its run
modes. For example, if you wanted to run a binary log file through Snort in sniffer mode to
dump the packets to the screen, you can try something like this:
You can manipulate the data in the file in a number of ways through Snort's packet logging
and intrusion detection modes, as well as with the BPF interface that's available from the
command line. For example, if you only wanted to see the ICMP packets from the log file,
simply specify a BPF filter at the command line and Snort will only see the ICMP packets in
the file:
To enable Network Intrusion Detection System (NIDS) mode so that you don't record every
single packet sent down the wire, try this:
70
./snort -dev -l ./log -h 192.168.1.0/24 -c snort.conf
where snort.conf is the name of your rules file. This will apply the rules configured in the
snort.conf file to each packet to decide if an action based upon the rule type in the file should
be taken. If you don't specify an output directory for the program, it will default to
/var/log/snort.
One thing to note about the last command line is that if Snort is going to be used in a long
term way as an IDS, the -v switch should be left off the command line for the sake of speed.
The screen is a slow place to write data to, and packets can be dropped while writing to the
display.
It's also not necessary to record the data link headers for most applications, so you can
usually omit the -e switch, too.
This will configure Snort to run in its most basic NIDS form, logging packets that trigger
rules specified in the snort.conf in plain ASCII to disk using a hierarchical directory structure
(just like packet logger mode).
Inline Mode:
Snort 2.3.0 RC1 integrated the intrusion prevention system (IPS) capability of Snort Inline
into the official Snort project. Snort Inline obtains packets from iptables instead of libpcap
and then uses new rule types to help iptables pass or drop packets based on Snort rules.
There are three rule types you can use when running Snort with Snort Inline:
drop - The drop rule type will tell iptables to drop the packet and log it via usual
Snort means.
reject - The reject rule type will tell iptables to drop the packet, log it via usual Snort
means, and send a TCP reset if the protocol is TCP or an icmp port unreachable if the
protocol is UDP.
sdrop - The sdrop rule type will tell iptables to drop the packet. Nothing is logged.
71
When using a reject rule, there are two options you can use to send TCP resets:
- You can use a RAW socket (the default behavior for Snort Inline), in which case you
must have an interface that has an IP address assigned to it. If there is not an interface
with an IP address assigned with access to the source of the packet, the packet will be
logged and the reset packet will never make it onto the network.
- You can also now perform resets via a physical device when using iptables. We take the
indev name from ip_queue and use this as the interface on which to send resets. We no
longer need an IP loaded on the bridge, and can remain pretty stealthy as the config
layer2_resets in snort_inline.conf takes a source MAC address which we substitue for the
MAC of the bridge.
For example:
config layer2resets
tells Snort Inline to use layer2 resets and uses the MAC address of the bridge as the
source MAC in the packet, and:
will tell Snort Inline to use layer2 resets and uses the source MAC of 00:06:76:DD:5F:E3
in the reset packet.
6. Conclusion:
SNORT is an open source network intrusion prevention and detection system utilizing
a rule-driven language, which combines the benefits of signature, protocol and
anomaly based inspection methods.
72
7. Viva Questions:
8. References:
http://www.thegeekstuff.com/2010/08/snort-tutorial/
https://www.howtoforge.com/intrusion_detection_base_snort
https://www.snort.org/
73
Information Security Laboratory
Experiment No. : 9
74
Experiment No. 9
1. Aim: Use of iptables in linux to create firewalls
5. Theory:
IPtables are the tables provided by the Linux kernel firewall (implemented as different
Netfilter modules) and the chains and rules it stores. Different kernel modules and programs
are currently used for different protocols; iptables applies to IPv4, ip6tables to IPv6, arptables
to ARP, and ebtables to Ethernet frames.
iptables requires elevated privileges to operate and must be executed by user root, otherwise
it fails to function. On most Linux systems, iptables is installed as /usr/sbin/iptables
and documented in its man pages which can be opened using man iptables when installed. It
may also be found in /sbin/iptables, but since iptables is more like a service rather than an
"essential binary", the preferred location remains /usr/sbin.
# sudo iptables -L -v –n
75
2. Only Block Incoming Traffic
# sudo iptables -L -v –n
host -t a hostname
6. Conclusion:
There are many other firewall utilities and some that may be easier, but iptables is a
good learning tool, if only because it exposes some of the underlying netfilter
structure and because it is present in so many systems.
7. Viva Questions:
8. References:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-
using-iptables-on-ubuntu-14-04
http://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-
firewall/
76
Information Security Laboratory
Experiment No. : 10
Mini Project
77
Experiment No. 10
1. Aim: Mini Project
5. Theory:
6. Conclusion:
The implementation of mini project will provide the student opportunity to explore
even other available tools for performing network analysis and finding vulnerability,
threats and attack on the host and network.
7. Viva Questions:
Viva Questions will be asked based on the mini project implemented.
78