You are on page 1of 86

102046708

Information and Network


Security
Credit – 4
Theory – 3, Practical -2

Reference: Cryptography and Network Security, 6/e, By William Stallings


Chapter 1 – Introduction

The art of war teaches us to rely not on the


likelihood of the enemy's not coming, but
on our own readiness to receive him; not
on the chance of his not attacking, but
rather on the fact that we have made our
position unassailable.
—The Art of War, Sun Tzu
Background
 Information Security requirements have changed
in recent times
 traditionally provided by physical and
administrative mechanisms
 computer use requires automated tools to
protect files and other stored information
 use of networks and communications links
requires measures to protect data during
transmission
Definitions
 Computer Security - generic name for the
collection of tools designed to protect data and
to thwart hackers

 Network Security - measures to protect data


during their transmission

 Internet Security - measures to protect data


during their transmission over a collection of
interconnected networks
Aim of Course
 our
focus is on Cryptography & Network
Security

 which consists of measures to prevent,


detect and correct security violations that
involve the transmission & storage of
information
Some Examples of Security Violation

User A Transmits a file to user B. The file contains sensitive information


that is to be protected from disclosure. User C, who is not authorized to
read the file, is able to monitor the transmission and capture a copy of
the file during it transmission.

A network manager D, transmits a message to a computer E, under


its management. The message instructs computer E to update an
authorization file to include the identities of a number of new users
who are to be given access to that computer. User F intercepts the
message , alters its contents to add or delete entries , and then
forwards the message to E, which accepts the message as coming
from D and updates its authorization file accordingly.
Some Examples of Security Violation
Rather than intercept a message , User F construct its own message
with the desired entries and transmit that message to E as if had
come from manager D. Computer E accepts the message as coming
from manager D and updates its authorization file accordingly.

An employee is fired without warning. The personnel manager sends


a message to a server system to invalidate the employee’s account.
When the invalidation is accomplished , the server is to post a notice
to the employee’s file as confirmation of the action. The employee is
able to intercept the message and delay it long enough to make a
final access to the server to retrieve , and the confirmation posted.
The employee’s action may go unnoticed for some considerable time.

A message is sent from a customer to a stockbroker with instruction


for various transaction. Subsequently , the investment lose value
and the customer denies sending the message.
OSI Security Architecture
 ITU-T X.800 “Security Architecture for OSI”
 defines a systematic way of defining and
providing security requirements
 for us it provides a useful, if abstract,
overview of concepts we will study
Aspects of Security
 consider 3 aspects of information security:
 security attack – Any action that compromise the
security of information owned by an organization.
 security mechanism – A process that is designed to
detect, prevent or recover form security attack.
 security service – A processing or communication
services that enhances the security of the data processing
systems and the information transfers of an organization. The
services are intended to counter security attacks, and they make
use of one or more security mechanisms to provide the services.
Security Attack
 can focus of generic types of attacks
 Passive
• Passive attacks are in the nature of eavesdropping on, or
monitoring of, transmission.
• The goal of the opponent is to obtain information that is
being transmitted.

 Active
• Active attack involves some modification of the data stream
or the creation of a false stream.
Passive Attacks
Passive Attacks (Cont.)
Active Attacks

A masquerade takes place when one entity pretends to be a


different entity
Active Attacks (Cont.)

Replay involves the passive capture of a data unit and its


subsequent retransmission to produce an unauthorized effect
Active Attacks (Cont.)

Modification of messages simply means that some portion


of a legitimate message is altered, or that messages are
delayed or reordered, to produce an unauthorized effect
Active Attacks (Cont.)

The denial of service prevents or inhibits the normal use or


management of communications facilities
Security attack
 Passive attacks are difficult to detect, measures
are available to prevent their success.

 Active attacks is quite difficult to prevent,


because of wide variety of potential, software
and network vulnerabilities.

 The goal is detect active attacks and to recover


from any disruption or delays caused by them.
Security Service
 enhance security of data processing systems
and information transfers of an organization
 intended to counter security attacks
 using one or more security mechanisms
 often replicates functions normally associated
with physical documents
• which, for example, have signatures, dates; need
protection from disclosure, tampering, or
destruction; be notarized or witnessed; be
recorded or licensed
Security Services
 X.800:
“a service provided by a protocol layer of
communicating open systems, which ensures
adequate security of the systems or of data
transfers”

 RFC 2828:
“a processing or communication service
provided by a system to give a specific kind of
protection to system resources”
Security Services (X.800)
Categories:
 Authentication - assurance that the
communicating entity is the one claimed
 Access Control - prevention of the unauthorized
use of a resource
 Data Confidentiality –protection of data from
unauthorized disclosure
 Data Integrity - assurance that data received is
as sent by an authorized entity
 Non-Repudiation - protection against denial by
one of the parties in a communication
Security Mechanism
 feature designed to detect, prevent, or
recover from a security attack
 no single mechanism that will support all
services required
 however one particular element underlies
many of the security mechanisms in use:
 cryptographic techniques
 hence our focus on this topic
Security Mechanisms (X.800)
 specific security mechanisms:
 encipherment, digital signatures, access

controls, data integrity, authentication


exchange, traffic padding, routing control,
notarization
 pervasive security mechanisms:
 trusted functionality, security labels, event

detection, security audit trails, security


recovery
Model for Network Security
Model for Network Security
 using this model requires us to:
1. design a suitable algorithm for the security
transformation
2. generate the secret information (keys) used
by the algorithm
3. develop methods to distribute and share the
secret information
4. specify a protocol enabling the principals to
use the transformation and secret
information for a security service
Model for Network Access
Security
Model for Network Access
Security
 using this model requires us to:
1. select appropriate gatekeeper functions to
identify users
2. implement security controls to ensure only
authorised users access designated
information or resources
 trusted computer systems may be useful
to help implement this model
Summary
 have considered:
 definitions for:
• computer, network, internet security
 X.800 standard
 security attacks, services, mechanisms
 models for network (access) security
Chapter 2 – Classical Encryption
Techniques
Symmetric Encryption
 or conventional / private-key / single-key
 sender and recipient share a common key
 all classical encryption algorithms are
private-key
 was only type prior to invention of public-
key in 1970’s
 and by far most widely used
Some Basic Terminology
 plaintext - original message
 ciphertext - coded message
 cipher - algorithm for transforming plaintext to ciphertext
 key - info used in cipher known only to sender/receiver
 encipher (encrypt) - converting plaintext to ciphertext
 decipher (decrypt) - recovering ciphertext from plaintext
 cryptography - study of encryption principles/methods
 cryptanalysis (codebreaking) - study of principles/
methods of deciphering ciphertext without knowing key
 cryptology - field of both cryptography and cryptanalysis
Symmetric Cipher Model
Requirements
 two
requirements for secure use of
symmetric encryption:
 a strong encryption algorithm
 a secret key known only to sender / receiver
 mathematically have:
Y = EK(X)
X = DK(Y)
 assume encryption algorithm is known
 implies a secure channel to distribute key
If P is the plaintext, C is the ciphertext, and K is the key,

We assume that Bob creates P1; we prove that P1 = P:


Cryptography
 characterize cryptographic system by:
• substitution / transposition / product
 The type of operations used for transforming plaintext to
ciphertext. All encryption algorithms are based on two general
 principles: substitution, in which each element in the plaintext (bit, letter,
group of bits or letters) is mapped into another element, and
transposition, in which elements in the plaintext are rearranged. The
fundamental requirement is that no information be lost (that is, that all
operations are reversible). Most systems, referred to as product
systems, involve multiple stages of substitutions and transpositions.
 The number of keys used
• single-key or private / two-key or public
 The way in which plaintext is processed
• block / stream
Cryptanalysis
 objectiveto recover key not just message
 general approaches:
 cryptanalytic attack
 Cryptanalytic attacks rely on the nature of the algorithm plus
perhaps some knowledge of the general characteristics of the
plaintext or even some sample plaintext-ciphertext pairs. This
type of attack exploits the characteristics of the algorithm to
attempt to deduce a specific plaintext or to deduce the key being
used.
 brute-force attack
 The attacker tries every possible key on a piece of ciphertext
until an intelligible translation into plaintext is obtained. On
average, half of all possible keys must be tried to achieve
success.
Cryptanalysis

As cryptography is the science and art of creating secret


codes, cryptanalysis is the science and art of breaking
those codes.

Cryptanalysis attacks

Chosen-text
Continued
Ciphertext-Only Attack

Ciphertext-only attack

Known information:
• Encryption algorithm
• Cipher text
Continued
Known-Plaintext Attack

Known-plaintext attack

Known information:
• Encryption algorithm
• Cipher text
• One or more plaintext-cipher text pairs formed with the secret key
Continued
Chosen-Plaintext Attack

Chosen-plaintext attack

Known information:
• Encryption algorithm
• Cipher text
• Plaintext message chosen by cryptanalyst, together with its
corresponding ciphertext generated with the secret key
Continued
Chosen-Ciphertext Attack

Chosen-ciphertext attack

Known information:
• Encryption algorithm
• Cipher text
• Purported ciphertext chosen by cryptanalyst, together with its corresponding
decrypted plaintext generated with the secret key
Chosen text

Known information:

• Encryption algorithm

• Ciphertext

• Plaintext message chosen by cryptanalyst, together with its


corresponding ciphertext generated with the secret key

• Purported ciphertext chosen by cryptanalyst, together with its


corresponding decrypted plaintext generated with the secret key
Cryptanalytic Attacks
 ciphertext only
 only know algorithm & ciphertext, is statistical,
know or can identify plaintext
 known plaintext
 know/suspect plaintext & ciphertext
 chosen plaintext
 select plaintext and obtain ciphertext
 chosen ciphertext
 select ciphertext and obtain plaintext
 chosen text
 select plaintext or ciphertext to en/decrypt
More Definitions
 unconditional security
 no matter how much computer power or time
is available, the cipher cannot be broken
since the cipher text provides insufficient
information to uniquely determine the
corresponding plaintext
 computational security
 given limited computing resources (eg time
needed for calculations is greater than age of
universe), the cipher cannot be broken
Brute Force Search
 always possible to simply try every key
 most basic attack, proportional to key size
 assume either know / recognise plaintext

Key Size (bits) Number of Time required at 1 Time required at


Alternative decryption/µs 106 decryptions/µs
Keys
32 232 = 4.3  109 231 µs = 35.8 2.15 milliseconds
minutes
56 256 = 7.2  255 µs = 1142 years 10.01 hours
1016
128 2128 = 3.4  2127 µs = 5.4  1024 5.4  1018 years
1038 years
168 2168 = 3.7  2167 µs = 5.9  1036 5.9  1030 years
1050 years
26 characters 26! = 4  1026 2  1026 µs = 6.4 6.4  106 years
(permutation)  1012 years
Classical Substitution
Ciphers
 where letters of plaintext are replaced by
other letters or by numbers or symbols
 or if plaintext is viewed as a sequence of
bits, then substitution involves replacing
plaintext bit patterns with ciphertext bit
patterns
Caesar Cipher
 earliest known substitution cipher
 by Julius Caesar
 first attested use in military affairs
 replaces each letter by 3rd letter on
 example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
Caesar Cipher
 can define transformation as:
a b c d e f g h i j k l m n o p q r s t u v w x y z
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

 mathematically give each letter a number


a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

 then have Caesar cipher as:


c = E(p) = (p + k) mod (26)
p = D(c) = (c – k) mod (26)
Cryptanalysis of Caesar
Cipher
 only have 26 possible ciphers
 A maps to A,B,..Z
 could simply try each in turn
 a brute force search
 given ciphertext, just try all shifts of letters
 do need to recognize when have plaintext
 eg. break ciphertext "GCUA VQ DTGCM"
Continued

Use the additive cipher with key = 15 to encrypt the message


“hello”.

Solution
We apply the encryption algorithm to the plaintext, character by
character:
Continued

Use the additive cipher with key = 15 to decrypt the message


“WTAAD”.
Solution
We apply the decryption algorithm to the plaintext character by
character:
Monoalphabetic Cipher
 rather than just shifting the alphabet
 could shuffle (jumble) the letters arbitrarily
 each plaintext letter maps to a different random
ciphertext letter
 hence key is 26 letters long

Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher
Security
 now have a total of 26! = 4 x 1026 keys
 with so many keys, might think is secure
 but would be !!!WRONG!!!
 problem is language characteristics
Language Redundancy and
Cryptanalysis
 human languages are redundant
 eg "th lrd s m shphrd shll nt wnt"
 letters are not equally commonly used
 in English E is by far the most common letter
 followed by T,R,N,I,O,A,S
 other letters like Z,J,K,Q,X are fairly rare
 have tables of single, double & triple letter
frequencies for various languages
3.2.1 Continued
Table 3.1 Frequency of characters in English

Table 3.2 Frequency of diagrams and trigrams


English Letter Frequencies
Continued

Eve has intercepted the following ciphertext. Using a statistical


attack, find the plaintext.

Solution
When Eve tabulates the frequency of letters in this ciphertext, she
gets: I =14, V =13, S =12, and so on. The most common character
is I with 14 occurrences.
Use in Cryptanalysis
 key concept - monoalphabetic substitution
ciphers do not change relative letter frequencies
 discovered by Arabian scientists in 9th century
 calculate letter frequencies for ciphertext
 compare counts/plots against known values
 if caesar cipher look for common peaks/troughs
 peaks at: A-E-I triple, NO pair, RST triple
 troughs at: JK, X-Z
 for monoalphabetic must identify each letter
 tables of common double/triple letters help
Example Cryptanalysis
 given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
 count relative letter frequencies (see text)
 guess P & Z are e and t
 guess ZW is th and hence ZWP is the
 proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made with political
representatives of the viet cong in moscow
Playfair Cipher
 not even the large number of keys in a
monoalphabetic cipher provides security
 one approach to improving security was to
encrypt multiple letters
 the Playfair Cipher is an example
 invented by Charles Wheatstone in 1854,
but named after his friend Baron Playfair
Playfair Key Matrix
a 5X5 matrix of letters based on a keyword
 fill in letters of keyword (sans duplicates)
 fill rest of matrix with other letters
 eg. using the keyword MONARCHY

M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypting and Decrypting
 plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’ E.G
balloon -> ba lx lo on
2. if both letters fall in the same row, replace each with
letter to right (wrapping back to start from end)
E.G. ar -> RM
3. if both letters fall in the same column, replace each
with the letter below it (again wrapping to top from
bottom) E.G. mu -> CM
4. otherwise each letter is replaced by the letter in the
same row and in the column of the other letter of the
pair. E.G. ea -> IM
Security of Playfair Cipher
 security much improved over monoalphabetic
 since have 26 x 26 = 676 digrams
 would need a 676 entry frequency table to
analyse (verses 26 for a monoalphabetic)
 and correspondingly more ciphertext
 was widely used for many years
 eg. by US & British military in WW1
 it can be broken, given a few hundred letters
 since still has much of plaintext structure
Hill Cipher
 Another interesting multiletter cipher is the Hill cipher, developed by
the mathematician Lester Hill in 1929. The encryption algorithm takes
m successive plaintext letters and substitutes for them m ciphertext
letters. The substitution is determined by m linear equations in which
each character is assigned a numerical value (a = 0, b = 1 ... z = 25).
For m = 3, the system can be described as follows:
 c1 = (k11P1 + k12P2 + k13P3) mod 26
 c2 = (k21P1 + k22P2 + k23P3) mod 26
 c3 = (k31P1 + k32P2 + k33P3) mod 26
 This can be expressed in term of column vectors and matrices:
 or
 C = KP mod 26
 where C and P are column vectors of length 3, representing the
plaintext and ciphertext, and K is a 3 x 3 matrix, representing the
encryption key. Operations are performed mod 26.
 For example, consider the plaintext
"paymoremoney" and use the encryption key

 The first three letters of the plaintext are


represented by the vector
 the ciphertext for the entire plaintext is
LNSHDLEWMTRW.
 Decryption requires using the inverse of the matrix K. The
inverse K-1 of a matrix K is defined by the equation
KK-1 = K-1K = I, where I is the matrix that is all zeros
except for ones along the main diagonal from upper left to
lower right. The inverse of a matrix does not always exist,
 but when it does, it satisfies the preceding equation. In this
case, the inverse is:
 K-1 = Adj k / |k|
It is easily seen that if the matrix K-1 is applied to the ciphertext,
then the plaintext is recovered.
Polyalphabetic Ciphers
 polyalphabetic substitution ciphers
 improve security using multiple cipher
alphabets
 make cryptanalysis harder with more
alphabets to guess
 use a key to select which alphabet is used
for each letter of the message
repeat from start after end of key is reached
Vigenère Cipher
 simplest polyalphabetic substitution cipher
 key is multiple letters long K = k1 k2 ... kd
 ith letter specifies ith alphabet to use
 repeat from start after d letters in message
 decryption simply works in reverse
Example of Vigenère Cipher
 write the plaintext out
 write the keyword repeated above it
 use each key letter as a caesar cipher key
 encrypt the corresponding plaintext letter
 eg using keyword deceptive
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Security of Vigenère Ciphers
 have multiple ciphertext letters for each
plaintext letter
 hence letter frequencies are obscured
 but not totally lost
 start with letter frequencies
 see if look monoalphabetic or not
 ifnot, then need to determine number of
alphabets
Using Example, we can say that the additive cipher is a special
case of Vigenere cipher in which m = 1.

Table A Vigenere Tableau


Autokey Cipher
 ideally want a key as long as the message
 Vigenère proposed the autokey cipher
 with keyword is prefixed to message as key
 knowing keyword can recover the first few letters
 but still have frequency characteristics to attack
 eg. given key deceptive
key: deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
Vernam Cipher
 The ultimate defense against such a
cryptanalysis is to choose a keyword that is as
long as the plaintext and has no statistical
relationship to it.

 Such a system was introduced by an AT&T


engineer named Gilbert Vernam in 1918. His
system works on binary data rather than letters.
Vernam Cipher
 The system can be expressed as follows:
ci = pi ex-or ki
where
pi = ith binary digit of plaintext
ki = ith binary digit of key
ci = ith binary digit of ciphertext
exclusive-or (XOR) operation
 Thus, the ciphertext is generated by performing the
bitwise XOR of the plaintext and the key. Because of
the properties of the XOR,
 decryption simply involves the same bitwise operation:
pi = ci ex-or ki
One-Time Pad
 if a truly random key as long as the message is used, the
cipher will be secure called a One-Time pad
 is unbreakable since ciphertext bears no statistical
relationship to the plaintext
 since for any plaintext & any ciphertext there exists a key
mapping one to other can only use the key once though
problems in generation & safe distribution of key
 ciphertext:
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
plaintext: mr mustard with the candlestick in the hall
 ciphertext:
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
plaintext: miss scarlet with the knife in the library
Transposition Ciphers
 now consider classical transposition or
permutation ciphers
 these hide the message by rearranging
the letter order
 without altering the actual letters used
 can recognise these since have the same
frequency distribution as the original text
Rail Fence cipher
 write message letters out diagonally over a
number of rows
 then read off cipher row by row
 eg. write message out as:
m e m a t r h t g p r y
e t e f e t e o a a t
 giving ciphertext
MEMATRHTGPRYETEFETEOAAT
Row Transposition Ciphers
(Columnar)
 a more complex transposition
 write letters of message out in rows over a
specified number of columns
 then reorder the columns according to
some key before reading off the rows
Key: 4 3 1 2 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Product Ciphers
 ciphers using substitutions or transpositions are
not secure because of language characteristics
 hence consider using several ciphers in
succession to make harder, but:
 two substitutions make a more complex substitution
 two transpositions make more complex transposition
 but a substitution followed by a transposition makes a
new much harder cipher
 this is bridge from classical to modern ciphers
Combining Two Approaches

Figure
Steganography
 an alternative to encryption
 hides existence of message
 using only a subset of letters/words in a
longer message marked in some way
 using invisible ink
 hiding in LSB in graphic image or sound file
 has drawbacks
 high overhead to hide relatively few info bits
Steganography
 Character marking: Selected letters of printed
or typewritten text are overwritten in pencil. The
marks are ordinarily not visible unless the paper
is held at 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.
Steganography
 Pin punctures: Small pin punctures on
selected letters are ordinarily not visible
unless the paper is held up in front of a
light.

 Typewriter correction ribbon: Used


between lines typed with a black ribbon,
the results of typing with the correction
tape are visible only under a strong light.
Summary
 have considered:
 classical cipher techniques and terminology
 monoalphabetic substitution ciphers
 cryptanalysis using letter frequencies
 Playfair cipher
 polyalphabetic ciphers
 transposition ciphers
 product ciphers and rotor machines
 stenography

You might also like