CSS Lab Manual - Print
CSS Lab Manual - Print
Signature Grade
Experiment No. 1
Aim: Write a program to study & implement basic cryptography using Product Cipher
algorithm
Theory:
Product Cipher:
In cryptography, a product cipher combines two or more transformations in a manner
intending that the resulting cipher is more secure than the individual components to make it
resistant to cryptanalysis. The product cipher combines a sequence of simple transformations
such as substitution (S-box), permutation (P-box), and modular arithmetic. The concept of
product ciphers is due to Claude Shannon, who presented the idea in his foundational paper,
Communication Theory of Secrecy Systems.
For transformation involving reasonable number of n message symbols, both of the
foregoing cipher systems (the S-box and P-box) are by themselves wanting. Shannon suggested
using a combination of S-box and P-box transformation - a product cipher. The combination
could yield a cipher system more powerful than either one alone. This approach of alternatively
applying substitution and permutation transformation has been used by IBM in the Lucifer cipher
system, and has become the standard for national data encryption standards such as the Data
Encryption Standard and the Advanced Encryption Standard. A product cipher that uses only
substitutions and permutations is called a SP-network. Feistel ciphers are an important class of
product ciphers.
Keyless Transposition Cipher:
In this cipher technique, the message is converted to ciphertext by either of two permutation
techniques:
a. Text is written into a table column-by-column and is then transmitted row-by-row.
b. Text is written into a table row-by-row and is then transmitted column-by-column
Keyed Transposition cipher:
In this approach, rather than permuting all the symbols together, we divide the entire
plaintext into blocks of predetermined size and then permute each block independently.
What makes a product cipher secure?
Nobody knows how to prove mathematically that a product cipher is completely secure.
So in practice one begins by demonstrating that the cipher "looks highly random". For example,
the cipher must be nonlinear, and it must produce cipher text which functionally depends on
every bit of the plaintext and the key. Meyer has shown that at least 5 rounds of DES are
required to guarantee such dependence. In this sense a product cipher should act as a "mixing"
function which combines the plaintext, key, and cipher text in a complex nonlinear fashion.
Conclusion:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Result:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Industrial Application:
In cryptography, a product cipher combines two or more transformations in a manner intending
that the resulting cipher is more secure than the individual components to make it resistant to
cryptanalysis. The product cipher combines a sequence of simple transformations such as
substitution (S-box), permutation (P-box), and modular arithmetic. The concept of product
ciphers is due to Claude Shannon, who presented the idea in his foundational paper.
Questions:
1. Product Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
2. Keyless Transposition Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
3. Keyed Transposition Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
4. Playfair Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
5. Columnar Transposition Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
6. double Transposition Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
7. Combined Transposition Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
8. Threat
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
9. Rail fence Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
10. Vernam Cipher
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No. 2
Aim: Write a program to study & implement Rivest Shamir Adelman (RSA) asymmetric key
cryptographic algorithm
Theory:
RSA is an algorithm used by modern computers to encrypt and decrypt messages. It is an
asymmetric cryptographic algorithm. Asymmetric means that there are two different keys. This
is also called public key cryptography, because one of them can be given to everyone.
The RSA Cryptosystem
The various observations just stated form the basis for the RSA public-key cryptosystem, which
was invented at MIT in 1977 by Ronald Rivest, Adi Shamir and Leonard Adleman.
The public key in this cryptosystem consists of the value n, which is called the modulus, and the
value e, which is called the public exponent. The private key consists of the modulus n and the
value d, which is called the private exponent.
Algorithm:
1. Start
2. Select two very large prime numbers. (i.e. p & q)
3. n = p.q
4. Φ = (p - 1).(q - 1)
5. Select e; such that, e is relatively prime to Φ and 1< e < Φ, gcd (e, Φ) = 1
6. Select d; such that, d.e mod Φ = 1
7. Public key: {e, n}
Private Key: {d, n}
8. C= P ͤ mod n
P= C ͩ mod n
Where, P= Plaintext message & C= Ciphertext message
9. End
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Results:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Industrial Application:
RSA is used mostly in hybrid encryption schemes and digital signatures.
In the former it is used to encrypt a symmetric key and send it to a second party who has
requested it.
This is because RSA is comparatively slow so you would never use it to encrypt a whole file.
Instead the file is encrypted symmetrically and only the key is encrypted by RSA directly.
For Digital signatures one can use the private key to sign a message or file (or better: sign the
cryptographic hash of the message/file, much faster). If a second party has the corresponding
public key he can verify that the file is authentic and has not been altered or damaged.
Questions:
1. RSA Algorithm is
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
2. Define prime number?
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
3. How many keys are used in RSA algorithm?
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
4. Vulnerabilities for RSA algorithm are?
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
5. RSA uses Feistel Cipher techniques or not? (True or False)
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
6. How Cipher text generated in RSA algorithm (equation)?
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
7. ___________are very crucial for success of RSA algorithm.
(A) Integers.
(B) Prime numbers.
(C) Negative number.
(D) Fraction
------------------------------------------------------------------------------------------------------------
10. Differentiate between Asymmetric Key Cryptography and Symmetric Key Cryptography?
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No.3
Aim: Write a program to study & implement Diffie-Hellman key exchange asymmetric key
cryptographic algorithm
Theory:
Diffie-Hellman key exchange (D-H) is a specific method of exchanging keys. It is one of
the earliest practical examples of Key exchange implemented within the field of cryptography.
The Diffie-Hellman key exchange method allows two parties that have no prior knowledge of
each other to jointly establish a shared secret key over an insecure communications channel. This
key can then be used to encrypt subsequent communications using a symmetric key cipher. It is a
type of key exchange.
Diffie-Hellman establishes a shared secret that can be used for secret communications by
exchanging data over a public network. Here is an explanation which includes the encryption's
mathematics:
Algorithm:
1. Start
2. Alice and Bob are two users wants to communicate and agree on two large prime
numbers p & g. such that, g is primitive mod p.
3. Alice chooses a random large integer a and sends Bob 'A' where,
A = g ͣ mod n
4. Bob chooses a random large integer b and sends Alice 'B' where,
B = g ᵇ mod n
5. Alice computes: K1 = B ͣ mod n
6. Bob computes: K2 = A ᵇ mod n
Both K1 & K2 are equal to K = g ͣ ᵇ mod n
i.e. K=K1=K2
7. End.
Conclusion:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Result:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Industrial Application:
The Diffie-Hellman protocol has been applied to many security protocols including
-The Security Sockets Layer (SSL),
-Secure shell (SSH),
and IP Sec.
Questions:
9. How the public keys are generated in Diffie -Hellman is key exchange algorithm
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
10. What is the formula for Key generation at both sides?
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No. 4
Aim: Write a program to study & implement Data Encryption Standard symmetric key
cryptographic algorithm
Theory:
Key Scheduling
Although the input key for DES is 64 bits long, the actual key used by DES is only 56
bits in length. The least significant (right-most) bit in each byte is a parity bit, and should be set
so that there are always an odd number of 1s in every byte. These parity bits are ignored, so only
the seven most significant bits of each byte are used, resulting in a key length of 56 bits.
Figure 2. Key Scheduling
The first step is to pass the 64-bit key through a permutation called Permuted Choice 1,
or PC-1 for short. The table for this is given below. Note that in all subsequent descriptions of bit
numbers, 1 is the left-most bit in the number, and n is the rightmost bit.
PC-1: Permuted Choice 1
Bit 0 1 2 3 4 5 6
1 57 49 41 33 25 17 9
8 1 58 50 42 34 26 18
15 10 2 59 51 43 35 27
22 19 11 3 60 52 44 36
29 63 55 47 39 31 23 15
36 7 62 54 46 38 30 22
43 14 62 54 46 38 30 22
For example, we can use the PC-1 table to figure out how bit 30 of the original 64-bit key
transforms to a bit in the new 56-bit key. Find the number 30 in the table, and notice that it
belongs to the column labeled 5 and the row labeled 36. Add up the value of the row and column
to find the new position of the bit within the key. For bit 30, 36 + 5 = 41, so bit 30 becomes bit
41 of the new 56-bit key. Note that bits 8, 16, 24, 32, 40, 48, 56 and 64 of the original key are not
in the table. These are the unused parity bits that are discarded when the final 56-bit key is
created.
Now that we have the 56-bit key, the next step is to use this key to generate 16 48-bit sub keys,
called K [1]-K [16], which is used in the 16 rounds of DES for encryption and decryption. The
procedure for generating the sub keys - known as key scheduling - is fairly simple:
1. Set the round number R to 1.
2. Split the current 56-bit key, K, up into two 28-bit blocks, L (the left-hand half)
and R (the right-hand half).
3. Rotate L left by the number of bits specified in the table below, and rotate R left
by the same number of bits as well.
4. Join L and R together to get the new K.
5. Apply Permuted Choice 2 (PC-2) to K to get the final K[R], where R is the round
number we are on.
6. Increment R by 1 and repeat the procedure until we have all 16 sub keys K[1]-
K[16].
Here are the tables involved in these operations:
Subkey Rotation Table
Round 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Number
Number 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1
of bits to
rotate
Conclusion:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Result:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Industrial Application:
DES method is used to store sensitive information or transmit information across insecure
networks so that it cannot be read by anyone except the intended recipient.
Questions:
1. Enlist modes of operation are there in in DES and AES?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
2. Which mode of operation in DES is used for operating short data?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
3. Describe 3DES?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
4. Data Encryption Standard (DES), was designed by
a) Intel b)IBM c)HP d)Sony
------------------------------------------------------------------------------------------------------------
5. Explain AES?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
6. Justify subkey in DES?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
7. Tell what is preoutput in DES?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Aim: Demonstrating the vulnerability, attacks & defense mechanism for program security using
working of virus.
Objectives: From this experiment, the student will be able to
Analyse the vulnerability, attacks for program.
Study working of virus.
Theory:
How Computer Viruses Work?
Computer viruses tend to grab our attention. On the one hand, viruses show us how
vulnerable we are. A properly engineered virus can have an amazing effect on the worldwide
Internet. On the other hand, they show how sophisticated and interconnected human beings have
become. For example, experts estimate that the Mydoom worm infected approximately a quarter-
million computers in a single day in January 2004. Back in March 1999, the Melissa virus was so
powerful that it forced Microsoft and a number of other very large companies to completely turn
off their e-mail systems until the virus could be contained. The
ILOVEYOU virus in 2000 had a similarly devastating effect. That's pretty impressive when you
consider that the Melissa and ILOVEYOU viruses are incredibly simple.
In this article, we will discuss viruses -- both "traditional" viruses and the newer e-mail
viruses -- so that you can learn how they work and also understand how to protect yourself.
Viruses in general are on the wane, but occasionally a person finds a new way to create one, and
that's when they make the news. When you listen to the news, you hear about many different
forms of electronic infection.
Conclusion:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Result:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Questions:
1. Enlist specific security mechanisms?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
2. What is confidentiality?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
3. What is passive attack?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
4. What is active attack?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
5. What is integrity?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
6. What are the different types of viruses?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
7. What is antivirus? Explain.
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
8. Explain Trojan horse virus?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
9. What is vulnerability?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
10. What is a computer worm?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No. 6
Aim: Write a program to study & demonstrate message authentication using Digital Signature
algorithm
Objectives: From this experiment, the student will be able to
Analyse the data, identify the problem and choose relevant algorithm to apply
Understand and implement classical association mining algorithms
Identify the application of association mining algorithms
Outcomes: The learner will be able to
Theory:
A Digital Signature is a protocol that produces the same effect as a real signature: It is a
mark that only the sender can make, nut other people can easily recognize as belonging to the
sender.
Just like a real signature, a digital signature is used to confirm agreement to a message.
Properties:
A digital signature must meet two primary conditions:
It must be unforgeable. If person P signs message M with signature S(P,M), it is
impossible for anyone else to produce the pair [M, S(P,M)].
It must be authentic. If a person R receives the pair [M, S(P,M)] purportedly from P, R
can check that the signature is really from P. Only P could have created this signature,
and the signature is firmly attached to M.
Algorithm:
1. Start.
2. Accept two prime numbers p and q.
3. Calculate value for phi function and n as
Phi=(p-1)*(q-1)
n=p*q
4. Accept encryption key e.
5. Calculate public key and private key.
6. Accept message to be encrypted.
7. Accept hash function
8. Calculate and display Message Digest and Digital Signature.
9. If message digest and digital signature are equivalent then accept signature o
otherwise reject it.
10. Stop.
Conclusion:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Result:
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Industrial Application:
In e-government, electronic documents and their exchange are the core of any application.
Therefore, our work focuses on the standards for semantic information structuring; separation of
content and layout ,meta-information and standardisation for the reuse of information, standards
for the electronic exchange of documents which are used by several applications, embedding
digital signatures in the document structures.
Questions:
Theory:
A Denial of Service (DoS) attack is an attack for preventing legitimate users from using a
specific resource such as web services, network or a host. The hacker intentionally blocks the
availability of the resource to its authorized users. DoS attack using UDP flooding is a technique
that executes the attack sing the UDP packets. During the year 1998-2000 security specialist
discovered vulnerabilities in many of the Systems including Microsoft products. Vulnerabilities
were discovered in ACE/Server in its port 5000 against Fraggle attack. Cisco has also discovered
vulnerabilities of its IOS software in routers against diagnostic port where attacker used two
ports namely diagnostics ports and chargen port as attacking media to attack using UDP
Flooding. Although DoS attacks are not new, there is still a significant risk of such attacks as the
new technique of DoS attacks is being invented by the hackers. This paper discusses existing
taxonomies for understanding different DoS attacks, techniques and tools, and countermeasures.
This paper also discusses the setup and installation techniques of DoS attacking tools.
Motivation of DoS Attack:
The motivation for DoS attacks is not to break into a system but to make the target
system deny the legitimate user giving service. This will typically happen through one of the
following ways:
Crashing the target host system.
Disabling communication between systems.
Make the network or the system down or have it operate at a lower speed to
reduce productivity.
Freeze the system, so that there is no automatic reboot, so that, production is
disrupted.
Depending on the type of DoS attacks planned, the hacker first needs to find a
sufficiently large number of vulnerable computers to use for attacking. This process can be
achieved manually or automatically. Nowadays, hackers use scripts or scanning tools that
automate the entire process for finding vulnerable computers to take over. Next, the hacker
establishes a communication channels between computers, so that they can be controlled and
engaged in a coordinated manner.
DoS Attack Classes:
The main classes of DoS attacks are:
(i) Bandwidth Depletion attack
(ii) Resource Depletion attack
Bandwidth Depletion attack:
The Bandwidth Depletion attack floods a victim network and thereby prevents
authorized traffic from reaching and getting the service of the targeted victim.
1. Flood Attack
In this kind of attack, the network of the victims system is flooded with a large number of
packets by the attacker to deplete the network bandwidth and thereby making the victim's
systems performance degradation or sometimes system crash. Due to saturation of the network
bandwidth of the victim's system, the legitimate users of the system are prevented from accessing
the system.
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Result:
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Questions:
1. What is DOS attack?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
2. Which attacks make computer systems inaccessible by flooding servers, networks, or even end
user systems with useless traffic so that legitimate users can no longer gain access to those
resources?
a. Blacklisting attacks b. PWC
c. DDoS d. Flooding attacks e. Spoofing attacks
------------------------------------------------------------------------------------------------------------
3. The attackers a network of compromised devices known as
a) Internet b) Botnet c) Telnet d) D-net
-----------------------------------------------------------------------------------------------------------
4. Which of the following is a form of DoS attack ?
a) Vulnerability attack b) Bandwidth flooding
c) Connection flooding d) All of the mentioned
------------------------------------------------------------------------------------------------------------
5. The DoS attack is which the attacker establishes a large number of half-open or fully open
TCP connections at the target host
a) Vulnerability attackb) Bandwidth flooding
c) Connection flooding d) All of the mentioned
------------------------------------------------------------------------------------------------------------
6. The DoS attack is which the attacker establishes a large number of half-open or fully open
TCP connections at the target
a) Vulnerability attackb) Bandwidth flooding
c) Connection flooding d) All of the mentioned
------------------------------------------------------------------------------------------------------------
7. Packet sniffers involve
a) Active receiver b) Passive receiver
c) Both of the mentioned d) None of the mentioned
------------------------------------------------------------------------------------------------------------
8. Sniffers can be deployed in
a) Wired environment b) WiFi
c) Ethernet LAN d) All of the mentioned
------------------------------------------------------------------------------------------------------------
9. Firewalls are often configured to block
a) UDP traffic b) TCP traffic
c) Both of the mentioned d) None of the mentioned
------------------------------------------------------------------------------------------------------------
10. Give real life examples of DOS attack
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No. 8
Aim: Write a program to study and implement SQL Injection using SQLmap.
Theory:
SQL Injection (SQLi)
SQL injection (SQLi) refers to an injection attack wherein an attacker can execute
malicious SQL statements (also commonly referred to as a malicious payload) that control a web
application's database server (also commonly referred to as a Relational Database Management
System - RDBMS). Since an SQL injection vulnerability could possibly affect any website or
web application that makes use of an SQL-based database, the vulnerability is one of the oldest,
most prevalent and most dangerous of web application vulnerabilities.
By leveraging SQL injection vulnerability, given the right circumstances, an attacker can
use it to bypass a web application's authentication and authorization mechanisms and retrieve the
contents of an entire database. SQL injection can also be used to add, modify and delete records
in a database, affecting data integrity.
To such an extent, SQL injection can provide an attacker with unauthorized access to
sensitive data including, customer data, personally identifiable information (PII), trade secrets,
intellectual property and other sensitive information.
How SQL Injection works?
In order to run malicious SQL queries against a database server, an attacker must first
find an input within the web application that is included inside of an SQL query.
In order for an SQL injection attack to take place, the vulnerable website needs to directly
include user input within an SQL statement. An attacker can then insert a payload that will be
included as part of the SQL query and run against the database server.
The following server-side pseudo-code is used to authenticate users to the web
application.
# Define POST variables
uname = request.POST['username']
passwd = request.POST['password']
# SQL query vulnerable to SQLi
sql = "SELECT id FROM users WHERE username='" + uname + "' AND password='" +
passwd + "'"
# Execute the SQL statement
database.execute(sql)
The above script is a simple example of authenticating a user with a username and a password
against a database with a table named users, and a username and password column.
The above script is vulnerable to SQL injection because an attacker could submit malicious input
in such a way that would alter the SQL statement being executed by the database server.
A simple example of an SQL injection payload could be something as simple as setting the
password field to password' OR 1=1.
This would result in the following SQL query being run against the database server.
SELECT id FROM users WHERE username='username' AND password='password' OR 1=1'
An attacker can also comment out the rest of the SQL statement to control the execution
of the SQL query further.
-- MySQL, MSSQL, Oracle, PostgreSQL, SQLite
' OR '1'='1' --
' OR '1'='1' /*
-- MySQL
' OR '1'='1' #
-- Access (using null characters)
' OR '1'='1' %00
' OR '1'='1' %16
Once the query executes, the result is returned to the application to be processed,
resulting in an authentication bypass. In the event of authentication bypass being possible, the
applications will most likely log the attacker in with the first account from the query result - the
first account in a database is usually of an administrative user.
Conclusion:
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Result:
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Questions:
------------------------------------------------------------------------------------------------------------
6. ______________________ is time based SQL injection attack.
a) Quick detection b) Initial Exploitation
c) Blind SQL Injection d) Inline Comments
7. What is SQLmap?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
8. What is DDL command? Example
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
9. What is DML command? Example
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
10. Define DBMS.
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No. 9
Aim: Write a program to study and implement Firewall for securing systems.
Objectives: From this experiment, the student will be able to
Learn basics of firewall with its importance in computer system.
Conclusion:
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Result:
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Industrial Application:
A firewall is a barrier or shield that is intended to protect your PC, tablet, or phone from the data-
based malware dangers that exist on the Internet. Data is exchanged between your computer and
servers and routers in cyberspace, and firewalls monitor this data (sent in packets) to check
whether they’re safe or not.
Questions:
1. What is firewall?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
2. What are the different types of firewall?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
3. What can’t a firewall protect against?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
4. What is network firewall?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
5. What are the critical resources in firewall?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
6. What is the difference between gateway and firewall?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
7. What is packet filtering?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
8. What is IP spoofing and how it can be prevented?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
9. What is POP3?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
10. What is HTTP?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
D.O.P. D.O.S. Signature Grade
Experiment No.10
Aim: To implement Email Security using Pretty Good Privacy (PGP) and secure multi-purpose
internet mail extensions (S/MIME)
Objectives: From this experiment, the student will be able to
Discover patterns from data warehouse
Outcomes: The learner will be able to
Recognize the need of online analytical processing.
Theory:
Industrial Application:
Pretty Good Privacy (PGP) is an encryption program that provides cryptographic privacy and
authentication for data communication. PGP is used for signing, encrypting, and decrypting
texts, e-mails, files, directories, and whole disk partitions and to increase the security of e-mail
communications.
Questions:
1. What is PGP?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
2. What is S/MIME?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
3. What are the applications of S/MIME?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
4. Differentiate between PGP and S/MIME.
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
5. What are the applications of PGP?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
6. What is the security issues related to PGP?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
7. Explain the backdoor feature in PGP.
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
8. What is key escrow?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
9. S/MIME Provide _________________
a) Digital Signature b) Integrity
b) Encryption d) All of the above
10. List security services provided by S/MIME?
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------