Cyber Security Lab
Cyber Security Lab
S. No. Experiments
ALGORITHUM DESCRIPTION:
The method is named after Julius Caesar, who used it in his private
correspondence. The transformation can be represented by aligning two
alphabets; the cipher alphabet is the plain alphabet rotated left or right by some
number of positions.
RESULTS:
DESCRIPTION:
Diffie–Hellman Key Exchange establishes a shared secret between two parties
that can be used for secret communication for exchanging data over a public
network. It is primarily used as a method of exchanging cryptography keys for
use in symmetric encryption algorithms like AES. The algorithm in itself is very
simple. The process begins by having the two parties, Alice and Bob. Let's
assume that Alice wants to establish a shared secret with Bob.
EXAMPLE:
ALGORITHM:
STEP-1: Both Alice and Bob shares the same public keys g and p.
STEP-2: Alice selects a random public key a.
STEP-3: Alice computes his secret key A as ga mod p.
STEP-4: Then Alice sends A to Bob.
STEP-5: Similarly Bob also selects a public key b and computes his secret key as
B and sends the same back to Alice.
STEP-6: Now both of them compute their common secret key as the other
one’s secret key power of a
mod p.
PROGRAM:
(Diffie Hellman Key Exchange)
#include<stdio.h> #include<conio.h>
long long int power(int a, int b, int mod)
{
long long int t; if(b==1)
return a; t=power(a,b/2,mod); if(b%2==0) return (t*t)%mod; else
return (((t*t)%mod)*a)%mod;
}
long int calculateKey(int a, int x, int n)
{
return power(a,x,n);
}
void main()
{
int n,g,x,a,y,b; clrscr();
printf("Enter the value of n and g : ");
scanf("%d%d",&n,&g); printf("Enter the value of x for the first person : ");
scanf("%d",&x); a=power(g,x,n);
printf("Enter the value of y for the second person : ");
scanf("%d",&y); b=power(g,y,n);
printf("key for the first person is :
%lld\n",power(b,x,n));
printf("key for the second person is :
%lld\n",power(a,y,n)); getch();
}
OUTPUT:
A bruteforcer has three main logical components: A selection where the user
inputs specific location of the attack; Generating the passwords to test; Testing
the password. Having the user input the specific location to attack is arguably
the easiest part of writing a bruteforcer. This part can actually be "hard-coded"
(specified by the programmer so no input is required) so I was thinking of not
even mentioning it. But, I decided to bring it up as any bruteforcer meant to be
used by more then one person will include this. Let's say we've written a
bruteforcer that attacks Yahoo accounts. In this case, the bruteforcer will be
programmed to attack Yahoo accounts, but the user must input the Yahoo
account to specifically attack. This first component of the bruteforcer will handle
thus handles obtaining this information.
Once the bruteforcer knows what it is going to attack, it must generate the
password to try. In a sequential bruteforcer, the password tried each time will
be sequentially one step away from the last password tried. So, in a sequential
ascending bruteforcer, the bruteforcer will try the password 000001 followed
by 000002. This works in reverse in a sequential descending bruteforcer. The
programming of this is generally handled by writing a continuous loop which
breaks only when the password generated is successful. Meanwhile, a handful
of variables constantly increment with each run through the loop. When all of
the possible passwords are tried, the variables are all reset as low as possible,
the number of characters in the password is incremented or decremented, and
the process begins again with checking all of the passwords one character longer
or shorter then the last number of characters in a password. In practice,
this is simpler then it sounds. The last main component of a bruteforcer is
the part in which a bruteforcer checks to see if it's generated the correct
password. In some cases, this can surprisingly be the hardest part of the
bruteforcer to write. Using our Yahoo example again, writing this part of the
bruteforcer requires a knowledge of the Yahoo API. It's really hard for me to
write how to perform the password check as each check will be written
differently. While all checks are simple from a broad perspective, this is liable to
get quite complex depending on what you're trying to bruteforce. My
recommendation is to look for a library to do the check for you so you can do
the least amount of work possible to perform what is really be a trivial step
overall.
Here is the code I wrote to an ascending bruteforcer in C/C++. It's really rather
small code and thus pretty self- explanatory. (The comments should help
explain things too):
Experiment-4
Introduction
The first part of the lab introduces packet sniffer, Wireshark. Wireshark is a free
open- source network protocol analyzer. It is used for network troubleshooting
and communication protocol analysis. Wireshark captures network packets in
real time and display them in human-readable format. It provides many
advanced features including live capture and offline analysis, three-pane packet
browser, coloring rules for analysis. This document uses Wireshark for the
experiments, and it covers Wireshark installation, packet capturing, and
protocol analysis.
Packet Sniffer
Packet sniffer is a basic tool for observing network packet exchanges in a
computer. As the name suggests, a packet sniffer captures (“sniffs”) packets
being sent/received from/by your computer; it will also typically store and/or
display the contents of the various protocol fields in these captured packets. A
packet sniffer itself is passive.
1. Start up the Wireshark program (select an interface and press start to capture
packets).
2. Start up your favorite browser (ceweasel in Kali Linux).
3. In your browser, go to Wayne State homepage by typing www.wayne.edu.
4. After your browser has displayed the http://www.wayne.edu page, stop
Wireshark packet capture by selecting stop in the Wireshark capture window.
5. Color Coding: You’ll probably see packets highlighted in green, blue, and
black. Wireshark uses colors to help you identify the types of traffic at a glance.
6. You now have live packet data that contains all protocol messages exchanged
between your computer and other network entities.
7. To further filter packets in Wireshark, we need to use a more precise filter. By
setting the http.host==www.wayne.edu, we are restricting the view to packets
that have as an http host the www.wayne.edu website.
8. Now, we can try another protocol. Let’s use Domain Name System (DNS)
protocol as an example here.
9. Let’s try now to find out what are those packets contain by following one of
the conversations (also called network flows).
10. If we close this window and change the filter back to
“http.host==www.wayne.edu” and then follow a packet from the list of packets
that match that filter.
Experiment-5
Installation of rootkits and study about the variety of options.
AIM:
Rootkit is a stealth type of malicious software designed to hide the existence of
certain process from normal methods of detection and enables continued
privileged access to a computer.
INTRODUCTION:
Breaking the term rootkit into the two component words, root and kit, is a useful
way to define it. Root is a UNIX/Linux term that's the equivalent of Administrator
in Windows. The word kit denotes programs that allow someone to obtain
root/admin-level access to the computer by executing the programs in the kit-
all of which is done without end-user consent or knowledge.
A rootkit is a type of malicious software that is activated each time your system
boots up. Rootkits are difficult to detect because they are activated before your
system's Operating System has completely booted up. A rootkit often allows the
installation of hidden files, processes, hidden user accounts, and more in the
systems OS. Rootkits are able to intercept data from terminals network
connections, and the keyboard.
Rootkits have two primary functions: remote command/control (back door) and
software eavesdropping. Rootkits allow someone, legitimate or otherwise, to
administratively control a computer. This means executing files, accessing logs,
monitoring user activity, and even changing the computer's configuration.
The presence of a rootkit on a network was first documented in the early 1990s.
At that time, Sun and Linux operating systems were the primary targets for a
hacker looking to install a rootkit.
PROCEDURE:
Static ARP entries: these can be defined in the local ARP cache and the switch
configured to ignore all auto ARP reply packets. The disadvantage of this method
is, it’s difficult to maintain on large networks. IP/MAC address mapping has to
be distributed to all the computers on the network.
ARP poisoning detection software: these systems can be used to cross check
the IP/MAC address resolution and certify them if they are authenticated.
Uncertified IP/MAC address resolutions can then be blocked.
• Telnet
• Rlogin
• HTTP
• SMTP
• NNTP
• POP
• FTP
• IMAP
The above protocols are vulnerable if login details are sent in plain text
Passive and Active Sniffing
Before we look at passive and active sniffing, let’s look at two major devices used
to network computers; hubs and switches.
The illustration below shows you the steps that you will carry out to complete
this exercise without confusion
• Open Wireshark
• You will get the following screen
• Select the network interface you want to sniff. Note for this demonstration,
we are using a wireless network connection. If you are on a local area network,
then you should select the local area network interface.
• Click on start button as shown above.
• Open your web browser and type in http://www.techpanda.org/
• The login email is [email protected] and the password is Password2010
• Click on submit button
• A successful logon should give you the following dashboard
• Go back to Wireshark and stop the live capture
• Filter for HTTP protocol results only using the filter textbox
• Locate the Info column and look for entries with the HTTP verb POST and
click on it
• Just below the log entries, there is a panel with a summary of captured data.
Look for the summary that says Line-based text data: application/x-www-form-
urlencoded
• You should be able to view the plaintext values of all the POST variables
submitted to the server via HTTP protocol.
Experiment-7
Demonstrate intrusion detection system using any tool (snort or any other
s/w).
AIM:
SNORT TOOL:
Snort is based on libpcap (for library packet capture), a tool that is widely used
in TCP/IP traffic sniffers and analyzers. Through protocol analysis and content
searching and matching, Snort detects attack methods, including denial of
service, buffer overflow, CGI attacks, stealth port scans, and SMB probes.
Snort is currently the most popular free network intrusion detection software.
The advantages of Snort are numerous. According to the snort web site, “It can
perform protocol analysis, content searching/matching, and can be used to
detect a variety of attacks and probes, such as buffer overflow, stealth port
scans, CGI attacks, SMB probes, OS fingerprinting attempts, and much more”
(Caswell).
Sniffer mode
Packet Logger mode
Network Intrusion Detection System mode Sniffer mode
Snort-v Print out the TCP/IP packets header on the screen
Snort-vd show the TCP/IP ICMP header with application data in transmit Packet
Logger mode
snort-dev-l c:\log [create this directory in the C drive] and snort will
automatically know to go into packet logger mode, it collects every packet it
sees and places it in log directory.
snort-dev-l c: \log –h ipaddress/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 log
directory. snort –l c:\log –b This is binary mode logs everything into a single file.
Network Intrusion Detection System mode
PROCEDURE:
STEP-1: Sniffer mode€ snort –v € Print out the TCP/IP packets header on the
screen.
STEP-2: Snort –vd € Show the TCP/IP ICMP header with application data in
transit.
STEP-3: Packet Logger mode € snort –dev –l c:\log [create this directory in the C
drive] and snort will automatically know to go into packet logger mode, it
collects every packet it sees and places it in log directory.
STEP-4: snort –dev –l c:\log –h ipaddress/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
log directory.
STEP-5: snort –l c:\log –b € this binary mode logs everything into a single file.
STEP-6: Network Intrusion Detection System mode € snort –d c:\log –h
ipaddress/24 –c snort.conf € This is a configuration file that applies rule to each
packet to decide it an action based upon the rule type in the file.
STEP-8: Download SNORT from snort.org. Install snort with or without database
support.
STEP-9: Select all the components and Click Next. Install and Close.
STEP-12: Create a path variable and point it at snort.exe variable name € path
and variable value € c:\snort\bin.
STEP-13: Click OK button and then close all dialog boxes. Open command
prompt and type the following commands: