CRNS Notes Unit I To V
CRNS Notes Unit I To V
CRNS Notes Unit I To V
Introduction:
This is the age of universal electronic connectivity, where the activities like
hacking, viruses, electronic fraud are very common. Unless security measures are taken,
a network conversation or a distributed application can be compromised easily.
Network Security has been affected by two major developments over the last
several decades. First one is introduction of computers into organizations and the second
one being introduction of distributed systems and the use of networks and
communication facilities for carrying data between users & computers. These two
developments lead to ‘computer security’ and ‘network security’, where the computer
security deals with collection of tools designed to protect data and to thwart hackers.
Network security measures are needed to protect data during transmission. But keep in
mind that, it is the information and our ability to access that information that we are
really trying to protect and not the computers and networks.
1
The 2007 CSI survey
• 494 computer security practitioners
• 46% suffered security incidents
• 29% reported to law enforcement
• Average annual loss $350,424
• 1/5 suffered ‗targeted attack‘
• The source of the greatest financial losses?
• Most prevalent security problem
• Insider abuse of network access
• Email
Threat Categories
• Acts of human error or failure
• Compromises to intellectual property
• Deliberate acts of espionage or trespass
• Deliberate acts of information extortion
• Deliberate acts of sabotage or vandalism
• Deliberate acts of theft
• Deliberate software attack
• Forces of nature
• Deviations in quality of service
• Technical hardware failures or errors
• Technical software failures or errors
• Technological obsolesce
Definitions
➢ Computer Security - generic name for the collection of tools designed to protect
data and to thwart hackers
2
➢ which consists of measures to deter, prevent, detect, and correct security
violations that involve the transmission & storage of information
ASPECTS OF SECURITY
➢ consider 3 aspects of information security:
⚫ Security Attack
⚫ Security Mechanism
⚫ Security Service
SECURITY ATTACK
➢ any action that compromises the security of information owned by
an organization
• Passive
• Active
30
3
Passive Attack
Active Attack
INTERRUPTION
An asset of the system is destroyed or becomes unavailable or unusable. It is
an attack on availability.
Examples:
Examples:
➢ Wire tapping to capture data in a network.
➢ Illicitly copying data or programs
➢ Eavesdropping
MODIFICATION
4
When an unauthorized party gains access and tampers an asset. Attack is
on Integrity.
Examples:
➢ Changing data file
➢ Altering a program and the contents of a message
FABRICATION
An unauthorized party inserts a counterfeit object into the system. Attack on
Authenticity. Also called impersonation
Examples:
➢ Hackers gaining access to a personal email and sending message
➢ Insertion of records in data files
➢
Insertion of spurious messages in a network
SECURITY SERVICES
It is a processing or communication service that is provided by a system to give a
specific kind of production to system resources. Security services implement security
policies and are implemented by security mechanisms.
Confidentiality
5
The other aspect of confidentiality is the protection of traffic flow from analysis. Ex: A
credit card number has to be secured during online transaction.
Authentication
This service assures that a communication is authentic. For a single message
transmission, its function is to assure the recipient that the message is from intended
source. For an ongoing interaction two aspects are involved. First, during connection
initiation the service assures the authenticity of both parties. Second, the connection
between the two hosts is not interfered allowing a third party to masquerade as one of
the two parties. Two specific authentication services defines in X.800 are
Peer entity authentication: Verifies the identities of the peer entities involved in
communication. Provides use at time of Mediaconnectionestblishment and during data
transmission. Provides confidence against a masquera or replay attack
Data origin authentication: Assumes the authenticity of source of data unit, but does
not provide protection against duplication or modification of data units. Supports
applications like electronic mail, where no prior interactions take place between
communicating entities.
Integrity
Integrity means that data cannot be modified without authorization. Like
confidentiality, it can be applied to a stream of messages, a single message or selected
fields within a message. Two t pes of integrity services are available. They are
Connection-Oriented Integrity Service: This service deals with a stream of
messages, assures that messages are received as sent, with no duplication, insertion,
modification, reordering or replays. Destruction of data is also covered here. Hence, it
attends to both message stream modification and denial of service.
Connectionless-Oriented Integrity Service: It deals with individual messages
regardless of larger context, providing protection against message modification only.
6
detected and the service reports it, either human intervention or automated recovery
machines are required to recover.
Non-repudiation
Non-repudiation prevents either sender or receiver from denying a transmitted
message. This capability is crucial to e-commerce. Without it an individual or entity can
deny that he, she or it is responsible for a transaction, therefore not financially liable.
Access Control
This refers to the ability to control the level of access that individuals or entities
have to a network or system and how much information they can receive. It is the ability
to limit and control the access to host systems and applications via communication links.
For this, each entity trying to gain access must first be identified or authenticated, so that
access rights can be tailored to the individuals.
Availability
It is defined to be the property of a systemMediaorasystemresource being
accessible and usable upon demand by an authorized system entity. The v ilability can
significantly be affected by a variety of attacks, some amenable to automated counter
measures i.e authentication and encryption and others need some sort of physical action
to prevent or recover from loss of availability of elements of distributed system.
SECURITY MECHANISMS
According to X.800, the sec rity mechanisms are divided into those implemented
in a specific protocol layer and those that are not specific to any particular protocol layer
or security service. X.800 also differentiates reversible & irreversible encipherment
mechanisms. A reversible encipherment mechanism is simply an encryption algorithm
that allows data to be encrypted and subsequently decrypted, whereas irreversible
encipherment include hash algorithms and message authentication codes used in digital
signature and message authentication applications
Specific Security Mechanisms
Incorporated into the appropriate protocol layer in order to provide some of
the OSI security services,
Encipherment: It refers to the process of applying mathematical algorithms for
converting data into a form that is not intelligible. This depends on algorithm used and
7
encryption keys.
Digital Signature: The appended data or a cryptographic transformation applied to any
data unit allowing to prove the source and integrity of the data unit and protect against
forgery.
Access Control: A variety of techniques used for enforcing access permissions to the
system resources.
Data Integrity: A variety of mechanisms used to assure the integrity of a data unit or
stream of data units.
Authentication Exchange: A mechanism intended to ensure the identity of an entity by
means of information exchange.
Traffic Padding: The insertion of bits into gaps in a data stream to frustrate traffic
analysis attempts.
Routing Control: Enables selection of particular physically secure routes for certain data
and allows routing changes once a breach of security is suspected.
Notarization: The use of a trusted third party to assure cert in properties of a data
exchange
Pervasive Security Mechanisms
These are not specific to any particular OSI security s rvice or protocol layer.
Trusted Functionality: That which is perceived to b correct with respect to some criteria
Security Level: The marking bound to a re ource (which may be a data unit) that names
or designates the security attrib tes of that resource.
Event Detection: It is the process of detecting all the events related to network
security. Security Audit Trail: Data collected and potentially used to facilitate a
security audit, which is an independent review and examination of system records and
activities. Security Recovery: It deals with requests from mechanisms, such as event
handling and management functions, and takes recovery actions.
8
MODEL FOR NETWORK SECURITY
Data is transmitted over network between two communicating parties, who must
cooperate for the exchange to take place. A logical information channel is established by
defining a route through the internet from source to destination by use of communication
protocols by the two parties. Whenever an opponent presents a threat to confidentiality,
authenticity of information, security aspects come into play. Two components are present
in almost all the security providing techniques.
A security-related transformation on the information to be sent making it unreadable
9
by the opponent, and the addition of a code based on the contents of the message, used to
verify the identity of sender.
Some secret information shared by the two principals and, it is hoped, unknown to
the opponent. An example is an encryption key used in conjunction with the transformation
to scramble the message before transmission and unscramble it on reception
A trusted third party may be needed to achieve secure transmission. It is
responsible for distributing the secret information to the two parties, while keeping it
away from any opponent. It also may be needed to settle disputes between the two
parties regarding authenticity of a message transmission. The general model shows that
there are four basic tasks in designing a particular security service:
1. Design an algorithm for performing the security-related transformation. The
algorithm should be such that an opponent cannot defeat its purpose
2. Generate the secret information to be used with the algorithm
3. Develop methods for the distribution and sharing of the secret information
4. Specify a protocol to be used by the two principals th t makes use of the security
algorithm and the secret information to achieve a part cular security service Various
other threats to information system like unwanted access still exist. The
existence of hackers attempting to penetrate syst ms accessible over a network remains a
concern. Another threat is placement of ome logic in computer system affecting various
applications and utility programs. This in erted code presents two kinds of threats.
Information access threats intercept or modify data on behalf of users who should
not have access to that data
Service threats exploit service flaws in computers to inhibit use by legitimate users
Viruses and worms are two examples of software attacks inserted into the system by
means of a disk or also across the network. The security mechanisms needed to cope with
unwanted access fall into two broad categories.
10
• DECIPHER (DECRYPT) - recovering ciphertext from plaintext
CRYPTOGRAPHY
Cryptographic systems are generally classified along 3 independent dimensions:
Type of operations used for transforming plain text to cipher text
All the encryption algorithms are abased on two general principles: substitution,
in which each element in the plaintext is mapped into another element, and
transposition, in which elements in the plaintext are rearranged.
The number of keys used Media
If the sender and receiver uses same key then it is s to be symmetric key (or)
single key (or) conventional encryption. If the s n er and receiver use different keys
then it is said to be public key encryption.
The way in which the plain text is processed
A block cipher processes the input and block of elements at a time, producing
output block for each input block. A tream cipher processes the input elements
continuously, producing output element one at a time, as it goes along.
CRYPTANALYSIS
The process of attempting to discover X or K or both is known as cryptanalysis. The
strategy used by the cryptanalysis depends on the nature of the encryption scheme and the
information available to the cryptanalyst. There are various types of cryptanalytic attacks
based on the amount of information known to the cryptanalyst.
Cipher text only – A copy of cipher text alone is known to the cryptanalyst.
Known plaintext – The cryptanalyst has a copy of the cipher text and the corresponding
plaintext.
11
Chosen plaintext – The cryptanalysts gains temporary access to the encryption machine.
They cannot open it to find the key, however; they can encrypt a large number of suitably
chosen plaintexts and try to use the resulting cipher texts to deduce the key.
Chosen cipher text – The cryptanalyst obtains temporary access to the decryption machine, uses
it to decrypt several string of symbols, and tries to use the results to deduce the key.
SUBSTITUTION TECHNIQUES
CAESAR CIPHER
A substitution technique is one in which the
letters of plaintext are replaced by other letters or by numbers or symbols. If the plaintext
is viewed as a sequence of bits, then substitution involves replacing plaintext
bitMediapatternswithcipher text bit patterns.
The earliest known use of a substitution ciph r and the simplest was by Julius
Caesar. The Caesar cipher involves replacing each l tter of the alphabet with the letter
standing 3 places further down the alphabet . . g., plain text : pay more money Cipher text:
SDB PRUH PRQHB
Note that the alphabet is wrapped around,
so that letter following „z‟ is „a‟.
For each plaintext letter p, substit te the cipher text letter c
such that C = E(p) = (p+3) mod 26
A shift may be any amount, so that general Caesar algorithm is C = E (p) = (p+k) mod
26 Where k takes on a value in the range 1 to 25.
The decryption algorithm is simply P = D(C) = (C-k) mod 26
MONOALPHABETIC CIPHERS
Here, Plaintext characters are substituted by a different alphabet stream of characters
shifted to the right or left by n positions. When compared to the Caesar ciphers, these
monoalphabetic ciphers are more secure as each letter of the ciphertext can be any
12
permutation of the 26 alphabetic characters leading to 26! or greater than 4 x 10 26 possible
keys. But it is still vulnerable to cryptanalysis, when a cryptanalyst is aware of the nature of
the plaintext, he can find the regularities of the language. To overcome
13
these attacks, multiple substitutions for a single letter are used. For example, a letter can be
substituted by different numerical cipher symbols such as 17, 54, 69….. etc. Even this
method is not completely secure as each letter in the plain text affects on letter in the
ciphertext.
Or, using a common key which substitutes every letter of the plain text.
The key ABCDEFGHIIJ KLMNOPQRSTUVWXYZ QWERTYUIIOPAS DFGHJ
KLZXCV BNM
Would encrypt the message
II think therefore II am
into
OZIIOFAZIITKTYGKTOQD
But any attacker would simply break the cipher by using frequency analysis by observing
the number of times each letter occurs in the cipher text and then looking upon the
English letter frequency table. So, substitution cipher is completely ruined by these
attacks. Monoalphabetic ciphers are easy to break as they reflect the frequency of the
original alphabet. A countermeasure is to provide substitutes, known as homophones for
a single letter.
PLAYFAIR CIPHERS
It is the best known multiple –letter encryption cipher which treats digrams in the
plaintext as single units and translates these units into ciphertext digrams. The Playfair
Cipher is a digram substitution cipher offering a relatively weak method of encryption. It
was used for tactical purposes by British forces in the Second Boer War and in World War
I and for the same purpose by the Australians and Germans during World War II. This
was because Playfair is reasonably fast to use and requires no special equipment. A
typical scenario for Playfair use would be to protect important but non-critical secrets
during actual combat. By the time the enemy cryptanalysts could break the message, the
information was useless to them. It is based around a 5x5 matrix, a copy of which is held
by both communicating parties, into which 25 of the 26 letters of the alphabet (normally
either j and i are represented by the same letter or x is ignored) are placed in a random
fashion. For example, the plain text is Shi Sherry loves Heath Ledger and the agreed key is
sherry. The matrix will be built according to the following rules.
• in pairs,
14
• without punctuation,
• All Js are replaced with Is.
SH IS HE RR YL OV ES HE AT HL ED GE R
• Double letters which occur in a pair must be divided by an X or a Z.
• E.g. LI TE RA LL Y LI TE RA LX LY
SHERY
ABCDF
GIKLM
NOPQT
UVWXZ
For the generation of cipher text, there are three rul s to be followed by each pair of
letters.
letters appear on the same row: re lace them with the letters to their immediate right
respectively
letters appear on the same col mn: replace them with the letters immediately below
respectively
not on the same row or column: replace them with the letters on the same row
respectively but at the other pair of corners of the rectangle defined by the original pair.
Based on the above three rules, the cipher text obtained for the given plain text is
HE GH ER DR YS IQ WH HE SC OY KR AL RY
Another example which is simpler than the above one can be given as:
Here, key word is playfair. Plaintext is Hellothere hellothere becomes-----he lx lo th er ex .
Applying the rules again, for each pair, If they are in the same row, replace each with the
letter to its right (mod 5)
he KG
If they are in the same column, replace each with the letter below it (mod5)
15
lo RV
Otherwise, replace each with letter we’d get if we swapped their column indices
lx YV
So the cipher text for the given plain text is KG YV RV QM GI KU
To decrypt the message, just reverse the process. Shift up and left instead of down and right.
Drop extra x’s and locate any missing I’s that should be j’s. The message will be back into the
original readable form. no longer usedMediabymilitaryforces because of the advent
of digital encryption devices. Playfair is now regar s nsecure for any purpose because
modern hand-held computers could easily br ak the cipher within seconds.
HILL CIPHER
It is also a multi letter encryption cipher. It involves substitution of ‘m’ ciphertext
letters for ‘m’ successiveSkyupsplaintextletters. For substitution purposes using ‘m’
linear equations, each of the characters are a igned a numerical values i.e. a=0, b=1, c=2,
d=3,…….z=25. For example if m=3, the system can be defined as: c1 = (k11p1 + k12p2 +
k13p3) mod 26 c2 = (k21 1 + k22p2 + k23p3) mod 26 c3 = (k31p1 + k32p2 + k33p3) mod 26
If we represent in matrix form, the above statements as matrices and column vectors:
16
The main advantages of hill cipher are given below:
It perfectly hides single-letter frequencies.
Use of 3x3 Hill ciphers can perfectly hide both the single letter and two-letter
frequency information.
Strong enough against the attacks made only on the cipher text.
But, it still can be easily broken if the attack is through a known plaintext.
17
POLYALPHABETIC CIPHERS
In order to make substitution ciphers more secure, more than one alphabet can be used. Such
ciphers are called polyalphabetic, which means that the same letter of a message can be
represented by different letters when encoded. Such a one-to-many correspondence makes
the use of frequency analysis much more difficult in order to crack the code. We describe one
such cipher named for Blaise de Vigenere a 16-th century Frenchman. The Vigenere cipher
is a polyalphabetic cipher based on using successively shifted alphabets, a different shifted
alphabet for each of the 26 English letters. The procedure is based on the tableau shown
below and the use of a keyword. The letters of the keyword determine the shifted alphabets
used in the encoding process.
For the message COMPUTING GIVES INSIGHT and keyword LUCKY we proceed by
repeating the keyword as many times as needed above the message, as follows.
18
Encryption is simple: Given a key letter x and a plaintext letter y, the ciphertext letter is
at the intersection of the row labeled x and the column labeled y; so for L, the ciphertext
letter would be N. So, the ciphertext for the given plaintext would be given as:
Decryption is equally simple: The key letter again identifies the row and position of
ciphertext letter in that row decides the column and the plaintext letter is at the top of that
column. The strength of this cipher is that there are multiple ciphetext letters for each
plaintext letter, one for each unique letter of the keyword and thereby making the letter
frequency information is obscured. Still, breaking this cipher has been made possible because
this reveals some mathematical principles that apply in cryptanalysis. To overcome the
drawback of the periodic nature of the keyword, a new technique is proposed which is
referred as an autokey system, in which key word is concatenated with the plaintext itself to
provide a running key. For ex In the above example, the key would be luckycomputinggivesin
Still, this scheme is vulnerable to cryptanalysis as both the key and plaintext share the same
frequency distribution of letters allowing a statistical technique to be applied. Thus, the
ultimate defense against such a cryptanalysis is to choose a keyword that is as long as
plaintext and has no statistical relationship to it. A new system which works on binary data
rather than letters is given as
Ci = pi ki where, pi = ith binary digit of laintext ki = ith binary digit of key Ci= ith binary
digit of ciphertext
= exclusive-or operation. Because of the properties of XOR, decryption is done by
performing the same bitwise operation.
pi = Ci ki A very long but, repeation key word is used making cryptanalysis difficult.
TRANSPOSITION TECHNIQUES
All the techniques examined so far involve the substitution of a cipher text symbol for a
plaintext symbol. A very different kind of mapping is achieved by performing some sort
of permutation on the plaintext letters. This technique is referred to as a transposition
cipher.
19
Rail fence is simplest of such cipher, in which the plaintext is written down as a sequence
of diagonals and then read off as a sequence of rows.
Key = 4 3 1 2 5 6 7
PT = m e e t a t t h e s c h o o l h o u s e
CT = ESOTCUEEHMHLAHSTOETO
A pure transposition cipher is easily recognized because it has the same letter frequencies
as the original plaintext. The transposition cipher can be made significantly more secure
by performing more than one stage of transposition. The result is more complex
permutation that is not easily reconstructed.
STEGANOGRAPHY
A plaintext message may be hidden in any one of the two ways. The methods of
steganography conceal the existence of the message, whereas the methods of
cryptography render the message unintelligible to outsiders by various transformations
of the text. A simple form of steganography, but one that is time consuming to construct
is one in which an arrangement of words or letters within an apparently innocuous text
spells out the real message. e.g., (i) the sequence of first letters of each word of the overall
message spells out the real (hidden) message. (ii) Subset of the words of the overall
message is used to convey the hidden message. Various other techniques have been used
historically, some of them are
20
• Character marking – selected letters of printed or typewritten text are
overwritten in pencil. The marks are ordinarily not visible unless the paper is held
to an angle to bright light.
• Invisible ink – a number of substances can be used for writing but leave no
visible trace until heat or some chemical is applied to the paper.
• Pin punctures – small pin punctures on selected letters are ordinarily not
visible unless the paper is held in front of the light.
• Typewritten correction ribbon – used between the lines typed with a black
ribbon, the results of typing with the correction tape are visible only under a
strong light.
Drawbacks of Steganography
• Requires a lot of overhead to hide a relatively few bits of information.
• Once the system is discovered, it becomes virtually worthless.
21
UNIT –II
Symmetric Key Ciphers: Block Cipher Principles and Algorithms (DES, AES, and Blowfish),
Differential and Linear Cryptanalysis, Block Cipher Modes of Operations, Stream Ciphers,
RC4, Location and Placement of encryption function, Key Distribution.
Asymmetric Key Ciphers: Principles of Public Key Cryptosystems, Algorithms (RSA, Diffie-
Hellman, ECC), Key Distribution.
1. Plain Text: This is the original message or data which is fed into the algorithm as input.
3. Secret Key: The key is another input to the algor thm. The substitutions and
transformations performed by algorithm depend on the key.
4. Cipher Text: This is the scrambled (unreadable) message which is output of the encryption
algorithm. This cipher text is dependent on plaintext and secret key. For a given plaintext,
two different keys produce two different cipher texts.
5. Decryption Algorithm: This is the reverse of encryption algorithm. It takes the cipher
text and secret key as inputs and outp ts the plain text.
22
The important point is that the security of conventional ncrypt on depends on the secrecy
of the key, not the secrecy of the algorithm i.e. it is not n cessary to keep the algorithm
secret, but only the key is to be kept secret. This feature that algorithm need not be kept
chip implementation of data encryption algorithms. With the use of conventional algorithm,
The input to the encryption algorithm are a plaintext block of length 2w bits and
a key K. the plaintext block is divided into two halves L 0 and R0. The two halves of the
data pass through „n‟ rounds of processing and then combine to produce the ciphertext
block. Each round „i‟ has inputs Li-1 and Ri-1, derived from the previous round, as well as
the subkey Ki, derived from the overall key K. in general, the subkeys K i are different from
K and from each other.
All rounds have the same structure. A substitution is performed on the left half of the
data (as similar to S-DES). This is done by applying a round function F to the right half
23
of the data and then taking the XOR of the output of that function and the left half of the
data. The round function has the same general structure for each round but is
parameterized by the round subkey ki. Following this substitution, a permutation is
performed that consists of the interchange of the two halves of the data. This structure is
a particular form of the substitution-permutation network. The exact realization of a
Feistel network depends on the choice of the following parameters and design features:
• Block size - Increasing size improves security, but slows cipher
• Key size - Increasing size improves security, makes exhaustive key searching
harder, but may slow cipher
• Number of rounds - Increasing number improves security, but slows cipher
• Subkey generation - Greater complexity can make analysis harder, but slows
cipher
• Round function - Greater complexity can make analysis harder, but slows cipher
• Fast software en/decryption & ease of analysis - re more recent concerns for
practical use and testing
24
The process of decryption is essentially the same as the encryption process. The rule is
as follows: use the cipher text as input to the algorithm, but use the subkey k i in reverse
order. i.e., kn in the first round, kn-1 in second round and so on. For clarity, we use the
notation LEi and REi for data traveling through the decryption algorithm. The diagram
below indicates that, at each round, the intermediate value of the decryption process is
same (equal) to the corresponding value of the encryption process with two halves of the
value swapped.
25
i.e., REi || LEi (or) equivalently RD16-i || LD16-i
After the last iteration of the encryption process, the two halves of the output are
swapped, so that the cipher text is RE16 || LE16. The output of that round is the cipher text.
Now take the cipher text and use it as input to the same algorithm. The input to the first
round is RE16 || LE16, which is equal to the 32-bit swap of the output of the sixteenth
round of the encryption process. Now we will see how the output of the first round of the
decryption process is equal to a 32-bit swap of the input to the sixteenth round of the
encryption process.
LE16 = RE15
= LE15
Therefore, LD1 = RE15 RD1 = LE15 In general, for the ith iteration of the encryption
Finally, the output of the last round of the decryption process is RE 0 || LE0. A 32-bit
26
DEFINITIONS
key, so that only a holder of the matching key can reconvert them.
Public Key encryption: Uses different keys for encryption & decryption
27
The figure above illustrates the overall structure of the simplified DES. The S-DES
encryption algorithm takes an 8-bit block of plaintext (example: 10111101) and a 10-bit
key as input and produces an 8-bit block of ciphertext as output. The S-DES decryption
algorithm takes an 8-bit block of ciphertext and the same 10-bit key used to produce that
ciphertext as input and produces the original 8-bit block of plaintext.
• a complex function labeled fk, which involves both permutation and substitution
operations and depends on a key input
• a simple permutation function that switches (SW) the two halves of the data
• the function fk again
• a permutation function that is the inverseMediaoftheintlpermutation
The function fk takes as input not only the data passing through the encryption algorithm,
but also an 8-bit key. Here a 10-bit key is us from which two 8-bit subkeys are generated.
The key is first subjected to a permutation (P10). Then a shift operation is performed.
The output of the shift o eration then passes through a permutation function that
produces an 8-bit output (P8) for the first subkey (K1). The output of the shift operation
also feeds into another shift and another instance of P8 to produce the second subkey
(K2).
The encryption algorithm can be expressed as a composition composition 1 of functions:
IP-1 ο fK2 ο SW ο fk1 ο IP
Which can also be written as
Ciphertext = IP-1 (fK2 (SW (fk1 (IP (plaintext)))))
Where
K1 = P8 (Shift (P10 (Key)))
K2 = P8 (Shift (shift (P10 (Key))))
Decryption can be shown as
Plaintext = IP-1 (fK1 (SW (fk2 (IP (ciphertext)))))
28
S-DES depends on the use of a 10-bit key shared between sender and receiver.
From this key, two 8-bit subkeys are produced for use n particular stages of the
encryption and decryption algorithm. First, permute the key in the following fashion. Let
the 10-bit key be designated as (k1, K2, k3, k4, k5, k6, k7, k8, k9, k10).
Then the permutation P10 is defined as:
P10 (k1, K2, k3, k4, k5, k6, k7, k8, k9, k10) = (k3, k5, K2, k7, k4, k10 10, k1, k9, k8, k6) P10
can be concisely defined by the dis lay:
P10
3 5 2 7 4 10 1 9 8 6
This table is read from left to right; each position in the table gives the identity of the
input bit that produces the output bit in that position. So the first output bit is bit 3 of the
input; the second output bit is bit 5 of the input, and so on. For example, the key
(1010000010) is permuted to (10000 01100). Next, perform a circular left shift (LS-1),
or rotation, separately on the first five bits and the second five bits. In our example, the
result is (00001 11000). Next we apply P8, which picks out and permutes 8 of the 10 bits
according to the following rule:
P8
6 3 7 4 8 5 10 9
29
The result is subkey 1 (K1). In our example, this yields (10100100). We then go back to
the pair of 5-bit strings produced by the two LS-1 functions and performs a circular left
shift of 2 bit positions on each string. In our example, the value (00001 11000) becomes
(00100 00011). Finally, P8 is applied again to produce K2. In our example, the result is
(01000011).
S-DES encryption
Encryption involves the sequential application of five functions.
Initial and Final Permutations The input to the algorithm is an 8-bit block of plaintext,
which we first permute using the IP function:
IP
2 6 3 1 4 8 5 7
This retains all 8 bits of the plaintext but mixes them up.
Consider the plaintext to be 11110011.
Permuted output = 10111101
At the end of the algorithm, the inverse permutation is use :
IP –1
The Function fk
4 1 3 5 7 2 8 6
The most complex Skyupscomponentof-DESis the function fk, which consists of a combination
of permutation and substitution f nctions. The functions can be expressed as follows. Let
L and R be the leftmost 4 bits and rightmost 4 bits of the 8-bit input to f K, and let F be a
mapping (not necessarily one to one) from 4-bit strings to 4-bit strings. Then we let fk(L,
R) = ( L (+) F( R, SK), R)
Where SK is a subkey and (+) is the bit-by-bit exclusive-OR function.
e.g., permuted output = 1011 1101 and suppose F (1101, SK) = (1110) for some key
SK. Then f K(10111101) = 10111110, 1101 = 01011101
We now describe the mapping F. The input is a 4-bit number (n1 n2 n3 n4). The first
operation is an expansion/permutation operation:
E/P
4 1 2 3 2 3 4 1
30
R= 1101 E/P output = 11101011 It is clearer to depict the result in this fashion:
The 8-bit subkey K1 = (k11, k12 12, k13 13, k14 14, k15 15, k16 16, k17 17, k18) is added
to this value using exclusive-OR:
The first 4 bits (first row of the preceding matrix) are fed into the S-box S0 to produce a 2- bit
output, and the remaining 4 bits (second row) are fed into S1 to produce another 2- bit output.
These two boxes are defined as follows:
The S-boxes operateSkyupsasfollows.Thefirst and fourth input bits are treated as a 2-bit
number that specify a row of the -box, and the second and third input bits specify a
column of the S-box. The entry in that row and column, in base 2, is the 2-bit output. For
example, if (p0,0 p0,3) = ) (00) and ( p0,1 p0,2) = (10), then the output is from row 0,
column 2 of S0, which is 3, or (11) in ) binary. Similarly, (p1,0 p1,3) and ( p1,1 p1,2) are
used to index into a row and column of S1 to produce an additional 2 bits. Next, the 4 bits
produced by S0 and S1 undergo a further permutation as follows:
P4
2 4 3 1
31
on a different 4 bits. In this second instance, the E/P, S0, S1, and P4 functions are the same.
The key input is K2. Finally apply inverse permutation to get the ciphertext
The main standard for encrypting data was a symmetric algorithm known as the Data
Encryption Standard (DES). However, this has now been replaced by a new standard known
as the Advanced Encryption Standard (AES) which we will look at later. DES is a 64 bit block
cipher which means that it encrypts data 64 bits at a time. This is contrasted to a stream
cipher in which only one bit at a time (or sometimes small groups of bits such as a byte) is
encrypted. DES was the result of a research project set up by International Business Machines
(IBM) corporation in the late 1960’s which resulted in a cipher known as LUCIFER. In the
early 1970’s it was decided to commercialise LUCIFER and a number of significant changes
were introduced. IBM was not the only one involved in these changes as they sought technical
advice from the National Security Agency (NSA) (other outside consultants were involved but
it is lik ly that the NSA were the major contributors from a technical point of view). The alt
red version of LUCIFER was put forward as a proposal for the new national encryption
standard requested by the National Bureau of Standards (NBS)3 . It was finally adopted in
1977 as the Data Encryption Standard - DES (FIPS PUB 46). Some of the changes made to
LUCIFER have been the subject of much controversy even to the present day. The most
notable of these was the key size. LUCIFER used a key size of 128 bits however this was
reduced to 56 bits for DES. Even though DES actually accepts a 64 bit key as input, the
remaining eight bits are used for parity chec ing and have no effect on DES’s security.
Outsiders were convinced that the 56 bit key was an easy target for a brute force attack4 due
to its extremely small size. The need for the parity checking scheme was also questioned
without satisfying answers. Another controversial issue was that the S-boxes used were
designed under classified conditions and no reasons for their particular design were ever
given. This led people to assume that the NSA had introduced a “trapdoor” through which
they could decrypt any data encrypted by DES even without knowledge of the key. One
startling discovery was that the S-boxes appeared to be secure against an attack known as
Differential Cryptanalysis which was only publicly discovered by Biham and Shamir in 1990.
This suggests that the NSA were aware of this attack in 1977; 13 years earlier! In
32
fact the DES designers claimed that the reason they never made the design specifications for
the S-boxes available was that they knew about a number of attacks that weren’t public
knowledge at the time and they didn’t want them leaking - this is quite a plausible claim as
differential cryptanalysis has shown. However, despite all this controversy, in 1994 NIST
reaffirmed DES for government use for a further five years for use in areas other than
“classified”. DES of course isn’t the only symmetric cipher. There are many others, each with
varying levels of complexity. Such ciphers include: IDEA, RC4, RC5, RC6 and the new
Advanced Encryption Standard (AES). AES is an important algorithm and was originally
meant to replace DES (and its more secure variant triple DES) as the standard algorithm for
non-classified material. However as of 2003, AES with key sizes of 192 and 256 bits has been
found to be secure enough to protect information up to top secret. Since its creation, AES had
underdone intense scrutiny as one would expect for an algorithm that is to be used as the
standard. To date it has withstood all attacks but the
INNER WORKING OF
search is still on and it remains to be seen Mediawhetherornotthis will last. We will look at
DES
DES (and most of the other major symmetric ciphers) is based on cipher known as the Feistel
block cipher. It consists of a number of rounds where each round contains bit-shuffling, non-linear
substitutions (S-boxes) and exclusive OR operations. As with most encryption schemes, DES
expects two inputs - the plaintext to be encrypted and the secret key. The manner in which the
plaintext is accepted, and the key arrangement used for encryption and decryption, both
determine the type of cipher it is. DES is therefore a symmetric, 64 bit block cipher as it uses the
same key for both encryption and decryption and only operates on 64 bit blocks of data at a time5
(be they plaintext or ciphertext). The key size used is 56 bits, however a 64 bit (or eight-byte) key
is actually input. The least significant bit of each byte is either used for parity (odd for DES) or set
33
arbitrarily and does not increase the security in any way. All blocks are numbered from left to
right which makes the eight bit of each byte the parity bit.
34
Once a plain-text message is received to be encrypted, it is arranged into 64 bit blocks required
for input. If the number of bits in the message is not evenly divisible by 64, then the last block will
OVERALL STRUCTURE
Figure below shows the sequence of events that occur during an encryption operation. DES
performs an initial permutation on the entire 64 bit block of data. It is then split into 2, 32 bit
sub-blocks, Li and Ri which are then passed into what is known as a round (see figure 2.3), of
which there are 16 (the subscript i in Li and Ri indicates the current round). Each of the
algorithms security is increased and its temporal efficiency decreased. Clearly these are two
conflicting outcomes and a compromise must be ma . For DES the number chosen was 16,
probably to guarantee the elimination of any correlation between the ciphertext and either
the plaintext or key6 . At the end of the 16th round, the 32 bit Li and Ri output quantities are
swapped to create what is known as the pre-output. This [R16, L16] concatenation is
permuted using a function which is the exact inverse of the initial permutation. The output of
35
So in total the processing of the plaintext proceeds in three phases as can be seen from
1. Initial permutation (IP - defined in table 2.1) rearranging the bits to form
output of the last iteration consists of 64 bits which is a function of the plaintext and
key. The left and right halves are swapped to produce the preoutput.
3. Finally, the preoutput is passed through a permutation (IP−1 - defined in table 2.1)
which is simply the inverse of the initial permutation (IP). The output of IP−1 is the
64-bit ciphertext
36
As figure shows, the inputs to each round consist of the Li , Ri pair and a 48 bit subkey
which is a shifted and contracted version of the original 56 bit key. The use of the key can
be seen in the right hand portion of figure 2.2: • Initially the key is passed through a
permutation function (PC1 - defined in table 2.2) • For each of the 16 iterations, a subkey
(Ki) is produced by a combination of a left circular shift and a permutation (PC2 - defined
in table 2.2) which is the same for each iteration. However, the resulting subkey is different for
37
DETAILS OF INDIVIDUAL ROUNDS
38
The main operations on the data are encompassed into what is referred to as the cipher
function and is labeled F. This function accepts two different length inputs of 32 bits and 48 bits
and outputs a single 32 bit number. Both the data and key are operated on in parallel, however
the operations are quite different. The 56 bit key is split into two 28 bit halves Ci and Di (C and
D being chosen so as not to be conf sed with L and R). The value of the key used in any round is
simply a left cyclic shift and a permuted contraction of that used in the previous round.
Ci = Lcsi(Ci−1), Di = Lcsi(Di−1)
Ki = P C2(Ci , Di)
where Lcsi is the left cyclic shift for round i, Ci and Di are the outputs after the shifts, P C2(.) is a
function which permutes and compresses a 56 bit number into a 48 bit number and Ki is the actual
key used in round i. The number of shifts is either one or two and is determined by the round number
i. For i = {1, 2, 9, 16} the number of shifts is one and for every other round it is two
39
S-BOX Details
40
ADVANCED ENCRYPTION ALGORITHM (AES)
• AES is a block cipher with a block length of 128 bits.
• AES allows for three different key lengths: 128, 192, or 256 bits. Most of our
discussion will assume that the key length is 128 bits.
• Encryption consists of 10 rounds of processing for 128-bit keys, 12 rounds for
192-bit keys, and 14 rounds for 256-bit keys.
• Except for the last round in each case, all other rounds are identical.
• Each round of processing includes one single-byte based substitution step, a row-
wise permutation step, a column-wise mixing step, and the addition of the round
key. The order in which these four steps are executed is different for encryption
and decryption.
Therefore, the first four bytes of a 128-bit input block occupy the first column in
the 4 × 4 matrix of b tes. The next four bytes occupy the second column, and so on.
The 4×4 matrix of bytes shown above is referred to as the state array in AES.
41
The algorithm begins with an Add round key stage followed by 9 rounds of four stages
and a tenth round of three stages.
This applies for both encryption and decryption with the exception that each stage of a
round the decryption algorithm is the inverse of its counterpart in the encryption
algorithm.
The four stages are as follows: 1. Substitute bytes 2. Shift rows 3. Mix Columns 4. Add
Round Key
Substitute Bytes
• This stage (known as SubBytes) is simply a table lookup using a 16 × 16 matrix of byte
values called an s-box.
• This matrix consists of all the possible combinations of an 8 bit sequence (28 = 16 × 16
= 256).
• However, the s-box is not just a random permutation of these values and there is a
well defined method for creating the s-box tables.
42
• The designers of Rijndael showed how this was done unlike the s-boxes in DES for
which no rationale was given.Our concern will be how state is effected in each round.
• For this particular round each byte is mapped into a new byte in the following way: the
leftmost nibble of the byte is used to specify a particular row of the s-box and the
rightmost nibble specifies a column.
• For example, the byte {95} (curly brackets represent hex values in FIPS PUB 197)
selects row 9 column 5 which turns out to contain the value {2A}.
• This is then used to update the state matrix.
43
MIX COLUMN TRANSFORMATION
• This stage (known as MixColumn) is basically a substitution
• Each column is operated on individually. Each byte of a column is mapped into a new
value that is a function of all four bytes in the column.
• The transformation can be determined by the following matrix multiplication on state
• Each element of the product matrix is the sum of products of elements of one row and
one column.
• In this case the individual additions and multiplications are performed in GF(28 ).
• The MixColumns transformation of a single column j (0 ≤ j ≤ 3) of state can be
expressed as:
s ′ 0,j = (2 • s0,j) ⊕ (3 • s1,j) ⊕ s2,j ⊕ s3,j s
′ 1,j = s0,j ⊕ (2 • s1,j) ⊕ (3 • s2,j) ⊕ s3,j s ′
2,j = s0,j ⊕ s1,j ⊕ (2 • s2,j) ⊕ (3 • s3,j) s ′
3,j = (3 • s0,j) ⊕ s1,j ⊕ s2,j ⊕ (2 • s3,j)
44
• This transformation is as simple as possible which helps in efficiency but it also effects
every bit of state.
• The AES key expansion algorithm takes as input a 4-word key and produces a linear
array of 44 words. Each round uses 4 of these words as shown in figure.
• Each word contains 32 bytes which means each subkey is 128 bits long. Figure 7 show
pseudocode for generating the expanded key from the actual key.
BLOWFISH ALGORITHM
• a symmetric block cipher designed by Bruce Schneier in 1993/94 •
characteristics
• fast implementation on 32-bit CPUs
• compact in use of memory
• simple structure for analysis/implementation
• variable security by varying key size
• has been implemented in various products
BLOWFISH KEY SCHEDULE
• uses a 32 to 448 bit key, 32-bit words stor in K-array Kj ,j from 1 to 14
• used to generate
Media
• 18 32-bit subkeys stored in P array, P1 ….P18
• four 8x32 S-boxes stored in Si,j , each with 256 32-bit entries
Subkeys and S-Boxes Generation:
1. initialize P-arra and then 4 S-boxes in order using the fractional part of pi P1 (
left most 32-bit), and so on,,, S4,255.
2. XOR P-array with key-Array (32-bit blocks) and reuse as needed: assume we have
Skyups
up to k10 then P10 XOR K10,, P11 XOR K1 … P18 XOR K8
3. Encrypt 64-bit block of zeros, and use the result to update P1 and P2.
4. encrypting output form previous step using current P & S and replace P 3 and P4.
Then encrypting current output and use it to update successive pairs of P.
5. After updating all P’s (last :P17 P18), start updating S values using the encrypted
output from previous step.
• requires 521 encryptions, hence slow in re-keying
• Not suitable for limited-memory applications.
45
BLOWFISH ENCRYPTION
• uses two main operations: addition modulo 232 , and XOR
• data is divided into two 32-bit halves L0 & R0
for i = 1 to 16 do
Ri = Li-1 XOR Pi;
Li = F[Ri] XOR Ri-1;
L17 = R16 XOR P18;
R17 = L16 XOR P17;
• where
F[a,b,c,d] = ((S1,a + S2,b) XOR S3,c) + S4,d
46
BLOCK CIPHER MODES OF OPERATIONS
• Direct use of a block cipher is inadvisableMedia
47
Cipher Block Chaining
• We would like that same plaintext blocks produce different ciphertext blocks.
• Cipher Block Chaining (see figure) allows this by XORing each plaintext with the
Ciphertext from the previous round (the first round using an Initialisation Vector (IV)).
• As before, the same key is used for each block.
• Decryption works as shown in the figure because of the properties of the XOR
operation, i.e. IV ⊕ IV ⊕ P = P where IV is the Initialisation Vector and P is the plaintext.
• Obviously the IV needs to be known by both sender and receiver and it should be kept
secret along with the key for maximum security.
48
• As with CBC, the units of plaintext are chained together, so that the ciphertext of any
plaintext unit is a function of all the preceding plaintext (which is split into s bit
segments).
• The input to the encryption function is a shift register equal in length to the block cipher
of the algorithm (although the diagram shows 64 bits, which is block size used by DES,
this can be extended to other block sizes such as the 128 bits of AES).
• This is initially set to some Initialisation Vector (IV).
49
Counter Mode
50
of some suitable protocol. The concept of public-key cryptography evolved from an
attempt to attack two of the most difficult problems associated with symmetric
encryption:
1.) key distribution – how to have secure communications in general without having to
trust a KDC with your key
2.) digital signatures – how to verify a message comes intact from the claimed sender
Public-key/two-key/asymmetric cryptography involves the use of two keys:
• a public-key, which may be known by anybody, and can be used to encrypt
messages, and verify signatures
• a private-key, known only to the recipient, used to decrypt messages, and sign
(create) signatures.
• is asymmetric because those who encrypt messages or verify signatures cannot
decrypt messages or create signatures
Public-Key algorithms rely on one key for encryption and different but related key
for decryption. These algorithms have the following important characteristics:
• it is computationally infeasible to find decryption key knowing only algorithm &
encryption key
• it is computationally easy to en/decrypt messages when the relevant
(en/decrypt) key is known
• either of the two related keys can be used for encryption, with the other used for
decryption (for some algorithms like RSA)
The following figure illustrates public-key encryption process and shows that a public-key
encryption scheme has six ingredients: plaintext, encryption algorithm, public & private keys,
ciphertext & decryption algorithm.
51
The essential steps involved in a public-key encryption scheme are given below:
1.) Each user generates a pair of keys to be used for encryption and decryption.
2.) Each user places one of the two keys in a public register and the other key is kept
private.
3.) If B wants to send a confidential message to A, B encrypts the message using A’s public
key.
4.) When A receives the message, she decrypts it using her private key. Nobody else can
decrypt the message because that can only be done using A’s private key (Deducing a
private key should be infeasible).
5.) If a user wishes to change his keys –generate another pair of keys and publish the
public one: no interaction with other users is needed. Notations used in Public-key
cryptography:
• The public key of user A will be denoted KUA.
• The private key of user A will be denoted KRA.
• Encryption method will be a function E.
• Decryption method will be a function D.
• If B wishes to send a plain message X to A, then he sends the cryptotext Y=E(KU A,X)
• The intended receiver A will decrypt the message: D(KR A,Y)=X
The first attack on Public-key Cryptogra hy is the attack on Authenticity. An attacker may
impersonate user B: he sends a message E(KUA,X) and claims in the message to be B –A has
no guarantee this is so. To overcome this, B will encrypt the message using his private key:
Y=E(KRB,X). Receiver decrypts using B’s public key KR B. This shows the authenticity of the
sender because (supposedly) he is the only one who knows the private key. The entire
encrypted message serves as a digital signature. This scheme is depicted in the following
figure:
52
But, a drawback still exists. Anybody can decrypt the message using B’s public key. So, secrecy
or confidentiality is being compromised. One can provide both authentication and
confidentiality using the public-key scheme twice:
A will decrypt Z (and she is the only one capable of doing it): Y=D(KRA,Z)
A can now get the plaintext and ensure that it comes from B (he is the only one who knows
his private key): decrypt Y using B’s public key: X=E(KUB,Y).
53
Applications for public-key cryptosystems:
1.) Encryption/decryption: sender encrypts the message with the receiver’s public key.
2.) Digital signature: sender “signs” the message (or a representative part of the
message) using his private key
3.) Key exchange: two sides cooperate to exchange a secret key for later use in a secret-
key cryptosystem.
6. Either of the two keys can be used for encryption, with the other used for decryption:
M= DKRb[EKUb(M)]=DKUb[EKRb(M)]
Easy is defined to mean a problem that can be solv in polynomial time as a
function of
input length. A problem is infeasible if the effort to solve it grows faster than polynomial time
as a function Skyupsofinputsize.Public-key cryptosystems usually rely on difficult math
functions rather than -P networks as cla ical cryptosystems. One-way function is one,
easy to calculate in one direction, infeasible to calculate in the other direction (i.e., the
inverse is infeasible to compute). Trap-door function is a difficult function that becomes
easy if some extra information is known. Our aim to find a trap-door one-way function,
which is easy to calculate in one direction and infeasible to calculate in the other direction
unless certain additional information is known.
Security of Public-key schemes:
• Like private key schemes brute force exhaustive search attack is always
theoretically possible. But keys used are too large (>512bits).
• Security relies on a large enough difference in difficulty between easy
(en/decrypt) and hard (cryptanalyse) problems. More generally the hard
problem is known, its just made too hard to do in practise.
54
• Requires the use of very large numbers, hence is slow compared to private key
schemes
RSA ALGORITHM
RSA is the best known, and by far the most widely used general public key
encryption algorithm, and was first published by Rivest, Shamir & Adleman of MIT in
1978 [RIVE78]. Since that time RSA has reigned supreme as the most widely accepted and
implemented general-purpose approach to public-key encryption. The RSA scheme is a
block cipher in which the plaintext and the ciphertext are integers between 0 and n-1 for
some fixed n and typical size for n is 1024 bits (or 309 decimal digits). It is based on
exponentiation in a finite (Galois) field over integers modulo a prime, using large integers
(eg. 1024 bits). Its security is due to the cost of factoring large numbers. RSA involves a
public-key and a private-key where the public key is known to ll and is used to encrypt
data or message. The data or message which has been encrypted using a public key can
only be decryted by using its corresponding private-k y. Each user generates a key pair
i.e. public and private key using the following steps:
• each user selects two large primes at random - p, q
• compute their system modulus n=p.q
• calculate ø(n), where ø(n)=(p-1)(q- 1)
• selecting at random the encry tion key e, where 1<e<ø(n),and gcd(e,ø(n))=1
• solve following equation to find decryption key d: e.d=1 mod ø(n) and 0≤d≤n
• publish their public encr ption key: KU={e,n}
• keep secret private decryption key: KR={d,n}
Both the sender and receiver must know the values of n and e, and only the receiver
knows the value of d. Encryption and Decryption are done using the following equations.
To encrypt a message M the sender:
– obtains public key of recipient KU={e,n}
– computes: C=Me mod n, where 0≤M<n
To decrypt the ciphertext C the owner:
– uses their private key KR={d,n}
– computes: M=Cd mod n = (Me) d mod n = Med mod n
55
For this algorithm to be satisfactory, the following requirements are to be met.
a) Its possible to find values of e, d, n such that Med = M mod n for all M<n
b) It is relatively easy to calculate Me and C for all values of M < n.
c) It is impossible to determine d given e and n
The way RSA works is based on Number theory: Fermat’s little theorem: if p is
prime and a is positive integer not divisible by p, then ap-1 ≡ 1 mod p. Corollary: For
any positive integer a and prime p, ap ≡ a mod p.
Fermat’s theorem, as useful as will turn out to be does not provide us with integers
d,e we are looking for –Euler’s theorem (a refinement of Fermat’s) does. Euler’s function
associates to any positive integer n, a number φ(n): the number of positive integers smaller
than n and relatively prime to n. For example, φ(37) = 36 i.e. φ(p) = p-1 for any prime p. For
any two primes p,q, φ(pq)=(p-1)(q-1). Euler’s theorem: for any relatively prime integers
a,n we have aφ(n)≡1 mod n. Corollary: For ny integers a,n we have aφ(n)+1≡a mod n
Corollary: Let p,q be two odd primes and n=pq. Then: φ(n)=(p-1)(q-
1) For any integer m with 0<m<n, m(p-1)(q-1)+1 ≡ m mod n For any integers k,m with
0<m<n, mk(p-1)(q-1)+1 ≡ m mod n Euler’s theorem provides us the numbers d, e such
that Med=M mod n. We have to choose d,e such that ed=kφ(n)+1, or equivalently, d≡e-
1mod φ(n)
56
Another example of RSA is given as,
Let p = 11, q = 13, e = 11, m = 7
n = pq i.e. n= 11*13 = 143
ø(n)= (p-1)(q-1) i.e. (11-1)(13-1) = 120
e.d=1 mod ø(n) i.e. 11d mod 120 = 1 i.e. (11*11) mod 120=1;
so d = 11 public key :{11,143} and private key: {11,143}
C=Me mod n, so ciphertext = 711mod143 = 727833 mod 143; i.e. C =
106 M=Cd mod n, plaintext = 10611 mod 143 = 1008 mod 143; i.e. M = 7
Security of RSA
There are three main approaches of attacking RSA algorithm.
Brute force key search (infeasible given size of numbers) As explained before, involves
trying all possible private keys. Best defence is using large keys.
Mathematical attacks (based on difficulty of computing ø(N), by factoring modulus N)
There are several approaches, all equivalent in effect to factoring the product of two
primes. Some of them are given as:
57
– factor N=p.q, hence find ø(N) and then d
– find d directly
The possible defense would be using large keys and also choosing large numbers for p
and q, which should differ only by a few bits and are also on the order of magnitude 10 75
to 10100. And gcd (p-1, q-1) should be small.
58
For this scheme, thereSkyupsaretwopbliclyknown numbers: a prime number q and an integer α
that is a primitive root of q. ppose the users A and B wish to exchange a key. User A
selects a random integer X A < q and computes YA = αXA mod q. Similarly, user B
independently selects a random integer XA < q and computes YB = αXB mod q. Each side
keeps the X value private and makes the Y value available publicly to the other side. User
A computes the key as K = (YB)XA mod q and user B computes the key as K = (YA)XB mod
q. These two calculations produce identical results.
Discrete Log Problem
The (discrete) exponentiation problem is as follows: Given a base a, an exponent b and a
modulus p, calculate c such that ab ≡ c (mod p) and 0 ≤ c < p. It turns out that this problem is
fairly easy and can be calculated "quickly" using fast-exponentiation. The discrete log
problem is the inverse problem: Given a base a, a result c (0 ≤ c < p) and a modulus p,
84
59
calculate the exponent b such that ab ≡ c (mod p). It turns out that no one has found
a quick way to solve this problem With DLP, if P had 300 digits, Xa and Xb have more than
100 digits, it would take longer than the life of the universe to crack the method.
Examples for D-H key distribution scheme:
1) Let p = 37 and g = 13.
Let Alice pick a = 10. Alice calculates 1310 (mod 37) which is 4 and sends that to Bob. Let Bob
pick b = 7. Bob calculates 137 (mod 37) which is 32 and sends that to Alice. (Note: 6 and 7 are
secret to Alice and Bob, respectively, but both 4 and 32 are known by all.)
10 (mod 37) which is 30, the secret key.
2) Let p = 47 and g = 5. Let Alice pick a = 18. Alice calculates 5 18 (mod 47) which is 2 and
sends that to Bob. Let Bob pick b = 22. Bob calculates 5 22 (mod 47) which is 28 and sends
that to Alice.
18 (mod 47) which is 24, the secret key.
22 (mod 47) which is 24, the same secret key
3. Darth intercepts YA and transmits YD1 to Bob. Darth also calculates K2 = (YA)XD2mod q.
6. Darth intercepts XA and transmits YD2 to Alice. Darth calculates K1 = (YB)XD1 mod q.
60
At this point, Bob and Alice think that they share a secret key, but instead Bob and Darth
share secret key K1 and Alice and Darth share secret key K2. All future communication
between Bob and Alice is compromised in the following way:
1. Alice sends an encrypted message M: E(K2, M).
3. Darth sends Bob E(K1, M) or E(K1, M'), where M' is any message. In the first case, Darth
simply wants to eavesdrop on the communication without altering it. In the second case,
Darth wants to modify the message going to Bob.
The key exchange protocol is vulnerable to such an attack because it does not
authenticate the participants. This vulnerability can be overcome with the use of digital
signatures and public-key certificates.
is defined as the set of points (x,y) ᴄ GF(p) * GF(p) which satisfy the equation
y2 ≡ x3 + ax + b (mod p), together with a special point, O, called the point at infinity. Let
P and Q be two points on E(a,b)(GF(p)) and O is the point at infinity.
• P+O = O+P = P
61
y3 = ƛ (x1 - x3) - y1 and
ƛ = (y2-y1)/(x2-x1) if P ≠ Q
ƛ = (3x12+a)/ 2y1 if P = Q
An elliptic curve may be defined over any finite field GF(q). For GF(2m), the curve has a
different form:- y2 + xy = x3 + ax2 + b, where b !=0.
Pick a prime number p= 2180 and elliptic curve parameters and b for the equation
y2 ≡ x3 + ax + b (mod p) which defines the elliptic group of points Ep(a,b). Select
generator point G=(x1,y1) in Ep(a,b) uch that the smallest value for which nG=O be a very
large prime number. Ep(a,b) and G are parameters of the cryptosystem known to all
participants. The following steps take place:
• A & B select private keys nA<n, nB<n
62
decrypt the ciphertext, B multiplies the first point in the pair by B’s secret key and
subtracts the result from the second point Pm+kPb – nB(kG) = Pm+k(nBG) – nB(kG) =
Pm A has masked the message Pm by adding kPb to it. Nobody but A knows the value of
k, so even though Pb is a public key, nobody can remove the mask kPb. For an attacker
to recover the message, he has to compute k given G and kG, which is assumed hard.
Security of ECC To protect a 128 bit AES key it would take a RSA Key Size of 3072 bits
whereas an ECC Key Size of 256 bits.
• Any application where sec rity is needed but lacks the power, storage and
computational power that is necessary for our current cryptosystems
KEY MANAGEMENT
One of the major roles of public-key encryption has been to address the problem of key
distribution. Two distinct aspects to use of public key encryption are present.
The distribution of public keys.
Distribution of Public Keys The most general schemes for distribution of public keys
are given below
63
PUBLIC ANNOUNCEMENT OF PUBLIC KEYS
Here any participant can send his or her public key to any other participant or broadcast the
key to the community at large. For example, many PGP users have adopted the practice of
appending their public key to messages that they send to public forums.
such a public announcement. Some user could pretend to be user A nd send a public key
to another participant or broadcast such a public key. Until the time when A discovers
about the forgery and alerts other participants, the forger is able to read all encrypted
messages intended for A and can use the forged keys for authentication.
64
3. A participant may replace the existing key with a new one at any time, either
because of the desire to replace a public key that has already been used for a large
amount of data, or because the corresponding private key has been compromised
in some way.
4. Participants could also access the directory electronically. For this purpose,
secure, authenticated communication from the authority to the participant is
mandatory. This scheme has still got some vulnerabilities. If an adversary succeeds in
obtaining or computing the private key of the directory authority, the adversary could
authoritatively a out counterfeit public keys and subsequently impersonate any
participant and eavesdrop on messages sent to any participant. Or else, the adversary
may tam er with the records kept by the authority.
PUBLIC-KEY AUTHORITY
Stronger security for public-key distribution can be achieved by providing tighter
control over the distribution of public keys from the directory. This scenario assumes the
existence of a public authority (whoever that may be) that maintains a dynamic directory
of public keys of all users. The public authority has its own (private key, public key) that
it is using to communicate to users. Each participant reliably knows a public key for the
authority, with only the authority knowing the corresponding private key. For example,
consider that Alice and Bob wish to communicate with each other and the following steps
take place and are also shown in the figure below:
65
1.) Alice sends a timestamped message to the central authority with a request for Bob’s
public key (the time stamp is to mark the moment of the request)
2.) The authority sends back a message encrypted w th its private key (for authentication)
–message contains Bob’s public k y and the original message of Alice – this way Alice
knows this is not a reply to an old r qu st;
3.) Alice starts the communication to Bob by sending him an encrypted message
containing her identity IDA and a nonce N 1 (to identify uniquely this transaction)
4.) Bob requests Alice’s public key in the same way (step 1)
5.) Bob acquires Alice’s public key in the same way as Alice did. (Step-2)
6.) Bob replies to Alice by sending an encrypted message with N 1 plus a new generated
nonce N2 (to identify uniquely the transaction)
7.) Alice replies once more encrypting Bob’s nonce N 2 to assure bob that its
correspondent is Alice
Thus, a total of seven messages are required. However, the initial four messages need be
used only infrequently because both A and B can save the other's public key for future
use, a technique known as caching. Periodically, a user should request fresh copies of the
public keys of its correspondents to ensure currency.
66
PUBLIC-KEY CERTIFICATES
The above technique looks attractive, but still has some drawbacks. For any
communication between any two users, the central authority must be consulted by both
users to get the newest public keys i.e. the central authority must be online 24 hours/day. If
the central authority goes offline, all secure communications get to a halt. This clearly leads
to an undesirable bottleneck. A further improvement is to use certificates, which can be used
to exchange keys without contacting a public-key authority, in a way that is as reliable as if
the keys were obtained directly from a public-key authority. A certificate binds an identity
to public key, with all contents signed by a trusted Public-Key or Certificate Authority (CA).
A user can present his or her public key to the authority in a secure manner, and obtain a
certificate. The user can then publish the certificate. Anyone needed this user's public key can
obtain the certificate and verify that it is valid by way of the attached trusted signature. A
participant can also convey its key information to another by transmitting its certificate.
Other participants can verify that the certificateMediawascreatedbythe authority. This
certificate issuing scheme does have the following requirements:
1. Any participant can read a certificate to determine the n me and public key of the
certificate's owner.
2. Any participant can verify that the certificate originat from the certificate authority and is
not counterfeit.
67
Application must be in person or by some form of secure authenticated communication.
For participant A, the authority provides a certificate of the form
CA = E(PRauth, [T||IDA||PUa]) where PRauth is the private key used by the authority and
T is a timestamp. A may then pass this certificate on to any other participant, who reads
and verifies the certificate as follows: D(PUauth, CA) = D(PUauth, E(PRauth, [T||IDA||PUa])) =
(T||IDA||PUa) The recipient uses the authority's public key, PUauth to decrypt the
certificate. Because the certificate is readable only using the authority's public key, this
verifies that the certificate came from the certificate authority. The elements ID A and PUa
provide the recipient with the name and public key of the certificate's holder. The
timestamp T validates the currency of the certificate. The timestamp counters the
following scenario. A's private key is learned by an adversary. A generates a new
private/public key pair and applies to the certificate authority for a new certificate.
Meanwhile, the adversary replays the old certificate to B. If B then encrypts messages
using the compromised old public key, the adversary can re d those messages. In this
context, the compromise of a private key is comparable to the loss of a credit card. The
owner cancels the credit card number but is at risk until all possible communicants are
aware that the old credit card is obsolete. Thus, the timestamp serves as something like
an expiration date. If a certificate is sufficiently old, it is assumed to be expired.
One scheme has becomeSkyupsuniversallyaccepted for formatting public-key
certificates: the X.509 standard. X.509 certificates are ed in most network security
applications, including IP security, secure sockets layer (SSL), secure electronic
transactions (SET), and S/MIME.
68
1. A uses B's public key to encrypt a message to B containing an identifier of A (ID A)
and a nonce (N1), which is used to identify this transaction uniquely.
2. B sends a message to A encrypted with PUa and containing A's nonce (N1) as well as a
new nonce generated by B (N2) Because only B could have decrypted message (1), the
presence of N1 in message (2) assures A that the correspondent is B.
3. A returns N2 encrypted using B's public key, to assure B that its correspondent is A.
4. A selects a secret key Ks and sends M = E(PUb, E(PRa, Ks)) to B. Encryption of this
message with B's public key ensures that only B can read it; encryption with A's
private key ensures that only A could have sent it.
5. B computes D(PUa, D(PRb, M)) to recover the secret key.
The result is that this scheme ensures both confidentiality and authentication in
the exchange of a secret key.
69
UNIT-III
Message Authentication Algorithms and Hash Function: Authentication Requirements,
Functions, Message Authentication Codes, Hash Functions, Secure Hash Algorithms,
Whirlpool, HMAC, CMAC, Digital Signatures, Knapsack Algorithm, Authentication
Applications: Kerberos, X.509 Authentication Services, Public-Key Infrastructure,
Biometric Authentication.
MESSAGE AUTHENTICATION
Message authentication is a procedure to verify that received messages come from
the alleged source and have not been altered. Message authentication may also verify
sequencing and timeliness. It is intended against the attacks like content modification,
sequence modification, timing modification and repudiation. For repudiation, concept of
digital signatures is used to counter it. There are three classes by which different types of
functions that may be used to produce an authenticator. They re:
Message authentication code (MAC)–a public function of the message and a secret
key producing a fixed-length value to erve as authenticator. This does not provide a
digital signature because A and B share the same key.
Hash function–a public function mapping an arbitrary length message into a fixed-
length hash value to serve as authenticator. This does not provide a digital signature
because there is no key.
MESSAGE ENCRYPTION:
Message encryption by itself can provide a measure of authentication. The analysis differs
for conventional and public-key encryption schemes. The message must have come from
the sender itself, because the ciphertext can be decrypted using his (secret or public) key.
Also, none of the bits in the message have been altered because an opponent does not
know how to manipulate the bits of the ciphertext to induce meaningful changes to the
plaintext. Often one needs alternative authentication schemes than just encrypting the
message.
Sometimes one needs to avoid encryption of full messages due to legal requirements.
70
Encryption and authentication may be separated in the system architecture.
71
and the MAC are transmitted to the intended recipient, who upon receiving performs the
same calculation on the received message, using the same secret key to generate a new MAC.
The received MAC is compared to the calculated MAC and only if they match, then:
1. The receiver is assured that the message has not been altered: Any alternations been
done the MAC’s do not match.
2. The receiver is assured that the message is from the alleged sender: No one except
the sender has the secret key and could prepare a message with a proper MAC.
If one side has a heavy load, it cannot afford to decrypt all messages –it will just check
the authenticity of some randomly selected messages.
72
Authentication of computer programs in plaintext is very attractive service as they
need not be decrypted every time wasting of processor resources. Integrity of the
program can always be checked by MAC.
MESSAGE AUTHENTICATION CODE BASED ON DES
The Data Authentication Algorithm, based on DES, has been one of the most widely used
MACs for a number of years. The algorithm is both a FIPS publication (FIPS PUB 113) and
an ANSI standard (X9.17). But, security weaknesses in this algorithm have been
discovered and it is being replaced by newer and stronger algorithms. The algorithm can
be defined as using the cipher block chaining (CBC) mode of operation of DES shown
below with an initialization vector of zero.
The data (e.g., message, record, file, or program) to be authenticated are grouped into
contiguous 64-bit blocks: D1, D2,..., DN. If necessary, the final block is padded on the right
with zeroes to form a full 64-bit block. Using the DES encryption algorithm, E, and a secret
key, K, a data authentication code (DAC) is calculated as follows:
73
The DAC consists of either the entire block ON or the leftmost M bits of the block, with 16
≤ M ≤ 64
Use of MAC needs a shared secret key between the communicating parties and also MAC
does not provide digital signature. The following table summarizes the confidentiality
and authentication implications of the approaches shown above.
HASH FUNCTION
A variation on the message authentication code is the one-way hash function. As
with the message authentication code, the hash function accepts a variable-size message
M as input and produces a fixed-size hash code H(M), sometimes called a message digest,
as output. The hash code is a function of all bits of the message and provides an error-
detection capability: A change to any bit or bits in the message results in a change to the
hash code. A variety of ways in which a hash code can be used to provide message
authentication is shown below and explained stepwise in the table.
74
75
In cases where confidentiality is not requir d, methods b and c have an advantage over
those that encrypt the entire mes age in that less computation is required. Growing interest
for techniquesSkyupsthatavoidencryption is due to reasons like, Encryption software is quite
slow and may be covered by atents. Also encryption hardware costs are not negligible and
the algorithms are bject to U.S export control. A fixed-length hash value h is generated by a
function H that takes as input a message of arbitrary length: h=H(M).
A sends M and H(M)
76
Computationally infeasible to find M such that H(M)=h, for a given h, referred to as
the one-way property
• Rotated XOR –before each addition the hash value is rotated to the left with 1 bit
remained as the most popular hash algorithm until r c ntly. The algorithm takes as input,
a message of arbitrary length and produces as output, 128-bit message digest. The input
is processed in 512-bit blocks. The processing consists of the following steps:
1.) Append Padding bits: The message is padded so that its length in bits is congruent to 448
modulo 512 i.e. the length of the padded message is 64 bits less than an integer multiple of
512 bits. Padding is always added, even if the message is already of the desired length.
Padding consists of a single 1-bit followed by the necessary number of 0-bits.
2.) Append length: A 64-bit representation of the length in bits of the original message
(before the padding) is appended to the result of step-1. If the length is larger than 264,
the 64 least representative bits are taken.
3.) Initialize MD buffer: A 128-bit buffer is used to hold intermediate and final results of
the hash function. The buffer can be represented as four 32-bit registers (A, B, C, D) and
are initialized with A=0x01234567, B=0x89ABCDEF, C=0xFEDCBA98, D=0x76543210 i.e.
32-bit integers (hexadecimal values).
77
4.) Process Message in 512-bit (16-word) blocks : The h art of algorithm is the compression
function that consists of four rounds of processing and this module is labeled HMD5 in the
above figure and logic is illustrated in the following figure. The four rounds have a similar
structure, but each uses a different primitive logical function, referred to as F, G, H and I in
the specification. Each block takes as input the current 512-bit block being processed Yq and
the 128-bit buffer value ABCD and updates the contents of the buffer. Each round also makes
use of one-fourth of a 64- element table T*1….64+, constructed
from the sine function. The ith element of T, denoted T[i], has the value equal to the
integer part of 232 * abs(sin(i)), where i is in radians. As the value of abs(sin(i)) is a value
between 0 and 1, each element of T is an integer that can be represented in 32-bits and
would eliminate any regularities in the input data. The output of fourth round is added to
the input to the first round (CVq) to produce CVq+1. The addition is done independently
for each of the four words in the buffer with each of the corresponding words in CVq,
using addition modulo 232. This operation is shown in the figure below:
78
5.) Output: After all L 512-bit blocks have been proc ssed, the output from the Lth stage
is the 128- bit message digest. MD5 can be summarized as follows:
CV0 = IV CVq+1 = SUM32(CVq,RFIYqRFH[Yq,RF G[Yq,RFF[Yq,CVq]]]]) MD =
CVL Where,
IV = initial value of ABCD buffer, defined in step 3.
Yq = the qth 512-bit block of the message
L = the number of blocks in the message
CVq = chaining variable processed with the qth block of the message.
RFx = round function using primitive logical function x.
MD = final message digest value
SUM32 = Addition modulo 232 performed separately.
MD5 Compression Function:
Each round consists of a sequence of 16 steps operating on the buffer ABCD. Each step is
of the form, a = b+((a+g(b,c,d)+X[k]+T[i])<<<s)
where a, b, c, d refer to the four words of the buffer but used in varying permutations.
After 16 steps, each word is updated 4 times. g(b,c,d) is a different nonlinear function in
each round (F,G,H,I). Elementary MD5 operation of a single step is shown below.
79
The primitive function g of the F,G,H,I is given as:
Where the logical operators (AND, OR, NOT, XOR) are represented by the symbols
(ᴧ,ᴠ, ~,(+)).
Each round mixes the buffer input with the next "word" of the message in a complex, non-
linear manner. A different non-linear function is used in each of the 4 rounds (but the same
function for all 16 steps in a round). The 4 buffer words (a,b,c,d) are rotated from step to step
so all are used and updated. g is one of the primitive functions F,G,H,I for the 4 rounds
respectively. X[k] is the kth 32-bit word in the current message block. T[i] is the ith entry in
the matrix of constants T. The addition of varying constants T and the use of different shifts
helps ensure it is extremely difficult to compute collisions. The array of 32-bit words X[0..15]
holds the value of current 512-bit input block being processed. Within a round, each of the
16 words of X[i] is used exactly once, during one step. The order in which these words is used
varies from round to round. In the first round, the
80
words are used in their original order. For rounds 2 through 4, the following
permutations are used
ƿ2(i) = (1 + 5i) mod 16
ƿ4(I) = 7i mod 16
MD4
Precursor to MD5
Design goals of MD4 (which are carried over to MD5)
Security
Speed
Simplicity and compactness
Favor little-endian architecture
Main differences between MD5 and MD4
A fourth round has been added.
Each step now has a unique additive constant.
The function g in round 2 was changed from (bc v bd v cd) to (bd v cd’) to make g less
symmetric.
Each step now adds in the result of the previous step. This promotes a faster
"avalanche effect".
The order in which input words are accessed in rounds 2 and 3 is changed, to make
these patterns less like each other.
The shift amounts in each round have been approximately optimized, to yield a faster
"avalanche effect." The shifts in different rounds are distinct.
81
The input is processed in 512-bit blocks. The overall processing of a message follows the
hash function. This is formed by 32-bit registers A,B,C,D,E. Initial values: A=0x67452301,
B=0xEFCDAB89, C=0x98BADCFE, D=0x10325476, E=C3D2E1F0. Stores in big-endian format
i.e. the most significant bit in low address.
4.) Process message in bloc 512-bit (16-word) blocks: The processing of a single 512-bit
block is shown above. It consists of four rounds of processing of 20 steps each. These four
rounds have similar structure, but uses a different primitive logical function, which we refer
to as f1, f2, f3 and f4. Each round takes as input the current 512-bit block being processed
and the 160-bit buffer value ABCDE and updates the contents of the buffer. Each round also
makes use of four distinct additive constants Kt. The output of the fourth round i.e. eightieth
step is added to the input to the first round to produce CVq+1.
5.) Output: After all L 512-bit blocks have been processed, the output from the Lth stage
is the 160-bit message digest.
82
The behavior of SHA-1 is as follows: CV0 = IV CVq+1 = SUM32(CVq, ABCDEq) MD = CVL
Where, IV = initial value of ABCDE buffer ABCDEq = output of last round of processing of
qth message block L = number of blocks in the message SUM32 = Addition modulo 232
MD = final message digest value.
83
SHA shares much in common with MD4/5, but with 20 instead of 16 steps in each of the 4
rounds. Note the 4 constants are based onMediasqrt(2,3,5,10).Note also that instead of just
splitting the input block into 32-bit words and using them d rectly, SHA-1 shuffles and
mixes them using rotates & XOR’s to form more complex input, and greatly increases the
difficulty of finding collisions. A sequence of logical functions f 0, f1,..., f79 is used in the SHA-
1. Each ft, 0<=t<=79, operates on three 32-bit words B, C, D and produces a 32-bit word
as output. ft(B,C,D) is defined as follows: for words B, C, D, ft(B,C,D) = (B AND C) OR ((NOT
B) AND D) ( 0 <= t <= 19) ft(B,C,D) = B XOR C XOR D (20 <= t <= 39) ft(B,C,D) = (B AND
C) OR (B AND D) OR (C AND D) (40 <= t <= 59) ft(B,C,D) = B XOR C XOR D (60 <= t <=
79).
WHIRLPOOL HA H FUNCTION
• Created by Vincent Rijmen and Paulo S. L. M. Barreto
• Hashes messages of plaintext length 2^256
• Result is a 512 bit message
• Three versions have been released – WHIRLPOOL-0 – WHIRLPOOL-T – WHIRLPOOL
➢ designed specifically for hash function use
➢ with security and efficiency of AES
➢ but with 512-bit block size and hence hash
➢ similar structure & functions as AES but
84
⚫ input is mapped row wise
⚫ has 10 rounds
⚫ a different primitive polynomial for GF(2^8)
⚫ uses different S-box design & values
• “W” is a 512-bit block cipher
• “m” is the plaintext, split into 512 bit blocks
• “H” is the blocks formed from the hashes
WHIRLPOOL OVERVIEW
• The block cipher W is the core element of the Whirlpool hash function
• It is comprised of 4 steps.
– Add Round Key
85
– Shift Columns
– Mix Rows
– Substitute bytes
Add Round Key
• During the Add Round Key step, the message is XOR’d with the key
• If this is the first message block being run through, the key is a block of all zeros
• If this is any block except the first, the key is the digest of the previous block
Shift Columns
• Starting from left to right, each column gets rotated vertically a number of bytes
equal to which number column it is, from top to bottom –
Ex:
• [0,0][0,1][0,2] [0,0][2,1][1,2]
• [1,0][1,1][1,2] ------> [1,0][0,1][2,2]
• [2,0][2,1][2,2] [2,0][1,1][0,2]
Mix Rows
• Each row gets shifted horizontally by the numb r of row it is. Similar to the shift
column function, but rotated left to right –
Ex:
• [0,0][0,1][0,2] [0,0][0,1][0,2]
• [1,0][1,1][1,2] ------> [1,2][1,0][1,2]
• [2,0][2,1][2,2] [2,1][2,2][0,2]
Substitute bytes
• Each byte in the message is passed through a set of s-boxes
• The output of this is then set to be the key for the next round
HMAC
Interest in developing a MAC, derived from a cryptographic hash code has been increasing
mainly because hash functions are generally faster and are also not limited by export
restrictions unlike block ciphers. Additional reason also would be that the library code for
cryptographic hash functions is widely available. The original proposal is for incorporation
of a secret key into an existing hash algorithm and the approach that received most support
is HMAC. HMAC is specified as Internet standard RFC2104. It
86
makes use of the hash function on the given message. Any of MD5, SHA-1, RIPEMD-160
can be used.
To have a well understood cryptographic analysis of the strength of the MAC based on
reasonable assumptions on the embedded hash function
The first two objectives are very important for the acceptability of HMAC. HMAC treats
the hash function as a “black box”, which has two benefits. First is that an existing
implementation of the hash function can be used for implementing HMAC making the
bulk of HMAC code readily available without modificat on. Second is that if ever an
existing hash function is to be replaced, the existing hash funct on module is removed and
new module is dropped in. The last design obj ctive provides the main advantage of HMAC
over other proposed hash-based schemes. HMAC can be proven secure provided that the
embedded hash function has ome reasonable cryptographic strengths.
87
HMAC Algorithm
HMAC Structure
The XOR with ipad results in flipping one-half of the bits of K. Similarly, XOR with opad
results in flipping one-half of the bits of K, but different set of bits. By passing S i and S0
through the compression function of the hash algorithm, we have pseudorandomly
generated two keys from K.
88
HMAC should execute in approximately the same time as the embedded hash function for
long messages. HMAC adds three executions of the hash compression function (for S 0, Si,
and the block produced from the inner hash)
A more efficient implementation is possible. Two quantities are
precomputed. f(IV, (K+
f(IV, (K+
where f is the compression function for the hash function which takes as arguments a
chaining variable of n bits and a block of b-bits and produces a chaining variable of n bits.
As shown in the above figure, the values are needed to be computed initially and every
time a key changes. The precomputed quantities substitute for the initial value (IV) in the
hash function. With this implementation, only one additional instance of the compression
function is added to the processing normally produced by the hash function. This
implementation is worthwhile if most of the messages for which a MAC is computed are
short.
Security of HMAC:
The appeal of HMAC is that its designers have been able to prove an exact relationship
between the strength of the embedded hash function and the strength of HMAC. The
89
security of a MAC function is generally expressed in terms of the probability of successful
forgery with a given amount of time spent by the forger and a given number of message-
MAC pairs created with the same key. Have two classes of attacks on the embedded hash
function:
1. The attacker is able to compute an output of the compression function even with an
IV that is random, secret and unknown to the attacker.
2. The attacker finds collisions in the hash function even when the IV is random and
secret.
These attacks are likely to be caused by brute force attack on key used which has work of
order 2n; or a birthday attack which requires work of order 2 (n/2) - but which requires
the attacker to observe 2n blocks of messages using the same key - very unlikely. So even
MD5 is still secure for use in HMAC given these constraints.
CMAC Media
90
To generate an ℓ-bit CMAC tag (t) of a message (m) using a b-bit block cipher (E) and a
secret key (k), one first generates two b-bit sub-keys (k1 and k2) using the following
algorithm (this is equivalent to multiplication by x and x2 in a finite field GF(2b)). Let ≪
denote the standard left-shift operator and ⊕ denote exclusive or:
1. Divide message into b-bit blocks m = m1 ∥ ... ∥ mn−1 ∥ mn where m1, ..., mn−1 are
complete blocks. (The empty me age is treated as 1 incomplete block.)
2. If mn is a complete block then mn′ = k1 ⊕ mn else mn′ = k2 ⊕ (mn∥ 10...02).
3. Let c0 = 00…02.
4. For i = 1, ..., n-1, calculate ci = Ek(ci−1 ⊕ mi).
5. cn = Ek(cn−1 ⊕ mn′)
6. Output t = msbℓ(cn).
DIGITAL SIGNATURE
The most important development from the work on public-key cryptography is the
digital signature. Message authentication protects two parties who exchange messages from
any third party. However, it does not protect the two parties against each
91
other. A digital signature is analogous to the handwritten signature, and provides a set of
security capabilities that would be difficult to implement in any other way. It must have the
following properties: • It must verify the author and the date and time of the signature
• It must to authenticate the contents at the time of the signature • It must be verifiable
by third parties, to resolve disputes Thus, the digital signature function includes the
authentication function. A variety of approaches has been proposed for the digital
signature function. These approaches fall into two categories: direct and arbitrated.
Direct Digital Signature
Direct Digital Signatures involve the direct application of public-key algorithms involving
only the communicating parties. A digital signature may be formed by encrypting the entire
message with the sender’s private key, or by encrypting a hash code of the message with the
sender’s private key. Confidentiality can be provided by further encrypting the entire
message plus signature using either public or private key schemes. It is important to perform
the signature function first and then an outer confidentiality function, since in case of dispute,
some third party must view the message nd its signature. But these approaches are
dependent on the security of the s nd r’s pr vate-key. Will have problems if it is lost/stolen
and signatures forged. Need time-stamps and timely key revocation.
Arbitrated Digital Signature
The problems associated with direct digital signatures can be addressed by using an
arbiter, in a variety of possible arrangements. The arbiter plays a sensitive and crucial
role in this sort of scheme, and all arties must have a great deal of trust that the arbitration
mechanism is working properly. These schemes can be implemented with either private
or public- ey algorithms, and the arbiter may or may not see the actual message contents.
Using Conventional encryption
X A : M || E ( Kxa ,[ IDx || H (M) ] )
A Y : E( Kay ,[ IDx || M || E (Kxa ,[ IDx ||H(M))] ) || T ])
It is assumed that the sender X and the arbiter A share a secret key Kxa and that A and
Y share secret key Kay. X constructs a message M and computes its hash value H(m) .
Then X transmits the message plus a signature to A. the signature consists of an identifier
IDx of X plus the hash value, all encrypted using Kxa.
A decrypts the signature and checks the hash value to validate the message. Then A
transmits a message to Y, encrypted with Kay. The message includes IDx, the original
message from X, the signature, and a timestamp.
92
Arbiter sees message
Problem : the arbiter could form an alliance with sender to deny a signed message, or
with the receiver to forge the sender’s signature.
A can decrypt the outer encryption to assure that the message must have come from
X (because only X has PRx). Then A transmits a message to Y, encrypted with PRa. The
message includes IDx, the double encrypted message, and timestamp.
Arbiter does not see message
Digital Signature Standard (DSS)
The National Institute of Standards and Technology (NIST) has published Federal
Information Processing Standard FIPS 186, known as the Digital Signature Standard
(DSS). The DSS makes use of the Secure Ha h Algorithm (SHA) and presents a new digital
signature technique, the Digital Signature Algorithm (DSA). The DSS uses an algorithm
that is designed to provide only the digital signature function and cannot be used for
encryption or key exchange, unlike RSA.
The RSA approach is shown below. The message to be signed is input to a hash
function that produces a secure hash code of fixed length. This hash code is then
encrypted using the sender's private key to form the signature. Both the message and the
signature are then transmitted.
93
The recipient takes the message and produces a hash code. The recipient also
decrypts the signature using the sender's public key. If the calculated hash code matches
the decrypted signature, the signature is accepted as valid. Because only the sender
knows the private key, only the sender could have produced a valid signature.
The DSS approach also makes use of a hash function. The hash code is provided as
input to a signature function along with a random number k generated for this particular
signature. The signature function also depends on the sender's private key (PRa) and a
set of parameters known to a group of communicating principals. We can consider this
set to constitute a global public key (PUG).The result is a signature consisting of two
components, labeled s and r.
At the receiving end, the hash code of the incoming message is generated. This plus
the signature is input to a verification function. The verification function also depends on the
global public key as well as the sender's public key (PUa), which is paired with the sender's
private key. The outp t of the verification function is a value that is equal to the signature
component r if the signature is valid. The signature function is such that only the sender, with
knowledge of the private key, could have produced the valid signature.
KNAPSACK ALGORITHM
Public-key cryptography needs two keys. One key tells you how to encrypt (or code) a
message and this is "public" so anyone can use it. The other key allows you to decode (or
decrypt) the message. This decryption code is kept secret (or private) so only the person
who knows the key can decrypt the message. It is also possible for the person
94
with the private key to encrypt a message with the private key, then anyone holding
the public key can decrypt the message, although this seems to be of little use if you are
trying to keep something secret!
The First General Public-Key Algorithm used what we call the Knapsack Algorithm.
Although we now know that this algorithm is not secure we can use it to look at
how these types of encryption mechanisms work.
Knapsack 1 6 8 15 24 1 6 8 15 24 1 6 8 15 24 1 6 8 15 24
Cipher text 1 + 15 + 24 = 40 1 + 6 + 15 = 22 6 + 15 + 24 = 45 0 =0
So, if someone sends you the code 38 this can only have come from the plain text 01101.
When the Knapsack Algorithm is used in public key cryptography, the idea is to create two
different knapsack problems. One is easy to solve, the other not. Using the easy knapsack, the
hard knapsack is derived from it. The hard knapsack becomes the public key. The easy
knapsack is the private key. The public key can be used to encrypt messages, but cannot be
used to decrypt messages. The private key decrypts the messages.
95
The Superincreasing Knapsack Problem
So, for example, if you have a knapsack that weighs 23 that has been made from the
weights of the superincreasing series {1, 2, 4, 9, 20, 38} then it does not contain the
weight 38 (as 38 > 23)
but it does contain the weight 20; leaving 3; which
does not contain the weight 9 still leaving 3; which
does not contain the weight 4 still leaving 3;
which contains the weight 2, leaving 1; which contains the weight 1.
The binary code is therefore 110010.
96
multiplier should have no factors in common with the modulus. So let's choose 31.
The normal knapsack sequence would be:
1×31 mod(110) = 31
2×31 mod(110) = 62
4×31 mod(110) = 14
10×31 mod(110) = 90
20×31 mod(110) = 70
40×31 mod(110) = 30
So the public key is: {31, 62, 14, 90, 70, 30}
and the private key is {1, 2, 4, 10, 20.40}.
97
All you then have to do is multiply each of the codes 71 mod 110 to find the total in the
knapsack which contains {1, 2, 4, 10, 20, 40} and hence to decode the message. The
coded message is 121 197 205:
Simple and short knapsack codes are far too easy to break to be of any real use. For a
knapsack code to be reasonably secure it would need well over 200 terms each of length
200 bits.
AUTHENTICATION APPLICATIONS
KERBEROS
• A user may alter the network address of a workstation so that the requests sent from
the altered workstation appear to come from the impersonated workstation.
• A user may eavesdrop on exchanges and use a replay attack to gain entrance to a
server or to disrupt operations.
Two versions of Kerberos are in current use: Version-4 and Version-5. The first
published report on Kerberos listed the following requirements:
98
Secure: A network eavesdropper should not be able to obtain the necessary information
to impersonate a user. More generally, Kerberos should be strong enough that a potential
opponent does not find it to be the weak link.
Reliable: For all services that rely on Kerberos for access control, lack of availability of
the Kerberos service means lack of availability of the supported services. Hence, Kerberos
should be highly reliable and should employ a distributed server architecture, with one
system able to back up another.
Transparent: Ideally, the user should not be aware that authentication is taking place,
beyond the requirement to enter a password.
Scalable: The system should be capable of supporting large numbers of clients and
servers. This suggests a modular, distributed architecture
Two versions of Kerberos are in common use: Version 4 is most widely used version.
Version 5 corrects some of the security deficiencies of Vers on 4. Version 5 has been
issued as a draft Internet Standard (RFC 1510)
KERBEROS VERSION 4
99
The Version 4 Authentication Dialogue The full Kerberos v4 authentication dialogue
is shown here divided into 3 phases.
100
There is a problem of captured ticket-granting tickets nd the need to determine
that the ticket presenter is the same as the client for whom the ticket was issued. An
efficient way of doing this is to use a session encryption key to secure information.
Message (1) includes a timestamp, so that the AS knows that the message is timely.
Message (2) includes several elements of the ticket in a form accessible to C. This enables
C to confirm that this ticket is for the TGS and to learn its expiration time. Note that the
ticket does not prove anyone's identity but is a way to distribute keys securely. It is the
authenticator that proves the client's identity. Because the authenticator can be used only
once and has a short lifetime, the threat of an opponent stealing both the ticket and the
authenticator for presentation later is countered. C then sends the TGS a message that
includes the ticket plus the ID of the requested service (message 3). The reply from the
TGS, in message (4), follows the form of message (2). C now has a reusable service-
granting ticket for V. When C presents this ticket, as shown in message (5), it also sends
an authenticator.
The server can decrypt the ticket, recover the session key, and decrypt the authenticator.
If mutual authentication is required, the server can reply as shown in message (6).
101
Overview of Kerberos
The following figure shows the authentication messages where service is being requested
from another domain. The ticket presented to the remote server indicates the realm in
which the user was originally authenticated. The server chooses whether to honor the
remote request. One problem presented by the foregoing approach is that it does not
scale well to many realms, as each pair of realms need to share a key.
102
The limitations of Kerberos version-4 are categorised into two types:
Environmental shortcomings of Version 4:
– Encryption system dependence: DES
– Ticket lifetime
– Authentication forwarding
– Session Keys
– Password attack
KERBEROS VERSION 5
Kerberos Version 5 is specified in RFC 1510 and provides a number of improvements
over version 4 in the areas of environmental shortcomings and technical deficiencies. It
includes some new elements such as:
Realm: Indicates realm of the user
Options
Times
103
– From: the desired start time for the ticket
Message (1) is a client request for a ticket -granting ticket. Message (2) returns a ticket-
granting ticket, identifying information for the client, and a block encrypted using the
encryption key based on the user's password. This block includes the session key to be used
between the client and the TGS. Now compare the ticket-granting service exchange for
versions 4 and 5. See that message (3) for both versions includes an authenticator, a ticket,
and the name of the requested service. In addition, version 5 includes requested times and
options for the ticket and a nonce, all with functions similar to those of message (1). The
authenticator itself is essentially the same as the one used in version 4. Message (4) has the
same structure as message (2), returning a ticket plus information needed by the client, the
latter encrypted with the session key now shared by the client and the TGS. Finally, for the
client/server authentication exchange, several new features appear in version 5, such as a
request for mutual authentication. If required, the server responds with message (6) that
includes the timestamp from the
104
authenticator. The flags field included in tickets in version 5 supports expanded
functionality compared to that available in version 4.
Advantages of Kerberos:
User's passwords are never sent across the network, encrypted or in plain text
Secret keys are only passed across the network in encrypted form
Kerberos has been scrutinized by many of the top programmers, cryptologists and
security experts in the industry
105
subject unique identifier (v2+) Media
extension fields (v3)
signature (of hash of all fields in certificate)
No party other than the CA can modify the certificate without being detected
Scenario: Obtaining a User Certificate If both users share a common CA then they are
assumed to know its public key. Otherwise CA's must form a hierarchy and use
certificates linking members of hierarchy to validate other CA's. Each CA has certificates
for clients (forward) and parent (backward). Each client trusts parents certificates. It
106
enables verification of any certificate from one CA by users of all other CAs in hierarchy. A
has obtained a certificate from the CA X1. B has obtained a certificate from the CA X2. A can
read the B’s certificate but cannot verify it. In order to solve the problem ,the Solution:
X1<<X2> X2<<B>>. A obtain the certificate of X2 signed by X1 from directory. obtain X2’s
public key. A goes back to directory and obtain the certificate of B signed by X2.
obtain B’s public key securely. The directory entry for each CA includes two types of
certificates: Forward certificates: Certificates of X generated by other CAs Reverse
certificates: Certificates generated by X that are the certificates of other CAs
X.509 CA Hierarchy
107
The user's private key is assumed to be compromised.
AUTHENTICATION PROCEDURES
X.509 also includes three alternative authenticationMediaprocedures that are intended for
use across a variety of applications. All these procedures make use of public-key signatures.
It is assumed that the two parties know each other's public key, ther by obtaining each other's
certificates from the directory or because the certificate is included in the initial message
from each side. 1. One-Way Authentication: One way authentication involves a single transfer
of information from one user (A) to another (B), and establishes the details shown above.
Note that only the identity of the initiating entity is verified in this process, not that of the
responding entity. At a minimum, the message includes a timestamp ,a nonce, and the identity
of B and is signed with A’s private key. The message may also include information to be
conveyed, such as a session ey for B.
108
Three-Way Authentication: Three-Way Authentication includes a final message from A to
B, which contains a signed copy of the nonce, so that timestamps need not be checked, for
use when synchronized clocks are not available.
BIOMETRIC AUTHENTICATION
Biometric authentication is a type of system that relies on the unique biological
characteristics of individuals to verify identity for secure access to electronic systems.
Biometric authentication systems compare the current biometric data capture to stored,
confirmed authentic data in a database. If both samples of the biometric data match,
109
authentication is confirmed and access is granted. The process is sometimes part of
amultifactor authentication system. For example, a smartphone user might log on with
his personal identification number (PIN) and then provide an iris scan to complete the
authentication process.
Iris recognition is used to identify individuals based on unique patterns within the ring-
shaped region surrounding the pupil of the eye.
Facial recognition systems work with numeric cod s called faceprints, which identify 80
nodal points on a human face.
Voice identification systems rely on characteristics created by the shape of the speaker's
mouth and throat, rather than more variable conditions.
Once seen mostly in spy movies (where it might be used to protect access to a top-secret
military lab, for example), biometric authentication is becoming relatively commonplace.
In addition to the security provided by hard-to-fake individual biological traits, the
acceptance of biometric verification has also been driven by convenience: One can’t easily
forget or lose ones biometrics.
110
The market for biometrics products is still too fractured to name specific top providers.
The physical characteristics of the biometrics products available today vary from the
mundane, such as fingerprinting, to the esoteric, like typing speeds and
electrophysiological signals.
Until recently, biometrics was typically used at a physical security level – protecting
facilities at military bases or impenetrable bank vaults, for example. But, because single-
factor authentication methods are easy to break, companies have started looking to
two-factor solutions, like biometrics.
However, the following five fundamental barriers may limit the growth of biometric
authentication:
2. The market is still fractured. Should you buy fing rpr nt reader, a voice
recognition system or an iris scanner? Since each pro uct differs greatly in its
approach and installation, it is difficult to compare them during a typical
company bid process.
3. Biometric data is like any other data. It its on servers, which are bait forhackers if
not properly hardened and sec red. Therefore, when reviewing any biometric
product, make sure it transmits data securely, meaningencrypted, from the
biometric reader back to the authenticating server. And, make sure the
authenticating server has been hardened, patched and protected.
4. Biometric readers are prone to errors. Fingerprints can smudge, faces and voices
can be changed and all of them can be misread, blocking a legitimate user, or
permitting access to an unauthorized or malicious user.
5. Difficulties with user acceptance. Properly trained employees may be willing to use
biometrics devices, but customers, like those logging on to your Web site, may be
more reluctant to use – or worse, forced to purchase – a device that's difficult to
use or makes doing business, such as banking, on your site, a hassle instead of a
111
convenience. And both your employees and customers may be squeamish about
exposing their eyes to devices like iris scanners, even if they appear harmless.
112
UNIT-IV
Email Privacy: Pretty Good Privacy (PGP) and S/MIME. IP Security: IP Security
Overview, IP Security Architecture, Authentication Header, Encapsulating Security
Payload, Combining Security Associations and Key Management.
113
PGP Notations:
114
1. sender creates message
3. signed hash with RSA using sender's private key, and is attached to message
4. receiver uses RSA with sender's public key to decrypt and recover hash code
5. receiver verifies received message using hash of it and compares with decrypted hash
code
Sender:
1. Generates messageSkyupsandarandomnumber (session key) only for this message
2. Encrypts message with the session key ing AES, 3DES, IDEA or CAST-128
3. Encrypts session key itself with reci ient’s public key using RSA
4. Attaches it to message
Receiver:
1. Recovers session key by decrypting using his private key
2. Decrypts message using the session key
Confidentiality service provides no assurance to the receiver as to the identity of sender
(i.e. no authentication). Only provides confidentiality for sender that only the recipient
can read the message (and no one else)
115
PGP Operation – Confidentiality & Authentication
can use both services on same message o create signature & attach to message
o encrypt both message & signature
o attach RSA/ElGamal encrypted session key o
is called authenticated confidentiality
encryption. This has the benefit of saving space both for -ma l transmission and for file
storage. The placement of the compression algorithm, in icated by Z for compression and
1. so that one can store only the ncom re ed message together with signature for later
verification
2. Applying the hash function and signature after compression would constrain all PGP
implementations to the same version of the compression algorithm as the PGP
compression algorithm is not deterministic
116
of converting the raw 8-bit binary stream to a stream of printable ASCII characters. It
uses radix-64 conversion, in which each group of three octets of binary data is mapped
into four ASCII characters. This format also appends a CRC to detect transmission errors.
The use of radix 64 expands a message by 33%, but still an overall compression of about
one-third can be achieved.
PGP Operation - Segmentation/Reassembly
E-mail facilities often are restricted to a maximum message length. For example, many of
the facilities accessible through the Internet impose a maximum length of 50,000 octets.
Any message longer than that must be broken up into smaller segments, each of which is
mailed separately. To accommodate this restriction, PGP automatically subdivides a
message that is too large into segments that are small enough to send via e-mail. The
segmentation is done after all of the other processing, including the radix-64 conversion.
Thus, the session key component and signature component appear only once, at the
beginning of the first segment. Reassembly at the receiving end is required before
verifying signature or decryption
117
PGP Message Format
A message consists of three components: theMediamessagecomponent, a signature (optional), and a session key component (optional). The message component includes the actual data to be stored or transmitted, as well as a filename
and timestamp that specifies the time of creation. The signature component includes the following:
118
The session key component includes the session key and the dentifier of the recipient's
public key that was used by the sender to encrypt the session key. The entire block is
usually encoded with radix-64 encoding.
The following figure shows the steps during message transmission assuming that the
message is to be both signed and encrypted.
119
The sending PGP entity performs the following steps:
120
Authenticating the message
a. PGP retrieves the sender's public key from the public-key ring, using the Key ID field
in the signature key component of the message as an index. b. PGP recovers the
transmitted message digest.
c. PGP computes the message digest for the received message and compares it to the
transmitted message digest to authenticate.
S/MIME
S/MIME (Secure/Multipurpose Internet Mail Extension) is a security enhancement to the
MIME Internet e-mail format standard, which in turn provided support for varying
content types and multi-part messages over the text only support in the original Internet
RFC822 email standard. MIME allows encoding of binary data to textual form for
transport over traditional RFC822 email systems. S/MIME is defined in a number of
documents, most importantly RFCs 3369, 3370, 3850 and 3851 and S/MIME support is
now included in many modern mail agents.
RFC 822
RFC 822 defines a format for text messages that are sent using electronic mail and it has
been the standard for Internet-based text mail message. The overall structure of a
message that conforms to RFC 822 is very imple. A message consists of some number of
header lines (the header) followed by unrestricted text (the body). The header is
separated from the body by a blank line. A header line usually consists of a keyword,
followed by a colon, followed by the keyword's arguments; the format allows a long line
to be broken up into several lines. The most frequently used keywords are From, To,
Subject, and Date.
121
• Text data that includes special characters (e.g., Hungarian text) cannot be transmitted
as SMTP is limited to 7-bit ASCII
• Some servers reject mail messages over a certain size
• Some common problems exist with the SMTP implementations which do not adhere
completely to the SMTP standards defined in RFC 821. They are:
delete, add, or reorder CR and LF characters
truncate or wrap lines longer than 76 characters
remove trailing white space (tabs and spaces)
pad lines in a message to the same length
convert tab characters into multiple spaces
MIME is intended to resolve these problems in a manner that is compatible with existing
RFC 822 implementations and the specification is provided in RFC’s 2045 through 2049.
The MIME specification includes the followingMediaelements:
1. Five new message header fields are defined, which prov nformation about the body of
the message.
2. A number of content formats are defined, thus standardizing representations that
support multimedia electronic mail.
3. Transfer encodings are defined that protect the content from alteration by the mail
system.
MIME - New header fields The five header fields defined in MIME are as follows:
• MIME-Version: Must have the parameter value 1.0. This field indicates that the
message conforms to RFCs 2045 and 2046.
• Content-Type: Describes the data contained in the body with sufficient detail that the
receiving user agent can pick an appropriate agent or mechanism to represent the data
to the user or otherwise deal with the data in an appropriate manner.
• Content-Transfer-Encoding: Indicates the type of transformation that has been used to
represent the body of the message in a way that is acceptable for mail transport.
• Content-ID: Used to identify MIME entities uniquely in multiple contexts.
• Content-Description: A text description of the object with the body; this is useful when
the object is not readable (e.g., audio data).
122
MIME Content Types The bulk of the MIME specification is concerned with the definition of
a variety of content types. There are seven different major types of content and a total of 15
subtypes. In general, a content type declares the general type of data, and the subtype
specifies a particular format for that type of data. For the text type of body, the primary
subtype is plain text, which is simply a string of ASCII characters or ISO 8859 characters. The
enriched subtype allows greater formatting flexibility. The multipart type indicates that the
body contains multiple, independent parts. The Content-Type header field includes a
parameter called boundary that defines the delimiter between body parts. This boundary
should not appear in any parts of the message. Each boundary starts on a new line and
consists of two hyphens followed by the boundary value. The final boundary, which indicates
the end of the last part, also has a suffix of two hyphens. Within each part, there may be an
optional ordinary MIME header. There are four subtypes of the multipart type, all of which
have the same overall syntax.
123
and body. Despite the name of this subtype, the encapsulated message may be not only a
simple RFC 822 message, but also any MIME message. The message/partial subtype enables
fragmentation of a large message into a number of parts, which must be reassembled at the
destination. For this subtype, three parameters are specified in the Content-Type:
Message/Partial field: an id common to all fragments of the same message, a sequence
number unique to each fragment, and the total number of fragments. The message/external-
body subtype indicates that the actual data to be conveyed in this message are not contained
in the body. Instead, the body contains the information needed to access the data. The
application type refers to other kinds of data, typically either uninterpreted binary data or
information to be processed by a mail-based application.
MIME Transfer Encodings The other major component of the MIME specification, in
addition to content type specification, is a definition of transfer encodings for message
bodies. The objective is to provide reliable delivery cross the largest range of
environments.
The MIME standard defines two methods of encoding data. The Content-Transfer-Encoding
field can actually take on six values. Three of these values (7bit, 8bit, and binary) indicate that
no encoding has been done but provide some information about the nature of the data.
Another Content-Transfer-Encoding value is x-token, which indicates that some other
encoding scheme is used, for which a name is to be supplied. The two actual encoding
schemes defined are quoted-printable and base64. Two schemes are defined to provide a
choice between a transfer technique that is essentially human
124
readable and one that is safe for all types of data in a way that is reasonably compact. The
quoted-printable transfer encoding is useful when the data consists largely of octets that
correspond to printable ASCII characters. In essence, it represents nonsafe characters by
the hexadecimal representation of their code and introduces reversible (soft) line breaks
to limit message lines to 76 characters. The base64 transfer encoding, also known as
radix-64 encoding, is a common one for encoding arbitrary binary data in such a way as
to be invulnerable to the processing by mail transport programs.
Canonical Form
An important concept in MIME and S/MIME is that of canonical form. Canonical form is a
format, appropriate to the content type, that is standardized for use between systems.
This is in contrast to native form, which is a format that may be peculiar to a particular
system.
125
S/MIME Functionality
S/MIME has a very similar functionality to PGP. Both offer the ability to sign and/or
encrypt messages.
Functions
S/MIME provides the following functions:
• Enveloped data: This consists of encrypted content of any type and encrypted-
content encryption keys for one or more recipients.
• Signed data: A digital signature is formed by taking the message digest of the content
to be signed and then encrypting that with the private key of the signer. The content plus
signature are then encoded using base64 encoding. A signed data message can only be
viewed by a recipient with S/MIME capability.
• Clear-signed data: As with signed data, a digital signature of the content is formed.
However, in this case, only the digital signature is encoded using base64. As a result,
recipients without S/MIME capability canMediaviewthemessge content, although they
cannot verify the signature.
• Signed and enveloped data: Signed-only and ncrypted-only entities may be nested, so
that encrypted data may be signed and sign data or clear-signed data may be encrypted.
IP SECURITY OVERVIEW
Definition: Internet Protocol sec rity (IPSec) is a framework of open standards for
protecting communications over Internet Protocol (IP) networks through the use of
cryptographic security services. IPSec supports network-level peer authentication, data
origin authentication, data integrity, data confidentiality (encryption), and replay
protection.
Need for IPSec
In Computer Emergency Response Team (CERT)’s 2001 annual report it listed 52,000
security incidents in which most serious types of attacks included IP spoofing, in which
intruders create packets with false IP addresses and exploit applications that use
authentication based on IP and various forms of eavesdropping and packet sniffing, in
which attackers read transmitted information, including logon information and database
126
contents. In response to these issues, the IAB included authentication and encryption as
necessary security features in the next-generation IP i.e. IPv6.
Applications of IPSec
IPSec provides the capability to secure communications across a LAN, across private
and public wide area networks (WAN’s), and across the Internet.
• Secure branch office connectivity over the Internet: A company can build a secure
virtual private network over the Internet or over a public WAN. This enables a business
to rely heavily on the Internet and reduce its need for private networks, saving costs and
network management overhead.
• Secure remote access over the Internet: An end user whose system is equipped with
IP security protocols can make a local call to an Internet service provider (ISP) and gain
secure access to a company network. This reduces the cost of toll charges for travelling
employees and telecommuters.
• Establishing extranet and intranet connectivity with p rtners: IPSec can be used to
secure communication with other organizations, ensuring authentication and
confidentiality and providing a key exchange mechanism.
• Enhancing electronic commerce security: Ev n though some Web and electronic
commerce applications have built-in security protocols, the use of IPSec enhances that
security.
The principal feature of IPSec enabling it to support varied applications is that it can
encrypt and/or authenticate all traffic at IP level. Thus, all distributed applications,
including remote logon, client/server, e-mail, file transfer, Web access, and so on, can be
secured.
The following figure shows a typical scenario of IPSec usage. An organization maintains LANs
at dispersed locations. Non secure IP traffic is conducted on each LAN.
127
The IPSec protocols operate in networking devices, such as a router or firewall that
connect each LAN to the outside world. The IPSec networking device will typically
encrypt and compress all traffic going into the WAN, and decrypt and decompress traffic
coming from the WAN; these operations are transparent to workstations and servers on
the LAN. Secure transmission is also possible with in v du l users who dial into the WAN.
Such user workstations must implement the IPS c protocols to provide security.
Benefits of IPSec
The benefits of IPSec are listed below:
• IPSec in a firewall/router provides strong security to all traffic crossing the perimeter
• IPSec can provide security for individual users if needed (useful for offsite workers
and setting up a secure virtual subnetwork for sensitive applications)
Routing Applications
IPSec also plays a vital role in the routing architecture required for internetworking. It
assures that:
• router advertisements come from authorized routers
• neighbor advertisements come from authorized routers
128
• redirect messages come from the router to which initial packet was sent
• A routing update is not forged
IP SECURITY ARCHITECTURE
IPSec Documents
The IPSec specification consists of numerous documents. The most important of these,
issued in November of 1998, are RFCs 2401, 2402, 2406, and 2408:
• RFC 2401: An overview of a security architecture
• RFC 2402: Description of a packet authentication extension to IPv4 and IPv6
• RFC 2406: Description of a packet encryption extension to IPv4 and IPv6
• RFC 2408: Specification of key management capabilities
Support for these features is mandatory for IPv6 and opt on l for IPv4. In both cases, the
security features are implemented as extension h ad rs that follow the main IP header.
The extension header for authentication is known as the Authentication header; that for
encryption is known as the Encapsulating Security Payload (ESP) header. In addition to
these four RFCs, a Skyupsnumberofadditional drafts have been published by the IP
Security Protocol Working Group set by the IETF. The documents are divided into seven
groups, as depicted in following fig re:
129
• Architecture: Covers the general concepts, security requirements, definitions, and
mechanisms defining IPSec technology
• Encapsulating Security Payload (ESP): Covers the packet format and general issues
related to the use of the ESP for packet encryption and, optionally, authentication.
• Authentication Header (AH): Covers the packet format and general issues related to
the use of AH for packet authentication.
IPSec Services
IPSec architecture makes use of two major protocols (i. ., Authentication Header and ESP
protocols) for providing security at IP level. This facilitates the system to beforehand choose
an algorithm to be implemented, ecurity protocols needed and any cryptographic keys
required to provide requested services. The IPSec services are as follows:
Connectionless Integrit :- Data integrity service is provided by IPSec via AH which
prevents the data from being altered during transmission.
Data Origin Authentication:- This IPSec service prevents the occurrence of replay
attacks, address spoofing etc., which can be fatal
Access Control:- The cryptographic keys are distributed and the traffic flow is
controlled in both AH and ESP protocols, which is done to accomplish access control over
the data transmission.
130
Limited Traffic Flow Confidentiality:- This facility or service provided by IPSec
ensures that the confidentiality is maintained on the number of packets transferred or
received. This can be done using padding in ESP.
Replay packets Rejection:- The duplicate or replay packets are identified and
discarded using the sequence number field in both AH and ESP.
SECURITY ASSOCIATIONS
Since IPSEC is designed to be able to use various secur ty protocols, it uses Security
Associations (SA) to specify the protocols to be us . SA s a database record which specifies
security parameters controlling security op rations. They are referenced by the sending
host and established by the receiving host. An index parameter called the Security
Parameters Index (SPI) is used. SAs are in one direction only and a second SA must be
established for the transmis ion to be bi-directional. A security association is uniquely
identified by three parameters:
• Security Parameters Index (SPI): A bit string assigned to this SA and having local
significance only. The PI is carried in AH and ESP headers to enable the receiving system
to select the SA under which a received packet will be processed.
• IP Destination Address: Currently, only unicast addresses are allowed; this is the
address of the destination endpoint of the SA, which may be an end user system or a
network system such as a firewall or router.
• Security Protocol Identifier: This indicates whether the association is an AH or ESP
security association.
SA Parameters
In each IPSec implementation, there is a nominal Security Association Database that
defines the parameters associated with each SA. A security association is normally
defined by the following parameters:
131
• Sequence Number Counter: A 32-bit value used to generate the Sequence Number
field in AH or ESP headers
• Sequence Counter Overflow: A flag indicating whether overflow of the Sequence
Number Counter should generate an auditable event and prevent further transmission of
packets on this SA (required for all implementations).
• Anti-Replay Window: Used to determine whether an inbound AH or ESP packet is a
replay
• AH Information: Authentication algorithm, keys, key lifetimes, and related
parameters being used with AH (required for AH implementations).
• ESP Information: Encryption and authentication algorithm, keys, initialization values,
key lifetimes, and related parameters being used with ESP (required for ESP
implementations).
• Lifetime of This Security Association: A time interval or byte count after which an SA
must be replaced with a new SA (and new SPI) or terminated, plus an indication of which
of these actions should occur (required for all implementat ons).
• IPSec Protocol Mode: Tunnel, transport, or w ldcard (required for all
implementations). These modes are discussed lat r in this section.
• Path MTU: Any observed path maximum transmission unit (maximum size of a packet
that can be transmitted without fragmentation) and aging variables (required for all
implementations).
Transport and Tunnel Modes
Both AH and ESP support two modes of use: transport and tunnel mode.
IP sec can be used (both AH packets and ESP packets) in two modes
132
• Transport mode: the IP sec header is inserted just after the IP header –this contains
the security information, such as SA identifier, encryption, authentication
Typically used in end-to-end
communication IP header not protected
• Tunnel mode: the entire IP packet, header and all, is encapsulated in the body of a
new IP packet with a completely new IP header
Typically used in firewall-to-firewall communication
Provides protection for the whole IP packet
No routers along the way will be able (and will not need) to check the content of the
packets
AUTHENTICATION HEADER
The Authentication Header provides support for data integrity and authentication of IP
packets. The data integrity feat re ensures that undetected modification to a packet's
content in transit is not possible. The authentication feature enables an end system or
network device to authenticate the user or application and filter traffic accordingly; it also
prevents the address spoofing attacks observed in today's Internet. The AH also guards
against the replay attack. Authentication is based on the use of a message authentication
code (MAC), hence the two parties must share a secret key. The Authentication Header
consists of the following fields:
133
IPSec Authentication Header
• Next Header (8 bits): Identifies the type of header immediately following this header.
• Payload Length (8 bits): Length of Authentication Header in 32-bit words, minus 2. For
example, the default length of the authentication data field is 96 bits, or three 32-bit
words. With a three-word fixed header, there are a total of six words in the header, and
the Payload Length field has a value of 4.
• Reserved (16 bits): For future use.
• Security Parameters Index (32 bits): IdentifiesMediasecurityssociation.
• Sequence Number (32 bits): A monotonically increas ng counter value, discussed later.
• Authentication Data (variable): A variable-length field (must be an integral number
of 32-bit words) that contains the Integrity Check Value (ICV), or MAC, for this packet.
Anti-Replay Service
Anti-replay service is designed to overcome the problems faced due to replay attacks in
which an intruder intervenes the acket being transferred, make one or more duplicate
copies of that authenticated packet and then sends the packets to the desired destination,
thereby causing inconvenient processing at the destination node. The Sequence Number
field is designed to thwart such attacks.
When a new SA is established, the sender initializes a sequence number counter to 0. Each
time that a packet is sent on this SA, the sender increments the counter and places the
value in the Sequence Number field. Thus, the first value to be used is 1. This value goes
on increasing with respect to the number of packets being transmitted. The sequence
number field in each packet represents the value of this counter. The maximum value of
the sequence number field can go up to 232-1. If the limit of 232-1 is reached, the sender
should terminate this SA and negotiate a new SA with a new key.
134
The IPSec authentication document dictates that the receiver should implement a
window of size W, with a default of W = 64. The right edge of the window represents the
highest sequence number, N, so far received for a valid packet. For any packet with a
sequence number in the range from N-W+1 to N that has been correctly received (i.e.,
properly authenticated), the corresponding slot in the window is marked as shown.
Inbound processing proceeds as follows when a packet is received:
Antireplay echanism
1. If the received packet falls within the window and is new, the MAC is checked. If the
packet is authenticated, the corres onding lot in the window is marked.
2. If the received packet is to the right of the window and is new, the MAC is checked. If
the packet is authenticated, the window is advanced so that this sequence number is the
right edge of the window, and the corresponding slot in the window is marked.
3. If the received packet is to the left of the window, or if authentication fails, the packet
is discarded; this is an auditable event.
135
In both cases, the full HMAC value is calculated but then truncated by using the first 96
bits, which is the default length for the Authentication Data field. The MAC is calculated
over
• IP header fields that either do not change in transit (immutable) or that are predictable
in value upon arrival at the endpoint for the AH SA. Fields that may change in transit and
whose value on arrival is unpredictable are set to zero for purposes of calculation at both
source and destination.
• The AH header other than the Authentication Data field. The Authentication Data field
is set to zero for purposes of calculation at both source and destination.
• The entire upper-level protocol data, which is assumed to be immutable in transit (e.g.,
a TCP segment or an inner IP packet in tunnel mode).
For transport mode AH using IPv4, the AH is inserted after the original IP header and
before the IP payload (e.g., a TCP segment) shown below. Authentication covers the entire
packet, excluding mutable fields in the IPv4 header that are set to zero for MAC
calculation. In the context of IPv6, AH is viewed as an end-to-end payload; that is, it is not
examined or processed by intermediate routers. Therefore, the AH appears after the IPv6
base header and the hop-by-hop, routing, and fragment extension headers. The
destination options extension header could appear before or after the AH header,
depending on the semantics desired. Again, authentication covers the entire packet,
excluding mutable fields that are set to zero for MAC calculation.
136
For tunnel mode AH, the entire original IP packet is authenticated, and the AH is inserted
between the original IP header and a new outer IP header. The inner IP header carries
the ultimate source and destination addresses, while an outer IP header may contain
different IP addresses (e.g., addresses of firewalls or other security gateways). With
tunnel mode, the entire inner IP packet, including the entire inner IP header is protected
by AH. The outer IP header (and in the case of IPv6, the outer IP extension headers) is
protected except for mutable and unpredictable fields.
137
Security Parameters Index (32 bits): Identifies a security association.
• Sequence Number (32 bits): A monotonically increasing counter value; this provides
an anti-replay function, as discussed for AH.
138
Transport Mode ESP
All security is provided between end systems that implement IPSec. For any two end
systems to communicate via an SA, they must share the appropriate secret keys. Among
the possible combinations:
a) AH in transport mode
b) ESP in transport mode
139
c) ESP followed by AH in transport mode (an ESP SA inside an AH SA)
d) Any one of a, b, or c inside an AH or ESP in tunnel mode
Case:-2
Security is provided only between gateways (routers, firewalls, etc.) and no hosts
implement IPSec. This case illustrates simpleMediavirtualprivte network support. The
security architecture document specifies that only single tunnel SA is needed for this case.
The tunnel could support AH, ESP, or ESP with the authentication option. Nested tunnels
are not required because the IPSec servic s apply to the entire inner packet.
Case-3:-
The third combination is similar to the second, but in addition provides security even to
nodes. This combination makes use of two tunnels first for gateway to gateway and
second for node to node. Either authentication or the encryption or both can be provided
by using gateway to gateway tunnel. An additional IPSec service is provided to the
individual nodes by using node to node tunnel.
Case:-4
140
This combination is suitable for serving remote users i.e., the end user sitting anywhere
in the world can use the internet to access the organizational workstations via the
firewall. This combination states that only one tunnel is needed for communication
between a remote user and an organizational firewall.
KEY MANAGEMENT
The key management portion of IPSec involves the determination and distribution of
secret keys. The IPSec Architecture document mandates support for two types of key
• Manual: A systemSkyupsadministratormanually configures each system with its own
keys and with the keys of other comm nicating systems. This is practical for small,
• Automated: An automated stem enables the on-demand creation of keys for SAs and facilitates the
141
Oakley Key Determination Protocol
Oakley is a refinement of the Diffie-Hellman key exchange algorithm. The Diffie-Hellman
algorithm has two attractive features:
• Secret keys are created only when needed. There is no need to store secret keys for a
long period of time, exposing them to increased vulnerability.
• The exchange requires no pre-existing infrastructure other than an agreement on the
global parameters.
142
fast hash (e.g., MD5) over the IP Source and Destination addresses, the UDP Source and
Destination ports, and a locally generated secret value. Oakley supports the use of different
groups for the Diffie-Hellman key exchange. Each group includes the definition of the two
global parameters and the identity of the algorithm. Oakley employs nonces to ensure
against replay attacks. Each nonce is a locally generated pseudorandom number. Nonces
appear in responses and are encrypted during certain portions of the exchange to secure
their use. Three different authentication methods can be used with Oakley are digital
signatures, public-key encryption and Symmetric-key encryption.
143
identifiers, the two nonces, the group, the two Diffie-Hellman public keys, and the
selected algorithms.
When I receives the second message, I verifies the signature using R's public key. The nonce
values in the message assure that this is not a replay of an old message. To complete the
exchange, I must send a message back to R to verify that I has received R's public key.
ISAKMP
ISAKMP defines procedures and packet formats to establish, negotiate, modify, and delete
security associations. As part of SA establishment, ISAKMP defines payloads for
exchanging key generation and authentication data.
ISAKMP Header Format
An ISAKMP message consists of an ISAKMP header followed by one or more payloads and
must follow UDP transport layer protocol for its implementation. The header format of
an ISAKMP header is shown below:
• Initiator Cookie (64 bits): Cookie of entity that initiated SA establishment, SA
notification, or SA deletion.
• Responder Cookie (64 bits): Cookie of responding entity; null in first message from
initiator.
• Next Payload (8 bits): Indicates the type of the first payload in the message
• Major Version (4 bits): Indicates major version of ISAKMP in use.
• Minor Version (4 bits): Indicates minor version in use.
144
• Exchange Type (8 bits): Indicates the type of exchange. Can be informational,
aggressive, authentication only, identity protection or base exchange (S).
• Flags (8 bits): Indicates specific options set for this ISAKMP exchange. Two bits so far
defined: The Encryption bit is set if all payloads following the header are encrypted using
the encryption algorithm for this SA. The Commit bit is used to ensure that encrypted
material is not received prior to completion of SA establishment.
• Message ID (32 bits): Unique ID for this message.
• Length (32 bits): Length of total message (header plus all payloads) in octets.
The Next Payload field has a value of 0 if this is the last payload in the message; otherwise
its value is the type of the next payload. The Payload Length field indicates the length in
octets of this payload, including the generic payload header. There are many different
ISAKMP payload types. They are:
a. The SA payload is used to begin the establishment of an SA. The Domain of
Interpretation parameter identifies the DOI under which negotiation is taking place. The
Situation parameter defines the security policy for this negotiation; in essence, the levels
of security required for encryption and confidentiality are specified (e.g., sensitivity level,
security compartment).
b. The Proposal payload contains information used during SA negotiation. The payload
indicates the protocol for this SA (ESP or AH) for which services and mechanisms are
being negotiated. The payload also includes the sending entity's SPI and the number of
transforms. Each transform is contained in a transform payload.
c. The Transform payload defines a security transform to be used to secure the
communications channel for the designated protocol. The Transform # parameter serves to
identify this particular payload so that the responder may use it to indicate acceptance
145
of this transform. The Transform-ID and Attributes fields identify a specific transform
(e.g., 3DES for ESP, HMAC-SHA-1-96 for AH) with its associated attributes (e.g., hash
length).
d. The Key Exchange payload can be used for a variety of key exchange techniques,
including Oakley, Diffie-Hellman, and the RSA-based key exchange used by PGP. The Key
Exchange data field contains the data required to generate a session key and is dependent
on the key exchange algorithm used.
e. The Identification payload is used to determine the identity of communicating peers
and may be used for determining authenticity of information. Typically the ID Data field
will contain an IPv4 or IPv6 address.
f. The Certificate payload transfers a public-key certificate. The Certificate Encoding field
indicates the type of certificate or certificate-related information, which may include SPKI,
ARL, CRL, PGP info etc. At any point in an ISAKMP exchange, the sender may include
a Certificate Request payload to request the Mediacertificateoftheother communicating entity.
g. The Hash payload contains data generated by hash funct on over some part of the
message and/or ISAKMP state. This payload may be used to verify the integrity of the
data in a message or to authenticate negotiating entiti s.
h. The Signature payload contains data generated by a digital signature function over
some part of the messageSkyupsand/orISAKMPtate. This payload is used to verify the
i. The Nonce payload contains random data used to guarantee liveness during an
exchange and protect against replay attacks.
j. The Notification payload contains either error or status information associated with
this SA or this SA negotiation. Some of the ISAKMP error messages that have been defined
are Invalid Flags, Invalid Cookie, Payload Malformed etc
k. The Delete payload indicates one or more SAs that the sender has deleted from its
database and that therefore are no longer valid.
ISAKMP Exchanges
ISAKMP provides a framework for message exchange, with the payload types serving as
the building blocks. The specification identifies five default exchange types that should
be supported.
146
1. Base Exchange: allows key exchange and authentication material to be transmitted
together. This minimizes the number of exchanges at the expense of not providing
identity protection.
The first two messages provide cookies and establish an SA with agreed protocol and
transforms; both sides use a nonce to ensure against replay attacks. The last two
messages exchange the key material and user IDs, with an authentication mechanism
used to authenticate keys, identities, and the nonces from the first two messages.
2. Identity Protection Exchange: expands the Base Exch nge to protect the users'
identities.
The first two messages establish the SA. The next two messages perform key exchange,
with nonces for replay protection. Once the session key has been computed, the two
parties
172
147
The first two messages establish the SA. In addition, the responder uses the second
message to convey its ID and uses authentication to protect the message. The initiator
sends the third message to transmit its authenticated ID.
4. Aggressive Exchange: minimizes the number of exchanges at the expense of not
providing identity protection.
In the first message, the initiator proposes an SA with associated offered protocol and
transform options. The initiator also begins the key exchange nd provides its ID. In the
second message, the responder indicates its acceptance of the SA with a particular
protocol and transform, completes the key exchang , and authenticates the transmitted
information. In the third message, the initiator transmits an authentication result that
covers the previous information, encrypted using the shared secret session key.
5. Informational Exchange: used for one -way transmittal of information for SA
management.
148
UNIT-V
Web Security: Web Security Considerations, Secure Socket Layer (SSL) and Transport
Layer Security (TLS), Secure Electronic Transaction (SET). Intruders, Viruses and
Firewalls: Intruders, Intrusion Detection, Password Management, Virus and related
threats, Countermeasures, Firewall Design Principles, Types of Firewalls.
Case Studies on Cryptography and Security: Secure Inter Branch Transactions, Cross Site
Vulnerability, Virtual Elections.
Usage of internet for transferring or retrieving the data has got many benefits like
speed, reliability, security etc. Much of the Internet's success and popularity lies in the
fact that it is an open global network. At the same time, the fact that it is open and global
makes it not very secure. The unique nature of the Internet makes exchanging
information and transacting business over it inherently dangerous. The faceless,
voiceless, unknown entities and individuals that share the Internet may or may not be
who or what they profess to be. In addition, because the Internet is a global network, it
does not recognize national borders and legal jurisdictions. As a result, the transacting
parties may not be where they say they are and may not be subject to the same laws or
regulations.
For the exchange of information and for commerce to be secure on any network,
especially the Internet, a system or process must be put in place that satisfies
requirements for confidentiality, access control, authentication, integrity, and
nonrepudiation. These requirements are achieved on the Web through the use of
encryption and by employing digital signature technology. There are many examples on
the Web of the practical application of encryption. One of the most important is the SSL
protocol.
A summary of types of security threats faced in using the Web is given below:
149
One way of grouping the security threats is in terms of passive and active attacks. Passive
attacks include eavesdropping on network traffic between browser and server and
gaining access to information on a website that is supposed to be restricted. Active attacks
include impersonating another user, altering messages in tr nsit between client and
server and altering information on a website. Another way of classifying these security
threats is in terms of location of the threat: Web server, Web browser and network traffic
between browser and server.
Web Traffic Security Approaches
Various approaches for providing Web Security are available, where they are similar in
the services they provide and also similar to some extent in the mechanisms they use.
They differ with respect to their sco e of applicability and their relative location within
the TCP/IP protocol stack. The main a proaches are IPSec, SSL or TLS and SET.
150
part of TCP/IP protocol suite, thereby being transparent to applications. Alternatively,
SSL can be embedded in specific packages like SSL being implemented by Netscape and
Microsoft Explorer browsers. Secure Electronic Transaction (SET) approach provides
application-specific services i.e., according to the security requirements of a particular
application. The main advantage of this approach is that service can be tailored to the
specific needs of a given application.
SSL provides for secure communication between client and server by allowing mutual
authentication, the use of digital signatures for integrity and encryption for privacy. SSL
protocol has different versions such as SSLv2.0, SSLv3.0, where SSLv3.0 has an advantage
with the addition of support for certificate chain loading. SSL 3.0 is the basis for the
Transport Layer Security [TLS] protocol standard. SSL is designed to make use of TCP to
provide a reliable end-to-end secure service. SSL is not a single protocol, but rather two
layers of protocols as shown below:
151
The SSL Record Protocol provides basic security services to various higher-layer
protocols. In particular, the Hypertext Transfer Protocol (HTTP), which provides the
transfer service for Web client/server interaction, can operate on top of SSL. Three
higher-layer protocols are defined as part of SSL: the Handshake Protocol, The Change
Cipher Spec Protocol, and the Alert Protocol. Two import nt SSL concepts are the SSL
session and the SSL connection, which are defined in the spec fication as follows:
• Connection: A connection is a transport (in the OSI layering model definition) that
provides a suitable type of service. For SSL, such connections are peer-to-peer
relationships. The connections are tran ient. Every connection is associated with one
session.
• Session: An SSL session is an association between a client and a server. Sessions are
created by the Handshake Protocol. Sessions define a set of cryptographic security
parameters, which can be shared among multiple connections. Sessions are used to avoid
the expensive negotiation of new security parameters for each connection.
An SSL session is stateful. Once a session is established, there is a current operating state
for both read and write (i.e., receive and send). In addition, during the Handshake
Protocol, pending read and write states are created. Upon successful conclusion of the
Handshake Protocol, the pending states become the current states. An SSL session may
include multiple secure connections; in addition, parties may have multiple simultaneous
sessions.
A session state is defined by the following parameters:
152
Session identifier: An arbitrary byte sequence chosen by the server to identify an
active or resumable session state.
Peer certificate:An X509.v3 certificate of the peer. This element of the state may be
null.
Compression method: The algorithm used to compress data prior to encryption.
Cipher spec:Specifies the bulk data encryption algorithm (such as null, AES, etc.) and
a hash algorithm (such as MD5 or SHA-1) used for MAC calculation. It also defines
cryptographic attributes such as the hash_size.
Master secret:48-byte secret shared between the client and server.
Is resumable:A flag indicating whether the session can be used to initiate new
connections.
153
• Confidentiality: The Handshake Protocol defines a shared secret key that is used for
conventional encryption of SSL payloads.
• Message Integrity: The Handshake Protocol also defines a shared secret key that is
used to form a message authentication code (MAC).
The Record Protocol takes an application message to be transmitted, fragments the data
into manageable blocks, optionally compresses the data, applies a MAC, encrypts, adds a
header, and transmits the resulting unit in a TCP segment. Received data are decrypted,
verified, decompressed, and reassembled and then delivered to higher-level users. The
overall operation of the SSL Record Protocol is shown below:
The first step is fragmentation. Each upper-layer message is fragmented into blocks of
214 bytes (16384 bytes) or less. Next, compression is optionally applied. Compression
must be lossless and may not increase the content length by more than 1024 bytes. The
next step in processing is to compute a message authentication code over the
compressed data. For this purpose, a shared secret key is used. The calculation is
defined as:
hash(MAC_write_secret || pad_2 ||
hash(MAC_write_secret || pad_1 || seq_num
|| SSLCompressed.type ||
SSLCompressed.length || SSLCompressed.fragment)) Where,
154
MAC_write_secret = = the byte 0x36 (0011
0110) repeated 48 times
Secret shared key pad_1 (384 bits) for MD5 and 40
times for
pad_2 = the byte 0x5C (0101
1100) repeated 48 times
for MD5 and 40 times for
SHA-1
The main difference between HMAC and above calculation is that the two pads are
concatenated in SSLv3 and are XORed in HMAC. Next, the compressed message plus the
MAC are encrypted using symmetric encryption. Encryption may not increase the content
length by more than 1024 bytes, so that the total length m y not exceed 2 14 + 2048. The
encryption algorithms allowed are AES-128/256, IDEA-128, DES-40, 3DES-168, RC2-40,
Fortezza, RC4-40 and RC4-128. For stream encryption, the compressed message plus the
MAC are encrypted whereas, for block encryption, padding may be added after the MAC
prior to encryption.
The final step of SSL Record Protocol processing is to prepend a header, consisting of the
following fields:
155
• Content Type (8 bits): The higher layer protocol used to process the enclosed fragment.
• Major Version (8 bits): Indicates major version of SSL in use. For SSLv3, the value is 3.
• Minor Version (8 bits): Indicates minor version in use. For SSLv3, the value is 0.
• Compressed Length (16 bits): The length in bytes of the plaintext fragment (or
compressed fragment if compression is used). The maximum value is 2 14 + 2048.
The content types that have been defined are change_cipher_spec, alert, handshake, and
application_data.
156
• close_notify: Notifies the recipient that the sender will not send any more messages on
this connection. Each party is required to send a close_notify alert before closing the write
side of a connection.
• no_certificate: May be sent in response to a certificate request if no appropriate
certificate is available.
• bad_certificate: A received certificate was corrupt (e.g., contained a signature that did
not verify).
• unsupported_certificate: The type of the received certificate is not supported.
• certificate_revoked: A certificate has been revoked by its signer.
• certificate_expired: A certificate has expired.
• certificate_unknown: Some other unspecified issue arose in processing the certificate,
rendering it unacceptable.
SSL Handshake Protocol
SSL Handshake protocol ensures establishment of reliable nd secure session between
client and server and also allows server & client to:
• authenticate each other
• to negotiate encryption & MAC algorithms
• to negotiate cryptographic keys to be used
The Handshake Protocol consists of a eries of messages exchanged by client and server.
All of these have the format shown below and each message has three fields:
The following figure shows the initial exchange needed to establish a logical connection
between client and server. The exchange can be viewed as having four phases.in phases
o Establish Security Capabilities
o Server Authentication and Key Exchange
157
o Client Authentication and Key Exchange
o Finish
Session ID: A variable-length session identifier. A nonzero value indicates that the
client wishes to update the parameters of an existing connection or create a new
connection on this session. A zero value indicates that the cl ent wishes to establish a new
connection on a new session.
• CipherSuite: This is a list that contains the combinations of cryptographic algorithms
supported by the client, in decreasing order of preference. Each element of the list (each
cipher suite) defines both a key exchange algorithm and a CipherSpec.
• Compression Method: This is a list of the compression methods the client supports.
158
Phase 2. Server Authentication and Key Exchange
The server begins this phase by sending its certificate via a certificate message, which
contains one or a chain of X.509 certificates. The certificate message is required for any
agreed-on key exchange method except anonymous Diffie-Hellman. Next, a
server_key_exchange message may be sent if it is required. It is not required in two
instances: (1) The server has sent a certificate with fixed Diffie-Hellman parameters, or
(2) RSA key exchange is to be used.
159
Once the server_done message is received by client, it should verify whether a valid
certificate is provided and check that the server_hello parameters are acceptable. If all is
satisfactory, the client sends one or more messages back to the server. If the server has
requested a certificate, the client begins this phase by sending a certificate message. If
no suitable certificate is available, the client sends a no_certificate alert instead. Next is
the client_key_exchange message, for which the content of the message depends on the
type of key exchange.
Phase 4. Finish
This phase completes the setting up of a secure connection. The client sends a
change_cipher_spec message and copies the pending CipherSpec into the current
CipherSpec. The client then immediately sends the finished message under the new
algorithms, keys, and secrets. The finished message verifies that the key exchange and
authentication processes were successful.
TLS was released in response to the Int rnet community’s demands for a
standardized protocol. TLS (Transport Layer Security), defined in RFC 2246, is a protocol
for establishing a secure connection between a client and a server. TLS (Transport Layer
Security) is capable of authenticating both the client and the server and creating a
encrypted connection between the two. Many protocols use TLS (Transport Layer
Security) to establish secure connections, including HTTP, IMAP, POP3, and SMTP. The
TLS Handshake Protocol first negotiates key exchange using an asymmetric algorithm
such as RSA or Diffie-Hellman. The TLS Record Protocol then begins opens an encrypted
channel using a symmetric algorithm such as RC4, IDEA, DES, or 3DES. The TLS Record
Protocol is also responsible for ensuring that the communications are not altered in
transit. Hashing algorithms such as MD5 and SHA are used for this purpose. RFC 2246 is
very similar to SSLv3. There are some minor differences ranging from protocol version
numbers to generation of key material.
Version Number: The TLS Record Format is the same as that of the SSL Record Format and
the fields in the header have the same meanings. The one difference is in version values.
For the current version of TLS, the Major Version is 3 and the Minor Version is 1.
160
Message Authentication Code: Two differences arise one being the actual algorithm and the
other being scope of MAC calculation. TLS makes use of the HMAC algorithm defined in
RFC 2104. SSLv3 uses the same algorithm, except that the padding bytes are concatenated
with the secret key rather than being XORed with the secret key padded to the block
length. For TLS, the MAC calculation encompasses the fields indicated in the following
expression:
HMAC_hash(MAC_write_secret, seq_num || TLSCompressed.type ||
TLSCompressed.version || TLSCompressed.length ||
TLSCompressed.fragment)
The MAC calculation covers all of the fields covered by the SSLv3 calculation, plus the
field TLSCompressed.version, which is the version of the protocol being employed.
Pseudorandom Function: TLS makes use of a pseudorandom function referred to as PRF
to expand secrets into blocks of data for purposes of key generation or validation. The
PRF is based on the following data expansion function:
P_hash(secret, seed) = HMAC_hash(secret, A(1) || seed) ||
HMAC_hash(secret, A(2) || seed) ||
HMAC_hash(secret, A(3) || seed) || ...
where A() is defined as
A(0) = seed
A(i) = HMAC_hash (secret, A(i - 1))
The data expansion function makes use of the HMAC algorithm, with either MD5 or SHA-
1 as the underlying hash function. As can be seen, P_hash can be iterated as many times
as necessary to produce the required quantity of data. each iteration involves two
executions of HMAC, each of which in turn involves two executions of the underlying hash
algorithm.
SET is an open encryption and security specification designed to protect credit card
transactions on the Internet. SET is not itself a payment system. Rather it is a set of
security protocols and formats that enables users to employ the existing credit card
payment infrastructure on an open network, such as the Internet, in a secure fashion. In
essence, SET provides three services:
• Provides a secure communications channel among all parties involved in a transaction
161
• Provides trust by the use of X.509v3 digital certificates
• Ensures privacy because the information is only available to parties in a transaction
when and where necessary
SET Requirements
Provide confidentiality of payment and ordering information
Ensure the integrity of all transmitted data
Provide authentication that a cardholder is a legitimate user of a credit card account
Provide authentication that a merchant can accept credit card transactions through its
relationship with a financial institution
Ensure the use of the best security practices and system design techniques to protect
all legitimate parties in an electronic commerce transaction
Create a protocol that neither depends on transport security mechanisms nor
prevents their use
Facilitate and encourage interoperability among software nd network providers
SET Key Features
To meet the requirements, SET incorporates the following features:
• Confidentiality of information
• Integrity of data
• Cardholder account authentication
• Merchant authentication
SET Participants
Cardholder: purchasers interact with merchants from personal computers over the
Internet
Merchant: a person or organization that has goods or services to sell to the cardholder
Issuer: a financial institution, such as a bank, that provides the cardholder with the
payment card.
Acquirer: a financial institution that establishes an account with a merchant and
processes payment card authorizations and payments
Payment gateway: a function operated by the acquirer or a designated third party
that processes merchant payment messages
Certification authority (CA): an entity that is trusted to issue X.509v3 public-key
certificates for cardholders, merchants, and payment gateways
162
Events in a transaction
1. The customer obtains a credit card account with a bank that supports electronic
payment and SET
2. The customer receives a X.509v3 digital certificate signed by the bank.
3. Merchants have their own certificates
4. The customer places an order
5. The merchant sends a copy of its certificate so that the customer can verify that it's a
valid store
6. The order and payment are sent
7. The merchant requests payment authorization
8. The merchant confirms the order
9. The merchant ships the goods or provides the service to the customer
10. The merchant requests payment
DUAL SIGNATURE
The purpose of the dual signature is to link two messages that are intended for two
different recipients. The customer wants to send the order information (OI) to the
merchant and the payment information (PI) to the bank. The merchant does not need to
163
know the customer's credit card number, and the bank does not need to know the details
of the customer's order. The customer is afforded extra protection in terms of privacy by
keeping these two items separate. The two items must be linked and the link is needed
so that the customer can prove that this payment is intended for this order and not for
some other goods or service.
The customer takes the hash (using SHA-1) of the PI and the hash of the OI. These two
hashes are then concatenated and the ha h of the result is taken. Finally, the customer
encrypts the final hash with his or her rivate signature key, creating the dual signature.
The operation can be summarized as
where KRc is the customer's private signature key. Now suppose that the merchant is in
possession of the dual signature (DS), the OI, and the message digest for the PI (PIMD).
The merchant also has the public key of the customer, taken from the customer's
certificate. Then the merchant can compute the quantities H(PIMS||H[OI]) and DKUc(DS)
where KUc is the customer's public signature key. If these two quantities are equal, then
the merchant has verified the signature. Similarly, if the bank is in possession of DS, PI,
the message digest for OI (OIMD), and the customer's public key, then the bank can
compute H(H[OI]||OIMD) and DKUc(DS). Again, if these two quantities are equal, then the
bank has verified the signature. To summarize:
164
The merchant has received OI and verified the signature.
The bank has received PI and verified the signature.
The customer has linked the OI and PI and can prove the linkage.
For a merchant to substitute another OI, he has to find another OI whose hash exactly
matches OIMD, which is deemed impossible. So, the OI cannot be linked with another PI.
Purchase Request
Merchant receives the Purchase Request message, the following actions are done:
165
1. verifies cardholder certificates using CA sigs
2. verifies dual signature using customer's public signature key to ensure order has not
been tampered with in transit & that it was signed using cardholder's private signature
key
3. processes order and forwards the payment information to the payment gateway for
authorization
4. sends a purchase response to cardholder
The Purchase Response message includes a response block that acknowledges the order
and references the corresponding transaction number. This block is signed by the
merchant using its private signature key. The block and its signature are sent to the
customer, along with the merchant’s signature certificate. Necessary action will be taken
by cardholder’s software upon verification of the certificates and signature.
INTRUDERS
One of the most publicized attacks to security is the intruder, generally referred to as
hacker or cracker. Three classes of intruders are as follows
166
• Masquerader – an individual who is not authorized to use the computer and
who penetrates a system’s access controls to exploit a legitimate user’s account.
• Misfeasor – a legitimate user who accesses data, programs, or resources for which
such access is not authorized, or who is authorized for such access but misuse his
or her privileges.
167
The following techniques are used for learning passwords.
• Try default passwords used with standard accounts that are shipped with the
system. Many administrators do not bother to change these defaults.
• Collect information about users such as their full names, the name of their spouse
and children, pictures in their office and books in their office that are related to
hobbies.
• Try user’s phone number, social security numbers and room numbers.
• Tap the line between a remote user and the host system.
• Detection – concerned with learning of an attack, either before or after its success.
INTRUSION DETECTION
Inevitably, the best intr sion revention system will fail. A system's second line of
defense is intrusion detection, and this has been the focus of much research in recent
years. This interest is motivated by a number of considerations, including the following:
1. If an intrusion is detected quickly enough, the intruder can be identified and ejected
from the system before any damage is done or any data are compromised.
2. An effective intrusion detection system can serve as a deterrent, so acting to prevent
intrusions.
3. Intrusion detection enables the collection of information about intrusion techniques
that can be used to strengthen the intrusion prevention facility.
Intrusion detection is based on the assumption that the behavior of the intruder
differs from that of a legitimate user in ways that can be quantified.
168
Figure 18.1 suggests, in very abstract terms, the nature of the task confronting the
designer of an intrusion detection system. Although the typical behavior of an intruder
differs from the typical behavior of an authorized user, there is an overlap in these
behaviors. Thus, a loose interpretation of intruder behavior, which will catch more
intruders, will also lead to a number of "false positives," or authorized users identified as
intruders. On the other hand, an attempt to limit false positives by a tight interpretation
of intruder behavior will lead to an increase in false negatives, or intruders not identified
as intruders. Thus, there is an element of compromise and art in the practice of intrusion
detection.
VIRUSES AND RELATED THREATS
Perhaps the most sophisticated types of threats to computer systems are presented by
programs that exploit vulnerabilities in computing systems.
Name Description
Virus Attaches itself to a program and
propagates copies of itself to other
programs
Worm Program that propagates copies of itself to
other computers
Logic bomb Triggers action when condition occurs
Trojan horse Program that contains unexpected
additional functionality
169
Backdoor (trapdoor) Program modification that allows
unauthorized access to functionality
Exploits Code specific to a single vulnerability or
set of vulnerabilities
Downloaders Program that installs other items on a
machine that is under attack. Usually, a
downloader is sent in an e-mail.
Auto-rooter Malicious hacker tools used to break into
new machines remotely
Kit (virus generator) Set of tools for generating new viruses
automatically
Spammer programs Used to send large volumes of unwanted
e-mail
Flooders Used to attack networked computer
systems with a large volume of traffic to
carry out a denial of service (DoS) attack
Keyloggers Captures keystrokes on a compromised
system
Rootkit Set of hacker tools used after attacker has
broken into a computer system and gained
root-level access
Zombie Program activated on n infected machine
that is activated to l unch attacks on other
machines
Malicious software can be divided into two categories: those that need a host program, and
those that are independent.
The former are essentially fragments of rograms that cannot exist independently of some
actual application program, utility, or system program. Viruses, logic bombs, and backdoors
are examples. The latter are self-contained programs that can be scheduled and run by the
operating system. Worms and zombie programs are examples.
The Nature of Viruses A virus is a piece of software that can "infect" other programs by
modifying them; the modification includes a copy of the virus program, which can then
go on to infect other programs. A virus can do anything that other programs do. The only
difference is that it attaches itself to another program and executes secretly when the
host program is run. Once a virus is executing, it can perform any function, such as erasing
files and programs. During its lifetime, a typical virus goes through the following four
phases:
195
170
• Dormant phase: The virus is idle. The virus will eventually be activated by some
event, such as a date, the presence of another program or file, or the capacity of
the disk exceeding some limit. Not all viruses have this stage.
• Propagation phase: The virus places an identical copy of itself into other
programs or into certain system areas on the disk. Each infected program will now
contain a clone of the virus, which will itself enter a propagation phase.
• Triggering phase: The virus is activated to perform the function for which it was
intended. As with the dormant phase, the triggering phase can be caused by a
variety of system events, including a count of the number of times that this copy
of the virus has made copies of itself.
• Execution phase: The function is performed. The function may be harmless, such
as a message on the screen, or damaging, such as the destruction of programs and
data files.
Virus Structure
A virus can be prepended or postpended to an execut ble program, or it can be
embedded in some other fashion. The key to its op ration is that the infected program,
when invoked, will first execute the virus code and th n execute the original code of the
program. An infected program begins with the virus code and works as follows.
The first line of code is a jump to the main virus program. The second line is a special
marker that is used by the virus to determine whether or not a potential victim program
has already been infected with this virus. When the program is invoked, control is
immediately transferred to the main virus program. The virus program first seeks out
uninfected executable files and infects them. Next, the virus may perform some action,
usually detrimental to the system. This action could be performed every time the
program is invoked, or it could be a logic bomb that triggers only under certain
conditions. Finally, the virus transfers control to the original program. If the infection
phase of the program is reasonably rapid, a user is unlikely to notice any difference
between the execution of an infected and uninfected program.
A virus such as the one just described is easily detected because an infected version of a
program is longer than the corresponding uninfected one. A way to thwart such a simple
means of detecting a virus is to compress the executable file so that both the infected and
uninfected versions are of identical length.. The key lines in this virus are numbered, and
171
Figure 19.3 [COHE94] illustrates the operation. We assume that program P1 is infected
with the virus CV. When this program is invoked, control passes to its virus, which
performs the following steps:
• For each uninfected file P2 that is found, the virus first compresses that file to
produce P'2, which is shorter than the original program by the size of the virus.
In this example, the virus does nothing other than propagate. As in the previous example,
the virus may include a logic bomb.
Initial Infection
Once a virus has gained entry to a system by infecting a single program, it is in a position
to infect some or all other executable files on that system when the infected program
executes. Thus, viral infection can be completely prevented by preventing the virus from
gaining entry in the first place. Unfortunately, prevention is extraordinarily difficult
because a virus can be part of any program outside a system. Thus, unless one is content
to take an absolutely bare piece of iron and write all one's own system and application
programs, one is vulnerable.
172
Types of Viruses
Following categories as being among the most significant types of viruses:
• Parasitic virus: The traditional and still most common form of virus. A parasitic
virus attaches itself to executable files and replicates, when the infected program
is executed, by finding other executable files to infect.
• Memory-resident virus: Lodges in main memory as part of a resident system
program. From that point on, the virus infects every program that executes.
• Boot sector virus: Infects a master boot record or boot record and spreads when
a system is booted from the disk containing the virus.
• Stealth virus: A form of virus explicitly designed to hide itself from detection by
antivirus software.
• Polymorphic virus: A virus that mutates with every infection, making detection
by the "signature" of the virus impossible.
• Metamorphic virus: As with a polymorphicMediavirus,metamorphic virus
mutates with every infection. The difference is that metamorphic virus rewrites
itself completely at each iteration, increasing the difficulty of detection.
Metamorphic viruses my change their behavior as well as th ir appearance.
One example of a stealth virus was discussed earlier: a virus that uses
compression so that the infected program is exactly the same length as an uninfected
version. Far more sophisticated techniques are possible. For example, a virus can place
intercept logic in disk I/O routines, so that when there is an attempt to read suspected
portions of the disk using these routines, the virus will present back the original,
uninfected program.
A polymorphic virus creates copies during replication that are functionally
equivalent but have distinctly different bit patterns
Macro Viruses
In the mid-1990s, macro viruses became by far the most prevalent type of virus. Macro
viruses are particularly threatening for a number of reasons:
1. A macro virus is platform independent. Virtually all of the macro viruses infect
Microsoft Word documents. Any hardware platform and operating system that supports
Word can be infected.
173
2. Macro viruses infect documents, not executable portions of code. Most of the
information introduced onto a computer system is in the form of a document rather than
a program.
3. Macro viruses are easily spread. A very common method is by electronic mail.
Macro viruses take advantage of a feature found in Word and other office applications
such as Microsoft Excel, namely the macro. In essence, a macro is an executable program
embedded in a word processing document or other type of file. Typically, users employ
macros to automate repetitive tasks and thereby save keystrokes. The macro language is
usually some form of the Basic programming language. A user might define a sequence of
keystrokes in a macro and set it up so that the macro is invoked when a function key or special
short combination of keys is input. Successive releases of Word provide increased protection
against macro viruses. For example,
files and alerts the customer to the potential risk of open ng file with macros. Various
A more recent development in malicious software is the e-mail virus. The first rapidly
spreading e-mail viruses, such as Melis a, made use of Microsoft Word macro embedded
in an attachment. If the recipient o ens the e-mail attachment, the Word macro is
activated. Then
1. The e-mail virus sends itself to everyone on the mailing list in the user's e-mail package.
2. The virus does local damage.
Worms
A worm is a program that can replicate itself and send copies from computer to computer
across network connections. Upon arrival, the worm may be activated to replicate and
propagate again. Network worm programs use network connections to spread from
system to system. Once active within a system, a network worm can behave as a computer
virus or bacteria, or it could implant Trojan horse programs or perform any number of
disruptive or destructive actions. To replicate itself, a network worm uses some sort of
network vehicle. Examples include the following:
• Electronic mail facility: A worm mails a copy of itself to other systems.
174
• Remote execution capability: A worm executes a copy of itself on another system.
• Remote login capability: A worm logs onto a remote system as a user and then
uses commands to copy itself from one system to the other.
The new copy of the worm program is then run on the remote system where, in
addition to any functions that it performs at that system, it continues to spread in the
same fashion. A network worm exhibits the same characteristics as a computer virus: a
dormant phase, a propagation phase, a triggering phase, and an execution phase.
and corresponding user IDs. The assumption Mediawasthatmanyusers would use the same
password on different systems. To obtain th passwords, the worm ran a password-
cracking program that tried
a. Each user's account name and simple permutations of it
b. A list of 432 built-in passwords that Morris thought to be likely
candidates
c. All the words in the local ystem directory
2. It exploited a bug in the finger rotocol, which reports the whereabouts of a remote
user.
3. It exploited a trapdoor in the debug option of the remote process that receives and
sends mail.
If any of these attacks succeeded, the worm achieved communication with the operating
system command interpreter.
Recent Worm Attacks In late 2001, a more versatile worm appeared, known as Nimda.
Nimda spreads by multiple mechanisms:
• from client to client via e-mail
• from client to client via open network shares
• from Web server to client via browsing of compromised Web sites
• from client to Web server via active scanning for and exploitation of various
Microsoft
175
FIREWALLS
A firewall is inserted between the premises network and the Internet to establish
a controlled link and to erect an outer security wall or perimeter, forming a single choke
point where security and audit can be imposed. A firewall:
1. Defines a single choke point that keeps unauthorized users out of the protected
network, prohibits potentially vulnerable services from entering or leaving the network,
and provides protection from various kinds of IP spoofing and routing attacks.
3. is a convenient platform for several Internet functions that are not security related,
such as NAT and Internet usage audits or logs
4. A firewall can serve as the platform for IPSec to implement virtual private networks.
Only authorized traffic (defined by the local security police) will be allowed to pass
The firewall itself is immune to penetration (use of trusted system with a secure
operating system)
The four general techniques that firewalls use to control access and enforce the sites
security policies are:
Service control: Determines the types of Internet services that can be accessed,
inbound or outbound
Direction control: Determines the direction in which particular service requests are
allowed to flow
Behavior control: Controls how particular services are used (e.g. filter e-mail)
The limitations of Firewalls are:
1. Cannot protect against attacks that bypass the firewall, eg PCs with dial-out capability
to an ISP, or dial-in modem pool use.
176
2. do not protect against internal threats, eg disgruntled employee or one who cooperates
with an attacker
3. cannot protect against the transfer of virus-infected programs or files, given wide
variety of O/S & applications supported
Types of Firewalls
Firewalls are generally classified as three types: packet filters, application-level
gateways, & circuit-level gateways.
Packet-filtering Router
A packet-filtering router applies a set of rules to each incoming and outgoing IP packet to
forward or discard the packet. Filtering rules are based on information contained in a
network packet such as src & dest IP addresses, ports, transport protocol & interface.
If there is no match to any rule, then one of two default policies are applied:
that which is not expressly permitted is prohibited (default action is discard packet),
conservative policy
that which is not expressly prohibited is permitted (default action is forward packet),
permissive policy
The default discard policy is more conservative. Initially, everything is blocked, and services
must be added on a case-by-case basis. This policy is more visible to users, who are more
likely to see the firewall as a hindrance. The default forward policy increases ease of use for
end users but provides reduced security; the security administrator must, in essence, react
to each new security threat as it becomes known. One advantage of a
177
packet-filtering router is its simplicity. Also, packet filters typically are transparent to
users and are very fast.
The table gives some examples of packet-filtering rule sets. In each set, the rules are
applied top to bottom.
A. Inbound mail is allowed to a gateway host only (port 25 s for SMTP incoming
B. explicit statement of the default policy
C. tries to specify that any inside host can send mail to the outside, but has problem that
an outside machine could be configured to have some other application linked to port 25
D. properly implements mail sending rule, by checking ACK flag of a TCP segment is set
E. this rule set is one approach to handling FTP connections
Some of the attacks that can be made on packet-filtering routers & countermeasures are:
IP address spoofing: where intruder transmits packets from the outside with internal
host source IP addresses, need to filter & discard such packets
Source routing attacks: where source specifies the route that a packet should take to
bypass security measures, should discard all source routed packets
Tiny fragment attacks: intruder uses the IP fragmentation option to create extremely
small fragments and force the TCP header information into separate fragments to
circumvent filtering rules needing full header info, can enforce minimum fragment size
to include full header.
178
Stateful Packet Filters
A traditional packet filter makes filtering decisions on an individual packet basis and does
not take into consideration any higher layer context. A stateful inspection packet filter
tightens up the rules for TCP traffic by creating a directory of outbound TCP connections,
and will allow incoming traffic to high-numbered ports only for those packets that fit the
profile of one of the entries in this directory. Hence they are better able to detect bogus
packets sent out of context.
APPLICATION LEVEL GATEWAY
An application-level gateway (or proxy server), acts as a relay of application-level
traffic. The user contacts the gateway using a TCP/IP application, such as Telnet or FTP,
and the gateway asks the user for the name of the remote host to be accessed. When the
user responds and provides a valid user ID and authentication information, the gateway
contacts the application on the remote host and relays TCP segments containing the
application data between the two endpoints. If the gateway does not implement the proxy
code for a specific application, the service is not supported nd cannot be forwarded across
the firewall.
Application-level gateways tend to be more secure than packet filters. Rather than trying
to deal with the numerous possible combinations that are to be allowed and forbidden at
the TCP and IP level, the application-level gateway need only scrutinize a few allowable
applications. In addition, it is easy to log and audit all incoming traffic at the application
level. A prime disadvantage of this type of gateway is the additional processing overhead
on each connection. In effect, there are two spliced connections between the end users,
with the gateway at the splice point, and the gateway must examine and forward all traffic
in both directions.
179
CIRCUIT LEVEL GATEWAY
A circuit-level gateway relays two TCP connections, one between itself and an
inside TCP user, and the other between itself and a TCP user on an outside host. Once the
two connections are established, it relays TCP data from one connection to the other
without examining its contents. The security function consists of determining which
connections will be allowed. It is typically used when internal users are trusted to decide
what external services to access.
One of the most common circuit-level gateways is SOCKS, defined in RFC 1928. It
consists of a SOCKS server on the firewall, and a SOCKS library & SOCKS-aware
applications on internal clients. The protocol described here is designed to provide a
framework for client-server applications in both the TCP and UDP domains to
conveniently and securely use the services of a network firewall. The protocol is
conceptually a "shim-layer" between the application layer and the transport layer, and as
such does not provide network-layer gateway services, such as forwarding of ICMP
messages.
Bastion Host
A bastion host is a critical strong point in the network’s security, serving as a platform
for an application-level or circuit-level gateway, or for external services. It is thus
potentially exposed to "hostile" elements and must be secured to withstand this. Common
characteristics of a bastion host include that it:
• executes a secure version of its O/S, making it a trusted system
• has only essential services installed on the bastion host
180
• may require additional authentication before a user is allowed access to the
proxy services
• is configured to support only a subset of the standard application’s command set,
with access only to specific hosts
• maintains detailed audit information by logging all traffic
• has each proxy module a very small software package specifically designed for
network security
• has each proxy independent of other proxies on the bastion host
• have a proxy performs no disk access other than to read its initial configuration
file
• have each proxy run as a non-privileged user in a private and secured directory
• A bastion host may have two or more network interfaces (or ports), and must be
trusted to enforce trusted separation between these network connections,
relaying traffic only according to policy.
Firewall Configurations
In addition to the use of a simple configuration consisting of a single system, more
complex configurations are possible and indeed more common. There are three common
firewall configurations.
The following figure shows the “screened host firewall, single-homed bastion
configuration”, where the firewall consists of two systems:
• a packet-filtering router - allows Internet packets to/from bastion only
181
This configuration has greater security, as it implements both packet-level & application-
level filtering, forces an intruder to generally penetrate two separate systems to
compromise internal security, & also affords flexibility in providing direct Internet access
to specific internal servers (eg web) if desired.
The next configuration illustrates the “screened host firewall, dual-homed bastion
configuration” which physically separates the external and internal networks, ensuring
two systems must be compromised to breach security. The advantages of dual layers of
security are also present here.
the router if this is in accord with the security policy, but are now separated from the
internal network.
The third configurations illustrated below shows the “screened subnet firewall
configuration”, being the most secure hown.
It has two packet-filtering routers, one between the bastion host and the Internet and the
other between the bastion host and the internal network, creating an isolated sub-
network. This may consist of simply the bastion host but may also include one or more
information servers and modems for dial-in capability. Typically, both the Internet and
the internal network have access to hosts on the screened subnet, but traffic across the
screened subnet is blocked.
182
This configuration offers several advantages:
• There are now three levels of defense to thwart intruders
• The outside router advertises only the existence of the screened subnet to the
Internet; therefore the internal network is invisible to the Internet
• Similarly, the inside router advertises only the existence of the screened subnet to the
internal network; hence systems on the inside network cannot construct direct routes to
the Internet
COMPUTER FORENSICS
Computer security and computer forensics are distinct but related disciplines due
to the degree of overlap of raw material used by both fields. In general, computer security
aims to preserve a system as it is meant to be (as per the security policies) whereas
computer forensics (and especially network or intrusion forensics) sets out to explain
how a policy became violated. Therefore, the main diff rence can be seen as one of system
integrity versus culpability for an event or set of v nts.
Whereas theSkyupstwofieldsmayeimilar data sources, they have different and
sometimes opposing aims. For exam le, ecurity countermeasures such as encryption or
data wiping tools may work against the computer forensic investigation. The security
measures will complicate the investigation as the data must be decrypted prior to
analysis. In addition, security functions tend to only implement minimal logging by
design. Therefore, not all the information required will be available to the forensic
analyst.
183