CSS Techmax
CSS Techmax
Scanned by CamScanner
a
000
aaa
ore
yee
7) cian
rae
—
Tete
.
2
ie ee te
‘
G
pat
Scanned by CamScanner
Lab Code Lab Name Credit
CSL604 System Security Lab 01
Lab Outcome .
Learner will able to
1. To be able to apply the knowledge of symmetric cryptography to
implement simple
ciphers.
To be able to analyze and implement public key algorithms like RSA
and El Gamal.
To analyze and evaluate performance of hashing algorithms,
To explore the different network reconnaissance tools to gather information about
networks.
5. To explore and use tools like sniffers, port scanners and other related tools for analys
ing
packets in a network.
6. To be able to set up firewalls and intrusion detection systems using open source
technologies and to explore email security.
7. To be able to explore various attacks like buffer - overflow, and web - application
attacks.
Scanned by CamScanner
5 Study the use of netw
ork Feconnaissance
nslookup to gather inform tools like WHOIS, dig,
atio n about networks and doma traceroute, | '
6 in registrars,
|
.
Study of packet
Sniffer tools ; Wi
reshark, : cn |
1. Downlo ad and install wireshar
k and capture icmp, tcp |
Promiscuous mode. , and http packets in|]
2. Explore how the Pa |
ckets can be tr aced based on differen
7 Download and instal t filters
l nmap. Use it with
.
Scanned by CamScanner
Table of Contents
essersses,
anism / Attack Preven
—
tion “Wttnestcaviaasessonrsee
1.4.2 Pervasive Security Me esernessnsst esievenssesics 1-8
+
.°
si
¢
®
Scanned by CamScanner
‘fj ‘
Table of Contents
yt
1.10. . a aussersenennntnates 2.
Le a pea one
v iia : Mono-alphabetic and Poly-alphabetic Substieotipe roe 2 syitab
. al
LU Substitution Cipher Techniques (Dec. 15).....-s-sessesseeere
[.11.1 Caesar Caplaetsssrrernenenennreenerern gaueaeieaat . nit
1.11.2 Monoalphabetic Cipher ...........0scee sanecennesnees
ieee ESET
rnnss v Syllabui
1.11.3 Polyalphabetic Cipher (Dec. 15)...-sosssusensesesceermerne
| 1.11.3(A) Procedure of Polyalphabetic Cipher......ssssssscsssrssersneereren 2.5 Disc
| 1.11.3(B) Difference between Polyalphabetic and Monoalphabetic (Dee. 17).....+:-+:s+s-+-+- 2.6 Fern
3.
3.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp
) 3 Table of Contents
Y Syllabus Topic : Buclid’s Theorem sstts
eessnsasserseseeseas
12 Euclid’s or Euclidean Algorithm ssesn
sssutnsnsisssonissersceneess
sersestanees 2-4
2.2.1 Extended Euclidean AIZOTHOM.
..cescccccss
scsees,
¥ Syllabus Topic : The Chinese on 2-8
Remainder Theorem.............
,
23 Chinese Remainder TOTEM sses 2-11
Vv ssccnsssssersonene
Syllabus Topic : Euler’s Theore
m .....cccse 2-11
2.4 Euler Totient Function PUG) ssusaisais, 2-15
TUONO OCLC OMe auNteseeceneneas
Scanned by CamScanner
Cc pt. &2
: MU-Sem. ——=
ET sys
cypt.s Seouty WEEE 4.3.1¢
esserser erererre tt 4,3.1€
3.3.5 Final Permutation.....scss
seseesns 4.3.1¢
3.3.6 Strength Of DES ......s+ssssesss
3.3.7 Weakness in DES .... 4.3.2
he y, e Chapter Ends..........
Foner pe Syllabus : Ke
Hellman Key «
faa
Syllabus: Public key cryptography: Principles of public key cryptosystems- The RSA algorithm, The knapse . 5.1 Key
algorithm, ElGamal Algorithm.
4.1. Public Key Cryptosystem with ApplicationS.....sscsscsscsssssssssssvessessseseenes Beisel echbstna neasecbuntes fee
4.1.1 Applications for Public- Key Cryptosystem, O00 Snes eevee edenenaeennaeneseaseeeseeeeeenaerseeens
¥ Syllabus Topic: Requirements and Cryptanalysis Se eeee ee eneneeeenenseeseeeeeeneserreneasennes
Scanned by CamScanner
P| crypt. & Sys. Security (MU-Sem. 6-Comp) Table of Contents
Scanned by CamScanner
SANE): “Key Stonsge sc ssciassasnsnivinieinayoemannnonee
|
5.1.4(D) Key Usage wiasccscssassnsasssaspissnssjccesiusezosssanonssseveviso
tnnasannvannenonstsonsessiessstboesesiis “reson Sg
SAA(E) Key Validation ...ussssnnnnnnnnnnnnnunnnennse
S-LAC
orm
F) Key Updation..essssssssustsssssesnssssnnasssvasvensssessessaeesucense
esieseeonstenesiniey 5p
5.1.5 Importance of Koy Mamagermeent sssssssssssnsvssssvstesassssnssvsscvasetseeseresa
neecanonanemssonessiaie
Y — Syllabus Topic : Diffie Hellman
Key Exchange Algorithm 7 saianmnnnvannnnnnennSl
3.2 Diffie Hellman Key Exchange (Dec. 15, May 17) ...uscc
ccssssssseeessn
© Chapter Ends o.oo... cscs.
\
|
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 7 Table of Contents
6.5.5
Difference between Message Digest and Message Authentication Code .......s00- 6-22
Y — Syllabus Topic : CMAC seseseasesssscessessntsncesasenecsessesesssensseessesseresscesssacssasesasssesessessesnsessansarsavaneze
serss 0°23
6.6 CMAC (Cipher Based Message Authentication Code) setsseeatiantnsesssnévstesicssiscacsisiviswcents ODS
6.6.1 The CMAC Tag Generation Process Dpaeeturnp diene conrad nseciaererneneteee 6-24
6.6.2 The Verification PLOCESS.essessosssssssnssetssssstssestnsstassssssusssosescessesssetsseesuseease 6-24
e Chapter Ends
Chapter
7 : Digital
seannrenenrotatecsats
Scanned by CamScanner
a
|i "
...+-+sssssssssssersercensee rsnseersareasnensnnteresees 4 103 i
8.4 Kerberos Authentication Protocol (Miay 16, May 18) ....
Difference between Kerberos Version 4 and Version 5 ..ss esssessssessesseesescnsensesteensens ! .
8.4.1
seec snsnaneeneents s
© Chapter EMds .....cccssscssseesssnsescsnesens 1
ee | ¥ Sylle
|
| Syllabus Digital Signature Schemes - RSA, ElGamal and Schnorr signature schemes. | 10.4 )
| f
Scanned by CamScanner
p) 9 , T able of Contents =
ie Crypt. & Sys. Security (MU-Sem, 6-Com
1
Module 5
a ee
Chap
10 te
: Netwr
ork Security Basics PA te stiiaaatiiaabii
y' labus : Network security basics ; TCP/IP vulnerabilities (Layer wise), Packet Sniffing, ARP fing,
po port
Syl
spoofing,
scanning, IP spoofing, TCP syn flood, DNS Spoofing.
Y , Syllabus Topic : TCP/IP Vulnerabilitics (Layer Wise) sscssessccsssseseccesccsscoscssscossssesseesuenersssarereeeeees 10-1
Scanned by CamScanner
ts
Table of Conten
go
j2.1-1
12.1.
Dental of Serv
ice y syllabes
Chapter 11: 1 Ip S¢
12.2
ial of Servic o
syllabus = Den 6 Ag
of Service. Defense: i
Distributed Denial Classt a
Denial of serv! ice - amine oo
¥ Syllabus Topic: -“eu
s Attacks ves
esseete** Sil May 17, Dec: |)
12
-inacameoivsnnveni
of Att ee += ‘*Faire
11.1.1(4) Classification 17) a 123
Attacks (May ae 12
11.1.10B) Types of DOS 2
Source Addres s
Spoofing ccemansseeneenannnsennseqssmers Tc
%
¥ Syllabus Topic :
fing. renner
11.2 source Address Spoo io
}
cuaeaneneenseeennnee?
nnacacancnonsnsansemmee eee’
aqeramssnssegeeest sda
suceneansennscnans
enaeannnessee®
vananeeasensnansce
nsnensanene® eesn 7
ad
ET :
trnnst ennnnancenrnsine sylla
SYN F008 sevsssee , ll
v
HA
4
yf
=
ecnnstso
2ST
lacsabcpsoensnnnocacnernslnnrn
aes
nnmre
y teeessuan
aneoen
snsonciom
P FG
e ess psttosonontetsennnaeTou eae
: UD
iap
ic
aamamelas
ehne mnsn
ntel
I! _cai sins
emrame
nnen sean et
cas
i Fe
Cha Intet
12: p rity F
Secur
met e tocols
pots. i; ;
i | Syllabus : Intemet Security Protocols : SSL, IPSEC, Secure, Email : PGP, Firewalls, IDS and types, Honey
12.6
Oe
" 12.1 Secure Socket Layer (SSL) (Dec. 15, Dec: 17) sii Se RE 12-1
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 44 Table of Contents
12.1.1(B) Alert Protocol *ersssersenenastonttetoiesernenssouseeyitildinsens
nnaayruesevusioaveni ovovorusuacedeniaarsanscenon DOT
12.1.1(C) Record Protocol
¥ — Syllabus Topic : IPSEC ernsrasensesres
cccoonnrronnesenscstsasssesanrssesiusisesantintdte rsensssemeaseresssanonevenanenarsese DOLL
12.2 IP Security Protocols (May 16)
12.2.1 Authentication Header
12.2.2
Encapsulating Security Pay
load ij AUN RSET Ey sane cat onatt
HE ATMS RESEW os vees oane 12-14
12.2.3. Security Association Databa
se (Dec. 17)
¥ — Syllabus Topic : Firewa
lls
12.3. Firewall Introduction (May
16, Dec. LY sean
casme re incest
12.3.1 Firewall Characteristics......
........ UBiarvennen
12.3.2 Limitations of Firewalls.........
...sece. Weseeessssseaseesscsernsaeasscartiss
sssssesiessesacesseneesce,,,
12.3.3. Firewall Architecture and Types
(Dee, 16, May VY) ccccsscssesssesssccc
slstsnensamneesavanesact 209
12.3.4 Firewall Configurations ........c
usssssssnsssssusssesssecs eveeeeseanesecerssta
12.4 nsseess
Introduction to Intrusion Detection...
..seccssrssscsesesesesececess i
12.4.1 Intrusion Detection .....cccccssecssccssessss
sescececnseseseee oe a sonares
v Syllabus Topic : IDS and TO sce S
iscissieserevccaye:
12.4.2 Intrusion Detection System : Need,
Methods, Types of IDS (May 16).......
........ 12-29
12.4.3 Intrusion Detection Methods/ Techmiqu
es......sccccccssses....
12.4.3(A) Signature Based Detect
ion set eseenenessssensessecssatacnsessevsatesss
asese
12.4.3(B) Anomaly Based Detection .svsesusosereneooo
e..
12.4.3(C) Stateful Protocol Anal
Si .......:ssssceseecesesess
12.4.4 Types of TODS isssssp5:sesibsptdnermnnmeconnessencentoar ines stesernsea
neesnsasasssssesusetersserarscatstasenes
~ 12.4.4(A) Network based IDS (NI
DS) ESCH Eennnnanesh SCIAN ALES StS sts ath Anenn
e macnasenceicecinncsciasnis TOCA
12.4.4(B) Host Based IDS (HIDS) Se ee
¥ — Syllabus Topic : Secure Email - PGP
vsnmnnnenenninnnsinuians
inninnanmen 12-39
12.5 Electronic Mail Security : Pretty Goo
d Privacy (May 16)
12.5.1 Working of Pretty Good Privacy (Dec. BS)
viscid NA isiesiiciteasepserensnnecsrmrveancses 12-41
12.5.2 Backdoors and Key Escrow in PGP a. ee eT
¥ Syllabus Topic :Honey POLS sseeeeeesneenest
nnenssneeneneueeseanseat ntcneneertestntntstinaiessooee 12-47
12.6 HONCYPOts-wesemscrnmennetnntnsnnttie
ntnininnentetet suai tmmnentnisistinseeeee., 12-47
* Chapter Ends Be rmoeereeaenneca ah tirereane ennui en Me nan AAR
Scanned by CamScanner
*
re Vulnerabilities
Syllabus : Softwa a
Log ic Bom b.
Viruses, Worms, eeen ns
ty -seeecenee
13.1 Program Securi
«++. crvcerssrroerern eeee
13.1.1 Secure Programs (Dec. 15) es
Program — te syllabus
13.1.2 Non-malicious sveseseeecer
eereen
: Ma lw ar e - Lo gi c Bomb, Bots security
Y Syllabus Topic
.veserer
13.1.3 Malicious Software we 13-6
Network
esreeree
uses and Worms wessse mono-alf
/ Syllabus Topic : Vir vee LB-T
13.1.4 Virus and Worms (Dec.
15, Dec. 1 cipher, F
Us vsereesssesssseterereere dedi seeeee 13-8 stegano¢
13.L.4(A) Types Of ViT
o..sssseeetreee ee
13.1.4(B) Types of Computer WOT ts
Virus ard Worm evveersercesteerereneer" yee 13-10
13.1.4(C) Difference between
¥ Syllabus Topic : Malware - Trojans, Rootkits...--s-sssce
enererrree* wee 13-10 4.1 Intr
ee
13.1.5 Targeted Malicious Code... vc TAL:
auannnsecessistinssegeeaageneeeeeeeeet
13.1.6 Controls against Program Threats ccsunusenagenanssenqu ... 13-13 In toda
.enssscesersrenseeeeenes
¥ Syllabus Topic : Software Vulnerability - Buffer Overflow on infc
neny ... 13-13
13.2 Buffer Overflow (Dec. 15)...-......csssssessseeseererssescenennnaneesen
13-15 Sensiti
t String.....sssssssssssssseseestennnnenssceetiarenteerents
VY — Syllabus Topic : Software Vulnerability - Forma
Attacks ........ssssssssssssessnsssssesssnessneessnsssnd ees eese
ee eeegegeneens
enscauacaneonscansnnsnng Tee ae .. 13-15 The th
13.3 Format String
svunsverttcseeinsctvonasad ai sesvevanee . 13-18
‘Syllabus Topic : Cross Site Sicripstiza gy esescossesesestscseateredniasnconee is a ne
13.4 Cross Site Scripting (Dec. 16, Det. 17) ...scesscssecsescssosesessessesnseneeteteneentenanquennaventeey ++ 13-18 interne
13.4.1 Stored and Reflected XSS Attacks ........0++ 13-19 The I
13.4.2. Stored XSS Attacks..... prencerecseeseneates LOSE i
When
ISAS wonetee
‘Reflested' MSS: AMaGKS sscsswsssvcaiscincsccreculcsscessnelayerasdtovusniervestiavaanssicssieetenvanetensve LO onad
13.4.4 Other Types of KSS Volnerabilities <...<.:iessessvisessssisersesseast atinescrseitsntasasctunesetueee ... 1341
13.4.5 XSS Attack Consequences enreneangmagneansenemt
Amor
tase sseestias ony narantguedd acenunssal ea stravtioaseadtnes ws 13-20
¥ Syllabus Topic : SQL Injection ...cssssessessssssessssee of all
sesoeeeee LOU
13.5 SQL Injection (Dec. 17) .ecscssccssssssesesssssn severe 13-20
don’
° Chapter EMd .ccccscsessessov and ¢
sree Ore
On |
e Lab Manual write wenicd cuuisantnes wansvisbuesaanay scuraitsbasis aseeeceneeeonssensceaetoases wseeeeeLel to L-66 ‘ trans
Qo0 man
Scanned by CamScanner
Module 1
Introduction to Cryptogra
phy
Syllabus
Security Goals, Services,
Mechanisms and attacks, The OSI security
Network Security model, Class architecture,
ical Encryption techniques, Symmetric ciphe
mono-alphabetic and poly ~alphabetic subst r model,
itution techniques : Vigenere cipher, playfair
cipher, Hill cipher, transp osition techniqu
es : keyed and keyless transposition ciphe
steganography. rs,
1.1 Introduction
Scanned by CamScanner
Introduction to Cryptograp te
-Sem. g-Comp) 1-2
.
t & Sys. Security (M
U
eas _
ey Crypt. & Sys.
ilove syllabus TOPIC scurity Goals __
—~> 2. Integrit
- Principle of
4.2 Security Goal > (MU
- Dec. 15 reaches to ai
- In this case
(el 600.12) 1.2)
Pie
°o Datain
Goals of information
security o System
and free
1. Confidentiality
> 3. Availa
2. Integrity
— Principle of
3. Availability
the time as
4. Data Authentication : available to
software an
Fig. 1.2.1 : Goal of information security
For example
| -> 1. Confidentiality
— Informatio:
, Confidentially is most common aspect of information security. Confidentially
is defined on email a
J as the contents of a message are accessed only by intended person
. Aim of confidentially time as on
is that only sender and his intended receiver shoul
d be able to access the contents of a authorized
message.’ : "i j — Thereiso
For example
attack.
In military application information
from one hi — These thi
authority. During this transmission
objectives
Scanned by CamScanner
Integrity
Introduction 4
lo Crypto
t graphy
a PrincNncip
ip!le
- of integrity st
1 ates that co; ‘
Teaches to authorize person
Ntents of message should not be modified until it
a4
thorized manner.
Assures that the s
ystem performs its
and free from unauthorized intended function Pro
manipulati on. perly
; > 3. Availability
For example
Availability
Scanned by CamScanner
Comp)
er Crypt. & Sys. Security (
tion — X.800 defin
+ a. Date Antiee z applications in networks.
__ Data authentication is important in many iver to angele whether that data really was sent”
| .
_ Data authentication allows the user oF receiver Ut
‘| — by
In the
the actual
two -sender
party or communication
n0t this; mechhanism is achieved through symmetric:
\ _ Receiver knows that the data is send by exact or actual sender, if and only it mes
i | arrives with a correct MAC. — 9
il _ Data origin authentication is a property that a data has not been modified when it will
| + 1. Authent
als :
ie! Sign and verify Vj] ‘
Application data} pot is assuran
Client application f i : Server application . Authenticati
j me ee 5 _. password or
} ; ig. 1.2.3: Data Authentication during trans
messaf
itl ia; (ii) Data ¢
: ie a one can be achieved, (Ref. 9) receive
0.1.3.2" Write short note on security service, (Ref. sec, 1.3 PAs
- X.800 is a Serviceservi provided by a protocol: layer of communicating
“ennesitansd open 4 "a
systems, to ensure ne
the enough security of the system/ organization or of the data transfer ay requested.
_ ‘ service
; as a communication
oy
REC 2828 defines Security service provided by a system to ; Or privile g
i
Bee
Scanned by CamScanner
ey Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-5 Introduction to Cryptography
Seas
——S
1. Authentication
2. Authorization
3. Access Control
4. Non-Repudiation
5. Auditing
6. Data integrity
7. Data 2 Confidntiay |
Authentication
v
—_
.
ETT
It is assurance of parties that they are authentic user in the communication network.
TT
(i) Peer entity authentication: It checks that the entities connected in communication
network are authentic and do not perform any ees like masquerade and replay of
messages in network,
(ii) Data origin authentication ; It checks that the data is authentic without any changes
received by the receiver.
> 2. Authorization } :
Authorization service helps for checking whether the entity has the right to perform action
requested. Authorization means providing authority or permission of accessing the system
or privilege of accessing data, directories, files etc of the system.
Authorization is one of the most important security aspects. It provides identification of
the user as authorized user. It is a kind of permission given by the network administrator
for accessing the network.
Scanned by CamScanner
i n t r o ductotCrioypntogry
6 —— AP crypt.
comp) _ =——
ee Crypt. & Sys. Security (MU-Sem :
4 ‘_ There
i and ne!
a “e helps |
For example ATM pin while withdrawing money bj
Password used for sever login,ing” emploIy! ee identification. oyeeonee
An auth
any empl oo usera
are valid => 6. : D
5 : office for check
machine used in an ATM card user and company To as
helps whether server administrator,
modificati
not.
Access Control J
stems. It prevey (i) Conn
-> 3. ‘7 vonne
tient : sae
ite
s Contr ol is the abilit y to limit and control the access to
Acces
ul ni scented use of a resource. The service used to preve nt unanthoriZ itions access can i CK attemr
can access to resources, under what condition
complete control over who . (ii) Check
(ii)
and what are different accessing methodology. commi
oe
For example
s fin Select
is to be made available only to legitimate
It controls the access of resources which vor d
Secondly it looks to the conditions of accessing the resource or network and what 1s allowed
;
be done to the resources. inserte
yc
=> 4. Non-Repudiation
, (iv) Conne
.
rmat ion and later on nll $e
Principle of non-repudiation states that if sender sends some info
,
denied that he never sends that information called non-repudiation.
(v) Select
(i) Non-repudiation, Origin : Proof that the message was sent by the specified party. singic
(ii) Non-repudiation, Destination : Proof that the message was received by the speci i netwo:
party.
7. D
For example
It is protec
Ramesh sends a request to bank about money transfer into Suresh account but later¢
(i Conn
Ramesh Denying the money transfer request to bank. Principle of non-repudiati‘does
on i
allow such type of refuses of sender. Non-repudiation prevents either sender or receiver fi0% protec
denying a transmitted message. a (ii) Conn
-> 5. Auditing (iii) Selec
- Auditing services helps to trace which user accessed what ? when ? and which way a | i.
Scanned by CamScanner
= TT
- There are different security mechanism are used to provide security services and also
helps to prevent all types of attacks,
(ii) Checks Connection integrity without recovery : It checks the integrity of the data in
communication network and detects various attacks like modification, deletion replay of
messages in network but without any recovery of same.
_ (iii) Selective-Field Connection recovery : It
provides integrity of selected fields within a
| user data or a data block to determine whether any of the selected fields are modified,
inserted, deleted or replayed. . .
7 (iv) Connectionless integrity : It determines and checks the modification of single data block
and for preserving its integrity in connectionless network.
Scanned by CamScanner
4.4 Security Mechanisms
To use mathematical algorithms to transform data into a form that is not, easil
understandable. The transformation and subsequent recovery depen
ds on the algori
and the number of keys used.
2. Digital Signature
4. Data integrity
Way
n
Various mechanisms used to assure the integrity of the data. Content should not moll
before it reaches to intended person.
:
Scanned by CamScanner
eos
def Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-9 Introduction to Cryptography
eee
5, Authentication Exchange
The mechanism used to ensure the identity of the entity by information exchange.
6. Traffic Padding
To insert bits into gaps in the data stream to frustrate traffic analysis attempt.
7. Routing Control .
To allow some selected routes in network for routing or can change the
route if any attack
is detected in the network.
These mechanisms are not specific to any of the OSI security service
or protocol layer.
This technique also called attack detection which is implemented to prevent
, if attacker bypass
_ the installed security measures to access the desired target/information,
Attack detection
| technique notifies such incidents happens and takes the responsibility to report
someone that
i something went wrong somewhere in the system. Such type of
mechanisms used to inform the
administrator or authorized user that something went wrong in the system now its job of
| administrator oro authorized user to take action against Geteciend attack,
1. Event detection
3. Security recovery
In these techniques data is sent Over an insecure channel such as Internet in encrypt
ed
‘ormat and decrypted at receiver side using keys under assumptions that attacker may have
iccess to the transmitted data.
— — — Scanned by CamScanner
—
oo
—
formed on sending data by using Well
cryptographic mechanisms such as : ky a
Security attacks
a
Scanned by CamScanner
ay Crypt. & Sys. Security (MU-Sem, 6-Comp) 1-11 Introduction to Cryptography
Passive Attacks
2. Traffic analysis
For Example
Telephonic conversation between two people, an electronic mail and a file may
contents sensitive information sent/ transfer over insecure channel such as Internet.
We would like to prevent third person from modification of these type
of transmission
as shown in Fig. 1.5.3. _ *
— The main goal is to prevent the cryptanalyst from learning sensitive and confidential
information through transmissions that take place through telephone calls or email
messages or files transferred on network.
Scanned by CamScanner
Introduction to Cryp
—
7 —_
comp) 112 2)" crypt. & Sys
[4 crypt. & Sys. Security (MUSET soe ion
. i )
Traffic analysis
.
> 2.
the message using
encryP q
sird person) is able to captur ¢ the contents of th :
nt en ts of
— Suppose we masmé sk the co
(here it is called
tl
th e message.
||
information from
but not extract the ¢ or any ¢ uj
sages to get the location,
i
me ss
m ag
e e n
o of mes
e a patt cn
The opponent might observ
¢ a
—
sage.
regarding the origin of mes ification off te 1.
=~ 2
Masquerade
t to det ect , bec aus e they do not involve mod
= Passiveve attacks are difficul hs
information. ivey
and neither sender nor rece generally done
- e sent and received is in normal fashion
me
rv ed pattern of messages as show
nk
that a third party has read message or obse
— It is generally «
awarede
wi
d by means of encryption.
Fig. 1.5.4. These attacks can be prevente
to a secure nets
= Once attacker |
of data or netw
:
Capture message from
Bob to Alice; later
raplay message to Alice
|
|
| _
Fig. 1.5.4: Traffic analysis | 4 cf
:
:
The emphasis when dealing with passive attacks is on prevention rather tha
detection. ; Such type of attac
> (b) Active Attacks 2. Replay Attack (F
Active attacks involve modification of a data stream - It isa netwo
or creation of a false stream ol
messages, Attacker aim in such type of attack is to corrup added into v:
t or destroy the data as a
network itself. Active attacks means information is modified or - The newly g
gets altered d
transmission between sender and receiver. as replay atts
Active attacks are divided into four categories as shown in Fig. 1.5.5. — Replay atta:
information
Scanned by CamScanner
(er Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-13
SSS
SSS
Introduction to Cryptography
“Activeattacks.
1. Masquerade
oh wae
Darth | message from Darth
that appears to be
~
Such type of attack involves pretendin g the user from accessing author
ized information.
2. Replay Attack (Rewrite)
It is a network attack in which original data get modified and new malicious code
added into valid data, during transmission, .
The newly generated malicious code retransmitted again and again to receiver called
as replay attack (Reusing information).
,
Replay attack involves passive capturing of data and retransmission of subsequent
information in order to create unauthorized effect as shown in Fig. 1.5.7.
Scanned by CamScanner
to Dtogran,
_— Introduction
1-14 |
(ET crypt. & Sys. Security (MU-Sem. e-Comp (er Crypt. & Sy%
— - The ca
: such ty
K ear lost.
arth ¢| Capture message fro
re | Bee tog ln 4. Denial of S
— Denial
A na hy commu!
eh a
Bob
— It is ger
j making
= — Due to int
Darth modifies Because c
ae
Suresh is
services at
- Once Din
things:
© Flood
| . .
Fig. 1.5.8: Modification of messages : overlo
i sf
For Example *
: i > Pee
if author
- If aan
Bob wants I
to transfer amount of Rs.1000/- into Alice account, ie s
transmission process an attacker called D during thi aa
the actual amount fi Differ
OT of R INS, 1000/. — ; eet te conversatin and
Rs. 100/- into Alice account. mogieg
. 7 rotectec
and sends just e
%
7
af
Scanned by CamScanner
I EEESS<SC_”’”:”C
a
Suresh
Dinesh
Scanned by CamScanner
introduction to Cryptograpy
Comp) 1 “1 6
Sys. Security (MU-Sem. 6-C
et Crypt_&
een Active At| t
1.5.1 Difference betw
Active Attack ae a
Sr.
a
co
No.
er me re ly ne ed s to observe the
: contro 1 of Attack i]
have physical e media or
1. | Attacker needs to commu! nication in th
the media or network.
network.
ed.
It cannot be easily detect
2, | Itcan be easily detected.
It does not affect the system.
3. | It affects the system.
5. | Types of active attack are : Masquerade, Types of passive attack are : Release of |
replay, denial of service, distributed denial
of service. 5
message, traffic analysis.
17 Op
Conside
6. | It does not check for loopholes or It scans the ports and network in search
_ another acrc
vulnerabilities, for loopholes and vulnerabilities.
_ aspects of th
7. | Itis difficult to prevent network from Passive attack can be prevented. | The tec
active attack.
— The ori
___ Syllabus Topic: The OSI Security Architecture that it i
_- Anadd
1.6 The OSI Security Architecture
the mes
i= The m™m
ITU- T International Telecommunication Union
Telecommunication Standardizatior messag
Sector X.800 (It is a service
Provided by a protocol layer key to:
of communi
—. Atrust
— The tru
the sen
defining and providing security r - The me
‘equirements.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 4-17
— = SSS SSS Introduction to Cryptography
es
- The OSI security architecture focuses main
ly on the following three concepts :
o Security Attack : An action that may compromise
the security of the information that
is owned by an organization is
called security att ack,
o Security Techniques/ Mechan
ism : Security mechanism is the process that desi gned
how to detect, prevent or rec
over fr om a security attack,
o Categories of Security Service : A processing or
communicating service that
enhances security of data processing and
information transfers of an organization.
The services are intended to counter
security attacks, The security service
can use of
One or More security mechanisms to prov
ide security. All these features of OSI
security architecture has been discusse
d in detail in the following section.
Scanned by CamScanner
Introduction to Crypte
-18
(BF crypt. & Sys. Security (MU-Sem. 6-Comp)
Security (MUSE (ay Crypt. & Sy:
R
Basically ¢
text into pl:
3. Encryptio!
Recipient
Message
The proces
Sende “Secure [4 encryption.
Message | message |S;
Let, P be th
Key we getC as
Scanned by CamScanner
ee Crypt. & Sys. Securi
ty (MU-Sem, 6-Comp
) 1-19
Introduction to Crypto
graphy
Basically a are two process Tequired to convert
text into plaintext, called plaintext into cipher
encrypt ion and text and cipher
3.
decryption,
Encryption
The process of conver
tin & the plain text Messag
encryption.. e to cipher text messag
e is known as
Let, P be the plai
ntext, E js encryp
we get C as show tion ;
n in Fig. 1.8.1.
4. Decryption
Scanned by CamScanner
Introduction to Cryptog
ee Crypt. & Sys. Security (Mu-Sem. 6 -Com 1-20
s
ss ib le ke ys , algorithm er Crypt. & Sys. Se
use all po
0
lyst attempt to
An attacker also called as el n original plaintext message. - 1. Known Pl:
; techniques to break ciphertext and 0
— In this type
7. Cryptology,
n as cryptology. om
sis together is know
The area of cryptography and cryptanaly — He will finc
8 Key . . ecryption algorithm which
type of atta
{ii It 18is the secret information or number used in encryption and decryp will discuss
;
is known only to’the sender and receiver. -> 2. Ciphertext
3.
8s hosen Paton attack
f
; designed cry
= =— ‘ee
4, Chetan her text t attack and keys use
— mel ec
A = Cryptanalys:
5. Side Channel Attack ra
|
perform par
Fig. 1.8.3: Cryptographic channel atta
Attack Methods
Scanned by CamScanner
[&Z crypt. a sys. Security (MU-Sem, S-Comp) _ 1-21
tee
Introd
ee an
uction to Cryptography
ae a
= 1, Known Plaintext attack
In this type of attack cryptanalyst always try to find out. which technology
used to
designed cryptographic algorithms and which are the different software or
hardware
and keys used during encryption and decryption process.
Cryptanalyst may find the additional: information like CPU usage, time
taken to
perform particular task, voltage used and so on. Such type of attack 'is called side
channel attack.
Scanned by CamScanner
(MU-Sem. 6-
& Sys. Security
:: . Tt focuses OD
ability
Threats and Vulner
as f
harm 'YSstem
@ ma y result in
that i
E n incident — Privacy prog
potenti al
i Ci‘ause of
tas i a
O th:
such as log i
of assets
or a group
. akness 0. a in set ( soure )
(4) Principles of Sec
— Vulnerability , 1s v
|
exploited by one or more threats. destruction of an asset as a result of a thtey — The three
es
— Risk is potential for loss, damage, OF integrity of it
exploiting a vulnerability. — Privacy defi
- Exam ple: Ina system that allows weak passwords, aye awe information.
o Vulnerability : Password is vulnerable for Hen OSE or.exhaustlv , f security depe
{ :
o Threat: An intruder can exploit the password weakness to break into the system
da
© Risk : The resources within the system are prone for illegal access/ modify/
by the intruder.
1.9 Encryption
— Threat agent-entities that would knowingly seek to manifest a threat.
Scanned by CamScanner
“2
: :
7 | [FP cryp& t.
Sys. Security (MU-Sem, 6-Comp) 4-23
System
i ‘ Introduction
OUCHON 10 to Cryptography
Cryptography
J - It focuses on the data and information
il rather than personal information of individuals.
| .
— Privacy program, on the
an ty other hand, fo uses on protecting only
such as Jog in credentia personal information
ls,Passwords, etc,
: _ (4) Principles of Securi
4 ; ty and Privacy
- me titer core Principles
of security inchide Protecting confident
integrity of information iality, preserving
assets, and promoting avai
i lability of data and inf
— ae
Privacy defines the i ormation,
) rights of indindi
ivividual and organizat
i ation. To some extent, ions with respect to person
izati
em privacy can be achieved al.
security depends on Privac with security initiatives
y of credentials and acc and
ess to data.
damage
|
and asymmetric key cry -€. symmetric key ¢
ptography as shown in
Fig. 1.9.1,
other, * ee
TyPes of cryptography
Teas
Scanned by CamScanner
4-24 troducti 10 Crypt
Introduction
ET crypt. Sys. Security (MU-Sem. 6-Comp)
[PF crypt. &
Mathematically it is represented as P = D (K, E(P)).
D (kK, E(P)) = Decryption ofp @ Disadva
Where P = Plain Text, E (P) = Encryption of plain text,
. — Once the
text using shared key K.
i i A A¢ dv4u, tod
o oem
— For Example : Stream and block cipher, Data Encryption Standard (DES),
; Encryption Standard (AES) and BLOFISH. 4 — Insymm
~— 1 seco
Secret key
oe ue ee ‘ 9.2 Asyn
|
jt Transmitted Asymmet
ciphertext ;
i}
_ In asymn
iN decryptior
Plaintext , '
Plaintext
As
* mentic
Encryption ‘algorithm Decryption algorithm
(e.g. DES) . (Reverse of encryption algorithm) may |}
i | : , ‘ Other is px
| _ Fig. 1.9.2 : Symmetric Cipher Model
7
_ Messages,
— Here th a . ‘
caiman Ee ede is that if an attacker/opponent got cipher text 7? He/she may af It is also c
ermu * r
‘aa ee
the main exieodof ol decrypt and obtain the original plain text, F _ only its cc
i iI ttre chai 18 came into picture. Always sender has to think on appl | Message.
ng technique ; on plain text messa etl
1essage and convert it into ci The
I) so that attacker cannot read the actual plain text easily,
Sec
| - Symmetric ciphpher model convert the plaj “tee
rig
;
Sl
_—
nce
‘
. techniques.
following Plain ain (ext message : :
into cipher text by’ u
dec:
*yption
oe cryptosyst.
Advantage
ges of Symmetric key cryptogr:aphy Sender
(Ramesh)
oe Ort sender
he cannot decrypt it withou encryption and
decryp
permission aetio i
ates tne pe foe
Plaintext
Scanned by CamScanner
(ay Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-25 Introduction to Cryptography
ee tte POOR
- Once the key is stolen while transmitting data between sender and receiver it is very easy
to decrypt the message as same key is used for encryption and decryption.
In symmetric key cryptography, key is transmitted first and then message is transfer to the
receiver. If attacker intercepts the communication between
sender and receiver then he can
decrypt the message before it reaches to intended
recipients.
a
9.2 Asymmetric Key Cryptography
Asymmetric key cryptography is also called as public key crypt
ography.
_ In asymmetric key cryptography two keys are used, one for encryption and other for
decryption.
As mentioned asymmetric key cryptography involves use of two
keys one is public key
that may know to everyone and can be used to encrypt messages, and verify
signatures.
Other is private key known only to the receiver of the message
or verifier, used to decrypt
_ Messages, and sign (create) signatures.
It is also called as asymmetric key cryptography because one
key is used for encryption
only its corresponding key must be used for decryption. No other
key can decrypt the
message,
_. The sender and receiver can encrypt messages using encryp
tion key (public) or verify
signatures, he cannot decrypt messages or create signatures because he-
required
decryption key (private) which is known only to the receiver of the messag
e. Public key
cryptosystem /asymmetric key cryptography as shown in Fig. 1.9.3.
Sender
Receiver
(Ramesh)
(Suresh) |
Scanned by CamScanner
F
Introduction to Crypto,
ee f
|| Ramesh Private Key (A) | Yes A must know Not known (o B RES HnISS
Ramesh Public Key (A) | Yes A must know Yes it is known to Suresh also” In Asymm
;
Ppboth h ave
| Suresh private key (B) | Not known to Ramesh (A) | Yes Suresh (B) must know - over i
;
Fy Suresh public key (B) Yes known to Ramesh (A) | Yes Suresh (B) also known it ' ; The nian
, i
a Following -are the possible cases of public key cryptography as per the table mentiol for used e1
| | pi i! above. ‘ j ? cannot dec
4. ‘ i
It 1Sis Important to Private
note that messais not aware
Ramesh
key the . about Suresh private key. _ - of ten, y |
ge only decrypted usin dt
nothing . else. ae i Sane pve = Asymmetr
/ Case 2 cryptograp
If Suresh wants to send the message to Ramesh, then reverse the above case 1. S
encrypt the message only with Ramesh public key. The
reason only Ramesh can‘ 1
the message to obtain its original plain text format using
his private key
Scanned by CamScanner
SE SS'SE EEE
: [&7 crypt. & sys, Security (MU-Sem. 6-Comp) 4-27 Introduction to Cryptography
—- Public key cryptography achieves authentication
(authentication helps to identify the
claimed identity of an entity, such
as user name password or any other important
— In Asymmetric key cryptography, key cannot be distribute among sender and rece
iver as
both have their own key, so there is no problem of key distribution while tran
smitting the
data over insecure channel.
Because of different key used between sender and receiver require more time to get
the
transmission done as compare to symmetric key cryptography. (Slower that symmetric:
key cryptography very few asymmetric encryption methods achieve the fast transmission
of data). ; -
Asymmetric key cryptography utilizes. more resource as compare to symmetric key
cryptography.
Scanned by CamScanner
introduction to Cryptogra,
4-28
-Comp)
(MU-Som, 9 aphy
{4F
= crypt. & Sys. Security
ASY mmetric Key Cryptogr sicall¥ :
cry
Sy™ met
ric and
1.9.3 Difference between Asymmetric Key Cryptography real iphet
igorith :
symmetric Key Cryptography ei
hy two piock cipher
key cryptogr ap
| In asymmetric cryption and pow! in Fig.”
single or one is for en
In Symmetric key cryptography keys are used,
ryption and ption.
same key is used for enc other is for decry!
also
cryptography is
decryption.
is also called Asymmetric key or
Symmetric key cryptography key cryptography
private key called as public em.
as secret key cryptography or
conv!entional
cryptographic syst
cryptography.
represented as
Mathematically it
3. | Mathematically it is represented as
p= D(Kd, E (KeP)),
P=D (K, E(P)). encryption and 4.10.1 Stream cl
“Where Ke and Kd are
Where K is encryption and decryption
decryption key. In stream ciph
key.
pit at a time, |
P = plain text, D= Decryption
accepting only
D = Decryption E(Ke, P) = Encryption of plain text
using private key Ke. — One time pad
E(P) = Encryption of plain text XOR with ea
4. | Symmetric key is faster than asymmetric Because of two different key used on varying til
key cryptography. asymmetric key is slower than
asymmetric key cryptography.
Scanned by CamScanner
1-29 Introduction to Cryptography
_ & SS
10 Block ciph
0 raphic algo rithm is used for transformation of plaintext into cipheatext.
; ally oP tog :
and Block cipher are main method of encrypting text using key and
1, Stream Cipher [|
2. Block Cipher
>P
a
bits
with a stream of plaintext bits, pj, Pz, Pyy---1 Pj» to produce the stream 0 f ciphertext
‘ 4
1+ C2,€3, ..... Cj. Broadly it can represented as shown below
c i: . i
* (1.10.1)
c = peek.
Scanned by CamScanner
RET’ crypt.
& Sys. Security (MU-Sem. 6-Comp) 1-90 Introduction to
— =
Cryptog,,
4'
. g
~ During decryption, the cipher text bits key stream to recoye; |
are XOR with a same key
plaintext bits. the |
Pp, = c ®k,
a
“(0am :
~ The stream cipher security depends on
the simple XOR and one time pad. a
stream output is random ; If the a |
that, it will take harder timefor a cryptanalyst to break te
However if it will keep on repeating same stream
bits then it can result an attack on the
cryptosystem,
i
— For example : Suppose we have plaintext
as pay 100 in ASCII (i.e. text format). Whe
is converted to binary valu
es let us take that it is translating as 010111001
n it
spene
also applying XOR logic in encryption algorithm. We can
see effect as,
In text format In binary format
|
Scanned by CamScanner
(ey Crypt. & Sys. Security (MU-Sem. 6-Co
——— mp) 1-31 Introduction to eye
1.10.2 Block Cipher
: Ciphertext
—_———_ § block of 64 - bit
mn ACH
Fig. 1.10.3 : Block cipher
Block cipheris main method of enc
rypting text in which keys and alg
orithm are applied to
block of data rather that individua
l bits like stream cipher. Data
Encryption Standard
(DES) is the best example of
block cipher in which each blo
ck of 64- bit get encrypted
using 56-bit key and cipher text of
64-bit get generated,
At receiver side decrypt message with
same key to generate plaintext.
Like in stream cipher, block ciph
er also uses the conc. ept of key gene
rator. Block cipher
are used in Chaining mode, this is because for
repeating text pattern, the same cipher
block will be generated which can give clue
to cryptanalyst regarding what is the o
riginal
plaintext hence chaining mode is used
for block ciphers. We will discuss c oncept of
chaining mode in block cipher modes
of operation.
As in chaining method, previous block is mixe
d with current block to avoid repeats in
patterns. Block cipher is little time consuming but
secure than stream cipher so generally
used in computer based cryptographic algorithms. Strea
m cipher is faster than block
cipher.
a EP a Fe re
Scanned by CamScanner
Introduction to Cryptog apy
main method of
1. In stream i
cipher keys ip xi is in which keys ai i
and Bloc k cipher
Igorithms are applied to each. encrypting are applied to block
algo
binary digit in a data stream, one bit algorithm bite Tike ofstreall
data} a Da
that individual bi i‘ >
at a time, rather than encrypting | rather
cipher. | . s
block of data.
is less _ time | Block cipher is more time consuming. | a” Bs2
ifTah *
2. Stream *
cipher .
consuming. i.
i | 4, Stream Cipher doesn’t used in| Block is used in chaining modes of|
| Su
| chaining modes of operation. operation. : i cip
P|
| fli 6. One Time Pad is the best example | Data Encryption Of
Standard (DES) is the | th:
PU of stream cipher. , ‘| best example of block cipher. :
hi) 1.10.4 Confusion and Diffusion
Claude Shannon introduced two properties of opera
tion of secure cipher.
Properties of operation
of secure cipher
Scanned by CamScanner
er Crypt. & Sys. Security (MU-Sem. 6-Comp)
eGQsseee 1-33 Introduction to Cryptography
=> 1. Diffusion
|
ee
Scanned by CamScanner
m. 6-Comp)
& Sys. Security (MU-Se
Confusion
Substitution Techniques
Syllabus Topic : Mono-alphabetic and Poly-alphabetic
1. Caesar Cipher
2. Monoalphabetic Cipher
3. Polyalphabetic Cipher _|
4. Playfair Cipher |
6. Hill Cipher
Scanned by CamScanner
eee ——— . EEE ee
- Julius Caesar introduced the easiest and the simplest use of substitution cipher.
— In Caesar cipher technique each letter is replaced by the letter /alphabet which is three
places next to that letter which is to be substituted. Or In Caesar cipher technique, each
alphabet of a plaintext is replaced with another alphabet but three places down the line as
mentioned in table below.
For example
- Ciphertext : V<QULVHVLQWKHHDVW
Following is the list of possible combination showing the letters 3 places down of each
alphabet:
|D
GHIJ KLMNOP
EFrtext
Ciphe QRSTUVWXYZABC
The corresponding number equivalent to each alphabet is given below : |
10 11 12
0123456789 13 14 15 16 17 18 19 20 21 22 23 24 25
C = E(3,P)=(P
+ 3)mod 26
P = D(3,C) =(C-3)mod 26°
Where C = Ciphertext/ or alphabet
P = Plaintext/ alphabet
E = Encryption
D = Decryption
Mod 26 because in English there are total 26 alphabets.
Scanned by CamScanner
Introduction to =YPIOCryptoq,.
BF copt. &S Security (MU-Sem. 6-Comp) 1-36
(e ys. LY
j
if -
1.11.2 Monoalphabetic Cipher cee (
hi — In Caesar cipher the attacker can easily guess the plaintext as it is easily recognizable.
As in m
j Be iHie Monoalphabetic cipher substitutes one letter of the alphabet with any ; monoalphabet
random letter from
' f the alphabet. . ‘ polyalphabeti
| iy j — Itis not necessary that if A is substituted with B then compulsorily B has to be substitu ec
stematically
with C. It can be replaced with any other letter of the alphabet. The only wea
kness in this
;
algorithm : 1.11.3(A) F
is that if more repetition occurs then attacker can easily guess the plaintext.
© .
— This random substitution is just done to have uniqueness.
nica =
— In this the substitution of characters are random permutation
W: .
7
times as |
RES Would
reacge
-_—
il - Following is the substitution that we are taking : “= below.
eas
Scanned by CamScanner
|
EP
SS
crypt. & Sys. Security (MU-Sem. 6-Comp) 4.97 Introduction to Cryptography
tail eneneneeereerseeesisinnssinmmmeneninenmenimecrameminasaieanl
aaa
Plaintext : East or West
Ciphertext ; aesy xk taay
- Ciphertext obtain with this technique yields
completely different text as compare to
Caesar cipher. In this method, each letter provides
multiple substitutes for a single letter.
For example,
3. For each plain text letter, look at the letter of the keyword above it (if
it was 'M', then you
would go to the row that starts with an 'M'), and find that row in the
Vigenere table given
below.
ea aT et a
Scanned by CamScanner
4-38 Introduction to Crypt,
——<aSs50 EE
[ET crypt. & Sys. Security (MU-Sem. o.com)
—
!
D |e IF 4. Ir
R d
4. Then find the column of your plaintext letter (for example, 'w', so the twenty-th V
column), .
5 F
r 5, Finally, trace down that column until you reach the row you found
before and write dp c
Ah the letter in the cell where they intersect (in this
case, you find an T’ there). Repeat
same till you will convert all plain text messages into ciphe F
rtext.
cat hey Example1
MECMECMECMECMECGMECMECM
weneedmoresuppliesfast
| Ciphertext IIPQIFYSTQWWBTNUIUREUF
Thus, the plain text message “We need more supplies fast!”
comes out :
IIPQIFYSTQWWBTNUIUREURF
Scanned by CamScanner
graphy
ie EB cops & Sys. Security (MU-Sem. 6-Comp) _ 1-39 Introduction to Crypto —
a a
More than one alphabet is used for One fixed single alphabet is used for
substitution. substitution.
Scanned by CamScanner
LEP cryp
& Sys. t.
Security (MU-g em. 6-Comp) 1-40 Introduction to Crypt
— Inthe first step all letter
s are t © be filled
| are already been placed jg in that matrix from left to right, the letters y
not be placed again in that matrix. ror Example :
— After filling up
of the Siv For pair ke
en letter, fill rest of the spa
ith no Tepetitions. ce in the matrix with
the Temaining The pair c
The letters I and
J will be Consider row letter t
Place J in rest of ed as one letter. So If I is 7
the matrix, already placed then no Need ty ;
Scanned by CamScanner
Ee
X|M|P/L/|B
c|D|G/H|K
N/O/Q/S/T
Z
U/VIWly|
|
t as HU.
so CY will encryp
re pl ac e it wi th im mediate next 1n that
so
are in same column
Checking for BE both
* column. ©
F/A;|I]R
X/M|P{L
c|D|G/H/|K
nlolels
U vIw]y |Z
.
ne en cr yp te d as K B (Below to Eis B)
BE will
Check foir nR(gX)
FIA] IRIE
x|M|P{|L/B
c!ilD|G/H|«#
n/o}]Q{s/T
u;| Vi wy Z|
same Tow
for ms a rec tan gle , rep lac e it wit h FL. If pair forms a rectangle, pick
The pair RX
letter but opposite corners.
R(X) will be encrypted as FL.
Scanned by CamScanner
’
11 USS |
crypt : “The key is hidden under the door’
EnSoln. using Playfair’¢
7.
Pi Keyword - domestic
- Keyword is domestic, z
yl — In the first step all letters are to be filled in 5 x 5 matrix from left to right, the letters which
are already been placed is not be placed again in that matrix.
i - After filling up of the given letter, fill rest of the space in the matrix with the remaining
li letters alphabetically with no repetitions.
i -
I r — The letters I and J will be considered as one letter. So If I is already placed then no needtp
fei place J in rest of the matrix,
I d/o |m/ejs
t}i |e ja}b}-
, f}g jh {k/1
| nip /qhrju
i ‘Iviw|x y|z
‘ — By using Playfair Cipher (Use following steps to encrypt given word or message) we
want to encrypt the plain text message “The key is hidden under the door” using keyword
domestic. .
1. The plaintext received is to be broken in pair of two letters, if duplicate letter put x |
; 2. Th, ek, ey, is, hi, dx, de, nu, nd, er, th, ed, ox, or 7 Playte
a
. - .
3. - If both letters are same or only one letter is left then put X with that alphabet. ~ “moonm
the letter with the immediate rig Soin, .
4, If both pair alphabet appears in same row replace Z E os ie was
letter in the original pairW Is Blnys
alphabet (wrapping around to the left side of-the row if a
ane 7 Play
on the right side of the row).
j oe immediate below ies e ;
in same column replace it with alphabet imm ise
mn if a letter in the original pa "
the top sid e of the co lu
letter (wrapping around to the
e
column). :
on the bottom side of the
Scanned by CamScanner
he same ro open Paid shove meet, then replace them with the letters on
the original pair. } © other pair of corners of the rectangle defined by
Refer above matrix for the same,
th > Step 6 > cf
ek — Step 5 > ar
ey > Step 5 ae
dx — Step 6 > mv
de > Step 4 os
a ever
nu —Step
4— pn -
ecru:
nd —Step
5 > vt
er > Step
5 > ay .
eee
th > Step
6 > cf
ed > Step
4 so
ox — Step
6 > mw
age) we
f or > Step 6 > ep
Scanned by CamScanner
For Playfair,
the Order igs
looking digr Unchan
aph. It isasy » We just substitute comm
on diagraphs
bstitution= cipher,
(j i
Mio
a
i-
fnli|s
} atb leldle
fig lalkly
ih) ,
heat
Pigiritju
‘i
‘Vv Wixlylz
The
The Message is “greet
” divide the latter's into
Message greet : set of two characters. Me
Fr ex et
Ciphertext is ; hq,
cz, du
Ex. 1.11.3
Cip!
Ex. 1.11.
Construct a pla yfair
matrix with the key “occur
“tall tress”, rence”, Generate the cipher Using pla
text for plain text
Soln. :
Soin. :
Draw
Draw matrix 5 x 5
a
eh
>
5
wr}
g h | if
m
p t
w
2
Viw/x |y)}z
The message is “Tall trees” divide the latter’s into the set of two character.
Massage Tall trees : Ta Ix It re es
Ciphertext is : pf, i/jz, tz, eo, rt
Scanned by CamScanner
E Ee Crypt. & Sys, Sec
urit ¥ (MU-leSo
m, 5-Camp)
1-45
Ex. 1.11.4 Introduction
to Cryptography
Ja zx, zx
Ciphertext : sb, uz, uz
a Ex. 1.11.5
plain text Using playtair cipher encrypt
son. the plaj
Pi the plaintext ‘ ‘Why, ' .
don't YOu?". Use the
key “keyword”.
Draw matrix 5 x §
Scanned by CamScanner
GPF crypt.
& Sys. Security (MU-Sem, 6-Comp) 1-46 Introduction to Cryp
era , go
Ex. 1.11.6
Use Play fair cipher to encrypt the following message “This is a columnar transposition» he a
key APPLE, |, ~ an:
Soln. : :
2
The key used is APPLE SO put it into 5 f
x 5 matrix,
Draw matrix 5 x 5 2 '
.
-
A/P |L/E/B
5.
“For!
C/D/IF/G/H
W|/K|MI|NIo
QiRIis!/tiu
IV} wlxlylz
The plain text message is “This
is a columnar transposition” divide
of two character, the latter’s in to the set
Scanned by CamScanner
er Crypt. & Sys. Security (MU-Sem. 6-Comp) 1-47 introduction to Cryptography
aes SSS
Plaintext OlWlAlRigilylolul ~
14} 22/0 |17|4 | 24] 14] 20
Key 3 c |b
13 |2. 4-1
For example — .
— The best example of one time pad is recharge voucher of:any mobile company.
- Allrecharge voucher having different key or code imprinted on it. Once that code entered
into mobile, customer will get talk time according to the voucher cost. If another customer
trying to use same code of voucher he/she get recharge failure message. The company is
regenerating all keys or code in such a way that every recharge voucher having new and ©
unique code on it called one-time pad.
- Another example of one time pad is license software or license copy of operating system
and antivirus having few keys available according to license. Iflicense key is of 50 users ?
Only 50 users can activate their software after 50 users the new user has to buy the new
software along with new key. Once the key has been used nobody can use same key for
activation.
Scanned by CamScanner
ef Cyt. & Sys. Security (M
U-Sem,6-Comp) 1-48 einai ae !tOduction toc TYDto,
Vernam Cipher
has two di
Sadvantages : Ss
1. Large random key Cannot rypt_ &
: be created, gon
oe
2. Key distribution and 8eneration where,
of keys can be problematic,
Pp i WaIDY oF “ryPlography f c, and P;
.
enrae”
tio
if
(1) In this
- This techniques uses column vectors
‘
and matrices : i
C, Ky Ky Ky ][ Pa ] ?
nform
=
C. = | K, es oo sy mod 26 se sing
C, i3 Ky, Ky K,; oe:
3 Disady
- This technique can be different way like, When
d i | :
C, = KP; mod 26
Scanned by CamScanner
(MU-Sem. 6-Comp “Ag Introduction to Cryptography
T crypt. 8 Sys. Security
Where,
C, and P, are the column vector which is hold length 3. K is used to representing the
encryption key. Which is used 3 x 3 matrix for Example :
254
Key (k) = | 9 12
3 717
- Using the vector we can represent the Key and first three letters of the plaintext HEL as
follow.
C, = KP; m od 26
"
[2 54 |: ‘|
= |9 12 mod 26
3 717JL11
18
= | 89 |no 26
| 236-
rg .
= 11 =ALC
2
.
- For the given plaintext HEL, we get ciphertext is ALC.
inverse of the
_ When we get the entire ciphertext it requires to do decryption using the
matrix K.
Scanned by CamScanner
[eP Crypt. & Sys. Security (MU-Sem,
6-Comp) 1-50 een oc
goescr
i Si,
Ex. 1.11.7
‘
|
Encrypt the message “Exam" using the Hill 9 4
cipher with the key ¢ aI . ee
at
using |
Soln. :
9 4 som
key (k) = | °
57
Plaintext (Pi) = “Exam”
°
94 4 23
g
Ci = KPimod26| . |x “a
5 7
mod 26
0 12
151 167
= mod 26
60 84
[ 21 | }
8 6
= VLIG
For the given plaintext, we
get ciphertext is VLIG.
Ex. 1.11.8
.
Use Hill cipher to encrypt 2465
the text DEF, The key tobe
usedis} 9 2 14
387
Soln.:
,
=
47 21
‘
a
40 |mod26=| 14 = voy
76 24
For the given plaintext, we get cip
hertext is yoy,
Scanned by CamScanner
= i . togra phy
[FP aonypt. a Sys. Security (MU-Sem. 6-Comp) _1-51 to CVE
Introdu ction
Fi> ——__
ex, 1.11.9
BZ”.
Using hill cipher encrypt plain text “COE” use key “ANOTHER
Soln. =
Plain text (Pi) = COE
It is represented as
Ci KPi'mod 26
AN O c
T H E |x] O | mod 26
Il
RBZ E
0. 13 14 2
22 tod26
“48° °
ef = EWS
For the given plaintext, we get ciphertext is EWS.
i rr
é __ Syllabus Topic : Transposition Techniques
i.
Scanned by CamScanner
Crypt. & Sys. Security (MU-Se
m, 6-Comp) 1-52 Introduction to ¢
@. 1.12.3 What is keyless Transposi
tion Cipher? Give any example of
_ (Ref, sec. 1,12) rail fence ch
Q. 1.12, 4 Whatis transp
osition technique? (Re 3) Read the text
f, sec. 1.12)
In transposition ci
plain text letters wi
phe T technique plaintext mess
thout altering the
age is hidden by rearrangi
ng the Order ot
(4 ) Combine all
In transposition ci
original letter, (5) The resullan
Pher,the letters are written in 4 row und ;
_@
column as Per er the key and then arr Example 1
alphabetical ord
— There are two types
er. ange the ie
of transposition cipher Selec
s: single columnar and
transposition cipher double columnar —_
s, _
In transposition technique
, there is no replacement
their positions are of alphabets or numbers
change d or reordering Occurs insteag
’ ciphertext. of Position of plaintext is don
e to Produce
~ Transposition cipher
is a kind of mappin
Pe€rmutation on the pl g achieved by perf
aintext message. Tran orming some sort
performs sp osition cipher also ca of 2:
permutations on pla
intext.
ll ed diffusion which Sele
pene
| || > . Diffusion means permutation of bit or byte |
Step3: Reac
Positions,
Step4: _oiey:
~ There are two types of transposition
techniques
Types of transposition Step5: Fina
techniques Ciphertext : oie
The ciphertext «
1. Columnar transposi
tion techniques
| rounds of su
2. Keyless transposition :
techniques A more comple
| and then rez
’ Fig. 1.12.1 : Types of tra
nsposition techniques
} he
iy : 5 The onder g
Syllabus Topie : Key
ed Transposition
Cipher ,
j ewes
1.12.1 Columnar Transp r
osition Technique Plaintext : |
Scanned by CamScanner
Introduction to Cryptography
f (3) Read the text present in each selected random key columns.
| (4) Combine all text present in each column as per selected random key order.
6) The resultant text called ciphertext
shown in Fi 8. 1.12.2.
@ Example 1
Select any Plaintext: are you missing somebody,
| Step 1:
1 2 3°45 6 +—Column size
ofu
Write plaintext - Ali fs[sfifn
row - by - row
eee
Step 4: oieysmrisdesoyamgounb
Step 5: Final ciphertext is
Ciphertext : oieysmrisdesoyamgounb
The ciphertext obtained in step 5 can be made more + comnplicnted by performing multiple
rounds of such permutations. ;
A more complex way to encrypt the message would be to write it ina rectangle,
row by row,
and then read off the message column by column, but to decide the order of the columns
.
The order of the column will be the key of the algorithm.
'> Example 2—
1/2/3/4/516]7
tihlelblolo
TR
;a
Scanned by CamScanner
KEP cpt. & sys. Security (MU-Sem.6-Comp)
_1-54 __ Introductio
pce
Select the order of columns (Key) : 4351267 ee crypt & SY
ge
Ciphertext : beoyertryolhtiethsdooaikts 1. preparing
1.12.2 Keyless Transposition Techniques, in this key
. he
~ ° Keyless transposition technique also called Rail anot
fence technique.
14573 4
~ Algorithm for keyless transposition technique
is given below :
tt That is, th
(1) Write plaintext Message into Zigzag order.
f numbered
(2) Read plaintext Message of step 1 in order of row by
row as shown in Fig. 1.12.3, letter has
® For example . _ write. Fot
— Plaintextintext message
mesag isis -: be care full while chatting. tf
; hand side
row 1—+ *\ a 6 u | h I c a t nN
rivet / ,
\/ \/ \J\/ \/\/ \/ \/ \/ .
heave!
42163 3
Fig. 1.12.3 : Zigzag order of plaintext
2. Preparir
— . plaintext
; a
Write obtained in row 1 and row 2. The resultantBo ciphertext mbere
* i
is ™ vay 3
Ciphertext :eaeulhlcatnberflwiehtig. the ey.
5 . 5
~— This technique doesn’t want any key. heave
Rows are also fixed (2) so that attacker
may get clu
to break the ciphertext obtained
using rail fence technique.
42189
Ex. 1.12.1
WEAT
Use Transposition Cipher to encrypt
the plain text “WE ARE THE BEST”
use key “HEAVEN". . ;
Solin. : HEBE
;
3. Encryp
Single Columnar Transposition
of the k
Single columnar transposition cipher is the
simple cipher. Read the key, and numbered
‘each letter of the key as per their appearance in the Hee hs
alphabet. The total encryption process is 1234.
divided into three parts :
AEE.
| 1, Preparing the Key
BES}
} 2. Preparing
Preparing the
the Plaintext
Plaintex
Then tt
3. Encryption
Le.
| : ABEE
Scanned by CamScanner
F
Security .6-Comp)
FT crypt. & Sys.(MU-Sem __1-55 Introduction to Cryptography
E
| 4, Preparing the Key : Suppose the key is another. We can assign the number to each Jeter
;
in this key as shown below
another
1457326
That is, the first letter a is numbered 1. There are no B's or C's, so the next letter to be
numbered is the e. So ¢ is numbered 2, followed by h, and so on, In the key. if the same
letter has occurred more than one time, it should be numbered 1, 2, 3, etc. from left to
write. For example, the key is heaven. Here e is occurred two times. So first ‘e’ from left
hand side is numbered as 2, whereas second ¢ is numbered as 3.
heaven
421635
2. Preparing the Plaintext : The letters from the message is written in rows under the
numbered letters of the key. One letter from message is to be written under each letter of
the key. Let us say that the message is - we are the best. We can write it as shown below :
heaven
421635 ©
WEARET
HEBEST
3. Encryption : Now, arrange the above message written in rows under the numbered letters
of the key as per ascending order of the numbers at the top of the plaintext letters.
aeehnv
123456
AEEWTR .
BESHTE -
Then the letters are copied down column wise from top to bottom. The result is ciphertext,
ie.
ABEEESWHTTRE
Scanned by CamScanner
SS Crypt. & SYS.
ep Sys. Secur
Security
ity (MU
(MU-Sem. 6-Comp) 1-56 Introduction tg C EF
Syllabus Topi
pic c :: | Stega r
te yano raphy = }
“FT copt BS
goaoa—
1 -13 Known ©
Steganography Applications
and Limitations original im
Q. 1.13.1 —
What is Steganography
comp
co ared =
? Give its advantages
(Ref. sec, and disad
i
vanta
:
ges,
1.13) :
f
s se
i
Je an oF
ae
Q. 1.13.2 What is Steganography? What are applications - and limitations" ema”col ded mi
steganography?
Ref..sec. 1,13) attacked: mé
Steganography isa attacks helt
technique of hiding
file or image: Steg the message, file and image within other
anography word m original me!
“secret writing”, is of Greek origin that means “covered Writing? , 4. Reformat A
— attacker chi
In other words, it is the art as
well as science of hiding the communication
that know body aware in Such Wa don’t store|
the existence of communication.
~ The goal of hiding messages, 5. Destroy E
files and images is to fool attacker
attacker to detect that there and not even all, mnlaled ite
is another
message hidden in original
| — message.
The main aim of Steganography eel eS
is to achie‘ ve high
; ;
security and encode ’ me
the sensitive day é. Known
» audio, video
Internet Even if there is small change in ste and send it over insecure channel such a
nographic image or data will change complet and, when
meaning of the messages,
help agains "
7. Multiple E
~ Im Steganography the term cal
Cryptography. Like cryptanal led as Steganalysis which is similar to cryptanalysis jg
ysis, the goal of steganalysis is to identi _—
messages, files and images, to determ fy suspected pbs
ine whether any hidden
available into those messages, and also or encoded information is
to try and gain access to that messages, files eee
images and 8. Compressi
attack tries
- Attacks on steganographic techniques
are very similar to ‘attacks
techniques/ algorithms and on cryptographic ae
Similar techniques apply: The
strength of a-steganographic
algorithm depends on its abil
I ity to successfully withstand atta
cks, .
i Following are the possible att
acks on steganography. .
1. Stego-only attack : In this type of atta
ck, onl y the medium (files and images) containing
hidden data is available for analysis,
This attac k also called as Visual attack.
2. File only attack : The attacker has access the file
he must determine if there is a messagt
hidden information inside that file.
Scanned by CamScanner
.-<g
' [@ crypt. & Sys. Security (MU:Sem. 6-Comp) _ 1-57 introduction to Cryptography
3, Known carrier attack : In this type of attack, the steganalyst has access to both the
original image and the image containing the hidden information are available and
compared to assume the message. The stego object (that contains the hidden information)
is compared with the cover object and the differences are detected, This attack also called
as file an original copy : It might happen that attacker have a copy of both the file i.e. the
encoded message and a.copy of the original file. If the two files are different, then
attacked may guess that there must be some hidden information inside a file. Such type
attacks helps attacker to destroy the hidden information by simply replacing it with
original message.
4, Reformat Attack : Most popular attack on steganography
is reformat attack, in this attack
attacker change the format of the file (BMP, GIF, JPEG) because different file formats
don’t store data in exactly same way.
s. Destroy Everything Attack: An attacker could simply destroy the message and all
related information. This can works correctly because there are different file formats are
used to store data in different ways. .
6. Known message attack : In this type of attack, the original message prior to embedding
and when transmitting over Internet is known to sender. This type of attack analysis can
help against attacks in the future.
7. Multiple Encoding of a Files : The attacker gets n different copies of. the files with n
- different messages. It might happen if some companies are inserting different tracking
information into each file. If the attacker tracks all the data during transmission then he |
may try to replace the tracking information with its own available information.
8. Compression Attack : One of the simplest attacks is to compress the file. This type of
attack tries to remove the unrelated information from a file during compression then what
is the use of hiding the data if extraneous information is removed.
Chapter Ends...
OOO
Scanned by CamScanner
2.1.1(A)
2.1 Modular Arith
metic — A pri
by la
2.1.1 Mathematica
l Backgroun Exam
d. | .
. In cryptography, — Thep
—
- Relat
have
ry and algebra tec
hniques are used for designins
cryptosystems. One of the — Exar
examples of cryptosystem in
DES ‘and AES algorithms. the 1
®@ Basics of Number Theory and Mo gcd |
dular Arithmetic
2.1.1(B)
Basics of Number Theory
GC]
1. Integer Arithmetic | Positive
integers
2. Binary Operations. |
integers
Fig. 2.1.1 : Basics of Number Theory Fo:
i.e. Z.
number represented by single alphabet
Scanned by CamScanner
et Crypt. & Sys. Security (MU-Sem.6-Comp) 2.2 Modular Arithmetic & Number Theory
— Forexample:
Z={...—3,-2,-1,0, 1, 2, 3,...} setof integers,
=~ 2. Binary Operations
A prime number is a positive integer which is greater than one and which is divisible
by 1 and itself i.e. the only factors of prime number are 1 and itself.
Example : 2, 3, 5, 7, 11 etc.
The prime number concept is use by cryptographic algorithms heavily.
Relatively prime number : Two numbers are relatively prime to one another when they
have no common factors except 1.
Example : 21 and 44 are relatively prime numbers, since common factors between both
the number is one i.e. Greatest Common Divisor GCD of a and n is:1 it is written as
gcd (a, n) = 1 hence they both are relatively prime.
GCD stands for Great Common Divisor, also called as greatest common divisor of two
positive integer a and b: The GCD of two integers is the largest integer that can divide both
integers. Most needed concept of cryptography is GCD and prime number. Two positive
integers may have common divisors but we are interested in largest divisor. |
gcd(12,60) = 12
Pa
Scanned by CamScanner
Modular Arit
hmetic & Numb
er 7,
”
ei Crypt. & Sys
——___
Modular Arithr
40 = 2*20 3. ((amoc
—_——
20 = 1*20
.
——
“ged (40, 20) = 20
2.2 Eucli
1. Rewweds °
2. If(R=0) then goto step 4 else Q.2.24 st
3. a=
b=Rb
goto
, step2 Tt is a ba
Suppose we hz
4. GCD=b :
Now divic
Example
15% 12 = 3 Suppose
obtain :
12%3 = 0
Hence
if r,=Q0
GCD (15, 12) = 3 the remainde
bi
i
{
Scanned by CamScanner
(er Crypt. & Sys.
y: Securitity (MU 5 Sem. 6-Comp)
| _ 2-4 . Modutar Arithmatic & Number Theary
Modular Arithmetic
Scanned by CamScanner
~QTa1
+4,
t O< T<T,_,
1-1 = Gait
, 40
d= ged (a, b)=r
SiaAt
mes
,
eae
ch Sta Ze we
have d =
a. gcd(r, Ji) fi
vig of two nally ¢ = &c
Vision algor In te ge rs by Tepetitive d(r,, O) =
ithm ca n be Tn - Thus, the
is is known ca lc ul ated by repeti STeatesy
as the E Uclide tive applicatio
Euclid’s al an algorithm, n of th
gorithm : E
UCLID (x,y
)
1, XX yy
iz, FY = 0, retum
x = ged (x, y)
3. “R=xmody
4, xey
5. yeR
6. Goto2.
Ex. 2.2.4
We know that,
om step 2 of algorithm,
If y =O, return x= gcd (x, y)
. ged = 20
Scanned by CamScanner
Solve / find ged (36, 10).
Soin. :
|
We know that,
|
ged (x, y) =
“. ged (10, 6)
Bed (6, 10 moa 6)
Il
I
Bed (6, 4)
STeates, |
Q of the gcd (6, 4) ged (4, 2)
ll
‘ Ex. 2.2.3
Using Euclidean algorithm calculate gcd(48,30) and ged(105,80).
Soln. :
(i) ged(48,30)
gcd(6,12 mod 6)
"
= gcd(6 0)
1. ged(48,30) 6
Nt
—__S—s—s—
Scanned by CamScanner
i EP crypt. & Sys. Security (MU-Sem, 6-Comp) 2-7
= gced(105,80)
= gced(80,105 mod 80)
= gcd(80,25)
= gcd(25,80 mod 25)
= ged(25,5)
= ged(5,25 mod 5)
. &cd(5,0).
» ged(105,80) 5
Ex, 2.2.4
Using Euclidean algorithm calculate gcd(20,16) and gcd(50,60).
°
Soln. : '
(i) ged(20,16)
= ged(16,20 mod 16)
= gcd(16,4)
= gcd(4,16 mod 4)
= gcd(4,0)
. ged(20,16) 4
(il) gced(50,60)
= gced(50,10)
gced(10,0)
..ged(50,60) = 10
Scanned by CamScanner
‘N\
—* ©YS. Securi
a =n. =Comp) Modular Arithmetic & Number Theory
2. 2. 1 Extended Eucl
idean Algorith
m
Q. 2.2.2
Write Extend
ed Euclidia n al
gorithm. (Ref, sec, 2.2.1)
— As we learn 4m in
; sch a
get an intege f ; Col days, when we divide integer values by other nonzero integer we
—
‘ Ber quotient (the “answer ”) plus a remainder (generally a rational number).
For instance,
<i Ww
13/5 = 2(“the quotient”) + 3/5 (“the remainder”).
© can rephrase this division, totally in terms of integers, without reference to the
aie division operation:
- 13 = 2(5)4+3
~ Note that this expression is obtained from the one above it by multiplying through by the
divisor 5.
— The greatest common divisor of integers a and b, denoted by gcd(a, b), is the largest
integer that divides (without remainder) both a and b. So, for example:
gcd(15, 5) =5, ged(7, 9) = 1,
It is well known that if the ged(a, b) =r then there exist integers p and s so that :
a
p(a) + s(b) =
By reversing the steps in the Euclidean Algorithm, it ispossible. to find these integer p
rrr
Scanned by CamScanner
Modular Arit
hmatic & Nu
mber Th
(24)
=ee 3( 57 = 37 ~ 2(24), so :
2(24)) — 1(24)
at 24 = 8] _ 1(57
), giving us:
= 367) .— 7(81~
1(57))
= 10(57) ~7(8 1)
—
So we have found
p =_ 7 ands = 10
The procedure we have follo:
we have to make, Itis nado isa bit messy because of all the back Substitutions
and s by doing some acer e seat the amount of computation involved infinding
uxiliary computations as we go forward in the Euclidean algorithy
(and no back substitutions will be necessary). This is known
as the extended Euclide a
Algorithm.
Given two integers a and b, we after need to find
other two integers S and t such that
Sxa+txb = ged (a,b)
The extended Euclidean algorithm can calculate the gcd (a, b) and at the same tim
calculate the value of S and t. As show the Fig. 2.2.1.
=
. Fig. 2.2.1
Scanned by CamScanner
FT cop S16, Security (MU-Sam.6-Comp) 2-10 0
Modular Arithmetic a. Number They
- . ‘tian
The extended Euclidean algorithm uses the same number of steps as the Buclidia
algorithms.
- The algorithm of extended Euclidean is as shown below :
nea *
:
1, b;
s,- 1 .
’
8-0; Initialization
he0 ; el;
while (1,> 0)
{
gett ;
rer1-qXh;. updating
1's
tehitet
}
ged (a, b) 1,38 83th
Ex. 2.2.5
‘Given a = 161 and b = 28 find gcd (a, b) and value of s and t.
Soln. :
Scanned by CamScanner
28 21 7 () \ ~J i a’ 6
2! 7 () | sal 4 -5 6 ~ 23
7 0 ~t, 4 6 ~23) 1
We get, ged (161, 28)=7 s=~1 and t= 6. The answer can be tested ,
(-1)X 16] 4+6x28 = 7
a, 2.3.1 Stato the Chinese remainder theorem with example. (Ref. sec, 2.3) a]
According to D. Wells, the following problem was posed by Sun: TsuSuanChing. There
are certain number repeatedly divided by 3 and remainder is 2, repeatedly divided by§
and remainder is 3, repeatedly divided by 7 and remainder is 2. .
What will be that number? The problem can be solved by well known theorem called
Chinese remainder theorem. If that it is possible to reconstruct integers in a certain range
from their residue modulo a set of pair wise relatively prime modulo.
xX = a, (mod m,)
X = a, (mod m,)
+h lees
ova
. Bh
.
Scanned by CamScanner
rc t_& Sys. Security (MU-Sem. 6-Comp) 2-12 Modular Arithmetic & Number Theory
_ = — = ——
Ex, 2.3.1
State CRT. Find x for the following equations,
x =1mod2
x =1mod3
xX =3mod5
X =1mod7
Soln.:
xX = a, (mod m,)
x = a, (mod m,)
X, = a, (mod m;)
Let, a,=1, a,= = 3, m3 =5 and m,=7
1,a;=3,a,= 1 and m,= 2, mz
vided by 5
M. = m,+ Mx M,* my,
em called = 24#3%5%7
| M2 = M/m2
10 san
= ~3-=70;
i 210 ©
[
M3 = Mi= m3
"5"=42,
f 10
hen the | M4 = M/m4= a =30
I
Scanned by CamScanner
SS
ef Crypt. & Sys. Security (MU-Sem, 6-Comp) 2-13 Modular Arithmetic &Number, |
X, = a, (mod m;) |
According
to given equation al= 2, a2 = 1 & a3 =3 and my= 3, m, = 4 and m; =5 |
M = m,* m,* m,* m, |
= 34445
M = 60
For all set of elements
Scanned by CamScanner
ea Cryp Sys.
t. &Sys Sacuri
ES . Security (MU-Som. 6-Comp) 2-14 _ Modular Arithmatic & Number Theory
=
¥1 = Inverse of (M/m1) mod m, = Inverse of 20 mod 3
= i-
a 20 * mod 3 = 20 mod 3 =2
D:dM), Y2 = Inverse of (M/m2) mod m,= Inverse of 15 mod 3 = 15° mod 4
Jay, = 225mod4=1
a2) Ys = Inverse of (M/m3) mod m,= Inverse of 12 mod 5 = 125"? mod 5
= 12’ mod5=3
According CRT
Oe X = apMyyi + aoMoyot asMoys4.... a,My;(modM),
Define the Chinese remainder theorem find the solution to the simultaneous equations.
mod 7.
wl x =2 mod 3, x=3 mod 5, x = 2
Soln. :
theorem is,
The general equation of Chinese remainder
x = a,(modm,)
x = a,(mod m))
| =
: 4 (mod m3)
xX,
1 m3 = 5
aneous equations
According to given simult
x=2mod7
x =2mod 3, x =3mod5,
a = 2, and m, « 3,m,=5,M;=7
Let, a, = 2, a, = 3,
M = m,+ m,* m* My
i
= 357
M = 210
= 105/7 = 15,
M, = M/m,
Scanned by CamScanner
| 4
ep Crypt. & Sys. Security (MU-Sem. 6-Comp) 2-15 Modular Arithmetic & umber
ns
———
)
2.4 Euler Totient Function o(n
eo
ed Eule r Toti ent func tion whic h states that, how many numbers are betwe
o(n) is call
y prime to n.
1 and n- 1 that are relativel
e to it.
All positive integers less than n are relatively prim
For example: ifn=4 find o(n) =?
er is i
o(n)= (4) = 1 and 3 are relatively prime to 4 because.their gcd is. 1. (The numb
to relatively prime if their gcd is always 1)
In this case 4 and 2 are not relatively prime, because gcd (4, 2) =2
| ’ “ 0(4) = 2 (ie. 1 and 3)
-9@ =? | | |
= 1, 2,3, 4 are relatively prime to 5 '
4
4 : i
3383
nm
9
to
Scanned by CamScanner
2-16 Modular Arithmatic & Number Theory
t.a
Crypt
(El cyp Sys,.sSecurity (MU-Sam. 6-Comp)
. & sys
~O7) = 6
This implies that $(n) will be casy to calculate if n has exactly two different
prime factors say p and q
“. O(a) = pxq
ie = (n) = Op) «b (q)
According to definition of Euler Totient function,
$(peq) = (p- 1) * (q- 1) if p and q are prime
Hence proved.
prime :
It states that for every a and n that are relatively
a“ = 1(modn)
r’s theorem.
For example : Prove using Eule
a=3, n=10; ¢)=?
Let, $(n)=9 (10) ={1, 3,7, 9) =4
According to Euler’s theorem,
3° = 1 (mod 10)
3¢ = 1mod 10
1 mod 10 (81 mod 10=1 & 1 mod 10=1)
81 =
ll
Hence proved.
.
Ex, 2.4.1
1.
Solve using Euler's theorem : a = 2 andn=1
Soln.:
Calculate o(n) = First
={1 to 10) =10
g(n) = (11)
According Euler’s theorem
aX” = 1 (modn)
2° = 1 (modn)
11 =1)
1024 = 1 mod 11 (1024 mod 11 = 1 and 1024 mod
Hence proved.
Scanned by CamScanner
(ar Crypt. & Sys. Sec
There is no poin
noting that 7? = 1
positive a< 19,
A a? o a’
i 1 1 1
2 4 8 16
3 9 8 >
4 16) 7 9
7 | b=a! mod > 3] 6) | a
© €xponent j j 6/17} 7 |4
11s referred as the i
discrete logarithm
of b for base q mod
This can be written as, p.
ee
on jet
d log ,, p(b)
© equation d log,,
p(b) called as discre
te logarithm Which 10S
| I
5 E
cryptographic algorithm is used in different
s like diff;1¢ Hellman
algorithm and digita
ital l sig =
For a = Prime numb sj nature algorithms
er P. Let a, b be non zer one
wes o integers (mod p). The “12
thata* = b(mod p) is called problem of finding X
Discrete Logarithm Pr —|*
Integer such oblem, Suppose that
that a° = 1 (mod p), n is the smallest
i.e. n = or d,(a). By = |=
x =L,(b), and call it the discre assuming 0 < x <n, we
te log of b w.r.t. a (mod p). denote _ wie |
Example: P= 11, a=2, 15 | 16 | 12
b =9, thenx =L,(b) =L,(9)
=6
To explain discrete Logarith 16 Polul
m considers the following exa
mple.
7 i= 7(mod 19)
: V7 fatal
| lieest
| a 1 (a| 18
e |
7 DP =ks 49es =2x19+=11(m=od
1119)
7 = 343= 18x 19+1=1 (m In general t
od 19)
(mod n) is gn),
7 = 2401 = 126 x 19+7=7
(mod 19) ; Ifa number j
7° = 16807 = 884 x 19 + 11=11 (mod 19)
Paros
Scanned by CamScanner
There is no point in continuing because the sequence is repeating. This can be proven by
:.
for all
a that 7° = 1 (mod 19). Table 2.5.1 shows all the powers ofa, modulo 19
positive a < 19,
Table 2.5.1
Dhadadaftafadadadeyryadadadyadadada
214]s8]ieli3| 7/14] 9 | 18] 17] 15} 1} 3 | 6 | 12] 5 | 10
lis} 7] 2] 6 | 18] 16] 10] 1] 14] 4 | 12 | 17] 13
3/9185
4lil7ioli7z/u}6{ 5} 8] 4] i] 7] 9] 7] mn] 6] 5
plnlalatalalafafefr7papad papaya pa
8} 7] yy i] i] 8 | 7 | ie] | 2
gf} 7fis}a{i2]1]
5 | 7) 6 |] 16] 11.) 4 ] 17
| 6] 16} 11) 4 17} 1/9]
9/517
18 9 | 14/7 ]13]16] 8 | 4] 2
1/5 |12] 6 | 3 | 1] 15) 17
7p app 7p ey 7p a pay 7
ulaftafada}afap
1fi2{ a1] 18] 7] 8 7 tf 2] | 8] 7 8
solutis| 7 {sf
it} tof ie} 18] 6 | 2) 7) 5] 5| 8 9 |3
wlit}i2| 4 | 14]
4] 18) 5 | 13] 219 {12} 16| 15
4u|/o6{sfi7}/i0} 7/3]
5] is] 4] 3474] 7] 8] § 14
slieliz}9]2{u}i3|
9] mys] 4] 7 17 | 6
wloluls|4]7}i7}o]1]i}
17] 4] mt] 6] 6] 7 5 | 9
wilaluliwle}7/5])9]1]
1 {18} 1] 18] 1 | 18] 1 | 18] 2D 18
i} 1dig\ 1 {18} 1]18]
nent to whom a number can belong
In general terms, that the highest possible expo
(mod n) is (n).
If a number is of this order, then it is called as primitive root of n.
Scanned by CamScanner
[ar Crypt. & Sys. Security (MU-Se
m, 6-Comp) 2-19 Modular Arithmetic & Number Theo,
The i mportance of thisis notion noti isi that ifif isj a Primit
: ive root of n then its powers iis,
By WY ccwea stiraesdtecnomene : a %) ore € disti
distinct(mod n) and are all relative i ly prim
i e to n, j,
particular, for'a prime number p, if is a primitive root of p,
then,
2
a, a” ...., viaeewernaNiN a ore distinct (mod n). For the prime
number 19, its primitj,,
roots are 2, 3, 10, 13, 14, and 15,
,
2.6 Fermat Theorem
—$_
Q.2,6.1- State and Prove Fermat's theorem, (Ref. sec. 2.6) _ —$$_|
Scanned by CamScanner
ec Pl. & Sys. Securityrity (MU-(MSem,
y. 6-Comp) _ 2.20
Modular Arithmetic & Number
Theory
(2.6.1) We can solve any large mod operation using this method, Solve
6” mod 11,
Soin. :.
According to Fermat’s little theorem a” = 1 mod p, 6” mod 11
» have
. = [(@ mod 11) x (6 mod 11)] mod 11 = [4x 7} mod 11
= 28mod11=6
6" mod 11 = 6.
Ex, 2.6.3
() 3" mod 41
According to Fermat's little theorem a?" = 1 mod p, 3 mod 11
__ Hence a =3 and p = 11, Put these values into above equation,
Scanned by CamScanner
[(3° mod 11) x (34 mod |
9 mod 11)] mod : 11 = [1x 4] mod 11 |
3° mod 11 (4 mod 11) =4 Eyfabus
“3 r mod 11 = 4 Blockc
ce
a Advanc
|
Chapter Endy.
—_—
Qo0
——
3.1 BI
— Basic;
—- Strea
algori
— Forn
Scanned by CamScanner
Module 2
Symmetric Key
Cryptography
Syllabus
Block cipher principles, block cipher modes of operation, DES, Double DES, Triple DES,
Advanced Encryption Standard (AES), Stream Ciphers : RC5 algorithm.
aes
iDtep Eng,
— Basically cryptographic algorithm is used for transformation of plaintext into cipher text
—. Stream cipher and Block cipher are main method of encrypting text using key and
algorithm. we
-— Formore details refer Section 1.10 of Chapter 1.
Scanned by CamScanner
EF crypt. & Sys. Secur
Cipher that May b
| “typtographic algori y = The drawback of
and decry the input genera!
pteg
| attacker or crypta
The modes
included in
this Standard are:
1.
| Electronic Codebo ok (ECB)
mode
2. Cipher Block Key
Chaining (CBC
) mode
Cipher Feedback
»
Scanned by CamScanner
ey Crypt. & Sys. Security (MU-Se
m, 6-Comp) 3-3 Symmetric Kay Cryptography
—_
The
heidr eect of ECB mode is‘ that for the occurrence of more than one plaintext block in
put generates the same ciphertext block in the output, which gives clue to the
attacker or cryptanalyst.
Ciphertext Ciphertext Ciphertext
block 4 block 2 block N
|
Key —»} Decrypt Key—»}Decrypt} -- Key —»| Decrypt
~ Only small messages can be encrypted using ECB mode of operation where the chances of
repeating the same plaintext message are quite less.
— Incase of cipher block chaining mode even if plaintext block repeats in the input, output
of CBC mode yields totally different ciphertext blocks as shown in Fig. 3.2.3.
a he
=, hae
Scanned by CamScanner
(FP ory. & Sys, Security
(MU-Sem. 6-Comp) _ 3-4 Symmetric Key Cryptogracs,
Initialization (Iv) ei Pa
Le r
Dy
W
,
K —+ Encrypt K —# Encrypt
Cc, Cz Cy
Ciphertext Ciphertext Ciphertext
block 1 block2 block N
|
v— Mi
wa
AL
<*
9
£
+ |
Py Py Py
Plaintext Plaintext Plaintext
block 1 block2 block N
Fig. 3.2.4 : Cipher Block Chaining (CBC) mode decryption process
3.2.3 Cipher Feedback (CFB) Mode
—
CFB mode uses block cipher as stream cipher meaning is that data
is encrypted in smaller
units of block say 8-bits rather than predefined size of
64 bits.
Scanned by CamScanner
FF crypt. & Sys. Security (MU-Sem,6-Comp) 3-5 Symmetric Key Cryptography
- CFB mode may be used as a stream cipher. In CFB encryption process 64 bits
initialization vector is used which is kept in 64 bits of shift register.
- The IV (shift register) is then encrypted and produces 64-bits of ciphertext i.e. encrypted
IV. Now the leftmost S bits (size of 8 bits) of the encrypted IV are XORed with the first
S bits (size of 8 bits) of plaintext P,to produce the first S bits of ciphertext C,, which is
then transmitted to next step.
- Innext step contents of the 64 bit shift register are shifted left by S bits and C, is placed in
the rightmost S bits of the shift register and which again undergoes to encryption process
as shown in Fig. 3.2.5, |
- This process continues until all plaintext units have been encrypted. Here panme key Kis
used during encryption and decryption process.
(shit register) ie
ae
Plaintext x, Plaintext 4
rT
Plaintext L
| 7 .
— Decryption of CBC mode reverse of CBC encryption, the same technique is used, except
that the output of encryption process is XOR with the received ciphertext block to produce
the original plaintext block as shown in Fig. 3.2.6.
Scanned by CamScanner
. Security (MU-:
Ber crypt. & Sys
Initialization '
[ Encrypt
(64!
select §
§ bits
Fig. 3.2.6 : Cipher
Feedback (CFB) Plaintext
mode
3.2.4 Output Feedback Decryption Process P,
(OFB) Mode
Ciphe
Fig. 3.2
— Decryption process
In this case Initialization Vector is extracted from a double length encryption key.
‘
Scanned by CamScanner
reo ae. ty fiu-Som. 6 Comp)
37 Symmetric Key Cryptography
Initlalization
vector
Encrypted IV.
- 8d bits
Ciphertext C,
i
- Ciphartext Cc,
Ciphertext Cy
yption process |
shift register
—
g. 3.2.7.
Scanned by CamScanner
AT coypt. 2 Sys. Securty (MU
3.2.6 Algorithm Mode L
Mode
el.
Output Feedback (OFB)
a
Counter (CTR)
Scanned by CamScanner
re Crypt. & Sys, Security
(MU-Sem, 5-Comp)
3-9
Symmatric Kay Cry
3.2.6 Algorithm Mode ptography
Detalls and Usage
Table 3.2.1 : Su
mmarization of algorithm mod
es
Details ; - Usage
Electronic code book
Same key is use to encrypt and |
(ECB) A single value is transmitted
decrypt 64 bit at a time.
in secure fashion,
Cipher Block Chaining
Ciphertext of Previous
(CBC) step and It is used for authentication
plaintext in next step are purpose,
XORed.
Cipher Feedback (CF
B) K number of’ random from Encrypted stream of data is
ciphertext bits of Previous
step transmitted for authentication
and k bit from plaintext of the
next step are XOred,
Output Feedback (OFB) It is similar to CFB, only| For transmis
sion of =
difference is that input to | stream of data
ed earlier and later .
encryption step is preceding
in Fig. 3.2.10, DES output.
Counter (CTR) Both counter and plaintext | It is
used in the mre
block are encrypted together, °
which need high speed of
transmission,
>
Q3at Explain working ot DES detailing the
(MU- Dec. 15, May 16, ay NT, me
Fiestel structure,
+8)
Scanned by CamScanner
PFT crypt. & Sys. Securtty (MU-Sem. 6:
“
~ DEs ;
“
in Carly
| i At the decryption side, DES
M, ach g Tequest 2
56-bit key.
‘als for
essis
ngie g lis ; m —
=
Which a heg ed. ve 3.3.2 Detall Steps of DES
te |
és I regi:, -
in 1975sa43in aMEE, Was acc
w draft of epted as Des.
ather The principle of DES is very s
7 “ject because of
© F, Fed, ;
smal] each, which is initial permutati
Prevent alysie om
Cc a :
. that Inte After initial permutation on 6
: os rna] achi
4 tecture € of D called left plaintext and right p
Publishe of ES
NClassifi g D, The left plaintext and right plz
eg licatio “
with 16 different keys for eacl
cain right plaintext gets combinec
blocks.
The result of final permutatior
Divide plaintext me
ssage into 64-bit blo
ck each
OR
The given plaintext messag
: e is divided
into size 64-bits block each and
56-bit key at the initial level. Fig. 3.3.15 ch and encrypted using‘
hows conceptual view of DES. 56 - bit
key —,]
siiady 64 bits
56 - bit ae sie
kay DES” te >. DES:
164 - bi Te- bt
|ciphertext ciphertext
Scanned by CamScanner
- At the decryption side, DES takes 64-bit ciphertext and creates 64-bit plaintext and
56-bit key.
- The principle of DES is very simple. Divide plaintext message into block of size 64-bits
each, which is initial permutation,
- After initial permutation on 64-bit block, the block is divided into two halves of 32-bit
called left plaintext and right plaintext.
along
- The left plaintext and right plaintext goes through 16 rounds of encryption process
with 16 different keys for each rounds. 16 rounds of encryption process left plaintext and
combined
right plaintext gets combined and final permutation is performed on these
blocks,
- The result of final permutation produces 64-bit of ciphertext as shown in Fig. 3.3.2.
__84-bitplaintext |
f= “Thitial permutation ~~
{Frond | [Round
WML
; Encrypted data
WLLL
Kia a
[84 - bitciphertext | :
Scanned by CamScanner
rity!
Sys: secu
PF copt &
!
'i Yo © Process OF rearra: : Ste©p 2+ 2 Expansion pet
. shown iin
n Fig.Fig 3
| NSE Fandom bit ofsarc shufllng cach bit of original pig oe text (LPT) a
b lock, © —First bit ofof original
orig PlaintextPtintext
{ . the 2"4 block message
re block. “te panes:
from 32-bits to 48-8
|| Places with 57" bit ead place with 48"bit
of Original Plaing
| Original pl] jaintext messag
Table 3, 3.1: e wey
shown in Table 3 3
| Initial Permutation
: m
Plaint
: ext block (64 bits
)
——-,
ss Qn9s
: his Protea called Juggle
ry of bit Position of plai
orginal plaintext blo ntext block which is applied
cks in a sequence. to al
i After initial permutation
the 64-bit plaintext block get
(32-bit) and RPT (32-bit). divided into two halves LPT
Fig. 3.3.3 : E
— Now 16 rounds of encryption process were
completed on LPT and RPT.
pe During: Shis:m
3.3.4 Rounds Fig. 3.3.3.
— From Fig. 3.3
Q.3,3.6 — Explain 16 Rounds of DESin details, (Ref. S60 GaAy > 7
RES 48-bit key ;
Q.3.3.7__ Explain permutation and substitution steps in DES. (Ref. sec: 3.3.4
) operation is ;
Before discussing about DES rounds let us know about key discarding process.
Step 3 : S-box si
| py Step 1 : Key discarding process .
peuad | _-~ _ S§-box subst
f ; — We know that 56-bit key is used during encryption process. Here 56-bit key is 48-bitait whicwhic
¢ transformed into 48-bit key by discarding every 8"bit of initial key ie. 8", 16", 32"... | ~ S-box perfi
- From this 56-bit key a different 48-bit sub-key is generated during each round
the process | ~ The substi
called key transformation.
Input for ¢
then comt
Scanned by CamScanner
Ef Crypt. & Sys. Security (MU-Sem,
cop
8-Comp) 3-49
Symmetric Key Crypto
Step 2 : Expansion graphy
Permutation Process
‘Nite a
tound is generated -
from initial 58 - bit key). «'S - Box substitution
32-bit
Plied
(0 all
22 - bit
_ RPT,
alves LPT
| Fig. 3.3.3 : Expansion Permutation (Details steps of
Single Round of DES Algorithm)
Scanned by CamScanner
FP crypt & Sys, Security (MU-Sem. 6-Comp
a XOR |
|
E RPT°T, (48(48 -- bit)
bit) »C]
>
re fay GESts S7 Se
pe Ao S3 Sa) h Ss
Shoxes < © 51) (2 7
4
mech anis m i.e. repl acem ent of each bit with ano the
permutation
bop called as P-box permutation.
% ' ¢
Scanned by CamScanner
eo it. & Sys
vy . Securi ty ( MU-Semm6
, Comp)
3.1- 5
3.3.5 Symmoatric Key Cry
Final Permutation ptography
:
The last operat
ion a data encr
yption Standard
RPT produced is a Permutatio
from XOR and n of 32-bit LP
sw ‘apping Proces T and 32-bit
Successful comp s. Final] Permutation
letion of 16 ro wa s Pe rf ormed after
und s.
- For exampl
;e
7“ 4;
ition of 4" output
bit and so on, . input
Table 3.3.2 ; Fin
al permy tation
29 | 64 | 32 391 8 | 47
14 | 22 | 6 30 | 37 | 45 | 5
44 / 12! 20} 59 35 | 28 | 26 | 44
1 | 33°} 56 | 53 | 30 44
steps on it in ord
er to Produced en
crypted ciphertext
f
3.3.6 Strength of DES
y left plaintext
round, output + 5. DES uses 56-bit
f equal to 7,2 x 19' keys so that there are 2% Possible
) produce the S keys required key combinations
tp break DES which 1S Toughly
I 6. A machine Perfor cipher,
ming one DES
encryption per
thousand year microsecond wo
an id the to break the cipher uld take More
old
, than a
s XOR and 7 Ifa smaii change in :
eith er Plaintext or the
key, the ciphertext
should change mark
edly.
Scanned by CamScanner
3.3.9 Triple DES
Q.3.3.10 Explair
Q.3.3.11 Writes
Triple DES per
uses three keys
First it perfon
ciphertext agair
the second cit
ciphertext Cp.
Mathematically
!
Pt >EK1(Pr) =
elerypted = Cp=EK3 (J
using KI Obtains firg |
} nother key called
= Mathematically K2 and Convertaj Where
Double DES
is Tepresented
j ; oePt >EK1 (Pt) => TE
MP = EKi¢Pt) =
as
EK2(E(K1(P)))=
Cp¢ =E= EK2EK1@)))
EK1(Pt) = Encrypted plaint EB
ext with Key Ki
. TEMP = EKi (Pt) Cp = EK3
= Temporary Variable
. EK2(E(K1(P))) = Encrypted Results
to store results Decryption of
of fire step using K2 The final ciph
Cp = Final Ciphertext
. _ Which results
Decryption of Double DE ; iP
S is reverse of Encryption Ciphertext, 4
after double DES encryp . Wh at ev er the ciphertext obtained
tion pro cess get decrypted Plaintext pt.
using K2 and obtain the firs!
ciphertext, the result of previous Step (cip
hertext) decrypted using K1 which yields tte To decrypt th
original plaintex t. To decrypt the cipher text Cp and obta
in the plain text Pt Double DES | peration,
need to perform the following operation.
|
if
Scanned by CamScanner
Syllabus Topic : Triple DES
Triple DES performs the same operation as double DES only difference is that triple DES
uses three keys K1, K2 and K3 while encrypting plaintext. .
First it perform encryption on plaintext which is encrypted using K1 obtains first
ciphertext again this ciphertext is encrypted by using another key called K2 which obtains
the second ciphertext which is again encrypted using K3 and converted into final
ciphertext Cp. ,
Mathematically, Double DES is represented as,
Pt = DK3(DK2(DK1(Cp)))
Scanned by CamScanner
PF cop. a Sys. S
The plaintext
Therefore, th
4x4 matrix
AES operate
shown in Fi;
is 32 bits. 1
Fig. 3.4.1.
Round ke’
Round k
Round
— Them
i, The AES algorithm is a symmetric key algorithm which means the same key is used to
both encrypt and decrypt a message. mentic
“ keyris
if — Also, the cipher text produced
by the AES algorithm is the same size as the plain text
State |
for m
— AES consists of multiple rounds for processing different key bits like 10 rounds for
processing 128 - bit keys, 12 rounds for processing 192 - bit keys, and 14 rounds for array
Wis
"
Scanned by CamScanner
er Crypt. &: Sys. §Security (MU- “Sem. 6-Comp) | 3-19
Symmetric Key Cryptography
3.4.3 AES Encryption and Decryption Process
- The plaintext given is divided into 128-bit block as consisting of a 4 x 4 matrix of bytes.
- Therefore, the first four bytes of a 128-bit input block occupy the first column in the
4x4 matrix of bytes. The next four bytes occupy the second column, and so on.
-. AES operates on a 4 x 4 column-major order matrix of bytes; called as state array
shown in Fig. 3.4.3. AES also has the notion of a word. A word consists of four bytes that
is 32 bits. The overall structure of AES encryption and decryption process is shown in
Fig. 3.4.1, i
Plaintext(128-bit) Plaintext(128-bit)
Round kay Lae mound key 1" Round Found kay a, (Fira! Round
“Ns unakey | ipveubByies
vy — a
‘TnvShiftRows:
Repeat |
Nr-1
Bound
—+ AGG round: Repeat
Round key ———-— Nr-1
Bound
Round key
Final round
tae
Round key Add rou: rsd round|KO key] 14" 4" Round
- The numbers of rounds are 10, for the case when the encryption key is 128 bit long. (As
mentioned earlier, the numbers of rounds are 12 when the key is 192 bits and 14 when the ~
key is.256.) Before any round-based processing for encryption can begin each
byte of the
state (plaintext) is combined with the round key using bitwise XOR operat
ion. Nr stands
for number of rounds.
Scanned by CamScanner
FP crypt. & Sys. Security (MU-Sem. 6-Comp) 3-20 Symmetric Key Cryptograph,
es only
all other rounds are identical. Final Round doesn’t have (MixColumns) it includ
SubBytes, ShiftRows and AddRoundKey.
‘ntext USINg Same
The process of transforming the cipher text back into the original plain
jon process the sey
encryption key is called as decryption process of AES, during decrypt
of rounds are reversed.
(1) SubBytes
(2) ShiftRows
. ;
/Substitute by te
4. The SubB yte step a fi xe d S-box lookup ta
ble as
te us in g
of re pl acement of each by ). It
— SubBytes() co ns is ts
in to th e 4 x4 state array (16 byte
n-linearity
4.2 to achieve no -
shown in Fig. 3. the S- BOX in DES
.
sa me fu nc ti on as
the
performs roughly ar su bs titution in the
ms a no n- li ne
ra te s on ea ch by te in the state and perfor
— It ope
is what makes AES a non-linear cryptographic
GF (28) field, which
Galios Filed
es techniques and if apply
me
Scanned by CamScanner
Er crypt & sys Securty(MU-Sem.6-Com321
p) Symmet
Key Cryptog
ric raphy
041 12 13
15 J6 |7 14
0 | 63 | 7c | 77 | 7b | F2| 6b | 6f |C5}30/1 | 67 | 2b | Fe | D7] Ab| 76
1 | ca | 82 | C9] 7d | Fa | 59 | 47°] FO | Ad} D4] A2] Af | 9c | A4 | 72 | CO
b7 | Fd | 93 | 26 | 36 | 3¢ | F7 | cc | 34 | as| es | Fr | 71 | D8} 31 | 15
be
9 | 83 | 2c | la | 1b | 6e | 5a | AO| 52 | 3b | D6 | B3 | 29 | E3 | 2F | 84
Wwlol~ wr] &
5
a
Ec | 5f | 97 | 44] 17 | C4] A7| 7e | 3d | 64 | Sd | 19 | 73
=.
&
60 | 81 | 4f | De | 22 | 2a 14 | Be | Se | Ob | Db
oo
60
oN
=~
S
oo
e
w
a 10 21 CO 81 CA FD BA 0C .
05 07 01 25
State Array 60 byte(128-bit) | 6B C5 7c oF
27 12 19 24 blocks cee te
15 27 30 35 ecemmnees
*. -
Tt vi b '
Scanned by CamScanner
Of thise . input
tp the Sh i PFT copt.& Sys. Socut
iftRows Wa
alray nsfor, —
OVer in the Order ofa roy, Malicg From Fig. 3.4
© t row rents Ne in this Step), column of —
TOlatedieg,
byt ANS une of day,
Yte to the left Position same operati
oe
bY two And three posi:
ed. Each byte of the
Second row, is » ,
Correspon trance
Utllarly the
third and fourth rows are eerrne)
PoSition 48 shown jn
TOW tr, "Sformation
Fig. 3.4.4,
als,
= The 4 bytes
VShiftRoMatio
ws)n durin 8 decrypti,on a t
process ig: called Inverse in Rijndael’s
shi source of difi
_ShitRows
C813
: 0] FET
FF] ap
64 4. AddRoundKey
[es=
] zo Felon
F21FE/ eo] on
ee
s In the na ddk
FE} 60 | 25'| 5
11876 [4 schedule is
state
AA FE 84 Dy 7@ [Ea] 12/45
The nitind ti
: aha ae
DALAT FE) - € roun
.
Plimary source for Provid ep > The same
ing complete diffusion to
the ~ ShiftRows
~ Except fo
B8/1E 041 £0} 48| 28
doesn’t h;
11] 98 81] 19] D3} 26
[03] of] 01 02} =| 90/AE}
Fil cs [EB] 9A 7A] 40 Teverse 7
iy InvMixe,
Predefined matrix
State array
New state
Same enc
Fig. 3.4.5 : MixColumns tran
sformation
Scanned by CamScanner
_ °° ~~»
(ET cryp& t.
Sys. Security (MU-Sem. 6-Comp) 3-23 ——__Symmetri
Kayc Cryptography
- From Fig. 3.4.5 on the left hand side, the row of the leftmost matrix is multiply with
column of state array (XOR operations) which produces the new state. Perform the
same operation on all columns which provides diffusion (mixing data within
columns).
- The 4 bytes of each column in the State are treated as a 4-byte number and
transformed to another 4-byte number via finite field mathematics (modulo multiplied
_ in Rijndael’s Galois Filed by a given matrix) as shown. MixColumns step is primary
source of diffusion in AES.
4, AddRoundKey
- In the AddRoundKey step, the Round key one generated using Rijndael's key
schedule is combined with the new state obtained from MixColumns transformation
State. i
- The round key is added by combining each byte of the state array using bitwise XOR
operations. The actual ‘encryption’ is performed in the AddRoundKeyQ function, -
when each byte of state array is KORed with the round key to produce final cipher
text as shown in Fig. 3.4.6. .
04 | BO
| 48 | 28 AO} 88 | 23/24} | a4] 68 | 6B] on
66 | CB] F8 | 06 | xor| Fa} 54| 43 | 6c} =| 0c | of 5B |
6A
81} 19 | D3 | 26 FE | 2C 39 | 76 TF | 35 | EA | 50
E5|9A17A | 4C 17 | B1| 39| 05 F2 | 2B} 43 | 49
Fig. 3.4.6 : AddRoundKey
— The same process of AddRound
Key is applied for nine rounds
i.e Repeat SubByte,
ShiftRows, Mi xColumns step and XOR with
Round key 9 more times,
Scanned by CamScanner
Ption ocey,.
InvShif S throug the funct 41
Ex. 3-4 .
.Inyerse fun
ri 0, Inv
ction, as Sub By tes (), fava AddRoundK (),
it simp ly XORs th olumns () andeyAddRouplus the inverse AES function,
ndKey () does not require
AES encryption ‘
nce, and decrypts when fpot soln. :
iaa aaiin &
State with the subkey (XOR encr
ypts when @PDligy We aware
3.4.5(A) Diffe
rence combin7 ations
=
, sb
f Enerypa between Data Encryption Standard (DES) and Adv —
i ia
Pp on Standard (AES) ance Day key during encr
: = Se are z into some tempc
permutation and
i
j| what will be the
Data oe €ncryption standard — : so when sender se
takes 64-bit | It allows the
i Plaintext as a input and creates data length (plain text size) |
cryptanalyst abl
Ciphertext i.e. it encrypts data in 64-b
bloc
it | of 128, 192 and 256 bits.
k
of size 64-bits per block. pene Bet ao
does not solve ir
2. | In DES plaintext message is divided | AES
divide plaintext into 16 bya| r
into size 64-bits block each and | (128-bit) blocks, and treats each :
encrypted using 56-bit key at the initial | block} —==
as a 4 x4 State array and supporting |
level. . 35 RCSA
three different key lengths, 128, 19),| (7) Sms GOA
and 256 bits. i
ij 3. The left plaintext and righ
y t plaintext | The number of rounds are 10, 1 5 i
{| goes through 16 rounds of encryption | case is for the’ ee
| when the encryption key is 128 bit notable for bei
process along with 16 diff erent keys for long. (As mentioned earlier, the number
each rounds, XOR, shift, etc
of rounds is 12 when the key is 192 bits}
and 14 when the key is 256.) _ Example
i 4. DES uses 56-bit keys so that there are | AES
' is stronger than DES because of!) Key.: 00(
a0 Possible key com binations which is key size vary from round to round.
roughly equal to 7.2 x 10'° keys
required to break DES cipher. Plain Text
| Ciphee'ts
5. Different versions of DES are double | AES
doesn’t have any future version.
DES and triple DES is added. ; ‘
Scanned by CamScanner
inati . Crypt the Plain text bY applyin: .
combinations, shift Tows, mixing columns, it plays permutation and
Jugglery ow «
key during encrypti with the Oicent
input bits and uses 128
on Process. What bit
if
supporting
128, 192, 3.5 RCS5 Algorithm
RCS is a symmetric key block encryption algorithm designed by Ron Rivest in 1994. It is
is for the’
is 128 ‘bit notable for being simple, fast (on account of using only primitive computer operations like
2 number XOR, shift, etc.) and consumes less memory.
192 bits
Example
Key.: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Plain Text : 00000000 00000000
Cipher Text : EEDBA521 6D8F4B15
RCS is a block cipher and addresses two word blocks at a time. Depending on input plain
text block size, number of rounds and key size, various instances of RC5 can be defined and
Ech instance is denoted as RCS - w/r/b where w = word size in bits, r = number of rounds and-
Scanned by CamScanner
For example, if
u = 32/8 =4,¢=
— Lis pre initialize
Jouiabel to O”
Lfi/u] = (Llwi] <<<:
Step - 3: Initializing
_ ama 5 of siz
5/0} =;
fori = ; to 2(r+1)-1
_ Shi] = Sfi-11 + Q
Step 4: Sub-key mi
— The RC5 encryy
the basis of user
Two’s complement addition
of words where addition is
z=
|
modulo
Bit wise Exclusive-OR
1. One-time. in
Tespectively
XOR A anc
wn
- Here, Odd(x) is the odd integer nearest to xe is the base of natural logarithms and ¢ is tt Cyclic left
golden ratio.
Add S[2¥j)
uF
Scanned by CamScanner
CE} crypt. & Sys. Security (MU-Sem, g C.
-8-Com
For examplple,e, i
if yw, fe Choose w Symmatric Key
Cryptography
= 32 bits
and Key k j
s OF f sisi ze 96
b
- Lis pre initialized to
eeisey se me ea 0. Vv ale e before sae
Secretkey K to it
Lfifa]= (Lfa/i] <<<) + Kf],
; ;
Step -3:*Ini
alizin g Sub-key S.
5Poi aa nO)
Step 4: Sub-key mi
xing,
— The RCS encryp
tion al gorithm uses Sub
. the basis of key S. Lis merely, a
€r entered secret key. temporary array formed
Mix in on
user’ 5 sec key with S and L,
j=ae b ‘yy % C
Step 3% Encryption.
We divide the input plain text block into two registers A
and B each of size w bits. After
undergoing the encryption processes the result of A and B together
forms the cipher text
block.
QQ],
ane
te
Scanned by CamScanner
Syllabus
rithm.
, Encryption
Plaintext public key © ‘
Cipher text
?
P :
Cipher text oe Plaintext
.
. Decryption ~
Fig. 4.1.1: Asymmetric Key Cry
ptography
Scanned by CamScanner
(crypt. a 5)
SSS
Z. Digital si;
3. Key exch
for conve:
Eneryptig
Bob
(eg Asam
text = x
Fig, 4.1.2(a)
- Itis easily ; Encryption
With Public Ke
Configurable y
than secret
key,
—_.
.
4.2 Publ
— Cryptographic
: Encryption algori i
thm -
(6.9. RSA) text Decryption algorithm Pain text 1. Itis comy
output
(PR)),
2. Itis com;
Alica
(b) Encryption With - Senerate.
Private Key
Fig. 4.1.2:
Public Key Cryptography
3. Itis com
1.1 Applications for-Public
- Key Cryptosystem Private
Applications of Public
key Cryptosystem are
classified Into three categories
Encryption/decryption 4, It is coy
Scanned by CamScanner
Fig. 4.1.3
‘ Syllabus Topic : Requirements
and Cryptanalysis
Scanned by CamScanner
=
Ro
Aldema
plain te:
* The
l. Sel
Cor
ty
Cor
- »
Sel
le<
Cal
pe
6 Pu
Scanned by CamScanner
PP cryot & Sys. Security (MU-Sem. 6-Comp) 4-5 Public Kay Cryptography
rithm —---———
Syllabus Topic : The RSA Algo
7, Computecipher textusing,
C=P*modn where, P <n where C= Ciphertext,
- 3s
P=Plaintext,e=Encryptionkey
, )
Scanned by CamScanner
—
@ For example
= 120.
= (13-1) * (11- 1)= 12* 10
(n)
= 1 and] << Hnje;,
Select ¢ such that, e is relatively prime to 0(n) i.e. gcd (e, o(n))
>
5. Findingd
e*dmod(n)=1; 13 *dmod120=1
Do the fol low ing i you are
i procedure till not get i getting
are not
d is calculated using following met hod .
a integer numbers
a (o(n) * i) + 1
= e
361 —
=" 360+1 7113 = 27.76 (i= 3)
480+1 481_
d= 13 = 1 =37
Hence. d = 37
6. Hence public key = {13, 143} and
Private key = (37, 143}
7, Encryption
integer.
Plain text message (P) which is in binary format converted into
Here P is selected as 13 such that P<n
(13 < 143)
Now, C= P*modn=13"
mod 143
- Hler to find out 13"° mod 143, use the following procedure
3 mod 143 = 13
i
Scanned by CamScanner
_ ~ CC SSsSTS*=C OO LL
FT crypt & Sys. Security (MU-Sem. 6-Comp) 4-7 Public Kay Cryptography
Again use above mentioned procedure to find out 52°” mod 143. As |
52 mod 143 = 52 | ||
52° mod 143 = 130 |
= 26
52° mod 143 = (130)’ mod 143 |
52 mod 143 = (26)’ mod 143 = 104 |
= 91
52'6 mod 143 = (104)’ mod 143 . |
52 mod.143 = (91) mod 143 = 130
Hence, P = 52” mod 143
[(52*? mod 143) * (52* mod 143) * (52 mod 143)] mod 143
[130 * 26 * 52] mod 143 = 13°
@ Computational Aspects
There are two main issues arises in complexity of the computation we can see that one by
one. At the first we see the process of encryption and decryption.
In RSA, both encryption and decryption method, integer can increased as power and mod
| n. Le, [(p mod n) x (q mod n)] mod n = (p x q) mod n so thedo given equation say’s that, we can.
practically.
reduced the result using modulo n. This calculation we can
a ie:
Scanned by CamScanner
[FFcrypt.
rypt. && Sys. Security
Sys. Security (MU-
(MU-Sem.6-Comp) 4-8 Public Key Cryptograpp,
We can find same result using only four multiplication i.e. (x) (x’) (x') (x)
— In this method we can take square of each partial result.
n.
is suppose we want to calculate x7 mod n for some integers x and
- Another example
— Wecan compute that value is as follow :
eee
x)= x2 (x) DD
ree ee
Scanned
a
by CamScanner
FPerypt. @ SY
S. Security (MU
-Sem 8-Comp) 4-9
cr2 Public Key Cryptography
= M3 mod n2
ereptiy
mw bresente
as M3d< Ni, No.3. SMe M is less that each of
X, C* mod q
rolue e =3
Where, p and q are the relatively prime numbers.
Jue called C! mod p=C*™mod
x - p
it ereates
X, C* mod q=c?™-» mod q
Scanned by CamScanner
——
tem eac h use r nee d to cre ate 4 pair of keys. This procedure
In the public key crypto sys
involves the following tasks :
Scanned by CamScanner
(ec Crypt. & Sys. Security (MU-Sem. 6-“Comp) 4-11 Public Key Cryptography
(3) Perform the primary test using Miller-Rabin Algorithm. If n fails the test, then discard
the value of n and go to step 1
(4) If n has passed the number of tests which are sufficient to decide the prime number
then accept n; otherwise go to the step 2.
- When we find the prime numbers i.e. p and q that time process of key generation is
completed by selecting a value of e and computing d or vice versa.
Ex, 4.3.1
private key d
Prime number p = 3, q = 11, @ = 3, m= 00111011 (m-message) then calculate
and cipher text C.
Soln. :
Use RSA Algorithm [Refer Section 4.3]
Step1: Prime numbers p=3, q=11 7
Step2: n=p*q= 33
Step3: o(n) = (P-1)*@-1)=G- 1) *(11-1)
2*10=20
Step4: Select e such that it is relatively a to (n) i.e. ged(e, (n))= :
Scanned by CamScanner
Po LT crypt.& Sys. Sys. Secur
SSeS Security (MU-Sem. 6-Comp) 4-12 Public Key Crpog |
edmod@(n) = 1
3*dmod20= 1
4s (O(n) * i) +1
e
Where i= 1to9
d=7
Scanned by CamScanner
FT cro. & Sys, Security (MU-Sem, 6-Comp) 4.13 Public Kay Cryptography.
Ex. 4.3.2
Calculate cipher text using RSA algorithm given data as follows : Prime numbers p, q a8 7, 17
respectively and plain text message is to be send is 10,
Soln.: By using RSA Algorithm : [Refer Section 4.3 ]
5*dmod 96 = 1
Using RSA algorithm
is (eave)
OF *
wheel? toe 22 ptt i94
d must be completely divisible by ‘e’,
“ eeret = 39¢ - 0823) +1
ae as =57.8
(96 * 4) +1
= 5 =77
d = 77
Scanned by CamScanner
Using RSA Algori
thm [Refer Sect;
on 4.3]
Step1: Pand Q denoted as
@ and b in our Algori
thm
a= 13, b=17
Step 2: =8*b= 13 * 17-991 | Steps, S
o(n) ~@-D*0~)= | te
03 -1e¢7_p
=12* 16= 192 | E
Select e such that itis re i is Yieyj lc
latively Prime to (n) cis given as 19,
%
Scanned by CamScanner
Sys. Security (MU-Sem. 6-Com 4-15 Public K Cryptography
et t. &
192 * 5 «6
éOr tt = 505 =(927 +! _ 60.6
(192 * 7) +1 (192 * 8) +1
= 19 = 70.7 = 19 = 80.8
(192
* 9) +1
me 19. 72!
d= 91
Step6: Public key = {e,n} = {19, 221}
.
Private key = {d,n} = {91,221}
12.
Step 7: Calculate cipher text c for given plain text message
¢ p modn
it
|
Scanned by CamScanner
eS
——_—_—— a. |
Step 3; Select e such that it is relatively prime to $ (a) and less than @ (n). But : US give
e'modo(n) = 1
g = GOMEDAL
€
herei= 110.20
(160 * 1) +1 (160
* 2) +1
* * 7
= 40 = fh ag iO = +1 3770
160*5) +1 ,
= ee S)+t _ 56.52
_ (160*7)+1 me
160* 9) +
- i281 if ay
— (60* 12)+1
17 =113
d = 113
Scanned by CamScanner
0) SMETYPt
Paes the follow ing -
=17 a=,
00%,
| (i) p=7,
Maio
F=11, en
"
47 Me=o5
8 hi (iil) Find the Co
rrespondin 9 ds
for ()) a
Soin. : nd (ii) a
ng dec
i Use RSA Alg
orithm
© = Tis given,
Step5: Calculate d such that
d = 7! mod $(n)
edmod (n) = |
7#dmod20 = 1.
.
ds GO)" D+ x
ere = 1 10 100
Find d such that it is divisi
ble by e,
Consideri = 1 you can contin
ue till d will get integer value,
Q(n) = 20 ande=7
d = (20*1)+1)/7=217=3
-d= 3
Scanned by CamScanner
ET crypt & sys Securty (MU-Sem. 6-Comp) _ 4-18
LE
Lr,,
ns
Step7: — Calculate cipher text message for given plain text message. .
Plain text message given is M = 12 we consider M as i.e. P = 12
d = @a)*)er
: where i = | to 100
((60*1) +1 17)
a = 3.58
dm ust be completely
divisible by ‘e”,
Scanned by CamScanner
———
Public: Key CiCc ryptography
After puttin
putti g value of i. = 15 into above formu
la we got value of d
= ((60*15) +1) 17) =
53
d= 53
25"7 mod 77
It can be represented as
CcC=9
Step 8: Now calculate plain text P required at the time of decryption. Once sender sends 9
to the receiver then receiver can calculate plain text
p.
P = C'modn
= 9° mod 77
P = 25
(iii) Find the corresponding ds for (i). and (ii) and decrypt the cipher texts
-will decrypt
Decryption key for question (i) is d =3 and for question (it) is d= 53 which
the message successfully.
J
Scanned by CamScanner
et Crypt. & Sys. Security (MU-Sem. 6-Comp) _ 4-20
Step2:;) n=a*b=7*17=119,
= -((96*2)
+ 1)/7 = 21.57 yes Step 4:
((96*3) + 1/7 = 48.28 |
il
((96*4)
+ 1)/7 = 55 :
d = 55 . Step 5:
Step 6: : Publici key= {e, n} = {7,
119}
s : Private key = {d, n} = (55, 119}
P72 Pa n ul ate cii pher text
Calc
Message for given ?
Plain text messa
text denoted as P= 10(m deno
ted as p)
C = Pmodn “ase
|
o i
| a
Scanned by CamScanner
SLY. & Sys, Secours,
arity (MU Sam, §-Comp
)
|
i .
| Using RSA algorithm
€ = 7. is given.
Step5: Calculdate
such that co
d = e'mod o(n)
edmodd@(n) = 1
7*d mod 20 = 1
at (> (n) * i) +1
€
d = QOKD#
7 ee ja;
20+1 21 ‘
nd5 d = 3
Scanned by CamScanner
sage plain text M = 5.
Ex. 4.3.8
te
; n two pririm e nun mber
yption algorithm to be used is . RSA. Give s 11 anes ‘and 3 anand pub
\ | Th € encr
the ciphertext
e given . plaintext is 7,
| - key (8) isi 3. Calculate the decryption key and Calculat
Soln.: -
le Step2: nea*b=11*3=33
ged (e,20) = 1
ged (3,20) = 1
e=3 is given.
Step5: Calculate d such that’
d = e' mod
9 (n)
edmod@(n) = 1
Scanned by CamScanner
3 *d mod 20 = |
d = G@si+1
Find d such that it is divisible bye
Where i = 1to100
qd = GO*iet where i= 1;
3
d=
~J
“Step 7: Calculate ciphér text message for given plain text message-
Plain text message = 7
c= P* modn where P<n
= 7 mod 33
= [7° mod 33] * [7 mod 33] * mod 33
= [49 mod 33] * [7 mod 33] * mod 33
Ex. 4.3.9
of ‘e’ and ‘d’ using RSA algorithm
d ‘Q’ = 19 find the value
For the given parameters ‘p= 3an
and encrypt message ‘M' = 6.
: ;
Solin. :
19
num ber s ate P = 3 and Q= 19 we are denoting P & Qasa=3, b=
Step 1: Prime
Step2: n=a*b=3*19=57
Scanned by CamScanner
i |
O(n)= 2* 18 =36
(n))= 11 SO< Hn) xz
Step 4: Select e such that it is relatively prime to (n) i. geal lh
ed mod
@ (n) 1
7 *d mod 36 = 1
Scanned by CamScanner
Public Kay Cryptography
’ . ¢
at e pl ai n toxt P. Once sender sends 9 to the receiver then receiver can
ow calc ul
n text p:
— calculate plai
p = C’modn
s vosmwws_
e—=r—:U“
“4 Knapsack Algorithm
—
should take the item as 2
in O-l Knapsack, items cannot be broken which means the thief
ng it as 0-1 Knapsack.
whole or should leave it. This is reason behind calli
the value ofxjcan be either 0or1, where other
Hence, in case of 0-1 Knapsack,
constraints remain the same.
0-1 Knapsack cannot be solved by Greedy approach. Greedy approach does not ensure an
optimal solution. In many instances, Greedy approach may give an optimal solution.
statement.
The following examples will establish our
Example 1
n
- Letus consider that the capacity of the knapsack is W = 25 and the items are as show in
the following table.
“Profit| 24| 18 | is | 10
“Weight 24 | 10 | 10 | 7
~ Without considering the profit per unit weight (p/w,), if we apply Greedy approach to
solve this problem, first itemA will be selected as it will contribute maxsmum profit
among all the elements. ;
Scanned by CamScanner
ene & Sys. Security (MU- Sem.6-Comp) _4-2
6
— After selecting item A, no more item will be selected. Hence, for this
Biven sq aw:
‘total profit is 24. Whereas, the optimal solution can be achieved by Selecting j item at
C, where the total profit is 18 + 18 = 36. “bey
Example 2
— Instead of selecting the items based on the overall benefit, in this example the; tna,
selected based on ratio p/w;. Let us consider that the capacity of the knapsack sy.
;
and the items are as shown in the following table. 4
ee
: 280 | 120
40 | 20
7 6
—- Using the Greedy approach, first itemA is selected. Then, the next item Bis
Chose
Hence, the total profit is 100 + 280 =380. However, the optimal solutio
n Of this instays
can be achieved by selecting items, B and C, where the total profit is 280 + 129
-= 40)
— Hence, it can be concluded that Greedy approach may not give
an optimal solution,
= To solve 0-1 Knapsack, Dynamic Programming approach is requi
red.
4.4.1 Problem Statement
We can express this fact in the following formula: define efi, w] to be the solution
items 1,2, ... , iand the max;mum weight w.
|
Scanned by CamScanner
Public Key Cryplograpny
following inputs ;
The algorithm takes the
Ww
weight
axymum
The m
The nu
mber of items 1 Wa>
eee Vim and w = <wy, W2 jana
o sequences y = <V pp Ve
_ The (v, w, n, W)
sack
pyna mi-0-I-Knap
gto Wdo
& w =
fo. wl =?
meefai. n0) = 0
eek to W do
ifw; éw then
then
i-l, wi)
. ify, + ef
off, ww
efi, w] = ¥i +
w]
geeefvl= ol) oad
ear
Lion
g
e a,
st ar ti ng at e[ m, wand tracin
e,
d from the tabl
n
efi, ¥) = ° S
ass
n be d e d u c e
s to take ca
_ The set of item es came from. e
s w h e r e th e op t i m a l va lu
lu ti on , an d w e continue —
packwar d the so
th en i t e i m i s not part of w e c o n t i n u e tracing with
l, w], and
_ Ifeli, wl = cfi- iis pa rt of the solution,
te m
Otherwise, i
with cfi-1, 1
cfi-1, w-W]
;
Analysis entry
44.3
(n + 1) .( w + 1) entries, where each
as table ¢ ha s
al go ri th m ta ke s 8(n, w) times
This
compute.
requires 6(1) time to
ngth fro m the ass ump tio n that the discrete logarithms cannot be
Proble: m, Itderives the stre
i
i
=
Scanned by CamScanner
PB cont. & Sys. Secur:
Thus the private k
4. 4 5iF Encryption
453 ElGamal E
|
Suppose sendet
Choosing a 8enerator elemen
6
t Ps (p, & ¥)» then:
5
This number i — Sender represe:
must be betwee
n 1 and p — 1, but
A o Itisa senerator of the
cannot be any number, ;
'
_ Toencrypt the
, multiplicative group of
3 integers modulo p- — Theencryptior
every integer m co “prime to p, there is This Meany by t|
an integer k such that g= |
o Randomly
For example, 3 is gene Tator of group 5 (Zs
= (1, 2, 3, 4}). o Compute
. Nf 3" | 3"mod 5 Cc
1 Cc
3 4.
= Send the cipt
iA 2 9 4 | - Referring to
4 | 3 27 2 encrypted as
4 | 4 81 |
o Randon
o Compu
- Choosing the private key. The private key x is any number bigger than 1 and smalic
than p-1.
— Computing part of the public key. The value y is computed from the parameters p, 2
~ Send the ci
the private key x as follows :
45.4 ElGan
y = g*modp
— Obtaining Public key. The ElGamal public key consists of the three parameters (p, g.¥) | To decryp
— For example, suppose that p = 17 and that g = 6 (It can be confirmed that 6 is a gent 2 Com
, an 7! 71,5
of group Z;7). The private key x can be any number bigger than | and smaller than
10 os
y = 6° mod 17=7
Scanned by CamScanner
-
“ws the private key is 62 and the public key is (17, 6, 7).
-
the equivalent
The generation of an ElGamal key pair is comparatively simpler than
RSA. But the encryption and decryption are slightly more complex than RSA.
rocess for
P
elGamal Encryption
public key is
suppose sender wishes to send a plaintext to someone whose ElGamal
u
y), then -
(p» &
ers modulo p.
5
endet represents the p Jaintext as a series of numb
a number modulo p.
crypt the first plaintext P, which is represented as
To enc
follows:
cry pti on pro ces s to obtain the ciphertext C is as
The en
r k;
ly generate a numbe
° Random re -
o - Compute two values C1 and C2, whe
Cl = gmodp
C2 = (P’y‘) modp
nsisting of the two separate values (C1, C2), sent together.
send the ciphertext C, co {[is
l ke y ge ne ra ti on ex am pl e given above, the plaintext P=
Referring to our ElGama
encrypted as follows:
, say k= 10
o Randomly generatea number
where —
o Compute the two values Cl and C2,
C1 = 6° mod 17
"
J
Scanned by CamScanner
encrypted as follows -
© Randomly Senera
te a number, say
© k=
Compute the two va
lues Cl and C2, 0
here—
i Cl = 6 mod 17
C2 = (13°7") mod 17=9
Send the ciphertext C = (C1, C2)
= (15, 9).
4.5.4 ElGamal Decryption
_
To decrypt the ciphertext (C1, C2) using private key x, the following two steps are taken:
oC ompu te the modular inverse of (C1)* modulo p, which is (C1)*, generally referred
to as decryption factor. :
© Obtain the plaintext by using the following formula
C2x(C1)* modp = Plaintext
Scanned by CamScanner
Syllabus
Key Manage
third party. p
: Ie is Nes. -
Scanned by CamScanner
L Module 2
Key Management
Techniques
Syllabus
Key management techniques : using symmetric and asymmetric algorithms and trusted
third party. Diffie Hellman Key exchange
algorithm.
Before discussing the key generation and usage let us first discuss what is Key.
5.1.1 Management
parties and
- The main aim of Key management is to generate a secret key between two
store it to prove the authenticity between communicating users.
generation, storage and
- Key management is the techniques which support key
maintenance of the key relationship between authorized users.
a broad survey of the
- The purpose of this unit is to give idea about the issues involved and
various aspects of key management and distribution of keys.
- Key management plays an important role in cryptography as the basis, for securing
ctyptographic goals like a authentication,
confidentiality, data integrity,, and digital
signatures.
- It is not the case where communicating parties are using same key for encryption and
decryption or whether two different keys are used for encryption and decryption the basic ;
Purpose of key management is key generation, key distribution, controlling the use of
keys, updating, destruction of keys and storage, backup/recovery.
Scanned by CamScanner
[ee Crypt. & Sys. Security (MU-Sem. 6-Comp) __5-2 Key Managemen tech
ag « a mic pt aS
symmetrici as well
known
Key can generated by using well
be
— prthere are NB
cryptographic algorithms like
Rive: SA), Diffie Het
st Shamir Adleman n and(Rdecryption of data
exchange algorithms and can be used
later for encryptio
session key is
5.1.2(A) Symmetric Key Distribution using Symmetric Encryption
connection, tre
nothing but symmetric key and the process between two parties that exchanges €S th the
called as symmetric encryption. by
— Ifhace
two persee eef . . i with
ith each other viai Messages or exchange dal
|
Scanned by CamScanner
i -Sem. 6-Comp
(MU —==—= Key management techni ues
N ho sts communicate each other than [N(N ~ 1)\/2 keys are required.
fe i
une tackeT succeeds to gaining access to any one key then other related keys will be
when at
opened tribution centre is responsible for distributing keys in the form of pairs of users as
res distr
w yery Use shares a unique key with key distribution center
.
mporary Key communication is encrypted between end users, This temporary key
as ee key.
sed for some logical duration in between connection like, in frame relay
port connection etc. after that session key will be discarded.
ses same networking facilities which have session key provided by key
yser U enter. Session key is in the form of encryption. Master key is also provided
gjstribution e
spution Center (KDC).
by Key Dist system.
Master key to end user or
so KDC shares iat
bution in
gach user bas one master key shares with key distribution centerthat can be distri
some fashion.
Cryptographic
Data protection :
Session : Cryptographic
keys protection
Master No Cryptographic
keys protection
A
Scanned by CamScanner
r So X has mater 7
Fins also
isa its
+ own Key K, that is Known
Mater key K, shares only itself and the key distribution
with key distribution Center, andy
center.
:
j . Key distribution
Steps
Authentication steps
i
| Fig. 5.1.2 : Key Distribution Scenario
So following Steps are required
:
1. X sends request for session key to the KDC
whic h Protect the Connegti. |
between.X and Y. The mess . ‘
age incites the identity of X and y and a tig |
On |
Scanned by CamScanner
ee Crypt. & Sys. Security (MU-Sem. 6-Com 5-5 Key mane
jement tachniquaes
- For example : Each local KDC is responsible for small area like single
building or
single LAN.
If two different domain wants to communicate or share some key that time local
oem KDC
connect or contact with global KDC.
The hierarchical approach having three layer or more layer,
Security
service
Host 2
a a
Scanned by CamScanner ;
a — : > & sys
; : 4 C g
Ask for KDC for session ity | fet
3. KDC distributes session key to both hosts | we vs° e
4. Buffered pi packet transmitted. . | r Ie
site ¥
pa ne
- In Fig. 5.1.3, Host wants to established connection with Another hos " 2 - acces
ak, * en '
the request packet the KDC he Ye, pin £9;
- Key distribution center provides the session key to the host USiNg the en . electro™
key also provide to the another host. TY Ption t. | air B
4 ve i
— KDCis encrypted with master key only with the host, j a reributio” ;
5. Decentralized key control i is
' Application
' o PP”
- This approach requires that each system can communicate in sec
. . ’
.
i ¢ are SO
ure Mariner
is need to use multiple master’s keys for configuration, 50 then |F BS Ther
.
- Full decentralization is not possible in practical for large “, area netw ork. "" This prop?
Key:
- So session key will be created as follows : i: eight t
: 1. X sends the request to Y for session key including with or j
iginal Message M,, following P'
2. Y replay to'the : X with original encrypte me
d ss a using shared
“SSage
replay attach with session key selected of f(™M,), mater key. Thy
another M,.
3. Using the new session key x returns f(M,
) to Y.
ID, || M,
@ E(KmlKs||1Dx][10,|)F(M,))]
F(M.) ©
@ EK, |IF(Mg))
Fig. 5.1.4 : Decentralized Key distribution
« . ; ; a
ae
required,
* ninal contains at most (n — 1) master key as multiple session keys®
Scanned by CamScanner
ka Crypt. & Sys. Security (MU-Sem. 6-Com ) 5-7 Rev mannoanank eannmeaae |
2, File Encryption key : Used for encrypting file which stored for publically available
or accessible on the locations,
3. PIN Encryption key : PIN is personal Identification number. It is mostly used for
electronic transaction like banking or €-transactions.
There are some limitation to use any key for that purpose of uses tag with session key.
This proposed technique is used with.DES in that it used 8 extra bits in each 64 bit DES
key. :
That eight bits are reserved for parity checking from,the key tag. That bits are used for
following purposes :
Control Master Session
ke
Control Master
r
Encrypted
vector ey ¥ vector key Session key
Fig. 5.1.5 : Control Vector Encryption’ Fig. 5.1.6 : Control Vector, Decryption
- All the time of key generation control vector is cryptographically coupled with the key.
'Pling and decoupling process can be given to Fig. 5.1.5.
* ‘- 1: Control vector is going through the hash function that produces some value
Sagth of that value is equal to the encrypted
key.
Scanned by CamScanner
ll
_5-8 Key management techn, |
EP crypt. & Sys. Security (MU-Sem.6-Comp)
- Step 2: 2: Hash
Hash function
func! reduces or maps the value from large . input range to the smay) inp : ar —tyPt
Crypt. & Sys.
- i 2. Q gener,
Pe tke number of range is 1 to 100 that can be reduces
by 10% so range is now | to ly ; _ toP,
roximately. /
= ste 3: ihe that Hash value is then XOR with the master key.to produte some Op, a, hon:
This output is used as for key ingut, | jf ; —_
- This key input is used for encrypting the session key thus, i
Hash value = H=htcv) , At the end |
Key input = M,@H from eavesd
Cipher text = E([M,@ H], §,)
, ‘ 4 2
Where, M, is the master key and S,is session key. For plain text we can TeCove,
session key using following operation:
D([Mx@ H),E([M,@ H],S,))
— Recovering of session key we use both master key that user must =
With Kpc and
control vector. Because of that link between séssion key and. its
contro]
Vector i
maintained.
— ,
There are two main advantages of control Fi
vector over the use of an 8 bit tag.
a: .
1, There is no restriction for control vector to its length. es t K
2 eee tay
2. Itis available in clear form at all stages of operation.
i, F Sends
5.1.2(B) Distribution of Symmetric none N,
Key (Secret Rey) using Asym metric
Enotyp tlon 2. Qsends
(1) Simple Secret Key Distribution nonce N
Scanned by CamScanner
- El
. m.6-Comp)
(FT cop t, 8& Sys.Sys. Securi Securly (MU-Se 5.9 techniques
Koy management
2. Qgenerates a session key K, and enc using P'sP’ public key (PU,) and transmits
“oP. typteted d using
usj
p decrypts the session key K, s by DY using & jits own privat
:
e key. Now both P and Q
suaw Kp
a
4. P discards public/private key and Q discards P's public k
— rae c key.
K,. The communication ion isi secure
At the end of communication both P and Q discards fj
dropping. The communication b ecomes unsafe fro m man-in-m
j iddle attack.
from eaves:
ooQing
4
es
: Anitiator 4
Scanned by CamScanner
d
Key me
managementmiSchnig
eT cy
:
n of Public Keys
5.1.3 Distributlo keys :
public
distribution of
Following techniques are used fo r the
1. Public Announcement
2. Publicly Available Directory
3. Pul
3. Public Key Authority
4. Public - key Certificates
4. Public Announcement
her key tgbe
as RSA, any user can send his or
In a public key cryptograp hy, such
own in Fig. 5.1.8.
other user or broadcast it to the group as sh
— This type of approach is having a biggest drawback. Any user can pretend to be ate
Pand send a public to another user or broadcast it.
— Until user A has got this thing and alerts to other user, a ffstenider 1si able to read
encrypted messages for user P,
2. Publicly Available Directory Steps
Tie Ps
- Adynamic publically available directory is used to achieve the security. Maintenzar’
and distribution of public directory is controlled by a trusted entity. 2. A;
- This technique is explained as follows and shown in Fig. 5.1.9. ke}
pul
' (a) A tusted entity maintains a directory for each user as < name, public key >. the
(6) Each user has to register a public key with the directory. » PP,
|
(c) A user can replace the existing key with a new one at any time for any patton enc
reason, ide
i]
4&5 (
It is more secure than public announcement but still having some weakness * |
hacker can obtain the Private key of directory or tamper with the information ie
directory. |
Scanned by CamScanner
AOESIO
D S’ ~S DIS
(ey Crypt. & Sys. Security (MU-Sem, 6-Comp) ‘
5-14
Kay management techniques
Pubtio kay
directory
PUp PU,
p
Q
Fig. 5.1.9 : Public y Avai; lablene Di Directory
,
ority
3. Public’ Key Auth
Steps
authority for public key of Q.
1. Psendsa time stamped request to
e. A mes sag e is € ncrypted using authority’s private
ted mes sag
2, Aauthority sends an encryp , Q’s
ryp t it by usi ng aut hor ity ’s pub lic key. A message includes
key, so that P can be dec by P with
be use by P for the enc ryp tio n, the original request se nds
’ public key which can
the time stamp. |
on and sen d an enc ry pted message to Q. An
en cry pti
3. P uses Q’s public key for an (N,), Which is used to
encrypted message contains the Id entity of A (ID,) and nonce
identify the transmission uniquely.
key fro m the aut hor ity simi larl y like 1 and 2.Now P and Q start
4&5 Q retrieves P’s public requiring.
steps may be
the communication. Two additional
Scanned by CamScanner
s. Securi (MU-Sem, 6-Comp
Scanned by CamScanner
5 1.4 K ey Seneratig,
- After successful generation of key, it should not store on multi-user machine unless they
are in encrypted
or secured form (e.g., temper-resistant security module) (name of the
__ Physical storage device).
- Itis important to define the key storage for data management of cryptographic key; the
Proper use of.the function depends on the key type, protection requirements and lifecycle
stage, There are different function provide by key storage ‘ .
I. Operational Storage :
2. Backup Storage
3. Archive Storage
Scanned by CamScanner
ET cry & sys. Seourty MUSem.6-Comp) 5-14 Key SITET
a
1. Operational Storage
— If the key isrequired for operational purpose that keys can oetaken fromm “Pera, |
‘
by strong physical and logical security such as dual control and rigorous accesg lop, |]
|
2. Backup Storage
~ In case of hardware or software failure if keys are lost then there should be Sty |
back up mechanism required to recover the lost data or corruption of theOperating
storage. The backup of only the important keys aré stored.
— Finally, the backup determination depends on key usage whether the applicatio, ‘
important to use the key.
3. Archive Storage
1A Key Ariifie is the term used to recover the large historical encrypted data.
The data backup storage keeps the data of today whereas
archive Storage address
the data management of tomorrows or overcome the future
challenges of data storag:
management.
Scanned by CamScanner
64 a(é) Key Validation Hayy repintepeneternet (oir brit pet
ion pertormice’
A function performed oron a cryptographicic key j
key in order to compute a new, but related key
for the same PURPOSE:
515 Importance of Key Management
SEARO
Scanned by CamScanner
OQ, —————————
ep Crypt.
pt. & Sys. Security (MU-Sem. Kay manag ement
L6chni
6-Comp) 5-16
l e example.
Q.5.23
Meek | Illustrate Diffie Hellman key exchange algorithm wit h e u i t a b
(Ref. sec, 5.2) , in»
thm, prone f MAN
’ 8 2.4 In what way, the Diffie Hellman key exchange #199
4
hare y
esh. | ae
3, Ramesh sends this R t o Sur number b, and calculate
lar ge ra nd om int ege r
ther secret
4, Suresh independently sel ects ano
.
S such that. —
$= q’ modp
.
5. Suresh sends the number S to Ramesh
using Ry = S1 mod p '
6. Now Ramesh is calculating his secret key by
7. Suresh is calculating his secret key S, by using
S, = R’modp
munication called as key
8. If Ry = S_ then Ramesh and Suresh can agree for future com
agreement algorithm.
9, We have Ry =S, = K hence proved. (K is called symmetric key)
Scanned by CamScanner
For example
1. Ramesh and Suresh are agree on two large prime numbers say p
7
= (17x 17X17 x 17x 17x 17) mod
y
R =1
Scanned by CamScanner
‘ arge numb er 4 i.e. b = 4
and calculate 5 such that ,
= q mod p=17' mod p cnt $ Ss
suresh is c
= 17 17% 17. 17) mod 7
S = 4
.3. Suresh sends numberS to Ramesh
wR. =5
* Ramesh now calculates it’s Secret
key Ry as follows :
\ future.
Ry = S" mod p = $° mod p = 4° mod 7
Ex. 5-2-3
= (4K4xK4x4 mod7
4x)4% | prgenerator o
Ry = 1
0 show tha
7. Suresh is calculating his secret Sx as
follows : '
q@ WA has F
Sx = R’modp=1‘ mod7
qi 1 has F
Sx = 1
| re) Calculate
8. IfRy = S, then Ramesh and Suresh can agree for c
future communication. i
soln. :
ise
Ex. 5.2.2 i To
| ae
Solve p = 353 and q=3, a=97 andb=233,
°
In gene:
Soin. : Q(n).
Scanned by CamScanner
If generator g => And n or
p
: 11
(i) Show .
that 2is primis using
9 Difp; fie y
Ve root ‘ of 44 Silman algSOori
rithm solve the following :
- (ii) If B
has public 8 key
key 3 What
atjis B's Pr
ivate
(iv) Calculate shar key?
eg Secret key
Soln. :
4
(i) To show that
2 is Primitive
root of 11
As mention in (i)
a=2 and n=11
Calculate $(n) i.e. (11) = { 1 to 10} = 10
According to Euler’s theorem
*) = {modn
2° = 1mod11
1024 1 mod [1
ie 1024imod11 = 1 and
Scanned by CamScanner
TE lll
Kay MANagEMeNt tocy,arity
a
Imod 11 = |
Hence 2 is primitive root of 11.
(ii) - ‘A’ has public key 9 then private key Is
b 3
S = q modp=2 mod 11
S = 8 .
Scanned by CamScanner
secret no.
and ®xchan
gs n
(i) Whatis co
mmon Secret kay
(ii) What are th 2
eir Secret nu
mbers rs >
(iil) Can in
truder m ga
i in any know
and 11. If yes, » sho Show h Owledge fro ™ prot Oc
Soln.: owe I Tun ifi he sees P, | 9 of and two keys 6
According to Di
ffie Hellman al
gorith
Let us say A as
~*
Ramesh and B ™;
as Suresh
Also p = 13 and g =2
Here in our example
we are denoting g as
q
‘Pps
, 13, . q’'= 2
Suresh selects another large random number b = 11 and calculate § such that
S = q’modp [q=2,b=11,p=13]
= 2" mod 13 "
S=7
Suresh sends $ to Ramesh
ws :
Ramesh now calculates it’s secret key Rx as follo
Rx = s'modp [S=7,a=6, p=13]
7° mod 13
Rx 12
Scanned by CamScanner
oo”
8)" crypt. & sys. Secur MU-Sem.6-Comp) 5-22 == —S——__Key mana nal Nite
"i
Sx 12
(i) Shared secret key of Ramesh and Suresh is
Ry = S,= 12 [A and B = 12]
R = 12andS=7
Scanned by CamScanner
, Following are the valucs available with Ramesh, Suresh and intruder m
Ramesh intruder m Suresh §
R=12 R=9,8=12 $=7
case 4:
amesh sending his R = 12 to Suresh but intruder m sending his own R = 9 to Sur esh
R
= 12. Suresh sending his S = 7 to Ramesh, here again intruder m sending his own
which values
12 to Ramesh. In this case Ramesh and Suresh doesn't aware that
yalue of 5 = use of his interception].
ding and receiving [Intruder m sending his own value Beca
wpey afe $8
rollowi ng are the new values with Ramesh, Suresh and intruder m.
Intruder m Suresh
Ramesh
gz12,S=12 R=12,S=7 S=7
R=9
ulating secret keys-
on above values Ramesh, Suresh and Intruder m calc
Based
case5?
Ramesh Intruder m Suresh
p= 13 a=8,b=6,p=13 p=13
Rx = s’ mod p
=3 S,=3
S,=R° mod p
= 12° mod 13
=1
happe ning ? Rame sh is think ing that val ue of his secret key is 1 and Suresh
- Think what is
also thinking that value of his secret key is 3.
aid
Scanned by CamScanner
>
& Sys. Security (MU-Sem. 6-Comp)
(ey Crypt. _5-24 Key management L€chnig
ut
— During real communication between Ramesh and Suresh intruder m sending his oy
secret keys to Ramesh and Suresh. If Ramesh sending his secret
key RK = | to Sing
because ofroacelneine eae attack. Intruder m sending his secret key RK = 3 to Stns,
In return Suresh is sending his secret key SK = 3 to Ramesh, intruder m sending his
Srey
key SK = 1 to Ramesh.
Chapter End;
Qdy
Scanned by CamScanner
Syllabus
| Cryptogr: aphic ha sh
HMAC, CMAc, “tions, p
Scanned by CamScanner
tographic Hash Functic
4
ey | Hash value h
es. H — 1Y (fixed length)
Ha sh Function
ryptographic
.
Bl oc k Dia g ra m ofC
Fig. 6.1.1:
for to im pl em en ti ng cr yp to graphic Hash functic,
used
— Cipher Block chaining is mostly hash function.
pular cryptographic
whirlpool is another po padding is done.
is app lie d on ori gin al message when
thm
- Cryptographic hash algori s.
fix var iab le len gth inp ut is added like 1024 bit
- Inpadding lue h.
alg ori thm is app lie| d so it creates a Hash va
— After this hash function
Hash .
6.1.2 Applications of Cryptographic
It is mostly
t adap tabl e cry pto gra phi c alg ori thm is’ the cryptographic hash function.
Mos .
Int ern et pro toc ol and sec uri ty app licatio. n.
used in
:
used in Cryptographic Hash Function
Following are some application which are
.
1. Message Authentication
ice that verify or checks the integrity of
— Message Authentication is a nothing but serv
that message. .
is exactly
- Message Authentication checks that the data received from sender which
modification wil
same as sent to receiver. (i.e. content of the data will be same no
have done or insertion deletion or updation).
— Some authentication provides a mechanism that checks identity of sender is valid0
not.
— When Hash Function provides a value, which is used for message authenticatot
purpose then that value is invoked as Message Digest (MD).
———
Scanned by CamScanner
helps
es in wh ic h a ha at code can be
ny approach
Fi g- 6. 1. 2( a) , describes how ma
The
ssage authentication.
to provide the me ReceivereB
Sender A ———E— e
E(K(MI|H(M)I)
—o- LO
|
i Compare
= K H(i) ‘ Hash
(Key for
message (Key for junction
Decryption)
encryption)
Hash function
Fig. 6.1.2(a)
t en cr yp te d us in g sy mmetric encryption.
e tha
with hash cod age is come from
Message add
es the same secret key, A mess
(a) d receiver B shar at ha sh co de provides a security OF
sende r A 2 ”
chang e d . A f t e r th
gender A th at must not be
n.
u thenticatio
+
ti ve a
structure t0 ac Receiver B
sender A
Compare
E(K,H(M))
@)
Fig. 6.1.2(b)
on . Th is m i nimizes the
encrypti
d us in g. s ymmetric key
te
Hash code is encryp s that don’t requ
ired any confidentiality.
application
Joad for those A
Receiver B
sender
eoy
=
H(MI|S)
Fig. 6.1.2(c)
ca ti on on ly us e hash function. In
ti
for message authen communicate wi
th
(c) No encryption required ke y W
‘w he n th ey
ares the same secret
this process two person sh
each other.
th e or ig in al me ss age M and S
value over addi ng
Sender A calculates the hash
e to message M.
and attach the result of hash valu
ed
Scanned by CamScanner
Cryptographic Hash Fyn,
the hash value toChee .
Because receiver B processes S and it can recalculate I .
pleceiver B
Sender A
" 9-2
K
H(MI||S)
E(K[MIJH(MI|S)))
Message Authenticatio,
me, 6.1.2(4): Simplified Examples of the use ofa Hash Funetion for
(c) is encrypted with eny,,
(d) Confidentiality is added to this process oe
Message concatenate with hash code.
5. "Papas (b) has more advantage over process (a) and process : ( d) which encrypts
Pts the
whole data or message.
_7— Minimum calcul is requite
ati d in on
process (). saationigachieved. Ti:
~ Using Message Authentication Code (MAC) message authentication is achieved. This
Scanned by CamScanner
rity (MU-Sem, 6-Cor 5! -
Coyptogranhin piaal
Cryptographic anh Pippin
" : a
when user enters a password the hash value of the paseword ia conmpared with the
purpose.
‘i stored nash value for verification
Has f function is also used for intrusion detection as
well as virus detection
- one system stores the H (F) for each file.
Receiver B
—
Sender A
Compare
-D
Fi g. 6.1.3(a) ? Simplified
Example of Digital Signatures
Receiver B
on
uffei 4 PUa
Y Compare
“ea O
E(K[MIIE(PRa, H(M))
of Digital Signatures
’ Fig. 6.1:3(b) : Simplified Example
A
Scanned by CamScanner
of
val Ue A) ig. 1 Sformin
& ini put message m into a fixed size
in Ction string (Ca
, lley
@Pplie. d on . hash function and it is de , ay, |
input Message noted by H. Here h is the Output of h a
Has, fies m, at ih. ant
h = H(m)
Ction Protects
the integrity
Message, then of the message. If attacker tries to modi
the contents of Origin f
applying Hashi
ng algorithm.
al message may hangeded iitt can
chang can behe jo.‘denti
jyin| "eh,“|
The most popular hashing algo gi.
Here, there rithms are MDs
. are two Simple hash and Shi, C
Principle. func tion, all hash functions are Oper.
ate Using itn ny
(1) The Message
file is like a si
m ple input it open a seq
When uence of n-bit blocks,
input is Proces
sed o nly one block at
the given time in iter
&enerate an n-
bit hash functi ative Fashio, ey]
on,
The simple hash
function is the bi
t-by- bit XORing done of eve
This can be shows ry block.
the following ways
|
CH; = isi” bit of hash code, 1 <i<n
m
|
= mis the number of n-bit blo
ck in the input
|
‘By = i” bit inj block
|
® = XORing operation
When this Operation is perform it Pro
_
Scanned by CamScanner
ctions
Seyateqranhic Haah Fun
when 128-bit
78-bit hash v alue is used, rather effectiveness of 2 -- 128 the b i on thr
funetien
" ¢ hash (13
an effectiveness of
wpes of files of Message has
performance j
;
qo improve t
re the matter
I lance, Use simple
blo ck is ways
pro ces i.¢. one-bit circular shift, and alse
sed
‘ + MO Est?
(a)
ween block and hash value.
(b) Perform the XOR operation in bet
z
+
>
®
®
@
Zz
a
=
i
ypted
Next,
e me ss ag e plu s has h’ code to produce the encr
t the whol
Using CBC mode encryp
message B,, B2, By. eee Byet
Scanned by CamScanner
OQ} Crypt. & Sys. Soc (MU-Sam. 6-Comp) 6-8 LN
Crypt
plographic,4 a
fash
4. Itis infeasible to find two different message with the same has valuue.
6.2.2 Characteristics of Simple Hash Function
Scanned by CamScanner
Here.
. the CoOl
llli
issi
; on ecurg
if
For region,
undesirable,
Scanned by CamScanner
ay
oes
ker Crypt. & Sys, Security (MU-Sem, 6-Com ; Cryptographic Hash F,,,7
4. Accomplish 2™ any random blocks ; for any block A, compute E, (A, HP, .
accomplish the additional 2"? any random blocks; for any block B,5: Sig
(B, C) where the D, is the decryption function like to E,. ‘
5. Place on the birthday paradigm, along high probability there will be A ang By
E,(A, HFy_2) =D, (B, C).
6. From the message M,, Mp, Ma,... My-2 A, B, this message has the hash Code ne
and used the prevent encrypted signature.
— This mode of attack is called as meet-in-the- middle-attack.
— The number of researcher are proposed insight intended to strength then the bag; thy
chaining approach.
— Using example of Davies and price are describe change.
HF; = E, (M,, HF,_;).® HF,_;
another change proposed the
— It was developed by Ron Rivest. This algorithm takes an input of arbitrary length aaj
128 - bit message digest is produced. The input message is produced in 512 - bit blocks,
Padding bits Massage.
(1 to 512) (n mode2”)
ff} L* 512 bits = N*82 bits |
# . |
i 7 n bits : >|
” Message
lees
i
Boas
Moat.
Sd
4 e e
Mi, Heeob
ae
eee
a
NE
men te Nie bucin fh cea deviant at
IV 9} MDs.
Ty] 128 rebits MDS
7128
p= oe
bits — MDS 7128 eee Bebits “MDS
— }——> 128 bits
128 7 Ww, es cy, bo cy, , massage
digest
Fig. 6.3.1 : Detail steps of Message Digest 5 Algorithm
Scanned by CamScanner
1, & Sys. Security (MU-Sem. 6-Comp ryptographic, Haah Functions
(5) Output
e Digest Algorithm
Fig. 6.3.2 : Steps MD5 Messag
length of
is padd ed to mak e the length of message is 448 mod 512. The
The message of 512.
m e s s a g e 18 64 bits Jess than an integer multiple
the padded length of padding
in g m e s s a g e co nsists a single 1-bit followed by 0 bits. The
The padd
n 1 to 512.
bits is in betwee
Length
4 (2) Append ab ove step 1. It is appende
d
p p e n d e d to th e re su lt of
message is a
64 bits of original
s to most significant byte.
-
as t si gn if ic an t by te
such that le
of 512 bits.
elds a mes sage of integer multiple
The output of step 2 yi is L * 512 bits.
ng th of expanded message
eee M,-1 - The total le
= As M,, M,, axe M,
7
4 (3) Initialize MD Buffer
buffer is
is use d to sto re the int erm ediate as well as final result. A
- A 128 - bit buffer
R, S.
represented as four 32-bit registers as P, Q,
P = 67452301
Q = EFCDA1389
R = 98BADCFE
S = 10325476.
Scanned by CamScanner
wl
ey Crypt. & Sys, Sec
urity (MU-Som. 6- Comp) 6-12
— Each round takes input 512-bit block, processed it and produces 128 bit outpy, th
output of fourth round is added to the first round CV, to produce CV, , tig
addition modulo 2™, .
128
CVe
Fig. 6.3.3 : Four rounds of MDS
algorithm
Scanned by CamScanner
nny
is Produced
ay a output
Syllabus Topi
c : SHA-1
- Padding means addition of bits to the original message. To make length of origi
massage to a value 64 bits less than multiple of 512. The message is padded to make
the length of message 448 mod 512.
Scanned by CamScanner
intege r multiple of 517 h
me ss ag e is 64 bit s less than an
ed
- Tielength of the padd by ™
of a single 1-bit, followed i
padding message consists
between 1 to 512.
length of padding bits is in
(2) Append Length
of or ig in al me ss age is apperg,
— A block of 64-bit is appended to a message. 64 bi ts
adding).
to the result of above step 1 (Original message + P te.
by
fican t bytes (0 m os t significant
— It is appended such that least signi
(3) Initialize MD5 Buffer
5 well as final result. The buffer ;.
the intermediate 4
- A 160-bit buffer is used to store
represented as five 32-bit registers.as P, Q, R, Ss T, as-
p = 67452301
Q = EFCDAB89
R = 98BADCFE
§ = 10325476
T = C3D2E1FO
. Fir st fou r reg ist ers are sam e as MDS. These five register
— It uses a big-endian method
as,
P, Q, R, S, T are represented
p = 67 45 23 O1
.
Q = EFC ABD89
R = 98 BA DC FE
s = 10 32 54 76
T = C3 D2 El FO
(32 bit 16 word) Block
(4) Process Message in 512-bits
as shown in Fig. 6.4.1. These rounds
— It consists of fo ur rounds of 20-step each
F2, F3, F4 have similar structure. Thes
e rounds used different
referred as Fl,
primitive logical function.
produced 160 bit output. The
Each round takes input 512-bit block processed it and
output of fourth round is added to the first round CV, to produce CVi41:
Each round also uses an additive constant k,, where 0 $ + $79.
K, = 5A 827999
Scanned by CamScanner
K, = GEDOEB AI
K, = 8FIBBCDC
K, = CA62C1 D6
output
(5) g all L 512 bit blocks, the 160 bit message digest is produced as
After processif
output.
where the chaining
sion function uses a feed forward operation
the . SHA Vqcompres
input 0 f the first
round is added to the output obtained (last step)
.
after
variable C a steps to produce the next chai ning variable CVq+1 as shown in
execution -
rig. 64-1. CV,
160
al s 32
FikW [0.19] 02
B
ST FoJK,W [20...99]°*
>= 5: 20 steps
Faw [40.58]
e220
Van
Hash Algorithm
Fig. 6.4.1 : Four rounds of Secure
CVq#1
= Sum32 (CVG, F
K20, 39] ,K40...59] , K60.
Scanned by CamScanner
[apr Crypt. & Sys. Security (MU-Sem. 6-Comp)
‘Sr. ; a
||
No. i
Hence
ge st . He n ce it It use s a 128 bit message digest.
e di
1. [It uses a 160-bit messag against Brute - fore,
- force atta cks is weaker than SHA1
is stronger against Bru te |
attacks.
|
than MDS.
cryptanalysis
is not vulnerable against| MDS is vulnerable against
2, |SHA-1
cryptanalysis.
————
res ent the) It use s a lit tle end ian method to represet |
|It uses big - endian method to rep
4,
message. the message.
—
5. |SHA has 20 rounds. MDS has 64 rounds . |
Scanned by CamScanner
1, & Sys. Security (MU-Sem. 6-6 Cryptographic Mash Function’
[Bate Auhonicnon
} |
|2, Digital Signatures
|
}
3, Password Storage
|
|
| 4, Key Generation
|
Hash Functions
Fig. 6.4.2 : Applications of Cryptographic
|
pata Authentication
a 1. 7
proof of identi ties and ensur e that the origin of an electronic message is
t establish
fied or not.
k if a message has been modi
d and to chec
_
x Digital Signatures |
fy the proof of message.
ss ag e di ge st using P rivate key and identi
Encrypt me
» 3 Password Storage
in the storage; hackers cannot get
Mess age digest of password is compared with that
essa
password from storage.
+ 4, Key Generation
lly expensive
gen era ted fro m dig est of pas s-p hrase; can be made computationa
Key can be
to prevent brute-force attacks.
_
Scanned by CamScanner
”
List
.6. 5.1” What is the need for message authentication ?_gec. LES
LL Ze 0 Mariel
6.5 —
C, = E (k, [P,®C, ] }
C=
E (k, [P3®C,] }
Scanned by CamScanner
U-Sam, 6-Comp) 9-19
Step 1 Stop 2 Stap 4
Mosaage Mosan
mange Me:
ne we i a i Vee seypat
Sender
—— | mac —+ [Sani neem
MAG op
mae [ MAC MAG B.
Hash _ Hashi Heat ) ~
— Compare - |
Scanned by CamScanner
(a _ el CU
| AP crypt. & sys. Security (MU-Sem, 6-Comp) _ 6-20 Cryptographic Ha ash Funiery
|| Message M = Py,Pp.....Pp,
| ar Pa
DES
K
peneerree®
. encryption
DES
.
25) i
os a Cy i
of operation |
Fig, 6.5.2: MAC design using DES in CBC mode
Code (DAC)
Data Authentication
Ka
- Using DES encryption algorithm, E and secret key
also called MAC is calculated as follows.
ticatio n Code)
* 6.5.4 HMAC (Hash based Message Authen
—— XOR
| ___Jet
Becr mingeayty
Transia
Fost, | Message
‘Message digest algorthm
Transmitting Key H)
Rash
ae
| OS2 |: Hash {H)-
!
Message digest algorithm
f
HMac |
Fig. 6.5.3 : HMAC Operation
~ / 4
Scanned by CamScanner
rs, BecuTI (MU-Sem §-Comp)
OE Seyptographic Hash Function’
Complete HMAC Operation
5.4)
(M DS, SHA-I ete.)
i) wressage Digest Algorithm : The message digest algorithm used
(i ‘I input message m whose MAC is
to be calculated
‘The shared secret key used in HMAC
(i) ae
(ii? k The string 0X36 byte repeated 64 times
* -
!
i X5Cbyte repeated 64 ti
ye IEP mnie
oprd- The string O
4 fixed and different 64 byte strings ipad and opad)
(ir OS] = Output of step |
0S2 = Output of step 2 |
(K) must |
» The Jength of message m must be equal to length of key, i.e. length of key
gteP pe equal to number of bits in the original message block. For example in original /
initial length of key is 170 bits and message length (i) 512 bits then odd 342 bits into
and make it equal size
key length
key now transmitting and XOR with ipad to produce'OS1 (output of stage 2
gr ST
i (OS1 isa variable).
Append message m to output of step 2 i.e. original message m i) added with output
step 3 of step2 which will produce message digest (OS1 +m)
e output
MD s and SH A -1 is app lie d on the output of step 3, This will produc
Step 4; The
Hash (H).
of
OR the secret key K with opad to produce output variable called OS2(output
step 5: x
step 1)
Add Hash H with OS2(Here the message digest calculated in step 4 is taken into
step 6:
with output of step 5.
consideration (Hash H) and appended
+ Hash H) to generate
alg ori thm is app lie d on output of step 6 (OS,
Step7: Message digest
aa
final output called as MAC.
atical form as,
Wecan also write above steps in mathem
HMAC = H (K @opad, H(k @ipad, message m))
Where,
HMAC = Final output
k = secret Kay
b 4
Scanned by CamScanner
aphic Hash p,.
€ Crypt. & Sys. Security (MU-Sem, 6-Comp) ¥
'
6- 22
® = XOR operation
M = input message m ted 64 times.
Opad and ipad = fixed and different 64 b yte strings FePo te (i.e. key k and mes,
by "Re
Append zeros to the end of key to make length 64
Step 1:
must be equal)
Step 2;
XOR 64 — byte string computed in ste
p 1 with ipad.
Z
Step 3; tr in g r e s u lting from step
Append the message m with 64 byte
Step 4; digest algorithm on output of step 5.
Apply message : ad.
Step 5: st ri ng co mp ut ed
.
in step with °P
XOR the 64 by te from step 5. |
th 64 by te st ri ng & enerated
Step 6: Append hash H outpu t of step 4 wi
A- 1) on output of step (6) to Beh |
digest algorithm (MD5,SH.
-
Step 7: Apply message |
atication.Code
Sr]
No. | —_,
Once the hash is generated which will Without secret key it is not. possible fv
not give any clue to the attacker about attacker to identifies and validate the cored
original content of the message. MAC. et
Most popular message digest Most popular MAC are MAC using DES #
algorithms are MDS and SHA-I CBC mode and HMAC ' _
Scanned by CamScanner
Sem. 6-Comp)
g Sys. Security (MU- 6-23 Cryptographic Haah Function?
CG \
- ee
Ke eed
soe
pe Aras
esaas|S Rna
my
Ky E
d
Scanned by CamScanner
- To generate an t-bit CMAC tag (1) of a message (m) using a b-bit block ciphe, tp
secret key (k), one first generates two b-bit sub-keys (ky and ky) using the,Shee ty
1. Divide message into b-bit blocks m= my II... [| ra-1 Il 7%, WhETE 11, «5 Mn-1 AEE comple,
blocks. (The empty message is treated as one incomplete block.)
2. Ifm,isa complete block then my! = ky ® m, else My’ = ka, © (Mp Il 10...02).
3. Letco= 00...05,
5. Cy = Ex(Cn-1 ® m,')
6. Output t = msb,(c,).
Scanned by CamScanner
wg C pt & SYS. security (MUSE.
.
sone 2) Cryptographic Hash Functions
o00
Scanned by CamScanner
Module3
Digital Certificate :
&
Syllabus
> (MU
- Dec. 15, Dec. 17)
Q. 7.1.1 Give the format of X.509. digital certificate. and explain the use of a digital’
signature init. (Ref.sec.7.1) : yay SE]
Q. 7.1.2 What is a digital certificate? How does ‘it help to validate the authenticity of A
user? Explain the X.509 certificate format. (Ref. sec. 7.1) __ PISS EOS
Digital certificate is an electronic file that is used to identify people and resources over!
insecure channel or a networks called Internet. Digital certificate also enable secur
confidential communication between sender and receiver using encryption.
For example when we travel to another country, our passport provides a way to establish
our identity and gain entry. Digital certificate provide similar identification in the
electronic world.
The role of Certification Authority (CA) is to issue certificates with authorized digit
signature. Much like the role of the passport office, the role of the CA is to validate
certificate owner’s identity and to “sign” sthe certificate so that it cannot be tampered t
unauthorized user.
—_—
Scanned by CamScanner
| ee |
Digital Certificate
signed a certificate
web
Be net ae wk resources to Bey h Owner can present their certificate to people, over
Cir identity for confidential communications
0 e€ 7 + .
’ and
4
Cg re channel.
i s X.509 defines .
dard called a cfines structure of digital certificate. The International
onic Union (ITU) permitted this Standard jn 1998,
3 4 shows qmnatits of X.509 digital certificate,
, ere. Digital Certificate contents
PS Certificate version number
=a Certificate serial number
Fe Validity Details
Name of the certificate owner
Public key of certificate owner
Extensions to certificate
Scanned by CamScanner
(ey Crypt. & Sys. Security (MU-Sem. 6-Comp) 7-3 Digital Contin
=——— ts
4. Certificate Issuer name
The validity period (or lifetime) of the certificate (a start and an end date).
6. Name of the certificate owner
The name of the owner and other identification information required for identifying the
owner such as email id and contact details.
7. Public key of certificate owner
Indentify the CA uniquely ie. whether single CA signed it or is any CA using sams
details. |
9. Owner unique identifier —
Indentify the owner uniquely if two or more owner has used the same name over a time.
‘10. Extensions to certificate
In creating the certificate, this information is digitally signed by the issuing CA. The C4
signature on the certificate is like a tamper-detection seal on packaging any tampet!
with the contents is easily detected.
—_ |
Scanned by CamScanner
s. Security (MU-Sem, 6.
ie Sa) 74 Tile Se 3M Digital
igital Certificate
ee- Bygy ! inspecting
pe the digital certific ate ona Web
Site, users can help prevent identity theft and
z fraud.
Scanned by CamScanner
7.2.1 Components of PKI
Scanned by CamScanner
yser registration is the process of coll
ect; Un
: “ § ‘ ‘
and veri
‘
fies user identity
7 tl
i s
ae
The users which request CAs or RAs to issue certifi
es . aigitel ceviltvane seit w GA Cates are called to as PKI Clients. To
» a PKI
details of the client. Key pair. The key pair contains the
2, Then sends request to the CA for the
CA Certificate through RA
juira 4, After verification from CA and RA client ¢
i an Use Certificate to : .
user and certificate owner.. 5 prove itself authorized
:
. Brery communicatio
helps n between a client
: and the CA is secure because client is respon
for ensuring the security of its private sible
key. If the Private key is lost
or stolen, then the
lation tacrypted message cannot be decrypted or any unaut
horized person can uses this private
ligital
key ta decrypt the messages.
;
Process known as certif icate revocation.
3
ae
CA publishes Certificate Revocation List (CRL) which mentions serial number so |
“ificates whi
A
4 tes which are no longer usable, reasons for certificate cancelation, and date when
ycale
Poly for new certificate.
pting
"cate can distributed to the users directly or distributed with the help of a
directory
Server. ‘ ‘ ‘ «i
| CDS distributes certificates in support with the directory service server.
Scanned by CamScanner
& Sys. Security (MU-Sem. 6-Comp)
5? crypt. _7-7 Digital Cortticat
o Generate public and private key pairs. Certify the validity by signing with public key,
o Revocation of expired or lost keys.
o Distribute or publish the certificate along with the public keys in the directory service
server.
Browsers and We observers use encryption for authentication and confidentiality and for
applications like online bank in and online shopping. Typically, using Secure Sockets Layer
(SSL), servers authenticate themselves
to clients. SSL also encrypts traffic.
Chapter Ends...
oOoOU
Scanned by CamScanner
eral
seryj Ce
raNnsfer,
SACtion
god - Thre are many technologies currently available to a network administrator to authenticate
Wet, :
Firebox authenticates user
Scanned by CamScanner
Authentication P
tt c 0g
Authentication is very important when you use dynamic IP addressing (DHCP
) fo,
computers on the trusted or optional network.
It is also important if you must identify your users before you let
them Connect to
resources on the external network.
Scanned by CamScanner
authentic.
ommunication between the prover and verificr must be
others
generate (p,, %,) Gen and convinces
ish electronic identity, Charlie must
8.2.1
pub lic inf orm ati on p, rep resents him as show in Fig.
ist the
verifier that his or her opponent
.
a n d L e g a l identities
qo physical
th
atio n is pos sib le onl y if all par ticipants have set up a network wi
ntic
entity ricated
authe communication links.
.
authen 1.1.11.5
4.1.11.3
1a 03
1.1.10 1
l Identities
Fig. 8.2.2 Physical and lega
§Authentication Protocol :
Authentication Protocol
f
1 . One Way Authentication
2. Mutual Authentication |
tocol
Fig, 8,3.1 : Authentication Pro
Scanned by CamScanner
& |_Grypt. & Sys. Security (MU-Sem. 6-Comp) _8-4 Authentication Protocols
:
7 t
Scanned by CamScanner
A
Lthenticar
RRSt e:0,
2 Py,
ae
Sys:
Sacurity (MU-Sem. 6-Comp) 8-5
Authentication ion P Protocols
tig bepat i mportant application of mutu
the ig
al authentication is that co mmun
+ machine and server mach ication between
ine over a network must be secure
before performing
gensding and receiving process. any
data
why there Is a Need of Mutual Authenticati
on Protocol ?
ite _ f 1
es 1 achieve mutual
Aleks red must
© are two a is be paral Provision of some
‘ eo which suppose to verily identity |
of the sender over an insecure commun
S Bier ication
By tse feet channel.
ication. Finally 1 roachieve this goal most of the protoc
ols depends on an authentication server
also called
> give -strengih fr S “ey itse
Disnder
tribut ionts Cen
A wan ter (KDC).
to establish a secure communication with rec
mM. Password inthe - jo eiver B, then A can request
session key from Key Distribut
ion Center for communicating wit
now: . Je wants to sec
h B. If group of
urely communicate with Key Dis
rd. It then tak tribution Center then providing
up = ember 2single key called a master every
key or secret key, Authentication
This is known servers are
as i" capable to delivers good quality session keys and distribute securely to client who
requested it.
ation. Withdrawing Authentication server also maintains a table
containing a name and a master key or secre
. For authentication t
key of each client.
we know) or use of
- The secret key is used to authenticate client to the authentication
server and then for
securely transmission of data between client and the authentication server.
- There are different protocols are used to perform this task but among
this the well known
Authentication is a protocol called as Needham-Schroeder Protocol.
8 ;
ider must Prove! "Syllabus Topic : Needham Schroeder Authentication Protocol
sender, before any
_'32 Needham - Schroeder Protocol \
etworks they must
| ~ Me first mutual protocol was publishe
d in 1978 by Needham and Schroeder.
Thisi |
receiver f 4pptvach was Proposed
eae message for various
Sertion and distribution of those purposes that includes secret-key and public key
d that ~ Nevdtam and Schroeder protocol useskeys a between |
sender
secret key and receiver.
known to the sender and also to an
|'
mute! authentication. server. Sender and receiver
other §& share a secret key and use it for secure
“Omtunication with authentication :
server,
|
Scanned by CamScanner
Secret-key Protocol
seaham-senroede
> petal steps of N
ests for a session key to authentication server is COFAMUNI Catigg : ge z
ae re as shown in Fig. 8.3.2. “The message sent by A to authenticatio, ee ~ auth 1
with receiver k address Na, B’s network
t key y Ka, A’s network adare: ’ addre, poss ble
server includes
A’s secre’
ee |
is basically a random number used to demonstrate the i:
Nb and a nonce. A nonce ; :
b e request sentby'y A to authentication Sery
req
2
freshness of a request denoted by N. The
okt
' which is in encrypted format E denoted by,
E (Ka, [Na, Nb, N]) c. jast 3
generated key Ky,
Step 2: Authentication server returns a message, containing a newly
ver), nonce N (to match
(used to encrypt communication between sender and recei
ticks Mn
the response received from authentication server with the request sent),
r A)
(contains the same shared. secret key Kab, as well as the name of the sende
encrypted with B’s secret key Kb and whole these message encrypted with sendey
private key or secret key Ka to ensure that no one else can read it. The message
that authentication server sends back to A can be expressed as:
E (Kab, N, {A, Kab} Kb, B,Ka’
Step 3: After receiving replay from authentication server, sender decrypt the ticket an
sends the ticket {A, Kab} to the receiver B. A sends the ticket to B which is notis
encrypted format because it was previously encrypted by authentication senz
using B’s secret key Kb.
(A, Kab) Kb
Step 4: B decrypts the ticket received from A using the secret key Kb and compatt
sender identity. B is again encrypting the ticket using shared secret key Kab at
generates nonce N1 and sends it back to receiver. This can be represented as
E (N1) Kab
Tn this step B got the session key (Kab) for communicating securely with A.
Step 5: Sender is decrypting the nonce N1; using the shared secret key Kab this proved!
senders identity. The sender sends response N1+1 encrypted using the
“
secret key Kab.
Scanned by CamScanner
hentic Protocols
A and receiver
Now sender B can Securely communicate with each other using
or ait?: _ session key generated.
com: ni : : ;
; : ess of this protocol is that for Ja: os .
Suthe win gre” - to generate and distribut ‘BE networks it is not possible for single
* .Netwoy, “to, +: +
pentication sery el § c
number of session key which is practically
demon Egg OA ssible.
henticay,Dticat; th c pare 4
th
is that if seion key Key b between
weakness 1S that if session sender A and receiver B is> stolen, aeand the {
scket to B isA rec orded, attacker can easily copy the contents of a sender A by performin
.
B
3. Authentication request
Receiver B
Authentication server
dt listributed -system.
1b this provel® Ts, |
using the ue Retheros is also calléd as authentication eihtocel. Like when to start~ in journey we |
need a
Continn ticket then only we can do our journey
safely.
Scanned by CamScanner
of the ticket as a token to prove the identity of the tia
Kerberos uses the concept
introduced Kerberos in Windows 2000 server as a default authentication
Microsoft
protocol.
Kerberos uses the concept of a ticket as a token th at proves the identity of a user.
of password, tickets ie
Tickets are digital documents that store session keys. Instead
issued during login session and then can be used in any Kerberos services.
For client authentication phase requires two tickets :
o Ticket Granting Ticket (TGT), which act a identifier for user and session key
o Aservice ticket to authenticate user to gain access to user for particular service.
Thé same concept of ticket is used likewise we use railway tickets it has time duratiog
expiration dates after that ticket become invalid.
In Kerberos these ticket includes different contents like time stamps to indicate an, stag
and expiration time, after time expiration the ticket become invalid. :
The timestamp is the time-set by Kerberos administrator depending upon how much tin
service is required to the client.
Kerberos Servers
To accomplish the task of secure authentication, Kerberos uses a trusted third partyi
called a Key Distribution Center (KDC).
The role of an Aavihentication server is to store a.database like secret key of the ust
and its services.
The secret key of a user is generated using one-way hash of user provide password.
ewer
The-main aim of the Kerberos is provide centralize authentication of entire n
git?
rather than storing the sensitive information. at each user. machine, the sen
information will be maintained at particular secure location only.
Scanned by CamScanner
maAluthentication Protocols
K Authentication
t server
Client
< __ Client-TGS session kay Gj
Ticket-Granting
Ticket-Granting ticket server
|
cin UghAttenioaor= >
Td
Authenti
—__f")
- This phase is called as Authentication phase because during this phase only
ztentication can be done between authentication server, ticket-granting server and
sevice provider.
- Asshown in Fig. 8.4.1, first client and authentication server authenticate themselves
to each other.
~ Gient and Ticket granting server authenticate themselves. Finally client and |’
requested service provider authenticate themselves to each other regarding which ; i
‘tformation/ service client wants.
1 |
Ubentication Details
we tibetan phase user has to provide username and password on the client
© Which cryptographically hastied to create a secret key for the client.
Scanned by CamScanner
Authanticatig
SS Protvo
a ry 4
After client verification done with authentication server, AS will replies the follow;
n
details to client as shown :in 8.4.1.
© The client Ticket Granting Sever (TGS) session key Kt, encrypted USiNg clieny
secreta key Ke (which now stored in authentication server), s
© The Ticket Granting Ticket (TGT) encrypted using the secret key of the Ticke
granting server. The ticket granting ticket includes the client ticket granting Seve,
session key Kt and its validity period.
The client now decrypt the Ticket Granting Server session key Kt using his secret;
Ke. To request as service client sends following two message to Ticket Granting
Server (TGS).
o The Ticket Granting Ticket and the ‘name of the service Sr that client want; ,,
request.
© Authentication token which includes client ID and time stamp, encrypted Using
client ticket granting server session key Kt.
Upon receiving all the details from client Ticket Granting Server decrypts the Ticks
Granting Ticket using Kt, thus retrieving the client Ticket granting server session key
stand the validity of the ticket granting ticket. If it is valid then Ticket granting Seng
sends following messages to the client.
New client server session key Ksc, encrypted using TGS session key Kt.
© Client to server ticket, encrypted using specific services key Ks, known to Tickt
oO Granting Server only. (Client to server ticket contains the client ID, netva:
address, validity period and the client server session key Ksc).
Upon receiving all the details from Ticket Granting server client decrypt the client
server session key Ksc, and authenticate him to service Sr by sending follow
messages.
o Theclient server ticket sent by the ticket granting server in previous step.
o Theclient ID and the time stamp encrypted suing client server session key Ksc.
The service provider decrypts the client to server ticket using secret key Ks ®
obtains the client server session key Ksc. With the help of client server session kt
Ksc, service provider decrypt the client ID and time stamp information. te a
final identity service providers increment the time stamp by 1 and send it back
client.
Scanned by CamScanner
qhe client decrypts and verifies (hig reg
. . . . “pons ; '
once this verification get succeed Pal a USINg Client to 5 €rver session key Ksc.
‘NOW Client
Kerberos; protocol was specially
‘
design to ~ Server can start
en
sqsecure network. c the authentication of the client over
qwo types Kerberos versions are exits i.e. Kerberos
4
eee
= ‘ 84 and §,
pifference between Kerberos Version 4 and Versio n 5
lo hee ae i |
* seas eel Kerberos version 5 |
a
Since the same key is used repeatedly In V5 this is avoided by requiring a sub
to gain a service from particular session key which is used only for one
server, there is a risk that an attacker connection.
can replay messages from an old
session to the client-or server.
Kerberos uses IP addressing Kerberos V5 can use any address since the
address is now: tagged with type and
length. ane
000
=
Scanned by CamScanner
Module 4
eH CHAPTER
Syllabus
Digital Signature Schemes - RSA, ElGamal and Schnorr signature schemes.
~ The receiver uses a verification key (Public Key) of the sender only to verify the origindl
the message and make sure that it has not been tampered with while in transit as shown8
Figs9, 1.1.
Scanned by CamScanner
r —
: 1 & Sys. Securit MU-Som, 6-Com ; .
-2
D ital Signature Sc hemes
igital '
Hash value of @ Message whey a Srypted wi
at e-Doc
gignature On that e-Document, t i
h the private key of a person is, his digital
-oital signature is an cxamp]
Digi" . ple of Asymmetric ke |
algorithms (0 complete the process, ¥ Cryptography which uses three different
1. First step is
key Beneration al Tire
Sonder
Confidential
document
ormassage
- As mentioned above the signature is generated with the help of private key. The’ private
key, which is never shared, is used in signature generation, known
to sender only.
-» Public keys, which are known by everyone, can be used to verify the signature of a sender.
Every sender and receiver having a private and public key pair, the reason digital
signature called public-key cryptography.
1. Message authentication
—
~
2. Message integrity
3. Non-repudiation
Scanned by CamScanner
MU-Sem. 6-Comp - ™
zy Message integrity
> 3. Non-repudiation
There are situation where a user sends a message and later on refuses that he had sent thes
message. This is known as non-repudiation because the person who signed the docurmer,
cannot repudiate the signature at a later time as shown in Table 9.2.1.
: Digital Signature |
No. | peices |
1. | Message Paper signature may be forged. | Digital signature cannot te)
Authentication copied.
|
: |
2. | Message Integrity | Independent to the contents of | Depends on the contents of te
the document. document.
— |
3. | Non-repudiation | Paper signature. required) Any computer user can
handwriting expert to achieve | achieve non-repudiation "
non-repudiation. _ | Digital Signature.
anit
confidential e-mails, during secure payment transfer . and possibly allae software a
+ taority Of wwe
and integtity
authentication
universities, educational institutions those want to achieve
confidential information.
Scanned by CamScanner
oe sys. Security (MU-Sem. 6-Comp)
9-4 Digital Signature Schemes
a
Syllabus Topic
: Digital Signatur
e Schemes
__
pigital Signature Algorithms, Schemes
1. RSA signature
schema
So
3. ElGamal scheme
a
Fig. 9.3.1; Digital signature
schemes
Scanned by CamScanner
Compute signature § = P’mod n where, P <n and
a System parameters
@ Key generation
Scanned by CamScanner
Digital Signature Schemes
Compute
¢-(H(m) - xgr ) k' mod (a— 1)
ry Verification
pigital signature (gr, s) of message m was verified as follows,
0<q,<aand0<s<a-1
gm) = y"q, mod a.
re” = y"q. mod a is equal then verifier accept the signature otherwise he reject it.
Where,
H(m) = xq,+Simoda-1
gHi = xq
g is
: qr i 5
= (g) x(g)
We know that y = q° mod a
Above equation can be rewrite as follows,
m ~ 8
g” = (y) x(gr) moda
Hence proved.
Here, H(m) = SHA = 1 (m) is 160- bit string output produced by secure Hash Algorithm.
Se
Scanned by CamScanner
Syllabus Topic : Schnorr Signature Schemes
Scanned by CamScanner
dial Signature Schemas
Chapter Ends...
O00
Scanned by CamScanner
-{ ‘Module 8 |
pg coke tae
r k S e c u r i t y Basics
Netwo
e)
10.1 TCPAP Vulnerabilities (Layer Wis
Scanned by CamScanner
saan
en /OtWOrk Security Basics
and switches do not make
use of this la
R yer but bandwidth throu; a
*
The technologies vulnerable to this attack are dynamic script languages including ASP,
ASP.NET, PHP, JSP, and CGI. All an attacker needs to perform an SQL Injection hacking
attack is a web browser, knowledge of SQL queries and creative guess work to important
ee
table and field names. The utter simplicity of SQL Injection has fuelled its popularity.
a nie
A way to defense
A network-based intrusion detection (IDS) tool such as Snort can be set up to detect
certain types of SQL injection and XSS attacks as they take place. Snort actually has a
.
default rule set that contains signatures for detecting these intrusions.
Scanned by CamScanner
However, they can be easily bypass
ed by an attacker, mainly by converting the
Malco, |
input string into its hex-encoded value,
\
10.1.2 Transport Laye
r
Description : The transport
layer's responsibilities contai
Capabilities independent of n end-to-end Mess age tans
the core network, along with y |
flow control. End to end message err or con tro l, fragm, entation ay ley| |
transmission or connecting applications
layer can be categorized at the Wan
as either :
1, connection-oriented
e, g. TCP
2. connectionless e.g.
UDP
The transport layer can be thou
ght of accurately as a transpor
whose responsibility t mechanism e. ga Vehics,
is to mak € sure that its contents
destination safely and comp (passengers/goods) teach i
letel , unless a higher or lo
delivery. wer layer is responsible for yg
:
The transport layer provides
this service of connecting app
the use of Port lications collective
s. Since IP provides only a ly throug
top effort deliver the tr
y, ansport layer js
the fn
7 An example of an atta
ck
Port Scan Attack
* Away to defense
Scanned by CamScanner
Network Security Basics
ot all scans will be followed by an actual attack, as the hacker may determine
were urrently has no weaknesses that they can take advantage of. This could
He newwork
| H er of alerts that do not require attention.
(mg large ume ,
on yet hazardous effect of this is that the staff may lose faith in the IDS and
for the traffic that it
, ign0 ring alerts: External firewall can be used to provide alerts
dent
we NIDS inside the DMZ (De-Militarized Zone, a part of the network that is
. ga winside” OF “outside” the corporate entity) the advantage that could be taken is
¢ NIDS attack signature " database can be done to consider only those
at te tailoring ©
ll will
as that are appropriate to the systems in the DMZ; at the same time the firewa
c.
a locked all other traffi
out diagnostic
the pr ot oc ol s ca rr ie d by IP, such as ICMP (used to send
- Some of data) are
sm is si on ) an d IG MP ( use d to. handle IP Multicast
| information about IP tran
rf or m in te rn et wo rk la ye r functions, illustrating an
lyered on top of IP but pe
OSI model.
ati bil ity be tw ee n the Int ernet and the IP stack and
incomp
RI P are als o par t of the network layer. What
OSPF, an d
All touting protocols, such as tha t the ir pa yl oa d is totally alarmed with
ork layer is
makes them part of the netw ar en ca ps ul at io n of that payload is
layer. The pa rt ic ul
management of the network
imelevant for layering purposes.
ae
Scanned by CamScanner
Os
i Crypt. & Sys. Security (MU-Sem. 6-Comp) 10-5 Network Secu rity
i Basic, |
* An example of an attack
The basis of the SYN flooding attack is in the design of the 3-way Kandshake that begi,,
Sq
TCP connection. In this handshake, the third packet verifies the initiator's ability
receive packets at the IP address it used as the source in its first request, or jts ret ty
Ur
reachability.
Fig. 10.1.1 shows the sequence of packets exchanged at the beginning of a norma] Top
connection.
Initiator Listener
Connect() Listen()
TCB initialized to
SYN-ACK
SYN-Received state
Success code
returned by
connect()
TCB transitions to
Established state
(Data packets exchanged)
Scanned by CamScanner
+ & SYS: Security (MU-Sem.6-Comp) 10.6
Gs * Network Security Basics
- ajthough
at this action
represents protects
another (minor)a host's available
resource memory
vulnerable resource
to attack from attack » the backlog
.
_ Inthe meantime, service is denied to the application process on the listener for rightful
new TCP connection initiation requests. Fig. 10.1.1 shows a simplification of the sequence
of events involved in a TCP SYN flooding attack.
7 Away to defense
- Both end-host and network-based solutions to the SYN flooding attack have merits. Both
types of defense are frequently employed, and they usually do not interfere when used in
combination.
Because SYN flooding targets end hosts rather than attempting to tire out the network
capacity, it seems logical that all-end hosts should implement defenses, and that network-
based techniques are an elective second line of defense that a site can employ.
End-host mechanisms are there in current versions of most common operating systems.
Some implement SYN caches, others use SYN cookies after a threshold of backlog usage
is crossed, and still others acclimatize the SYN-RECEIVED timer and number of
retransmission attempts for SYN-ACKs.
Because some techniques are known to be futile (increasing backlogs and reducing the
SYN-RECEIVED timer), these techniques should definitely not be relied upon, Based on
Scanned by CamScanner
10-7_ oe - _Network Security Bagi
SSnitin
experimentation and analysis, SYN caches seem like the best end-host Mechanism tf an .
hand, _ access
— This choice is motivated by the facts that they are capable of withstanding
Profoung Me ac sp’
attacks, they are free from the negative effects of SYN cookies, and they do not neeq any ae mpt *
’ heuristics for threshold setting as in a lot of hybrid approaches. ee york @
. — Among network-based solutions, there does not seem to -be any tough argument f,, gendi
: SYN-ACK spoofing firewall/proxies. o vaoker o
— Because these spoofing proxies rip the TCP connection, they may disable SMe the host (
high-performance or other TCP options, and there seems to be little advantage to thiy atil the
approach over ACK-spoofing firewall/proxies. “a M tab!
— Active monitors should be used when a firewall/proxy solution is administrative | ;
impossible or too costly to deploy. a7 Away to
— Ingress and egress filtering is frequently done today (but not ubiquitous), and j,, ) — The best
commonly acknowledged practice.as part of being a good neighbor on the Internet. automatic
— Because filtering does not cope with distributed networks of drones that use straisy attaching |
attacks, it needs to be supplemented with other mechanisms, and must not be relied upg - Detection
by an end host. occurrenc
. known O1
10.1.4 Data Link Layer
- Once det
— Description : The link layer, which is the method used to move packets from the netwat connectin,
layer on two different hosts, is not actually part of the Internet protocol suite, because?
can run over a range of different link layers. 10.1.5 Physi
— The processes of transmitting packets on a certain link layer and receiving packets fron!) — Descripti
given link layer can be controlled both in the software device driver for the network c= Retwork ¢
as well as on firmware or expert chipsets. These will perform data link functions such}
adding a packet header to prepare it for transmission, and then in fact transmi
t the frat It operate,
over a physical medium. A ding (s
a co et,”
— For Internet access over a dial-up modem, IP packets are typically transmitted
modems, PPPoE 1s often used. Bs 3 ICes th
For broadband Internet access such as ADSL or cable
Scanned by CamScanner
Notwork Security Bagica
AQ pai”?
A comtl (MAC) Address spoofing |
f 8
ii ng attacks involve the use of a known MAC address of another host to
Cc target switch forward frames intended for the remote hostst ‘to th the
MA (10 make the
“eit , attacker
wre
wor gle fr am e
on i h the other host's source Ethernet address,85, the netnet
wit wor
work
.
— sin
nding so that t he switch forwards packets intended for
py *°YT overwritvaess the CAM table entryry
cker.
a 4 t0 the network atta
os On ‘
mth
neh ffi c. When the host sends out traffic, the
«ane host sends traffi‘ c it will not get any tra
alil . 0 nce again so that it moves back to the original port
y 1s rewritten
‘ att sable entr
,way to cerense
ent WLAN system to
against MAC spoofing is for an intellig
est WAY to protect
prohibit offending machines from
y detect MAC spoofing attacks and
in several ways:
“hing to the WLAN. This is done
juromatical
g any
spoofing attacks is to fla
«
a
e wa y to avo id MA C
- On
tion and Containment ed WLAN adapter differs from
the
_ Dele manufacturer name of a detect
h the
accurrence in whic .
an iza tio nal ly Uni que Identifier) for that equipment
now OUI (Org
attacker from
intelligent WLAN system can avoid the kn own
once detected, an AN.
AP s or an y AP s located throughout the entire WL
by
connecting to any near
er
iis Physical Lay
on data on
ye r is re sp on si bl e fo r en coding and transmissi of
al la
. Description : The Physic
a.
network communications medi
Phy sical layer of the
in, the str uct ure of bits tha t are sent from the
- ltoperates with dat a
at the Phy si cal la ye r of the destination device.
ed
sending (source) device and receiv twork
, cab les an d co nn ec to rs are standard ne
- Etemet, Token Ring, SCS I, hubs, repeaters
devices that function at the Physical layer. ork
ain of numerous ha rdware-related netw
laye r is also con sid ere d the dom
~ The Physical logy.
LAN and WA N top olo gy and wireless techno
design issues, such as
Scanned by CamScanner
i Crypt. & Sys. Security (MU-Sem. 6-Comp) 10-9 Network Secu rity Basiog
} Syllabus To: pi
ARP Spoc
oting.
10.3 ARP Spoofing
__at
Scanned by CamScanner
and this ARP spoofing attacks are oft
en used to facilitate other att
pey ACKS such ag -
pot-service attacks
ia
; attacks often leverage ARP spoofing
to link multiple [Pp addresses
with a Sing]
av t's MAC add
ress. ne Be
cesull, traffic that is intended for many differen
t IP addresses will be redi
Ae MAC add ress, overloading the target with traffic.
a
arget’s
| ae Syllabus Topic : Port Scanni
ng
| od port Scanning
5. Stealth sean : The scanner blocks the scanned computer from recording the port scan
activities. a
Port scanning in and of itself is not a crime, There is no way to stop someone from port
canning your computer while you are on the Internet because accessing an Internet server
_ "Psa port, which opens a door to your computer. There
are, however, software products that
“a stop a port scanner from doing any damage to your system.
Scanned by CamScanner
3ys. Security00M
(MU-Sen!. 6-Comp) M
10-11 _Network Security Basic,
=
ee EN SN OS
.
*
U9 ir spoofing
The oT creates a record in a data structure and responds with SYN/ACK Message ty
the spoofed IP address, but it never. receives the final acknow
ledgment message ACK for
establishing the connection, since the spoofed IP addresses are unrea
chable or unable to |
respond to the SYN/ACK messages.
Although the record from the data structure is freed
after a time out period, the attacker
attempts to generate sufficiently large number
of “half-open” connections to overflowW the
data structure that may lead to a segmentation fault
or Jocking up the computer.
In session hijacking, the hacker takes over the
control over the TCP session between two
machines whereas in spoofing the attacker pret
ends to be the pimtientieats user and gain
access to other machine.
|
Scanned by CamScanner
Pf cog tS $_ Securily (MU-Sem, 6-Comp)
Notwork Security Basics
264 Attack Description
10."
When a clientient a and: serv er establish
i
a hormal TCp «
jooks Jike this: three-way handshake", the exchange
10.7 ‘DNS.Spoofing | : , ¢
- Domain Name Server (DNS) spoofing (a.k.a. DNS cache poisoning) is an attack in which
altered’ DNS records are used to “redirect online traffic to a fraudulent website that
as
information. mg
Furthermore, the malicious website is often used to install worms or viruses on a user Ss’
Computer, giving the perpetrator long-term access to it and the data,it stores.
Scanned by CamScanner
(ey Crypt. & Sys. Security (MU-Sem. 6-Comp) 10-13 Network Security Basi
cs
10.7.1 Methods for Executing a DNS Sp
oofing Attnok |
- Manin'the middle (MITM)
The interception of communications between users and
a DNS server in order to r 0
users to a different/malicious IP address. : . “
DNS server compromise
The direct hijacking of a DNS server ; ) which iis configured to ici
address,
~ Sem 8 milion .
_& S
Chapter Ends.
Qog
____<i
Scanned by CamScanner
syllabus
penial of Service: Classic DOS attacks, of ae :
ae Address 5 Poofing, ‘ ICMP f lood, SYN
flood , UDP flood , Dist ribu ted Deni al
8, Defenses against Denial of
Service
Attacks.
Denial of service and distributed denial of services is a type of attack that causes
ailable to the
legitimate users unable to use services or the: resource, or services become Bmunav
legitimate users. y
Scanned by CamScanner
ey Crypt. & Sys. Security (user. 6-Comp) 11-2 Denial of s,
rVieg
- The e attacker’s
attacker’s m main target for websites or services which include financial site bank Site or
credit card gateway systems.
- Th € targeted : network wich are toot for DOS are mobile phone network OF credit das
gateway network.
Bouffeer ove: rflow technique is used to make denial service attack, What an attackers does;
I takes cket (where is a unit of data) divide’into small chunks, the attacker checks i
the IP aiden of the particular network in that packet and floods the network of Viet
with repeated request. As IP is a fake, from attacker’s machin €.
— This acts consumes bandwidth which let other service tofail or unavailable for: ‘Other Use
Scanned by CamScanner
rvice
Denial
ath attack
g) Ping of De
in IP layer or network layer for
sending huge ICMP packet (These packets are used victim’s
Sends this huge oversize packet to the
indicating. error message). The attacker
or freeze resulting. in DOR
system which causes victim’ s system to crash
a
3) SYN attack
service attack. In TCP handshaking of ,
It is a TCP SYN flooding attack, a denial of
tw or k co nn ec ti on is do ne be tw ee n se nd er and receiver through synchronous (SYN) |
ne
es.
and acknowledgement (ACK) messag
e server
tion, with server with a SYN message. Th
An attacker initiates a TCP connec
i
repl y send s an ack now led gem ent message. (SYN - ACK) message.
in
which causes
clie nt (att acke r) does not res pon d back with acknowledgement
- The
server to wait. |
up the buffer space
to conned with other client. This fills
- . Due to which it is unable ; |
for communicate.
for SYN message preventing other
packet to server.
1. Clients sends synchronize (SYN)
.
to client.
2. Servers send syn-ack (SYN— ACK) nt. as
with ACK pack et and conn ect is €sestablished clie
3. Clients responds back y {
Scanned by CamScanner
SYN
SYN-ACK
, SYN.°
a , ! %
Legitimate connection
is refused
_—a
Scanned by CamScanner
Service
Denial ofOe
. 5 Sy security (MU-Sem. 6-Comp) _ 11-5
* ——
oP att ack : It is an att ack whe n pac kets are overlapped with each other
reardr are
e them, usually corrupted packets
and the receiver is not able to reassembl
em.
send by attacker to hang or freeze the syst q
= It is an atta ck of sen din g inva lid ICM P packet to the target which slow
Nuke
gown the affected computer till it is completely stop.
rf
IP address broad casting is done. A Smu
smurf attack : It is an attack in which
ds a packet which seems to
program is used to make network inoperable, It buil
ains ICMP ping. ‘The echo
originate from another address. This packet cont k
imum ping and echo make networ
responses are sent back to victim. Max
unusable.
sy, Targa ete.
“The various tools used for DOS attack or Jolt2, Neme
Syllabus Topic : Source A ddress Spoofing
Spoofing
*
42 source Address
nections using IP
k, att ack er est abl ish es a large number of “nalf-open” con
In this attac
‘
spoofing.
N pac ket s wit h the spo ofe d (fa ked) IP address to the victim in
ds SY
The attacker first sen
tion.
order to establish a connec
in a dat a str uct ure and res pon ds with SYN/ACK message to
- The victim creates a rec ord
message ACK for
the spoofed IP address, but it never receives the final acknowledgment
are unreachable or unable to
stablishing the connection, since the spoofed IP addresses ae
ons to oyerflowthe
attempts to generate sufficiently large number of “half-open” connecti
locking up the computer.
ita structure that may lead to a segmentation fault or
session between two
;
g, the
}
hack
.
er takes over the cont rol over the TCP
session hijackin
Ih : ‘ *
Thachjhines whereas in‘ spoofing the attacker pretends to be the authenticate use
r and gain
a 2 *
*cess to other machine,
Scanned by CamScanner
Syllabus Topic : ICMP Flood
— -A targeted local disclosed ping flood targets-a sole computer on a local network fe i Z
attacker needs to- have physical access to the computer in order to discover out is?
address.'A successful attack would result in the target computer being taken down eo aii
— A router disclosed ping flood targets routers in order to interrupt communications beni 1 F by sea
i dependent on the attacker knowing the intern
® computers on a network. It is 21 1p
all computers connected to the &
a local router. A successful attack would result in
; “being taken down. > 7
. ys ; , IP 24 dress#*
- A blind ping flood involves using an external program to disclose the
target computer or router before executing an attack.
Scanned by CamScanner
eral of Service
gore larly against a large network. ility to carry out a DoS attack,
a Syllabus Topic :
syjy flood
|
i sYN Flood
"sq attacker initiates a TCP connection with server with a SYN message. The server in
reply sends an acknowledgement message. (SYN — ACK) message.
causes server to —
: The client (attacker) does not respond back with acknowledgement which
wait.
the buffer space for
‘pe to which it is unable to connect with other client. This fills up
municate.
SYN message preventing other for com
SYN
-_— / :
of >
shake
Fig. 11.4.1: 3 way hand
Scanned by CamScanner
Clients sends synchronize (SYN) packet to server.
SYN
SYN-ACK
Connection ar
a all full
SYN
OS
Legitimate
connection
is refused
- A UDP flood attack is a Denial-of-Service (DoS) attack using the User Dat?
Protocol (UDP), a connectionless computer networking protocol. i
. ; , : ission CO
ol
- Using UDP for denial-of-service attacks is not as easy as with the Transms
Protocol (TCP).
Scanned by CamScanner
evel, I r
jom ports on a remote host, 7 sending a huge number of UDP packets
t0 ;
ult, the distant host will ; .
AS a res
Pe aily for the application listening at that port:
. . .
:
: af that no application is listening at that port:
® ls
int
Thus: for 4 Jarge number of UDP packets, the ill-treated system will be forced into
‘
client
y ICMP packets, eventually leading it to be unreachable by other er clients,
ending man
ensuring that th
spoof thes IP addressck of the UDP packets, ing
cker(s)ICMmay
attaat)
Thenees also
P return packetdo not reach them, and anonymiz
-
,
their networkc
«
jocationlS)-
tiple
ted Den ial -of -Se rvi ce (DD oS) attack is an attack in which mul
4 Distribu r network
d co mp ut er sys tem s att ack a target, such as a server, website or othe
aapromise
nia l of ser vic e for user s of the targeted resource. The flood. of
source, and cause ade
ec ti on re qu es ts OF ma l for med pac ket s to the target system, forces it to
> inning messages,.conn
d sh ut do wn , . the reb y den yin g service to legitimate users OF
ox down or even cr as h an
systems,
ice, it is whe
- Disributed denial of serv
.
anoher computer. er
sec uri ty vul ner abi lit y to take control on for comput
les and
- It takes advantage of loopho /
d huge data to other computers. "
lo send vulnerability spam or sen
ack ing vic tim com put er are calledas Zombie systems.
The systems which are used for att
lau nch DD OS att ack are Tri noo, Tribe flood, shaft etc.
Various tools to
Scanned by CamScanner .
(ey Crypt. & Sys. Security (MU-Sem. 6-Comp) __11-10 Denial of Ser.
attack is the control master program. Its task is to coordinate the attack:
Scanned by CamScanner
4
>
§ SYS
— — Denial of Service
— is the real attacker, 1
———
LO}te . tru;
On
| attacke, lo
‘Xamples of
©ey
Victim: 7 Bit tease
| Real attacker }
Pe cee = Swees eee
es eee. a
traffic,
BT : Fig. 11.6.1 : Chaotic handshake
Preventing
| _ Although it seems that the real attacker has little to do but sends out the “execute”
command, he/she actually has to plan the execution of a successful distributed denial
;
of service attack.
_ The attacker must infiltrate all the host computers and networks where the daemon
sé attacks attackers are to be deployed.
-d of four h for bottlenecks and
_- The attacker must study the target’s network topology and searc
host that
' wnerabilities that can be exploited during the attack.
presence r programs, the real attacker is
~ Because of the use of attack daemons and control maste
makes it difficult to trace who spawned
not directly involved during the attack, which
+ victim. »the attack.
‘ect both some, well-known attack methods (Smurf,
> Inthe following subsections, we review
agr am Pro toc ol (UD P) Flo od) and t the current distributed
SYN Flood, and User Dat
Flood Network, Stacheldr aht, Shaft, and
a
E55 and
aaa
| service
gees
dby networks.
isms that can be employe
' Wedescribe defense mechan
Scanned by CamScanner
——= «|
[AF crypt. a sys. Security (MU-Sem. 6-Comp)_
acks
11.6.3 Methods of Denial of Service Att
SYN Flood attack is also known as the Transmission Control Protocol (TCP) syy |
attack, and is based on exploiting the standard TCP three-way handshake.
connections, SYN Flood results in the server being unable to process other incomulg
connections as the queue gets overloaded. > ' :
UDP Flood attack is based on UDP echo and character generator services provided"!
fe
most computers on a network. The attacker uses forged UDP packets to connect #
:
: on one machine Ps ef
echo service to the character generator (chargen) servic¢ on and
machine.
Scanned by CamScanner
i of Service
Denial ice
mation 28 at
b t re ‘
a
with wenn
mc caled ICMP Flood, floods a machineine wan ICMP packets instead of UDP
packets:
Scanned by CamScanner
A?" cryp& t.
Sys. Security (MU-Sem. 6-Comp) _ 11-14 Denial .
Sot Servi
; Set ame
z
Filtering Routers : Filtering all packets entering and Jeaving the network Protects i, rs
network from attacks conducted from neighboring networks, and Prevents the :
network itself from being an unaware attacker. This measure
requires installing
ingress and egress packet filters
on all routers.
- Disabling IP Broadcasts : By
disabling IP broadcasts, host com
puters can no longer
be used as amplifiers in ICMP Flood and Smurf atta
cks. However, to defeng agains
this attack, all neighbouring networks
need to disable IP broadcasts.
- Applying Security Patches : To
guard against denial of service
computers must be updated with attacks, hog
the latest security patches and
example, in the case techniques, F,
of the SYN Flood attack, there
are three steps that the hos
computers can take to guard themselves
from attacks : increase the Size
connection queue, decrease the Of the
time-out waiting for the three-
employ vendor software patches way handshake, anj
to detect and circumvent the pro
blem.
~ Disabling Unused Services
: If UDP echo or charge-n-ser
disabling them will help to def vices are not required,
end against the attack. In gen
are unneeded or unused, the eral, if network services
services should be disabled
attacks. to prevent tampering and
s
~ Performing Intrusion Detection : By performing intrusion detection, a host £
being a victim of an att
ack. Network monitori
Suarding against denial ng is a very good pr
of service ‘attacks. e-emptive way
Chapter En
oo
Scanned by CamScanner
Module 5
Internet Security
Protocols
yer (SSL)
42.1 Secure Socket La
Ot required, (0,121.2 What are the different protocols in SSL? Haw do the client and server establish
ork services nection
? (Ref.sec.124)
"___anSSLoon EATS
ipering and Secure Socket layer invented by Netscape communications in 1994. Secure Socket layer is
client's web
an internet protocol used for securely exchanging the information between
yn, a host browser and the web server.
ity and data confidentiality
is while as Secure socket layer ensure the authentication, data integr
es a secure tunnel between client and
ive way of between web browser and web server i.e. it creat
ity to web traffic in all the way.
server. The main role of SSL is to provide the secur
TCP/ IP protocol suite is shown
ittack, and - The current version of SSL is 3.0. The position of SSL in
t can also in Fig, 12.1.1.
also
is works in betwe en applic ation lay er and tran sport layer the reason SSL is
_~ SSL
called as Transport Layer Security (TLS).
ee
apter Ends.
gag
Scanned by CamScanner
[7 crypt. & Sys. Security (MU-Sem. 6-Comp) _12-2 Intarmet Security Protoce,
Transport Layer Security (TLS) protocol is used to ensure security betven,
communicating applications and their users on the Internet.
Main function of transport layer protocol is to protect attacker when a server and Clie
communicate, it ensures that attacker or third party should not modify
i
or tamper With ty t
message.
Application layer
Physical
Bake
pene layer” a
SSL encrypted data
Scanned by CamScanner
ity (MU- a
Pgs Se Seu ASeme-Comp)
ceiving encrypted data, Server ___|nternet Security Protocols
remoy
es
' a ihe decrypted data to application layer NP SSI- header and decrypts the data and
| aa Li composed of four Protocols
in
| §8 Wo |
AYCTS, whic: h Suppor
t SSL as shown in
pg.rof the
four, the two most important er
|
| oO andsbake Protocol _and the SSL _R neo ‘that are at the heart of SSL are the SSL
ecord Protoco}, the other 1
Protocols such as SSL
change Cipher Specification and the SSL Alert Prot
ogo| | .
yjous WO protocols. maya Minor role relatively to
re role of these higher-level protocojg ‘Vite
Connection establi
her techniques for data encryption ang alert (warning
| @# .
of required
. ishment, use .
SSL hand
ener eV Ption, algorithms and alert massage
|.SSt change
connec! ' shake 3 ;
establishmen
; Protocol cipher
| Specificatio a
n (ane
fe Py
‘ SSL
. —
'8cord protoco| SSL protocol!
: layer
VA aMeessage authen
tication, confidentialit an
| y d integrity /
| += TcP
.
“Tp
: __-| \|). Transpor
t and
“ layer intemet
@
_ ~ SSL was designed to make use of TCP protocol to provide a reliable secure
process-to-
Wocess delivery of entire message/packets. We will discuss how client machine securely
|
‘ommunicate with the server machine by using unde
rlying network architecture.
lata Working of SSL a |
, |
Wewill discuss SSL Handshake Protocol and the SSL Record Protocol in details.
Scanned by CamScanner
i Crypt. & Sys. Security (MU-Sem. 6-Comp) 12 4 Internet Security Proy
coh
protoco I.
Q. 12.1.3 Write in brief about SSL handshake
(Ref. sec. 12.1. 1(A))
ests when we meet to our friend/colleagues, we have habit 1,
-— As the name suggest
Ilo and do the shake-hands with each other before starting our actual communica
hi/hello an
SSL handshake protocol uses somewhat same ideology but in terms of client and Serve, aR 3
an
The ¢e first sub-protocol of SSL called handshake protocol used for secure communica,
between client and the server using an SSL enabled connections.
— In this protocol client authentication to the server is more important that sep, 4
authentication because server has different options available for client authentic ation ‘ : >
Server
machine
(web browser)
” Server certificate. a }
client certificate request,
. Server key exchange
Client certificate : : ; -
: C6rtificate
_.Gllent key verification
exchange
} onal
change cipher specification *
_cliont handshake finished
Scanned by CamScanner
} go pt aS s. Security (MU-
U-Sem. 6
Comp)
aol
a12-
__Intomet Security
Protocols
|. itis used by client an
d server to st
he rauditioking is done vise. Art Commy nication
using SSL enabled connection.
|
Phases of handsh
aking
¢
i
>» (a) Phase 1 : Establishing Security Connection/Capa
Client hello
bilities
In this phase logical connections is established betw
(i) The highest SSL version number which the client can support.
of two messa es, the
(ii) A 32-bit timestamp and a 28-byte random field that together serve as nonce during key
exchange to prevent re- play attacks. ;
(iii) A session id that defines the session (a variable length session identifier).
(iv) There is a cipher suite parameter that contains the entire list of cryptographic algorithms
which supports client’s system.
Scanned by CamScanner
Internat Securit Protec
————— lh
(v) A list of compression methods sent by the client from which the server wil] Select the
method,
> (b) Phase 2 : Server Authentication and Key Exchange
In this phase, the server authenticates itself if it is needed. The server sends its CCFtificat,
its public key, and also request certificate (digital certificate) from the client,
- Certificate : The server sends a certificate message to authenticate itself to the
Client
If the key exchange algorithm is Diffie Hellman than no need of authentication.
— Server key Exchange : This is optional. It is used only if the server doesn’t Sends its
digital certificate to client.
— Certificate Request : The server can request for the digital certificate of client
The
client’s authentication is optional.
— Server Hello done : The server message hello done is the last messa
ge in phase
This indicates to the client that the client can now verify
all the certificates received
by the server, After this hello message done, the server waits
for the client’s side
response in phase 3.
Scanned by CamScanner
ad
__Internet Security Protocols
l
12 4.1(B) Alert Protoco
sSL uses the Alert protocol for reporting error that is detected by client or server, the
to other party. If error is seriouis then both
party which detects error sends an alert message
parties terminate the session.
_ Table 12.1.1 shows the types of alert messages. SSL alert protocol is the last protocol of
SSL used transmit alerts (warnings, errors, fatal etc.) if any via SSL record protocol to the
client or server.
- The SSL alert protocol format is shown in Fig. 12.1.5. Alert protocol uses two bytes to
generate alert. First 1 byte indicates two values either 1 or 2. “1” value indicate warning
and “2” value indicate a fatal error (if fatal error terminate the session/ connection).
Whereas second 1 byte indicates predefined error code either the server or client detects
any error it sends an alert containing the error (error occurred during handshaking, error
occurred during data processing at server or client side, certificate defeats, etc.)
Level Alert
Scanned by CamScanner
LE} CP. 8 Sys. Securly (MU-Som. 6-Comp) 12-8 _ __InHS
temet Securit P otg putt! or
Table 12.1.1: Types of alert messages
ae
a tio"
Alert Code Al ert Messag
e Descri ption i *, .
0 close_no
—nottif
ity No more message from sender a oe
10 :
tnexpected_message | An incorrect message
received “: F
2 0 bad_record_mac A wrong MAC received |
30
mac = |
decompression_failure Unable to deccmpens,
4
40 a
handshake_failure BE Unable to finalize handshake by
the sender. " “nom
42 bad_certificate , ived a corrupted certificate.
Rece
a nding oF
42 Nocertif;icate Client has no-certificate to send to serv
er. 4x psign7ore
42 Certificate expired Certificate has expired.
7
12.1.1(C) Record Protocol
_
After completion of successful SSL e
handshaking the keen role of SSL reco
rd protocol | se
starts now.
‘ ,
4. i ee
— SSL record protocol is second sub-prot ]
ocol of SSL also called lower level protocol
. on
— As defin ed earlier the SSL Record Protoc Divi
ol is responsible for encrypted data transmiss
ion
| 16334 bytes
~
and encapsulation of the data sent by the higher layer protoc
ols (handshake, alert, HITE)
also to provide basic security services to higher layer protocols, ~ Next step 15
oq data should
- SSL record protocol is basics for data transfer and specially used to build a data path — Mer th
between client and server and encrypt the data path before communication.
ee - Niter
Code) me
is c
- SSL record protocol provides different service like data authentication, data” dla is nov
confidentiality though encryption algorithms and data integrity through message gy . Te oh
authentication (MAC) to SSL enabled connections. Poco)
The details steps involved in SSL record protocol and SSL record header format as sho q |
— DEA be,
in Fig. 12.1.6. 4 s Finally ,
Scanned by CamScanner
6-Comp) te
S. security (MU-Sem. _— _* 2-5 ‘
——
———————S—S—— ae
——— Security Prote
Massage / data a)
—_— application dala
a | Data 2 | [oats]
pata die tation Data 1
frag
——
all nec ess ary aut hen tic ati on and cryptographic param
_ at this sta ge
ougheeSSL
edions ie
“petween client and server now it’s time of secure SSL data iomeri
record protocol.
data i.e. actual data that client wants to send over
_ SL record protocol takes . application4
d not exceed
different blocks for each length shoul
ss .
serve r. Divi de this data into the
ission
distribution or data fragmentation.
16384 bytes this process is called as data
on size of
HTTP)
is Dat a com pre ssi on usi ng loss less compression techniques; compressi
_ Next step
bytes.
data should not exceed 1024
ation
a on and com pre ssi on step the MAC (Message Authentic
Path - After the data fragmentati appended to the compressed data
(the
and MAC is then
Code) is computed over the data payload.
is now encapsulated) to form a new encrypted data /
data SSL record
again goes through data encryption process.
and MAC i
ssage _- The compressed data chniques like DES, triple DES, AES, and
crypto gr ap hi c te |
protocol uses symmetric key to op er at e on block ci pher.
are specially desi
ques gn ed
IDEA because these techni ne ry pt ed bl oc ks oblttai ned from
jown each e
co rd he ad er is pr etended onto
~ Fina1 lly SSL re rd.
as an SSL reco
encryption process. Re co rd Pr ot oc ol i 5 referred
to
L
od uced by the SS
oc k pr
bytes:
t t© exceed 32, 767
ut bl
~~ Bach outp
is no
The length of a record
Scanned by CamScanner
rypt. & Sys. Security (MU-Sem. 6-C
omp) 12-10 = Intemet Securin, p
SSL record header refer Fig 12.1
.6 consist of 8-bit content type
Of the message whether any app to which identify ‘
lication data or connection ter ‘hae,
Message.
min ati on o, any
oe
~ Next field is Major Version which is 8-bit
field used to indicate latest version a
use (€.g., 3). Minor Version which is 8-bit
‘ .
i 0
field indicates the lowest vers
use (e.g., 0), ion Of Ss it ;
iy
— Plaintext (compressed) / compressed length which
is 16-bit field indicates the length 8
the plaintext being compressed.
~ Finally sends SSL layer encrypted data
to TCP and IP (Transport and Interne;
layes
necessary transmission over network
) fog
— At the receiver end, the encrypted blocks are decrypted and then checkeg Fin
dad
authentication, data confidentiality and data integrity, reassemble these data int, iiss
unit, and delivered to the application-layer protocol, > ie
Scanned by CamScanner
__Inlemet Security Protocols
; Major Version (8 bits) specifiesthis thefieldmajor version of SSL used, for example if
gSL version 3.1 is in use than contains 3,
°
Minor Version (8 bits) specifics the minor version of SSL used, for example if
. sSL version 3.0 is in use than this field contains 0.
of the original plain text
0 Compressed length (16 bit) specifies the length in bytes
block.
> an Syllabus Topic : IPSEC
2 IP security Protocols
{ee
> (MU - May 16)
Write in brief about eee protocols for: ‘security.
9, 12.2.1 Rk ages
Ref. sec. Hee): LEV AFI CIS
Fnseit of data and its authenticity is prime concern for secure communication, to
sl this tO features, [PSec provides two protocols at network layer :
av
IP Security Protocols
1. Authentication Header ;
Scanned by CamScanner .
(BF cop sy. sooutty MU-Som. Comp) 1212 intome Sac
SOUT Protec
- Authentication Header is also used to protect the upper-layer or the entire IP packet. wi
the help of message authentication code (MAC - used to generate fixed length value from
message and secret key to provide authentication) using well known hashing algorithms
like MDS5 or SHAIL.
- By using Hash function and symmetric key algorithm, message digest ls Calculateg ang
inserted in authentication data as shown in Fig,12.2.2 because of ae AH Protocoy
provides data authentication and data integrity, but not confidentiality or privacy,
— The internal fields of authentication header format are shown in Fig. 12.2.2.
— This protocol uses cryptographic checksum which is similar to hash function or MeSsap¢
digest, the checksum is inserted in authentication header and placed in location depends
on which mode it is using (tunnel mode or transport mode).
8 -bils 8 - bits 16-bits 31-bit
- Application layer /’ | Next header |Payload lengthl, Reserved
Lediciuliaiiaiiabaiiall
4
- The next header is an 8 - bit filed which is used to identify the type of payload/ day
carried by IP packet.
— Identifies the type of header immediately following this header.
- The payload header is also an 8 - bit filed which defines length of the authenticatia
header. , é
— Length of the AH in 32-bit words minus 2.
AH contains 16 - bit field which is reserved for future use and always set to zero.
Scanned by CamScanner
C & sys.
SY: Security (MU-Sem, 6.6 ‘Omp) 12-15
fy, 3
« tc a 32-bit it field
1¢ used In combi :
¢ Modes of Operation
Scanned by CamScanner
YONA ee MOTO SeCUTyFr,
Soa :
IP AH Original IP TCP Original data
header _ header header
- (b) After applying AH
Scanned by CamScanner
y crypt. & SYS: Securit {MU-Som. 6-Com
ESP Header
Encrypted data
Scanned by CamScanner
ESP Traller ,
ep trailer field contains padding
(0-255 bytes), pad length 8-bits
and next header
8 - bits.
— This is mandatory field in ESP protocol which used to indicate the number of pag
(protection) bytes added into the packet.
—
Indicates the number of pad bytes immediately preceding this eld.
The same bit length as of pad length used to identifies the type of encrypted data in tk
Payload Data field,
Identifies the type of data contained in the Payload Data field (an upper-layer protocol
-
TCP, UDP, or an IPv6 extension header).
i —
Scanned by CamScanner
1, & SYS SECU
(MEE Sem. 6-Comp) 19.15 cols
Intemot Security Protoce
de
ig IS yariable length field whose length .
is?varjad Je-length field (must be Pends upon encryption algorithm used,
an integer;
Be Check Value computed overile Bh number of 32-bit words) that contains the
jateg “od 4 earlier ESP encrypts th SP packet minus the Authentication Data field
4 ntl ed . e498
3 AS ig ansmissi00 MA the reason it provide data confidentiality
odes of Operation
: MCry pte, =e rk in both modes namely ;
to rats, psPo wo .
“Fr of b
Ytes z
Xt Hea,
de
=>) (i) ESP Tunnel Mode
Fig. 12.2.7 : Modes of
Operation
‘ aW nsport mode
ESP Transp (i
T Of paq
jn this case ESP header is added before the transport layer header (like TCP,UDP) and
trailer is added after the IP Packet whereas if authentication is
required then authentication
data is added after the ESP trail er:
Scanned by CamScanner
(ay Crypt. & Sys. Security (MU-Sem., 6-Comp)
12- 18 Intorne! Security Protocol,
_——
Scanned by CamScanner
6A uses different parameters to
security parameter index (Spy ).
- 23 Firewall Introduction
Scanned by CamScanner
EF cptsy. secu MU-Sam
6. Comp)
. _12.20
12.3.1 Firewall Characterlstics
[otess” What are the various characteristics of firewall 7 (Ref sac. 12.3.1)
2. The traffic defined by the local security policy will only allowed to pass through the
network. Different types of firewall are used to define the policies as per the norms
decided.
— User control : This technique is used to controls access to a service according to which +2 At
user is attempting to access it. . ; ak
‘ : é Ww.
— Behaviour control : Controls how particular services are used. For example, the firewall P eee. ca
-
Ya al ne tw
may filter e-mail to eliminate spam.
. . {Tchitee
12.3.2 Limitations of Firewalls g Prewan
’ > 1 atism ie
I Q. 12.3.4 What are the disadvantages of firewalls? (Ref sec. 12.3.2) ‘ «is< planplanned @ : ; D00D
or falls f
be ap , t of securing your organize and
ivotal componen
A firewall may activity verification (through stateful pa
7
n integrity OF
e issues of info rmatio
address th your inner network (thr ough NAT). Your network picks uP
‘ of
inspec tion) and secrecy ; transmi ted activity through the firewall ‘—
firewall by accepting all tat all by receiving itted ac
id all transmitte
benefits from a fn o m @ fi re w
ck nefits fr
these beenefi
network P! ks up
the firewall.
Scanned by CamScanner
3. Architecture |
4. Configuration
5. Monitoring
6. Encryption
7. Masquerading |
8. Vulnerabllities
42, Attacks
s or ringy.in to or out of the
attackers with modems from ente“l
A fire wall | c cann ot p pre vent user
and its protection com
internal network, thus bypassing the firewall
|
+3, Architecture
ty
: ‘ : ds upon single chanism failure. If that . securi
Firewall architecture depends upon sing
security me
firewall programs: which opens
entire
mechanism has a single point of failure, affects on
the loop falls for intruders.
+4 Configuration
n. Only
Firewall doesn’t have mechanism to tell administ
rato r about incorrect configuratio
erly.
in the field of netw ork secur ity C an configure firewall prop
ined professionals
Scanned by CamScanner
EF orypr, Pt. & Sys, Security (MU-Sem. 6-Com )
12-22 Intemot Security Protocols
~> 5. Monitoring
Firewall doesn’t give notification about hacking, It will notify only about threa
Occurrences. The reason is, organization demands additional
tware hardware, sof
different networking tools and
as per there requirement hence there is no control on
it.
> 6. Encryption
Firewall and Virtual Private Networks (VPNs) don't
encrypt confidential documents and
E-mail messages sent within the organization or
to outsiders. Dignified procedures and
tools are needed to provide protection agains
t confidential documents.
> 7. Masquerading
Firewalls can’t stop hacker those who steal login id
and password of authentic user to gain
access to a secure network. Once attacker gains : L Packet Filteri
full access of the entire network, attacker
can delete or change the network policies
of organization. tis the most simpl
> 8. Vulnerabilities
Packet filtering is «
Firewall can’t tell other venerability that might allow some protocol type
a hacker access to your internal
network, Ifthe firewall is pla
Scanned by CamScanner
ing are the common architectural implementations of firewalls
Implementations
of firewalls
= Personal firewalls
_ packet filtering is done on the basis of packets source or destination address or based on
some protocol type like HTTP or HTTPs.
- [fthe firewall is placed just behind the router then the traffic can be analyzed easily.
- In the Fig. 12.3.3 it is shown that how packet filtering gateway can block traffic from
network | and allow traffic from network 2.
- Also the traffic using telnet protocol is blocked. Packet filters do not analyze the contents
dfthe packet rather they just check IP address of the packets as shown in Fig. 12.3.3.
~ The biggest disadvantage of the packet filtering gateway is that it requires lot of detailing
- — Wset policies,
Packet
filtering
gateway (69
Scanned by CamScanner
Crypt, & Sys. Security
Sm. (MU-Sem. 6-Comp)
6-Comp) jee
If port 80 is blocked, If Some applications
essentially need use of port 80 then
Wwe have to provide all the details
of those applications
in this cas, |
for which port 80 is needed,
> ; 2. 4 z A
Stateful Inspection Firewall
~
ona
Packet filtering is done one packet :
at time. Sometimes attacker may use j
their attack. Attacker can this technique for . It a
split the script of attack into different
complete script of attack cannot be ide : packets so that the |
ntified by packet filtering firewall.1 ete-
~ To avoid this stateful inspection firewall
keeps record of states of the Packets from
packet to another. Thus Sequence . ,
of packets and conditions within
identified easily, the Packets CAN be
Remote
file fetches
Fig. 12.3.4; Firewall
Proxies
Example
Scanned by CamScanner
rnet a school Bi anh Bowsinadt’
_ i order to increase the speed of the inte ownload limit for the
students.
Astudent can download only 20mb data per day etc
oh personal Firewalls
Firewall Configurations
ter
1. Firewall with screening rou
nfigurations ©
Fig. 12.3.5 : Firewall Co
eee
Scanned by CamScanner
ET crypt. & sys. Security
(MU-Sem. 6-Comp)p 12-26 Internet Security Protocolg
> 1. Firewall with screening rout
er
Outside network
Screening router
Fig. 12.3.6
network
Proxy gateway
Fig. 12.3.7
Scanned by CamScanner
oe inyomet Security PICS
|) 3
1 with Proxy and Screening Router
Proxy firawall
screening router
Fig. 12.3.8
rect
is ins tal led beh ind the pro xy firewall, then it ensures the cor
ning router yone fails
a double guard protection. If an
all. mn other words it is
sed
pAN is nol expo
n Detection
introduction to i Intrusio
si
A ce nt ye ar s, se cu ri ty has becomes an eesent
Internet during re
n of
with therapid expansio stems.
ut er ne tw or ks and computer sy
issue for comp assets
t valuable
m a i n a i m © f a security system is to protect the mos
the
as defined earlier g; ani zat ion s like ban ks, com pan ies, universities and many
ation) of an or n in some form, and
(dota/secret inform se cr et in fo rm at io
others, because these org aniz
ations have data or
acy, int egrity, and availability of
uri ty po li ci es are keen for protecting the priv
their sec
ation or data.
ees
these valuabl e inform g on
ty po li ci es an d requirements dependin
i
ll have diff er en t se cu ri
_ As these organizations wi
.
their vision and missions se cu rity policies, firewalls,
mp li sh thi s ta sk ar e
en carried out to acco e different services
_ = Many efforts have be (I DS s) to co nf ig ur
usion Detection Syste mis
anti-virus software even Intr
er networks.
inoperating systems and comput death,
(l ik e den ial ser vic e att acks, IP spoofing, ping of
attacks
, But still detecting different mi ng 4 crucial problem to so
lve
comp uter ne tw or ks is be co
network scanning etc.) against
inthe field of cryptography and network security.
Scanned by CamScanner
ice attacks,
Scannin mation SY¥stem
g a Networks Perform, an
an Mtrusion, e lp address, , Ping Scan
et ©. Which is legally és ’ Sendin
t Alloweg
Scanned by CamScanner
ot. & SVE: Security
(M U-Sem
Comp) 12.29 Internat Security Protocols
Syllabus Topic : ID
S and Types
af as What is intrusion detection system? Enlist and explain different types of IDS
or (Ref. sec. 12.4.2)
geet What are the challenges of-intrusion detection? (Ret, sec, 12.4.2)
snirusion Detection system has some policies or mechanisms to protect computer systems
7 from many attacks. As the use of data transmission and receiving over the internet
iqereases the need to protect the data of these connected systems also increases. Many
scientists have different definition of IDS but as per our point of view IDS can be defined _
qs below point.
#An Intrusion Detection System is software that monitors the events occur in a computer
ems or networks, analyzing what happens during an execution and tries to find out
confidentiality,
indications that the computer has been misused in order to achieve
integrity and availability of a resource or data”.
round, and only generate the
The IDS will continuously run on our system in the backg
rules and regulation or attack
alert when it detects something suspicious as per its own
action to prevent damage.
signature present into it and taking some immediate
? \ntrusion detection
le attacks on the
System examines or monitors system or network activity to find possib
stem or network. Signs of violation of system security policies, standard secunty
prctices are analyzed.
ae i m from
Intusion Prevention is the process of detecting intruders and preventing ie
intusive effort to system.
Scanned by CamScanner
Crypt. & Sys, Security (MU-Sem, 6-Comp Internal Security p fe Moody
some restrictions, In this case, the intruder already has legitimate access to a COMPAatey
system, but utilizes any of the previously mentioned techniques to gain Nd itiongy
privileges and misuse the computer system, Sometimes inside intruders are more harmy, ‘l
than outside intruders. It is ‘observed that 80% of intrusions and attacks come from Withig
organizations,
Following are the possible type of attacks that intrusion detection needs to face ;
Type of attacks
Scanned by CamScanner
ictil m creates a record jn g data
the ¥} 4 structure q
j a spoofed IP address, but it never
receive nd responds with SYN/ACK message
8 the fj to
es
gablishing the connection, since the SPOofgped tektowledgment message ACK for
gespond t0 the SYN/ACK messages, Addresses are unreachable or unable to
anhoug! the record from the data struct
nempts to generate sufficiently large nu Ure is freed after a ti ‘
a mber of “hate, Me out period, the attacker
gata structure that may lead to a segment Atioi
n fay| to pen” connect 10N8 to Overflow the
r locking Up th
e computer,
» » Pingscan
The simplest form of scan, an attacker sends
an
spidate machine (which is the same way the Ping tool echo request packet to every
works),
Any addresses that respond are
noted ag active,
' ’
connection attempts, active. Since many system
this type of scan is s log any
relatively easy to recogn
ize from standard audit
data
.
Q) UDP scans : This scan consists of sending
UDP packets to likely ports on candidate
machines at worst, scanning for any open UDP ports, Since UDP is
connectionless, such
attempts are harder to control using filtering firewalls,
and may be capable of finding
unprotected services and hosts. Many variations on these scanning
techniques exists -
including scans using fragmented packets, and scans spread across a long period or a
number of source machines. In practice, completely blocking scans is probably infeasible -
but may give an administrator early warning of an impending attack.
,
() Rlogin : The RLOGIN attack is characterize3 d by a high rate of connection
s from Sones |
0 another, often within a small period of time. In this attack, the intruder is attempting to
gain access to the system.
* Need of IDS
| ection has its primary goal the detection of abuses of computer systems also
~ Intrusion Det | |
itperforms a variety of functions like :
I Monitoring and analyzing user and system activity.
Scanned by CamScanner
Internet Securit
Auditi
‘ting system con
. figura I
tions and vulnerabilities.
Assessing the integrity of critical system and
data files.
Recogniti sos
°snition of activity patterns reflecting known attacks.
Statistics .
auistical analysis for abnormal activity patterns.
Operating-system aud
it-trail Management, with recognition
Policy violations. of user activity reflecting
© To maintain the logs of all the threat those are detected by IDS.
- As users are monitored continuously in network, making them analyze so that ks
violations cannot be committed.
— Using some preventive measures so that violation cannot be occur like terminating the
or block access to the targets or the accounts that
ar
network connections, user session
likely to be violated. |
. - y, which helps#
The IDPS (Intrusion Detection and Prevention System) can acts penie
1 i x
Scanned by CamScanner
1, & SYS: Security (MU-Sem, 8-Comp)
12-39
Internet Security Protocols
intrusion Detection Methog s/
Techni ques
7 Exp ain methods for intrusion detectio
n
ae : Signature Ba
protocol analysis. Most of the IDPS usesSes 4 th “© techniques to re
sed, anomaly
based
duce or make
network
;43(4) Signature Based Detection
‘Ogres. 12 .
nis process of comparing the Signatures of know.
;
i of
rity ‘ onserved. Here the current packet j n threat with the events th
packet Is been matched With ] St ate been
CUrity petwo rk. °8 entry of the signatures in the
-snature is defined as the pattern (structure BZ
— si - Dy contain sommsncaddcens, desta *) that we search inside a data packet. The data
g packe » tion address, Protocol, port number etc.
|. faa ttacker adds any malicious code j
© Ito these data packet he is generating attack
‘Stem, pattern or signature.
that q
‘ite ;
_ Signature based IDS reais '
even of such attack pattem for detecting the known or
documented attacks. Single signature is used to detect one or more types of attacks which
| ge present in different parts of a data packet. ,
ful i ; ;
m - Signature based IDS used to monitor the events occurred in the network and match those
events against a database of attack signatures to detect intrusions.
- Italso uses a rule set to identify intrusions by watching for patterns of events specific to
known and documented attacks.
less - Forexample, we may get signatures in the IP header, transport layer header (TCP or UDP
header) and application layer header or payload.
; the - Signature based intrusion detection system sometimes also called misuse detection
a techniques. It checks for the attack pattern with the existing stored database pattern and if
_ atch is found then generates the alert.
in te ecause
Signature based IDSs are unable to detect unknown and newly generated attacks b
the fee : ; isti da tabase.
. | krequires manual updating of each new type of attacks into to the existing
E> The most well known example of signature - based IDS is SNORT IDS freely available
for atack detection and study purpose.
Scanned by CamScanner
[3 cop. & Sys. Security (MU-Sem. 6-Comp) 12-34 Intamet Security Protocols
— ==
vw Advantages
An advantage of misuse-detection IDS is that itis not only useful to detect intrusions, bus
it will also detect intrusion attempts.
Effective at detecting known attack without too many false alerts as compare tn
anomaly
detection technique.
uses misuse detection technique
Most of the current network intrusion detection system
to the rules and regulation ae °
for finding the attack pattern and detect them according
— Furthermore, the misuse detection IDS could detect port - scans and other
EVENS that
possibly precede an intrusion.
# Disadvantages
- Detecting only known attacks therefore it cannot identify new attacks efficiently.
— If there is single variation into attack signature it invalidates the attack Signature or unable
to detect it. ;
— Constant updating of attack pattern is required.
For example
Web activities are a normal activity done in a network. Anomaly based IDS works on tk
notation that “attack behavior” enough differ from “nor
mal behavior” (IDS developer ms
define normal behavior).
- Normal or acceptable behaviors of the system (e.g. CPU usage, job execution time et if
the system behavior looks abnormal i.e. increasing CPU speed, too many job execulic® '
6°
a time then it is assumed that the systems is out of normal activity. Anomaly
detection is based on the abnormal behavior of a host or network.
Z ark ani *
~ Database for such type of IDS is the events generated by user, host and ner
“normal” behavior of the systems. These events (historical data) are collected
Scanned by CamScanner
_ 5 Sys, Security (MU-Sem. 6-Comp Intarnat Security Protocols
Work on
i
and abno tal x io we :
normal
ver 4
Q
ly based IDS chec kss ongoin
i g traf f Ic,
“a ons t
8
An
he t acti vili
iti es, transactions
identify intrusi
d
, to identry i 'y detecti ng anomali es, - based IDS general
”
ly
io :
uses
il ced techniq ues. 8. Host
an
:
ris can be done in two ways
Anomaly Based
Detection
1. Threshold detection
at Threshold detection
measured
groups and frequency of all events is
old is defined for all users for all
comparing with threshold.
tection
4 2. Profile Based de
tics for
cr ea te d an d th ey are ma tc hed against the collected statis
s
Profiles of individual ar e
tterns.
checking the irregular pa
x Advantages
network. If it
st em 0 bse rve s and checks the deviation of normal
sy
An anomaly detection om no rm al de viations it will immediately
ious in the ne tw or k fr
abserves any changes Or suspic
unknown attack.
| igforr and alert about the
|
Scanned by CamScanner
ker Crypt. & Sys. Security (MU-Sem. 6-Comp) 12-36 1 nternet Security Protocolg
et
4
12.4.3(C) Stateful Protocol Analysis a qrese
Unlike anomaly based detection which uses host and network specific Profiles, the «
pp?
stateful protocol analysis relies on Vendor devel
oped universal Profiles. The stateful Protogg,
analysis means the IDPS is able of checking the network, applications, and Protocols that ‘ | 4
op &
pre defined in them. It can identify unexpected sequence of
threats in form of commands. E ese
@ Disadvantage of stateful protocol analysis
. 2 Amon:
- Stateful protocol analysis are extensively resource deman . net
ding. the
- These methods don’t capture threats or attacks
that don’t hamper the general acceptey i 42. A.A) !
protocol in network.
Types of IDS
Technologies
2. Wireless
4. Host Based
Scanned by CamScanner
Ne
‘i
twork E tehavio Ur Ana lyse Intamet Security Protocols
Protocols
Bas network behavior an
specifi (Distributed Denial
alyze
fes
id ‘+
ty the
s. Th © Profiles pposiPis of Service) Attacks cnt that create
a
and ©Protoco}s
statefy] 4.ro CO Host
os Based : * Malware, aan 1 POlicy
oy sna rntt
violation overflow,
M Of é on a
‘4.
: spe nerworks and hosts. © portant and Most ¢ Ommonly used to moni
Omutor
the gen eral ac , ‘A Networ
k based IDS
cept d 94a ) (NIDS)
as the usage and popularity of Internet js tis reac:
petwork are increasing for example TCp hijack; Casing ttemendou Sly, the attacks
- * : Cl
ae
rin g, cap tur ing and ana lyz ing packets or network traffic
~ NIDS detects attacks by mon ito
cts malicious data
, indication that computer has been mis used, It dete
and, tries to give
ictivities 4 _ Pfésent into packets by monitoring network traffic.
aS
Scanned by CamScanner
12-38 Intemet Security Protocols
et Crypt. & Sys, Security (MU-Sem, 6-Comp)
oy
NIDS continually monitors network traffic and discovers that if hacker/ intruder are
attempting to break into a system,
- When NIDS installed on main server which consist of multipl
e hosts in a single network
it detects attacks present in the multiple hosts by checking incoming packets that looks
unordinary.
— NIDS uses raw network packets as the traini
ng dataset for offline detection collected from
well known research laboratory such as Defence Advance Research Project Agen cy
(DARPA).
- As defined earlier it can be installed on servers, workstations,
personal computers o-
machines dedicated to monitor incoming network packets from switches, routers and
probes for intrusions.
@ Advantages of NIDS
- (NIDS) usually consists of a network sensor with a Network Interface Card (NIC) 9r i
card operating in casual mode. The IDS is placed along a network segment or boun a
and it monitors all traffic on that network segment.
Scanned by CamScanner
| «, geculit
; 49; intarnat Securl Protocols
E 2
a apt §
Host pased IDS (HIDS)
:
ects information fi m the operating system audit trails, and sy
stem logs.
y eal ro ating system, an
ie a sec riesoof records of events, about an oper
computer
ae
iit trail 18 a tors system activity)
yser activin 8 dy an auditing system that moni
iy installed on individual host which is connected to the internet ;
ne tw or k de ni al of se
suitable for detecting
- Host based IDS are not kets received by in
dividual host.
only those pac
atacks because it only checks
Email - PGP
Fe Syllabus Topic : Secure
Se
‘
cu ri ty : Pr et ty Good Privacy
5 Electronic Mail
|
Scanned by
wd
CamScanner
(ey Crypt. & Sys. Security (MU-Sem.6- 12-)40
Comp wedittematat SeSecurit
Urity Protoco, E
We all are aware that most popular use of Internet is to send the te and chatting With
the friend’s, partner etc, But have you ever think that if we are sending mail to
Intended
person is going in his inbox only?
Security concerns have estimated that only about one ini every 100 m essages
i BES isis secur
; d
against interception and modification: attacks. Are we aware that sendin
nding g an an emailemail ;.|
business partner or friends in clear text message is going through thousands
of Machines
(between sender and receiver before it reaches to intended recipients?)
these mach}
might read and saved the contents of email for future use?
Many people think that name given in sender of the mail identi
fies who actually sends it,
When you send a message through email, we cannot
guarantee that it will be deliver
Correct destination or received exactly what
you sent. And even there is a no Way of
knowing that the message is received read and
forwarded by attacker.
Because of wide spared problem of email modifica
tions, sending it to wrong destinatig
by intermediate parties, email spoofing
, we need a competing solution
to overcome and
address the issues of authentication, in tegrity and reliability of the messages
Sender and receiver,
betweey
ald
Scanned by CamScanner
a signature functionality of Pq Intornat Security Protocols
’ «ital § P au
Ra and not from an intruder, Rarantegs 4 At the message
or file come fram the
: working of Pret
ty Good Privac
y
5.
it
S
set ned earlier PGP
uses the Concept of
7 3 tin text message using PGP, it first Compr
aad
Scanned by CamScanner
OrypAt Sys, Geourty (MU-Sem, & Com Internet Securt Protocels
eee
Encryption and decryption
alopa of PAP
1.PGP Authontication \
2,PQP Confidentiality \
4, PGP Compresaion }
Ramesh encrypts the hash using his private key Rd to obtain ciphe
rtext c given by
¢ = encryptra(SHA(m))
Ramesh sends the pair (m,c)to Suresh
Suresh receives (m,c) and decrypts c using Ramesh's public
key Re to obtain signature
S = decryptp.(c)
He computes the hash of m using SHA-1 and if this hash value is equal
to S then
message is authenticated.
Suresh is sure that the message is correct and that came from Ramesh. Furthern®
Ramesh cannot later deny sending the message since only Ramesh has access
private key Rd which works with respective
public key Rd.
2. PGP Confidentiality
__ —_
Scanned by CamScanner
protocols
Internet Security
| : 4 gecurity (MU-Sem. 6-Comp) eet
yi = encryptne(k)
pts the message m With the session key k to get ciphertext c
pen ¢ = eneryptx(m)s
gon? ,c)
I, h l ue (k’
res the va a
sen
ds Su
«fi ond
d(h’)
in
gnc ryp
ts
ing vat
e
key By to ob
ta k.
ryptn
ues ( dec k’ us his pri
f ves the val ic) and
b sur
sh ci
& dec
e session key k to decrypt the ciphertext c and recover the message
p uses th
m = decryptk(c)
for
wie? etric key aeypicaysems are combined in this way to provide security
is used only to
Pu e and then efficiency for encryption. The session key k
a
dis not stored for any length of time.
message"
enetsh
GP Authentication and Confidentiality
— .
4a*
authentication and confi denti ality can be combined so that Ramesh can
rhevcontisevd eme s fOr alt uired are as
ential message which is encrypted before transmission. The steps req
sift
.
|
glows *
si gn at ur e c for his message m as in the Authentication scheme
tes a
| Ramesh genera
¢ = encryptra(SHA(m))
tes a ran dom sess ion key k and encrypts the message m and the signature c
1 Ramesh genera
cry pt osystem to obtain
ciphertext C
using & sy mm et ri c
C = encrypt(m,c)
n key k us ing Suresh public
key
1, He en cr yp ts the se ss io
k’ = encryptne(k)
- 4 Ramesh sends Suresh the values (k’,C)
session
C and decryp ts k’ using his private key Bd to obtain the
$, Suresh receives k’ and
kyk
decryptpa(k’)
k =
5
6 i the sessi on key k to obtai n m and c
Suresh decrypts the ciphertextC using
;
(m,c) = decrypt(C) ;
ri. § uresh now has the message m. In order to authenticate it he uses Ramesh public key Re
|
to decry . m using SHA-1.
decrypt the signature c and hashes the message
a
Scanned by CamScanner
£
L 2 gach 6
Then the message is authenticated.
E 3 : this yal
=> 4. PGP Compression § a po?
. set
PGP can also compress the = if desired. The compression algorithm js ZIP ang i a & es cons
decompression algorithm is UNZIP.
; another
1. The original message mis signed as before to obtai
. n a poP automa
c = encryptra(SHA(m))
. i pt, th
ian recel
2, Now the original message m is compressed to obtain
@ followin’ ah
M = ZIP(m)
BE. i Authent!
3, Ramesh generates a session key k and encrypts the compress
i
ed message ang the Signat, 3 Non-rept
.
using the session key re
; :
ores
C = encrypt(M,c)
oo _ ce oc
4. The session key is encrypted using Sures
h’s public key as before. 7, Segment
5. Ramesh sends Suresh the encrypted sessi de
on key and ciphertext C. we kK
125.2 nag
6. Suresh cccryps the session key using his private key
and then uses the Session key 4 _
decrypt the ciphertext C to obtain M and c Suppose, we
can get unav
(M,c) = decrypt,(C)
a Backdoor i
7. Suresh decompresses the message M
to obtain the original message m
= ABackdoor
m = UNZIP(M)
provide unaut
8. Now Suresh has the original message m
and signature c. He verifies the signature
SHA-1 and Ramesh’s using - A backdoor i
public key as before,
encryption al;
> 5. PGP E-Mail Compatibility
~ ABackdoor ;
—- Many electronic. mail; systems can only trans
mit blocks of ASCII text. This; creates! «ven be j
problem when sending encrypted data which mple
is in cipher text form might not correspod
to ASCII characters that can be transmitted. Nst to give al
Statement for
_
PGP overcomes this problem by using Radi
x-64 conversion.
Suppose the text to be encrypted has been converted into binary
using ASCII coding .
encrypted to give a ciphertext stream of binary. Radix-64 conver
sion maps. arbi
binary into printable characters.
1. The binary input is split into blocks of 24 bits (3 bytes
).
Scanned by CamScanner
ib . ~ Internet Security Protocols
is then split
into four Sets
cach of 6 bi-bits,
i
ss 6-bit set will then have a value between 0 andn 2° ~ | (= 63),
ria
wit
2. Confidentiality
|. soayetition
sepusiation 4, Integrity
s F mpression 6. E-mail Compatibility
, * Se gegmentation
packdoors and Key Escrow in PGp
.
Su ppases We have ; saved your password in laptop. So, anys one who
: has access the laptop,
woe unauthorized access to your account. And that is a simple way of saying what
a Backdoor Py,
_ aBackdoor is a method for bypassing normal authentication in a system and thus,
provide unauthorized remote access to the system to malicious users.
_ abackdoor is a “feature” in the software of-PGP like an utility functions but not in the
| qgcryption algorithm that allows an outside party to decrypt which is encrypted by PGP.
_ ABackdoor may be implemented as a hidden part of a program or a separate program or
| wen be implemented by hardware.
I. just to give an example, in 2003 a Backdoor was planted in Linux Kernel. Ina conditional
| silement for checking root access permission, ‘= =' was replaced with '='. As a result, it ji
gave unauthorizd access to malicious callers. Even very recently, in 2015, Salles i
that automatically
Networks have warned about a malicious Backdoor in their firewalls
derypis VPN traffic. i
and Asymmetric
are two types of Backdoors -Object Code Backdoors
/* There
a:
|
rr
Scanned by CamScanner
LB" crypt. sys. Security (MU-Som 6-Comp) _12-46 Internet Security Protec
In Object Code Backdoors, software source code remain
s unchanged, but the object egqa
gets modified maliciously. As the object code is designed
to be machine readable,
becomes much more difficult to detect. These types of Backdo
ors are inserted in the
disk object code or inserted at some point during compilation, linking or loading,
_ Recompiling the software source code may get rid of the
Backdoors. So, malicious us ones
sometimes change the compiler source code in such a way that, whenever jt compiles -
if
a
links and loads the source code, the Backdoor is inserted. These Backdoors can be a 3
- Key escrow is a cryptographic key exchange process in which a key is held in escrow, Method;
stored, by a third party. A key that is lost or compromised by its original user(s) may 0 Pro,
a
Scanned by CamScanner
: Protoco Is
| clippet Chipi was a U.S. go eh
g Vvernment
The .
93. The
i
oo 5 Honeypot ——___
ia | y
Scanned by CamScanner
_-ntemet Security Protocols
Honeypot developers are often more interested in getting into the minds of hackers, which
then permits them to design more secure systems, as well as to educate other professional,
about the lessons learned through their efforts.
Overall, honeypots are considered an effective method to track hacker behavior and
heighten the effectiveness of computer security tools.
Sa,
Chapter Ends.
QO0Q
Scanned by CamScanner
Module 6
Software Vulnerabilities
_—
and integrity.
is wh ic h pro vid es or enf orc es availability, confidentiality
rogram
. Asecurep
nee ds.
peo ple ma y ha ve dif fer ent security requirements and
_ But different
.
Examples
her work is good enough.
1. Naive user : Fit for his or
ing.
his / her tests while programm
2, Programmer : Passes all
d.
na ge r : All re qu ir em en ts and specifications are covere
3, Ma
g.
lo pe r : Co rr ec t im pl em en ta tion, functioning and testin
4, Deve
llowing ways,
~ This security can be judged by fo
1. By fixing software faults faults can be
k fix method new
While fixing software faults especially by quic nes, side effects of
by work pres sure, deadli
introduced. Mainly these faults are caused
requirements efc.
the fault fixing, system performance
2, By testing program behavior In requirement
ma y cau se fau lts / failures in the program.
ors
While coding typing err
Scanned by CamScanner
—<—— Software Vulnorabititiog
od then again it May cause
understo ; 8
not clearly. ent
‘ea’ments |.are Aga components inaethe prmogararm hayg
se
‘ requireme
if in dif fer s 3
analysis pha . a . o r
ioneeal or acc ntal flaws fi
ide
lementat jon
ng and imp
wrong codi each other
whl
at e w i t
i h use by 4
to communic fa ul ts ar e faults.
pr og ra m. Accidental g h l y ¢ o avoid such
the thorou
te st in g must be done g al so . Te st in g can check that what
Therefor e this test in
for
jimitations program
But there
are some
chee k what; program should
not do. Again
It ca nn ot as well as changing
ld do. ex data structures
program shou © od in
i g, c o m p
ic. omplex
complexity for testing:
gi es ar e th e challenges
technolo
alysis uld be taken
3, By program an
r j u d g i n g so ftware security. Care sho
oaches fo
It is one of the best appr to deployme:
nt stage: While developing program,
m e n t an al ys is
ire considering all the scenarios,
right from requ Id be pe
P rformed care fully by can te
testing and deb
uggin g sh ou
se cu ri ty me th od s and. techniques
p eciali z e d
Based on the analysis s
implemented.
Program Errors
13.1.2 Non-malicious
> (M c. 15)
- DeU
programming errors. |
ex am pl e § exp lai n non mal ici ous
@.13.1.2 With the help of : DS
1.2)
(Ref, sec. 13. 2) a
ogram ef rors ? (Ref. Sec. 13.4
Q. 13.1.3 Whatis non malicious pr
a pro gr am me r ca n ma ke mi st akes/errors. Most of these errors are no!
While programming, security. Program
‘of errors do not have huge impact on
intentionally done. Many such kind
it is non-malicious.
may produce wrong or incorrect results but
program errors,
Following are the three types of non-malicious
1. Buffer overflows
a5 re
-
Scanned by CamScanner
also known as aliasing.
Running normal
<< << —— After attack
—
Program
Instructions a Program
Instructions
Data
>} ata
rors. - As shown in Fig. 13.1.1 attacker changes the return address and thus can transfer the
. 15, 5 Marks
control of the program.
sa
1 Incomplete mediation
|
e errors are not
urity. Program U12.1.5 What is incomplete mediation in software security?
(Retsec.19.1.212)). pe
introduced as sensitive
Due to incomplete mediation serious security threats can be
data may get exposed and can result in uncontrolled con
dition.
Scanned by CamScanner
[a Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-4 Software Vulnerabilities
- Example : If two threads are sharing their root and current directories then, Let
_ Thread X’s current working directory is /college.
¥ ealls chdir(“/department”) | | |
eystem monitor permits both the calls
_ Proper locking mechanism can prevent this kind of attack. Time lags should be.
considered. After checking values it must be locked using digital signatures and
certificates. Thus after check data cannot be modified.
Q. 13.1.8 What are ‘the different types of malicious software’ S 27 (Ret. sec. 13.1.3)
Malicious software is software where an attacker can get partial or full control of the
program. Thus attacker is free to do anything that he / she want to do.
Malware is currently the major source of attacks and fraudulent activities on the Internet
Malware is used to infect computers. Malware, short form is malicious software or also called j
as malicious software.
awail'* !
Scanned by CamScanner
f Trojan Horses
it) potnet
under control of an attacker.
ig a network of zombies, i.e. compromised computers
is acomputer connected to the
i - program loaded on zombie computer (a zombie
provides remote control mechanisms
sa that has been compromised by a hacker) that |
tely control a computer.
Bot - a small program to remo
SE men
unication (C&C) channels to command
Rot is characterized by Remote control and comm
ds and information between the —-
victim (Means of receiving and sending comman
the zomb ies) as show n in Fig 13.1. 3. For example, perform denial-of service
ae and
. ‘amteae
attack, send spam.
(Botmaster)
7
| em
———_ ee ee ee ee ee
1
1
1
t
i
1
1
J
i
'
1
1
t
t
1
1
SS Se
ee eee
eee
é
eee
ee eee
eee
eee
ee
2 en a ae
Fe
a a ee a
wan
Scanned by
ath
CamScanner
ep Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-6 Software Vulnerabilities
(2) Trojan horse
It is a computer program. Along with some useful code or function, some hidden
malicious code or function is there which may hamper performance of Security
mechanisms. Useful information can be stolen by attackers.
(3) Bacterium
Bacterium is a special kind of virus. Virus is getting attached with different files but
bacterium does not get attached to a specific file.
Logic bomb is generally usedin DoS (Denial of Service) attacks. When specifieg
conditions are met it activates malicious program logic. It may damage system Tesources
greatly.
(6) Rabbit - | .
It is a kind of virus / worms that replicates itself without any limits. The intension
is to
exhaust resources.
— iasiliinand
(7) Trapdoor / backdoor
An intruder can enter into the system by’ bypassing ‘all security servic
es or mechanisms.
Thus intruder knows the flaws or loopholes in the system and can get
anal
these loopholes to
Lina iae sc
gain access to the computer.
Scanned by CamScanner
_
curity (MU-Sem, 6-C Sottware Vulnerabilities
1, & Sy® os _
wt slowly:
gpreads OF infects system without priory informing the user the activities like
ing the
, ton of file, halting of system etc, virus can affect system mildly, effect
ata or can cause severe like denial of service.
le files, Whereas worm are standalone
most all viruses come with some of the executab
they ente r syst em by find ing loop hole in the system and take advantage of file
“oftware
ranspott features of system,
® Stealth Virus
@) Potmorhi Virus
6) Macro Virus
l
(7) Active X and Java contro
us
Fig. 13.1.4 : Types of vir
Scanned by CamScanner
[EF crypt. & sys. Security (MU-Sem, 6-Comp) iy Io _— Software Vulnerabilities
ieee
A program virus gets active when program containing these virus gets openeg
program.
(-bin, exe, ove), once if gets open it starts copying itself and infect other
“> (3) Multipartite virus
— It infects the program files. When this virus is active it will affect boot sector also
after booting or starting up it will affect other computer also.
hes
=~ (4) Stealth Virus
ites
- “Dubbed Brain” the first computer virus was a stealth virus it tries to disguise itself
so that antivirus software may not able to recognize it.
— Italters the file size, concealing file’s memory and so on.
= (5) Polymorphic Virus 4
It keeps on changing it patterns or. signature to get undetected. Usually it acts like a
‘chamleon’. These are not actual virus, it is a virus which hides actual virus of the system.
1, E-mail worms
any infected websites.
It spreads through infected email message of
ead s by sen din g link to con tac t list of instant messaging application.
It spr
Scanned by CamScanner
erabilities
U-Sem.6-Comp) _13-9 Software Vuln
it
k re s ces whi ch are ava ila ble and system. If it found vulnerable,
all net w o r our
b 5 a
F in access,
gvantage and ga
s
{ Relay Chat) worm
gc anter® copy of itsel { through link in infected websites.
Network worms
file charing
P network.
4
gr place
5 a c O py of itself
in
a folder which is sharable and spread via P2
n Virus and Worm
¢) Difference betwee
sec. 13.1.4(C))
ig thedidifference between Virus and Worm ? (Ref.
Worms
Scanned by CamScanner
EET crypt.
Crypt. && sys.
Sys. S ecurity (MU-Sem. 6-Comp) _13-10 Software Vulnerabllitiog
Example
||
extensions or for an emergency access if
software fails. These loopsholes are purposely kept
in the system with good intension.
— Major sources of Trapdoors / Backdoor
s —
o During testing of the system stubs, driv
ers are created. These are temporary
which functions
then further replaced by actual functions.
Sometimes some malicious code is
intentionally injected
into the system for testing purpose.
oO Poor error checking conditions.
© Undefined opcodes in hardware processo
rs.
(2) Salami Attack
Scanned by CamScanner
Software Vulnerab
ilities
g Write a short Noto On Govor, cha
co nnel, Rar
be - channel the proces
iv ses Which are
ct tion
by security policy
5 | ap ile can “OMMUnicate
i
5 (ore
Such types of att and transfe and transfer th
e
jects a c k a
s re Virtually 1 r da ta Us in
tem, a Part i oly‘ é 13.5 show s channel crea | © ) deteactable by system or& Cu rrent System
admini..strators
Ula,
tion,
i I eh
, om Protected
j _
data
| +---[Gorviog Pym} —
Ueainate
[W/Trojan.h,)
Sonvort Channal
Spy
= Mechanisy |
se loopholes to Fig. 13.1.5: Covert chan
nel creation
§) Rootkits
¢ program
installed by an in: trud
— ion.
insta’
er. Intru der installs it by
on. The purpose is to gain
+4 ti ically itis
a
control of the co
—_— mputer : m is in
kind of Trojjan
an ho rs e Iwares, System sc i ste) fected with a
h m a a g e an cannot detect it.
ery hard to tr If sy The best solu
at ust infected oper ing tion is
snl Mit
it becomes
v at ing sy:syCstDem-. ROM,
infected system and bo Pendrive and
0 shut down th ot that system by some UL
e infected s .
Clean it,
ab le ro ot ki ts
i t s an d can be easily re
at system startup. These are de te ct
Scanned by CamScanner
_13-12 Software Vulnerabitit
mp)
(a Crypt. & Sys. Security (MU-Sem.6-Co nit es
. ———————
= :
2, Kernel Mode |
can corrupt the functionality f
Kernel mode rootkits are installed like an OS hence
0
complete OS. These Rootkits are very hard to detect. It can be detected only after |
5
some event,or crash.
3. Firmware
ware. At system |
Firmware’s are dangerous amongst all. Malcode is created inside a fir
. a
startup this malware will be reinstalled. It is very hard to remove
Scanned by CamScanner
_ Software Vulnorabilitios
. the controlling techniques ;
afl
aor" os
i amental principles of programms... x
o pha Programming like encapsulation, modularity and
hiding:
i goemation ‘
_ are
geviews mo st effective. Reviews,
Revi
Walkthrough and
ialinspection techni
echniques can b
ys ad to control program threats. q .
gussd analysis gives systematic approach
to identify Potential threat s
, Static analysis examines design and code before release to identify flaws,
32 Buffer Overflow
Itis also known as buffer overrun. It deviates from a standard, where the process stores
ata in buffer overruns the buffer's boundary and overwrites adjacent memory locations,
Bulle overflow can be triggered by inputs that are designed to execute code or alter the way
* program operates, Bound check can prevent buffer overflow.
: C and C++, as it
The languages which are commonly associated with buffer overflow are
“rides no built in protection against accessing or overwriting data in any part of memory.
Toverflow occur when a process tries to store data in buffer then it was intended to hold.
Scanned by CamScanner
‘ :
aoa)
Software Vulnerabilities
(ay Crypt. & Sys. Security (MU-Sem. 6-Comp) _13-14
J. Stack based buffer overflow : When program writes in memory address, on program's
call stack outside the intended data structure, then stack overflow occurs. The condition
where Buffer being overwritten is allocated on the stack (i.¢., is a local variable or
parameter to a function).
3.. Heap buffer overflow : In Buffer overflow, the overflow occurs when an application
copies more data into buffer then the buffer was designed
to contain. The heap space is
dynamically allocated by new(), malloc(), calloc() dynamically allocated in runtime.
Scanned by CamScanner
1 SS: Security (MU-Sem, 6-Com
YZ
—=
ee
- a a Softw. il
OftWare Vulnerabilities
| Syllabus Topic : Soft
ware Vulner
ability - Format Stri
ng
P iia
a
rormat String Attacks é
i" poauctton
ata i bait
Of an input string is evaluated as
¢
| suprintf Prints data into a'string and checking its the length
ion and is an ASCII Zstring _
~ The format string is the argument of the Format Funct . rol
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) 13-16 Software Vulnerabilities
— The format string parameter, like %d %x %s Joc Yop defines the type of conversion of
the format function. ;
—
— We have demonstrated the following examples on Linux environment by using Linux
cross compiler (gcc) which results how the application can behave when the format
function does not receive the necessary values for validation in the input of format string.
- First example shows the application operating with normal behaviour and normal inputs,
then, we will discuss the application operating when the attacker inputs the format string
and the resulting behaviour.
Example 1
#inelude <stdioh>
Void main()
inti = 77:
; chara = 'a’; ;
: printi("The value
of int i & char
a is : 9d Yed\n", i, a);
‘printf("The value of int i & char a is : %c Sc\n", i, a);
—
} ne SEE NPEAD aN, aot, ne ve ene ir a . Le
Scanned by CamScanner
cys: security (MU-Sem. comp) 13-17
Software Vulnerabilities
.@4 th
: . at £() writes the value of the i :
_ first PT? j : nteger variabl e¢ i and of the char acte i
* ynclude<stdio. i
argv)
' void main(int arge, char**
{
char buf[100};
etrnepy(buf, argv[1], 100);
:
_ printf(buf);
Be Scanned by CamScanner
GA] Crypt.
ie
& Sys. Security (MU-Sem, 6-GCom 13-18
fi
Software Vulnaratie
¢
If attacker pass Yos into the printf function which will fetch a number from the stack
treat this number ax an address, and prints the memory
contents pointed by this address as ‘
atving, until a NULL character (i.e., number 0) is encountered,
In this case Whatever number fetched by the printf function
might not be the address, the
memory displayed by this number might not exist because of such illegal fetching of
meme
address the program will crash such type of attack is called as
format string attacks,
Syllabus Topic : Cross Site Scripting ne
Scanned by CamScanner
- Software Vulnerabilities
_goourity (MUST. eee
. jous
p
stored xss Attacks 7
ge? re the injected script pt isi permanently stored on the target
$ red al tta cks are tho
: se whe :
as in a dat aba se, in a mes sag e for um, visitor log, comment field, etc.
cerverss such
then ret rie ves the mal ici ous scri pt fro m the serv er when it requests the stored
_ thew ctim o som etimes referred to as Persistent or Type-I
XSS.
form tion. Stored XSS is.als
ag Reflected XSS Attacks
h as
ack s are tho se whe re the inj ect ed script is reflected off the web server, suc
Reflected att ludes some or all of the
in an error message, search resu lt, or any other response that inc
part of the request.
input sen tto the server as e,
ve re d to vi ct im s vi a an ot he r ro ute, such as in an e-mail messag
_ Reflected atta
cks are deli
e.
or on some other websit
o cli cki ng on a ma li ci ou s li nk , submitting a specially crafted
When a user is tricked int able
to a mal ici ous sit e, the inj ected code travels to the vulner
form, or even just browsing
back to the user’s browser.
web site, which reflects the attack Reflec ted
the cod e bec aus e it cam e from a “trusted” server.
es
- The browser then execut
rsistent or Type-II XSS.
ed to as Non-Pe
XSS is also sometimes referr
Scanned by CamScanner
abies
eg
BETS
ue “(Ref. sec. 13.5)
into
urc e code inje ctio n tec hni que in whi ch malicious SQL statements are inserted
— It is aso
ent.
entry field of database to dump data base cont
4
Scanned by CamScanner
(MU-Sem, 6-Com 10
crypt. & Sys. Security
a Software Vulnerabilities
steps fo r SQL Injection
) 3 The attac cker looks for
: login PAR
pagES
es Search,
‘ . :
| HTML commands like POST of GET, ages or pages that display
miss or feedback R
° Attacker chec ks the source
code of the web
spittts ‘
Page by righ t clic' k on web page and view
gy I checks term <form> tag eve
rything insides .
getting vulnerabilities, <form> ag </form >have potential of
(4) The attacker puts single
i quote under the text
l
response iS an erro me Which
acceceptst
r ssage such as “a = +91 ( PIS
Something like usus ername and password. If .
6) Attacker th
an uses SQL c ) then ite
ommand such i
as SE LECT i
.
to add information to database,
NO retrieve data w in ene a
or INi sd
SERT comman
vx Benefits for attacker using SQ
L Injection
(1) Obtain basic information about
website OF organization
Scanned by CamScanner
J
Scanned by CamScanner
List of Experiments weer
_ mpl?
tation and analysis of RSA cryptosy
s
Implemen system ......
. ave
n
Experiment 1:
l............
o a
aie of
Scheme using RSA/E\Gamma opie” oti
ncn is
ane Dig Signa Ll
Experiment 2 :
Vv
Experiment 3(a) : nt
Write program in Java to impleme MDS algori
thm The algor!
n ati on. sii ESS eis dsesapeewe ald select
for key generatio and cipher verific \.
a c k e t e c t i o n u s i n g I n t r u s i on Detection System... L®
Experiment 6(b) : DoS att d
n g r s o n a l F i r e w a l l u s i n g i p t a bles.... vet
Experiment vi Sett i up p e e
y e ° BS ea es es ce ss er enscnnenerrnnner -
Set up Snort and stu t d h
Experiment 8:
Scanned by CamScanner
Scanned by CamScanner
ee
abe koe oe ia; x
sR? ge Tea Sake eae
ig ap ern eet z
es ide fe PAE ug
Aer
ahs 5 %. a ng
i. St
ee PL s * Siler
Neer ahha Be: We ee Soe So
frotnee - a:
sureadoad waef ayy Zoquuns pue conerdures 10J woyssas 4s9}e] ygr 2:
fF senenenee®
i
aanneneee®
: +p, Kay uondéisep MOUY ISNUT J9AtaIaI pur ,a, Aay WondCoy,
*NOUY Isnul Jopues oy) ‘VORIPpe UT “U JO SNTEA oY] MOU IoAysoer PUL Jepuas tog
“fay uordAiap = p “aray A
“R[NULIOJ WAAIs oy} Sursn ureyqo 9q Wes q XSITE] U POU =y +4
‘ezis Woo] = u pue Aoy uoNdAsug = 9 YxowE]g = J TxaWeydry = 5
: pue u> q ‘aiaqa U pou g=75
‘B[NULIOS ayy Bursn yxo}aydI9 ino putz +
“{U‘p) = Aay oqeatad *{u ‘a} = fox ongng j
"1 = (u)$ pour pa so (u)p pour | 2 = psem yons Jo aenaeD 5
“(U)O> 9 > | pur | = ((u)d ‘a) pod “3'T (u)> 0} ound Apoaneyar
st a eq Yons 9 329/95 7
“U-D ¢ (1-®) = (a)p qemogy f
Get =uaenge) 7
“d# 8 a1oym q pur e srequinu sumd om} 19999
SMO][OJ SE SyOM EUTLOSE A
: wopnies
Zuoe sXoy ayeaud eo
pue stfgnd syes9uag *49y ond Asap pue wond! al
PAPE UY We om UNWOSTe you SuIsq ‘ofenFue
10 +45 UT unp Hog ye ] S u r
Vvsu wourjduy st
quawrudisse ‘sr yo aano aiqo 7
aap?
public class Sample
{
Public static long p, q.n, phi, m, d, e, enc, dec;
long a, ¢, b;
c=b; ie
b=a%b;
Bigintege
Biglntege
return e; ae
i
Public static long Encryption(long n, long phi, lon
i { - g
m) fe
e=CCD(phi); gue
‘or(long a=Oja<e-lat+)
Scanned by CamScanner
)
(MU-Sem. 6-Comp
pt. & Sys. Security L-3 Lab Manui
ra fom
mo enc:
elu
}
ablic atatic BigInteger Decryption(long
p .
e, long enc, long n, 7 long phi)
{
jong y, temp=phit 1.x;
ll;
pighnteget object2=nu
try
{
for(long i= 1;i<phi; i+ +)
{
{((@*e)%phi)==1)
{
d=1;
i=phi;
}
lighnteger object] =new Big] nteger(Long.toString(enc));
ligInteger object3=new BigInteger(Long.toString(n));
}
ttch(Exception exception)
¢
}
tum object?;
}
Scanned by CamScanner
——
ee Crypt. & Sys. Security (MU-Sem. 6-Comp) __L-4 Lab Manu;
SS 5656800 eee ee ew ew wN008( 000 —E—SsSS>>— =,
public
aS static void main(String
e argsf)
{
DatalnputStream in=new DatalnputStream(System.in);
");
Spateasoulipebni(\n Enter First Prime No:
p=Integer.parselnt(in.readLine()); ;
System.out.print("\n Enter Second Prime No :");
| q=Integer.parselnt(in.readLine());
‘ seh Os Meee Syainch a chatsdigs atta MEL mee DRnipeas algae sam aeek
oe cas UNE ak RS cal ke ea ‘
Save above program with program name as RSA, java (In java class name should be s2”
; program name).
Scanned by CamScanner
5, Security (MU-Sem. 6-Comp) —_L-5
Lab Manu:
ie
pater First Prime No :
sitet Second Prime No : 11
32):13
please Enter Message Between (0 to
gnorypt: KEY : 7
Encrypted DATA: 117°
Decrypt. KEY : 103
Decrypted DATA : 13
C:\programfiles\jdk1.6\bin>java RSA
Enerypt, KEY : 5
Enerypted DATA': 2
Decrypt. KEY : 5
Decrypted DATA: TL.
Scanned by CamScanner
A Cc yet. & ‘Sys, Security
‘ (MU-Sem. . 6-Comp) __L-6 Lab My —
.
®
7 ent
€E *perim
> 2: Implementation of Diffie Hellman key exchange algorith
;
AimmM: Our Lineaim is writ. e a program m,
in Java to implement Diffie Hellman key exch,
algorithm. ange
Objective
Diffie Hellman algorithm is used to generate same (symmetric) private cryptographic 5
at sender as well as receiver end so that there is no need to transfer
this key from sender
receiver. Remember that Diffie Hellman algorithm is used only for key agreement not fo,
encryption or decryption of message. If sender and receiver want to communicate With each
other they first agree on the same key generated by Diffie Hellman Algorithm later on they can
use this key for encryption or decryption.
Solution : |
Following the important steps of Diffie Hellman algorithm :
1. The first step is that if Ramesh wants to communicate with Suresh they must agree on two
large prime numbers p and q.
2. Ramesh selects another secret large random integer number a, and calculate R such that Deobai |
Market, N
. R = q modP No.
C
é
Ramesh sends this R to suresh. Mis.
4. Suresh independently selects another secret large random integer number b, and calculate
S such that.
S = q modP
Suresh sends the number S to Ramesh.
Now Ramesh is calculating his secret key by using Ry = s’ mod P
7, Suresh is calculating his secret key S, by using |
|
Sx = R’ mod P {
;
re e for fu icatiion call led
ture communicat
as
:a nd Su re sh ca n ag
8. If Ry = Sx then Ramesh
* agreement algorithm. a
symmetric key).
We have Ry =Sx = hence proved. (K is called
9.
me er:
|jmport java.math. BigInteg
n {
blic class DiffieHellma :
at ic Bi gh nt eg er on e = new Bighnteger("l");
final st
Scanned by CamScanner
L-7 Lab Manu
Sys. gecutity (MU-Som. 6-monte)
args[}) {
tatie void main(String
pote ¢
Geil anner stdin= new Scanner(System.in);
pigtnteset Ps
. we ‘ ,G a ©
gystem.out-printn(
ays Enter the first prime number pol your hater ) ’
siring ans = stdin.next();
p= getNextPrime(ans);
gystem.out.printin("Enter another prime number q';
BigInteger g = new Bighnteger(stdin.next());
system.out.printin("Ramesh: select your secret number a ";
_Bighnteger a = new Bighnteger(etdin.next());
Bighntegerresulta = g.modPow(a,p);
System.out.println("Ramesh can sends the valite of Rto Suresti "+resulta+".");
System.out.println("Suresh select your your secret number b");
BigInteger b = new BigInteger(stdin.nexi());
BigIntegerresultb = g.modPow(b,p);
System.out.printIn("Suresh now sends value of Sto Ramesh "+resulitb+"."); *
i! Now calculate secret key of Ramesh & Suresh Rk&Sk
BighntegerKeyACalculates = resulth.modPow(a,p);.
BigIntegerKeyBCalculates = resulta.modPow(b,p); :
ee
Scanned by CamScanner
: e!
ep Crypt. & Sys. Security (MU-Sem, 6-Comp) _L-8 ; Lab Manual 4 gr?
ay
mee above program by using DifficHellman.java in JDK bin directory or set path before ’
compilation. Now compile the program using javac DiffieHellman.java and run using java q
DifficHellman , gxP?
7
Output
“ aitaar et aetng oe i‘ i . y . c
C:\Program Files (x86)\Java\jdk1.7.0_25\bin> java DifficHellman q pit e
>
1
Scanned by CamScanner
ee security (MU-Sem. 6-Comp) _L-9 Lab Manual
a |
anjectiv?
ft was developed by Ron Rivest. This algorithm takes an input of arbitrary length and
producéd in 512 - bit blocks. This
sae pit message digest is produced. The input message is
is produced. The input
thm takes al input of arbitraryo length and 128 - bit message digest
gor procedure of MDS.
“ duced in 512 - bit blocks. Following steps explains the
message is pro
solution +
5 algorithm.
Refer Chapter 6 for complete steps of MD
s :
Following Program Demonstrate the MD5 algorithm in detail
Se meeps ie ee
Input Strea m;
saportjava.io.Byte
import java.io.File; ;
import java.io.FileInputStream; 3
import java.io. LOException;
import java.io.InputStream;
import javacio.PrintStream;
import java.io. UnsupportedEncod ingException;
Scanned by CamScanner
Crypt. & Sys. Security (MU-Sem. 6-Comp) __L-10
private static final int $23
= 14;
‘Private static final int $24
. . :
%
= 20;
private statie final int $3] = 4; °
|
Private static final int $82 = 11:
E
private static final int $83 = 16;
; z
private static final int S34. = 23;
private static final int S41 = 6;
E
private static final int S42 = 10; sb
Scanned by CamScanner
Lab Manual
io 52051 Zbullength: i++)
jot
°
(bulli] & 0x0) > >
i] & ox08);
Fwat * ( pulf
' + hy);
™ c t e r ( (ehar) ((h > 9) fa! + 1h--10105:'0''0 + 1); ‘
jpappen
do e Char a r) 9) ?'w +
ter({cha (1 >
oen Charac
;
saapen
b.toSt ring()s
ren e
}
int y, int 2)
private final int F(int x,
{
yetumn ((x &y) | ((~x) & 2))s
y, int z)
private final int G(int x, int
{ .
int 2)
private final int Hint x, int y,
z) .
private final int I(int x, int y. int
ted
retum (y ~ (x | (~2)))5
}
lefi(int x, int )
private final introtate_
Scanned by CamScanner
i@ Crypt. & Sys. Security (MU-Sem. 6-Comp) L-12 0 Lab Manua
Bah
return ((x << n) | (x >>> (32 -n)));
}
tarivata final int FF(int a, int b, inte, int d, int x, int a, int ac)
{
forivals final int GG(int a, int b, int c, int d, int-x, ints, tat ac)
{ |
a += (G(b, c,d) + x + ac);
a = rotate_left(a,
s);
at=b;
‘retuim a;
vo}
ielvate final int HH(int a, int b, int c, int d, int x, int s, int ac)
{
private finel int II@int a, int b, int c, int d, int x, int s,int ac)
a += (I(b,¢,d) + x + ac);
aN “as rotate_left(a, 8);
Scanned by CamScanner
, gomsseees (MU-Sem, 6-Comp) L-13
L
Sea.
Lab Manual
int) on
{
output] = ((Gint) (inputfoff + j] & Oxf)
| (int) (inputfoff + j + 1) & Oxf) << 8)
| (Gnt) (inputfoff + j + 2] & xm) << 16)
| ((Gnt) (input[off + j + 3] & Oxi) << 24);
}
J
| fed
| inta = state[0];
int b = state[1]; igs ;
' int c = state[2]; | :
ated’ state(3]3 20047 Se ae
jntxf}= new inlf16};.
/* Round 1 Spero ah Se
/* 1*/
a = FF(a, b, ¢; d, x[ 0], S11, 0xd76aa478);
2 */
d = FF(d, a, b, c, x[ 1], S12, Oxe8c7b756); /*
3 c = FF(c, d, a, b, x[ 2], S13, 0x2420
70db); #3
: lbdceee); /* 4 */
b = FF(b, c, d, a, xf 3], S14, Oxe
Oxf57e0fal); /* 5 */
a= FF(a,b, c, d, xf 4], S11,
*/
da b. e 5], $12, 0x4787c62a);:/* 6
d= FF x[
(bu
0 = FF(e,d, a, b, x[ 6], $l 3, 0xa8304613); /*
Oxfd469501);/* 8 “f
“b= FRO, 6, dex 71 S14
Scanned by CamScanner
ker Crypt. & Sys,
Security (MU. Sem, 6-Comp)
|.
** FE(@,b, 65d, x[ 8),
Si, 0x698098dB); /*
d=FF, a, bo x[ 9 «,
9]. S12, Ox8b44f7ap
© = FF; d, a, b, ; /» 19 xy
xf10}, S13, OxfffS
b= FF, od, a, bb1); /« 11 "/
x[11], S14, OxB9Se
a. FF (a, b, 0, d, x[12 d7he);/* 19 #/
], $11, Ox6b901129
d= FF, a, b,c, ); /# 13 */
x(
13], $12, Oxfd9871
e* EF (dia;
93); /» 14 +/
b, x[14], S13, 0x
a679438e); /* 15
b= FF(b , e, dia, x{15}, S14, 0x */
49b40821); /* 16 #/
/* Round 2 */
@ = GG(a, b,c, d. xf 1]. $2
1, 0xf61e2562/*);17 #/
d= GG(d, a, b, o, x{ 6], $29, Oxe040b3
e = GG(c, d, a, b, xf11], $23, 40);/* 1g #/
Ox265e5a
51); /* 19 4
b = CG, ¢, d, a, x[ 0} S24,.0
xe9b6e
2 = GG(a, bso, d, xf 5], $21, Oxd6 7aa); /* 90 /
2n1054), fe 21%) :
d= GG(d, a, b, o, x[10}, $22,
012441453); /* 99 er
© = CG(e,d, a, b, x{15}, S23, Ox
dBae
°F S60, ed, 4, $24, O:e7 681); /# 3
2 2 =GG(a, b, 6, d, xf91, S21, dBtbe8fe)s24s)
Ox21elede6
"7 O6(€, ab, x14), $22, 0508 ); /* 95 Hy
© = GGle, d, a, b, x{ 3], $23, Oxf4 370746); /* 26.4) .
d50d87); #274)
b= GC , ¢, d, a, x[ 8], $24, Ox455al4ed);
a= GG(a, b,c
/# 29,
, d, x[13], 892, Oxa%e3e9
05);/*
“= GC(d, a,b, o, sf 2], $22, Oxfeetaata); Pos OS
¢= GC(c, d, a, b, xf 7], $23,
Ox676f02d9);/* 31 #/
b= GG(b, ¢, 4, a, x[12}, S24, ee Bi
Ox8d2ade8q): /* 32%) Be
ta
/* Round 3 */
2]
a.
b= HH(b, ¢, d, a, x[14], $34, Oxfd
a
e5380¢); /* 36 /
a
Scanned by CamScanner
apt: & Sys. Security (MU- -Sem.
8-Comp) L-15
2 HH(e. d, a. b, x[ 7], $33, Oxf6bb4b60); /* 36 ¥/ Lab Manual
} = HH(b. ¢, dea. x[10], S34, Oxbebthe70); /*
49 */
a= HH(a, b, c,d, x[13]. $31, Ox289b7e06);
/* 4] */
d = HH(, a, b, e, x[ 0}, $32, Oxeaal 27fa); /* 49 */
¢ = HH¢e, d, a, b, x[ 3], $33,
Oxd4ef3085); [* 43%)
= HH(b, ¢, d, a, xf 6], S34, Ox4881d05); /* da, #/
a = HH(a, b. c. d, x[ 9], 831, Oxd9d4d039);
/* 45 *y
d= HH(d. a. b,c. x[12], $32, OxeGdb99e5); /# 46 */
HH(c, d, a, b, x[15]. $33, Ox1fa27eR8); /* 47
b = HH(b, c,d, a, x[ 2], $34, Oxe4ac5665);
/* 4g +/
/* Round 4 */
a= II(a, b, ¢, d, x[ O}, S41, Oxf4292244);
I* 49 */
d= I, a, b, ¢, xf 7], $42, 043208107);
/* 50 «7
c= Me, d, a, b, x[14], $43, Oxab9493a7);
/# 5) 4
b= II(, c, d, a, xf 5],
S44, Oxfc93a039); /*
52 ef.
a= Ifa, b,c, d, x[12}, $41, 0x655b59¢
3); /* 53 4
d= I(d,a, b, ¢, xf 3], $42, Ox8f0ece92);
/* 54 4/
e=Il(e,d, a, b, x{10}, $43, Oxffefi47d); *
55 ¥
b=II(b, c, d, a, xf 1), $44, 0x85845dd1);
/* 56 */
a= II(a, b, c, dj xf 8}, 541,
Ox6fa87e4f}; /* 57 */
d= Id, a, b, ¢, x{15], S42,
Oxfe2ce6e0); /* 58 */
¢= II(e, d, a, b, xf 6], $43, 0xa3014314);
/* 59 ¥/
b= IIb, ¢, d, a, x[13], $44, Ox4de081
1al); /*60 */
a= II(a, b, c, d, x[ 4], S41, Oxf7537682); /* 6L-*
/
d= Id, a, b, e, x[11], $42, Oxbd3af235);/# 62%)
2
c= Ile, d, a, b, x[ 2], $43, Ox2ad7d2bb); /*63-*/
b= II(b, ¢, d, a, x[ 9], $44, Oxeb86d391); /* 64 #/
fate(0) +=
Slatef1] += b;
Mate[2] += ¢:
Mate[S] Pe! dP vel pen et
Scanned by CamScanner
er Crypt. & Sys, Security (MU-Sem, 6-Comp)
L-16 4 . -
Lab Wa,
‘ Dual
Private final void update(byte input], intlen)
a
int index = ((int) (count >> 3)) & Oxf;
if (len>= partLen)
Bf fat
System, arraycopy(input, 0, buffer, index, partL
en); ;
transform (buffer, 0);.
fo
for (i = partLen; i + 63 <len;i its
64)
transform/(input, i);
‘index = 0;
}
else
{
3
private byte] endQ
fet
byte bits[] = new byte};
update(padding, padlen);
i
Scanned by CamScanner
L-17
Lab Manual
} pyle
uput[] = new byteflen];
+ gt i = 95
+ jot p = 9
ae rj <iensit+,j+=4)
x 7 jst ey
; ‘
a
ue x 6
el
th #5 in ai 8
the digest for our input stream: ae
throwsIOException» 6% pees.
Dy
eee
Scanned by CamScanner
Crypt. & Sys, Security (MU-Sem, 6-C
omp) L-18
byt ‘bulfer[] = new byte[BUFFER_ SIZE];
int got = -);
if (digest != null)
Tetum digest;
while (got = in.read(bulfer)) > 0)
update(buft er, got);
this.digest = end(:
return digest;
}
: /**
Scanned by CamScanner
ecurity (MU-Sem. 6-Comp) __L-19 Lab Manual
—
SaaEaEEEEEieieeieeomamms
(2 ot. & SYS.
—
{
dies" == null)
ow i}
ew RuntimeException' (this.getClass().getName()
% + "[getStringDigest]"
+": called before processing.");
_ ee
* Construct a digestifier for the given string.
* @param input The string to be digestified.
* @param encoding the encoding name used (such as UTF8) *
i ‘
i
by
{
bytes = input.getBytes(enc);
} catch (Unsupported ncodingException
OY a -
{ " aie.
throw new RuntimeException("no "+enc+
" encoding!!!");
}
this.stringp “ —
_this.in = new ByteArrayInputStream (bytes);
this.state = new int(4];
this buffer = new byte[64];
this,count= 0; cs,
Scanned by CamScanner
er Crypt. & Sys. Security (MU-Sem. 6-Comp) __L-20
state[0] = 0x67452301
;
state(1] = Oxefedabeo,
‘state[2]= Ox98hadcfe:
state[3] = 0x10325476;
7
je
* Construct a digestifier for the given string.
* @param input The string to be digestified,
” .
[*®
Scanned by CamScanner
mp) to,
“= Aon ot 8 YE: security: (MU-Sem.6-Co
L
Manus 7 je void main(String args) Lab Manual
é _aoescetion
ws
{ fength i” 1)
al
,outprintln( "Md5 <file>"):
4 =
7 i net 3
1
i
(b));
ti n (stringify
aqgemoutprin
}
} :
_ Save above program with program name
Md5 java into the JDK bin directory and compile
_jrusing javac Md5 java and execute using java Md5
b1.txt,
- To get correct output please create one text file (Give
any name to that text file here we
have created one text file b1.txt) as an input to MD5 algorithm.
Output
fo get correct output pleasé, create one text file (Give-anynni e to that text file here I have created one text ‘
ale blixt text provide in b1.txt is Cryptography & System Security) as an input to MDS
algorithm .
| (86802dea5126270864153563166198a :
e i sl
ae j MDS enerypt the text Cryptography & System Security & produce the digest as
_| 936302dea5126270864f53563/66198a
Scanned by CamScanner
ey Crypt. & Sys, Secu
rity (MU-Sem, 6-
Comp) L-29
Write a Program in
Java to im Plement
Using Librarie SHA-1
s (API),
- Objective
th
import javax.crypto,*:
a
import java.io.*:
import java.securit ye
public-class SHA
{
public static String Ge
tdataQ
String Message=null;
try
:
{\
DatalnputStream in=new Dataln
"
putStream(Syste m.in); .
System.out.print("\n Please
Enter One Message : ");
Message=in.readLine();
}
catch(Exception exception)
‘ 4
}
retum Message;
}
public static § tring Comp
i ( ute(String Message,Ke
y key)
Scanned by CamScanner
guts , Security (MU-Sem. 6-Co he ; ie
Lab Manual i!
=digest] digest); 2s .
Mana) | en —
alue=
ya |
~1 M90rith jt Mac mac=Mac. -getlnstance("HmacMD5"); ‘ |
‘
:
yo itl il(key i
upsate »(value)s
~- iF mac. JdoFinal(); 5
ibrarie (APY )
{
_ 1 yaluel =digest[i] & Oxff;
yo
ifvaluel <16)
{
: :
hulfer.append('0);
}
pulfer.append (Integer.toHexString(value1));
}
ae
gore=bufler.toString);
. |
catch(Exception exception) |
i et
y System.out.print("\n Exception : " + exception); ae aes
} ‘
é
r
i
retum store;, f.
}
public static void main(String args[])
7 om Pet z
‘ | String Mes sage,holderl sholder2;
;
| tats y 4 s
Instance(’AES");
m i KeyGenerator generator= KeyGeneralor.get
{ j generator. init(128);
| erateKey();
ator- -gen
SecretKey key=gener
- Message==Getdata(): :
(™ fiessage * key ):
holderl = ompute
=C
- Bel '9
| :. + holderl
Digestt !
("\n Message
System out. Pp rint
Scanned by CamScanner
ka Crypt. & Sys. Security (MU-Sem, 6-Comp)
L-24 cman Manual
Message=Getdata();
holder2 = Compute(Message,key):
System.out.print("\n Message Digest? : ["
+ holder2 +" }:
iffholder] equals (holder?2))
{
System.out.prin
| t(“\n
{ Messaze
ag) Is Same... ap
i
i
else
{
System.out.print("\n Message Is Not Same .."):
}
}
catch(Exception exception)
{
~ System.out.print("\n Exception In Main :" + exception);
} } «
. ii
Output
Scanned by CamScanner
) _L-25
Sem.6-Comp
= Sys: security (MU- Lab Manual
SE Manny Fag
il
again with same message
& Run!
ar
,
1.7.0_25\hin>javac SHA Java
a Files (x86) Java\idk
a
SHA
k 1,7.0_25\bin >java
on™ Files (x86)Java\jd
.
.
rity
guerne Message + Cyber Crime & Secu
i
ity
gee Enter One Message : Cyber Crime & Secur
yessaze JsSame. -.
| Ofective pture
pa ck et an al yz er will try t ca
k
{
is a ne tw or k pa ck et analy zer. A networ po ss ib le . Yo u cou Id think of
Wireshar k detailed as
es to di sp la y tha t pa cket data as wh at's going on
inside a
s an d tri ed ex am in e
twork packet as @ measuring device us
to
g on inside
_ ‘network packet analyzer to ex am ine what's goin
ician
e a vo lt me te r is used by an electr
lik
"work cable, just
id
7
Scanned by CamScanner
ey Crypt. & Sys, Security (MU-Sem. 6-Comp)
a_L-26 Lab Manual |
an electric cable (but at a higher level, of course).In the past, such tools were cither very
expensive, proprietary, or both. However, with the advent of Wireshark, all that has changed,
Wireshark is perhaps one of the best open source packet analyzers available today
Solution:
— In late 1997, Gerald Combs needed a tool for tracking down networking problems and
wanted to learn more about networking, so he started writing Ethereal (the former name of
the Wireshark project) as a way to solve both problems.
- Ethereal was initially released, after several pauses in development, in July 1998 as
version 0.2.0.Within days, patches, bug reports, and words of encouragement started
arriving, so Ethereal was on its way to success.
— Not long after that, Gilbert Ramirez saw its potential and contributed a low-level dissector
to it.
— In October, 1998, Guy Harris of Network Appliance was looking for something better
than tcp view, so he started applying patches and contributing dissectors to Ethereal.
— In late 1998, Richard Sharpe, who was giving TCP/IP courses, saw its potential on such
| courses, and started looking at it to see if it supported the protocols he needed. While it
didn't at that point, new protocols could be easily added. So he started contributing
dissectors and contributing patches.
— The list of people who have contributed to the project has become very long since then,
and almost all of them started with a protocol that they needed that Wireshark or Ethereal
did not already handle. So they copied an existing dissector and contributed the code back
to the team.
— In 2006 the project moved house and re-emerged under a new name : Wireshark.
— In 2008, after ten years of development, Wireshark finally arrived at version 1.0. This
release was the first deemed complete, with the minimum features implemented. Its
- release coincided with the first Wireshark Developer and User Conference, called
SharkFest. —
ntial on such
wireshark Main Window
a er arc Tene ae)
ed. While it pr
pr Situs Grobe, Sunes, Tekephory, Joos eae
contributing SExeei nerve AQQE MERA
since then,
w Ethereal rieace can be sed For caphuringI zy, Open ys
tn aton ath ihe carver corfiguraticn. & B Open nperieaty capeed e / a
code back ‘a Capeum Hep below For cette. © pan Recent: a fd erent 4
.O. This
ted. Its’
#
called
Scanned by CamScanner
Wireshark Main Window
. ‘ | Start cancd
Capturing live network data is one of the major features of Wireshark. The Wireshark
capture engine provides the following features :
Capture from different kinds of network hardware (Ethernet, Token Ring, ATM, ...).
Stop the capture on different triggers like: amount of captured data, captured time,
captured number of packets.
— Simultaneously show decoded packets while Wireshark keeps on capturing.
——
Scanned by CamScanner
.s curity (MU: -Sem. 6-Comp) L-29 Lab Manual
5 SYS —
go multiple files while doing a long term capture, and in addition the option to
a att ett bu uffer of these files, keeping only the last x files, useful for a “very long term"
ion:
op “enti still lacks the following feat
ures
pure
ap cil sais capturing from multiple network interfaces (however, you can start multiple
sia— an - of Wireshark and merge capture files later),
le
Dever: Wevice\nel =] inst — (or doing some other action), depending on the captured data.
stor ca :
pe COptUTe Interface
- RE: ‘Capture Se
= megabytets)
cacture ° eae as Les eee
=] Compile EPF = 92, 168, 2102 -¥A eet sits Fe eee
ppaddrest: o2.168.2h.002
Packets in real time Seumotsss wt Remote Settings
Buffer size: Me > megebyte(s)
Fcutue in aaRTTNE
ling in live capture
: oe “Warne Reschton
'M, -:-)-
aa
ptured time,
Scanned by CamScanner
er
a jt.
Scanned by CamScanner
1 4 att
5 |S oye: Sear Cae Sore) 33
—=—=== Lab Manual
Z
-_# was
- was initially
initially developed by y Gerald Combs. Ongoing i devel opment and
: . : ‘ .
er Capture egintenance of Wireshark is handled by the Wireshark team, a loose group of individuals
apo fix bugs and provide new functionality.
_ qeere have also been a large number of people who have contributed protocol dissectors
so Wireshark, and it is expected that this will continue.
_ You can find a list of the people who have contributed code to Wireshark by checking the
spout dialog box of Wireshark, or at the authors page on the Wireshark web site.
_ Wireshark is an open source software project, and is released under the GNU General
Public License (GPL). All source code is freely available under the GPL. You ae
‘
welcome to modify Wireshark to suit your own sieeds, and it would be appreciated if you
i
contribute your improvements back to the Wireshark team. t
j
a.
Scanned by CamScanner
G
BE cope
Crypt. & Sys. Security (MU-Sem.6-Comp) _L-32 Lab Manuay gs
= Tepdump : Capturing with tcpdump for viewing with Wireshark.
r.
~ Dumpcap : Capturing with dumpcap for viewing with Wireshark.
~ Capinfos : Print information about capture files,
sm
~ Rawshark : Dump and analyze network traffic,
Ww
— Editcap : Edit capture files.
”
— Mergecap : Merging multiple capture files into one. ess
N
- Text2peap : Converting ASCII hexdumps to network captures.
Keyboard Navigation
2
S
Accelerator
ee cna
iz boy
pet ean ey
_ Description
eS reed Fo!
Tab, Shift + Tab Move between screen elements, e.g. from the toolbars to the packet
list to the packet detail. ~
Down Move to the next packet or detail item. =
Up Move to the previous packet or detail item. ~
Ctrl + Down, F8 Move to the next packet, even if the packet list isn't focused.
Ctrl+Up,F7 ~ Move to the previous packet, even if the packet list isn't focused.
Ctrl+. Move to the next packet of the conversation (TCP, UDP or IP)
Ctrl+, Move to the previous packet of the conversation (TCP, UDP or IP) 1
Left In the packet detail, closes the selected tree item. If it's already closed, j '
jumps to the parent node.
Right In.the packet detail, opens the selected tree item.
Shift + Right In the packet detail, opens the selected tree item and all of its subtrees.
Conclusion
Scanned by CamScanner
6-Comp) _L-33 Lab Manual
é cnet: 4, sys. Security (MU-Sem.
4(b): Explore how the packets can be traced based on different
ment ‘
a filters.
sous bility
" "ter, Nessus is. a proprietary compreFhensive vulnerability sc scanning 6 progra
mpuler,
pr
m.
It is
it is
jn comp for personal use in a non-enterprise enviroa
nment. Its goal is‘ to detect potential j
of charge
for example
Vulnerabilities that allow a remote cracker to control or access sensitive data on a system.
Misconfiguration (e.g. open mail relay, missing patches, etc).
Scanned by CamScanner
————
re
=, Securit
EF ont.
Crypt. & Sys. Security (MU-Sem.6-Comp) L.34
cry!
Lab a
tual Nessus 3 eng
Operation of Nessus qhe
For instance, it can use Windows credentials to examine patch levels on computers
running the Windows operating system, and can perform password auditing using
_ dictionary and brute force methods. Nessus 3 and later can also audit systems to make sure
they have been configured per a specific policy, such as the NSA's guide for hardening
Windows servers. ,
- The "Nessus" Project was started by Renaud Deraison in 1998 to provide to the Internet
community a free remote security scanner. On October 5, 2005, Tenable Network
Security, the company Renaud Deraison co-founded, changed Nessus 3 to 4 proprietary
.
(closed source) license.
Scanned by CamScanner
«vy (MU-Sem. 6-Comp) _L-35 Lab Manual
Sys: gecully
0/month per
3 eng ine is still free of cha rge, though Tenable charges $10
ais
other
tion audits for PCI, CIS, FDCC and
pe N°ar
fot the ability to perform configura
A vulnerability audits, the latest network
sci cation standards, technical support, SCAD
urations and the ability for
oe J patch audits, the ability to audit anti-virus config
, social security number
rform sensitive data searches to look for credit card
ta.
r types of corporate da
oa many a08 ne vi si on of the feed license which will allow hom
e
july 0f 20 , T e n a b l e se nt ou t a re
use.
fessional license is available for commercial
gers full access to plugin feeds. A pro open +
a min ori ty of the plu gin s are still GPL, leading to forked
2 Nessus 2, engine and ahn.
on Ne ss us li ke O p enVAS and Porz-W
source projects based 2 engine and has updated it
still mai nta ine d the Nes sus
tenable Network Security has IX
the rel eas e of Nes sus 3.N ess us 3 is available for many different UN
geveral times since t the
ch auditing of UN IX and Windows hosts withou
and Windows systems, offers pat e released
is 4-5 tim es fas ter tha n Nes sus 2.0n April 9, 2009, Tenabl
need for an agent and
Nessus 4.0.0.
fet Aho
Oey
0 tren
Main Window
Fig. 1 : Nessus
Scanned by CamScanner
IY abl. & Sys, Security (MU-Sem,
6-Comp) _L-36 Lab Manua|
Manage Policies
WD Wehome Wreeuertiy Wed poli tanci
be mana
es ged here, You can patect
OD Wat thaws tank a predefined pobre hen starti
# new ng
Bean,
V View Reon
11 Manian COEU MBSE It tence tomer eye tae e eren
”
BB 08 a new poncy nme
t =
Other Options 2X Ovtete veierted
poncriay
A Neen Bank,
W henge Potten
W Wwotate Piigine
Seset Premet
Pls irene rma f thy nae
pet
=—=—— ”
Scanned by CamScanner
6-Comp) L-37 «
Sys: security (MU-Sem.
Nessus Server
a
Target Systems
vulnerabilities, .
twork
Scanned by CamScanner
er Crypt. & Sys. Security (MU-Sem. 6-Comp)
—————————————— _L-38 I Lab Manual
Nessus Server
Nessus Reports
Scanning Methodologies
Someone scans your system(s) and makes the report available to you.
The end user requests a scan directly from the server, the machine is scanned, and report is
sent automatically. "
When the user connects to the network the system is scanned automatically (Popular with
wireless and VPN).
Servers are scanned on a regular basis (maybe weekly) and results are compared.
Network Perimeter is scanned on a regular basis.
Which ones should I do.
Nessus will crash systems, routers, firewalls, and any other devices on the network!
Happens no matter how careful you are Monitor your configuration closely, test new
plugins first.
Scanned by CamScanner
sys. security | (MU-Sem. 6--Comp) L-39
uke gure you have at least one other tool to test the application!
l it take ?
challenges ~ How long wil
- Depends.
Number of hosts.
Number of open ports.
| ) :
scanned, and report is z Number of services running on those ports.
What kind of host (Windows, Unix, Mac).
tically (Popular with How many hosts have firewalls.
- Speed of the network.
compared.
- Other network traffic.
me
Scanned by CamScanner
ey Crypt. & Sys. Security (MU-Sem. 6-Comp) _L-40 a Lab Mariual
> Experiment5: Download and install nmap. Use It with different options to
scan open ports, perform OS fingerprinting, do a ping scan,
tcp port scan, udp port scan, xmas scan etc. |
Aim: Aim of this experiment is to download & install port scanning tool to identify the
number of computers on a network & to find the port open on one or more target
computers.
Solution :
What Is NMAP?
Ping Sweeping
—ICMP
_— Echo Request
——s
Source -
192.168.0.8 Destination
192.168.0.10
Scanned by CamScanner
ssponse from an active host will
retu mM an
" gavailable on the netw
he
IC
ork or ICMp is filtered
ss
HH
: ICMP Echo Repty
Source
192.168.0.8
Destination
192. 188.0.19
Port Scanning is the process of connecting to
TCP and UDP
fnding which services and appl Port for the Purpose
ications are open on th ¢ Ta
rget Machine. "
TCP establishes a connecti
on by using what is called a
header contains one byte field for the Three way handshake. The TCP
flags.
These flags include the following :
eo ACK: The receiver will send
an Ack to acknowledge data.
o SYN : Setup to begin communicatio
n on initial Sequence number.
° FIN : Inform the other host that the
Sender has no more data to send.
o RST: Abort operation.
o PSH: Force data delivery without waiting
for buffers to fill.
o URG: Indicate priority data.
The port numbers are unique only within a computer system. Port
numbers are 16-bit
unsigned numbers. The port numbers are divided into three ranges: the Well
Known Ports
(0-1023), the Registered Ports (102449151), and the Dynamic and/or Private Ports
(49152-65535).
All the operating systems now honor the tradition of permitting only the super-user open
the ports numbered 0 to 1023.
Some are listed below :
echo 7/tep Echo
ftp-data20/udp _—‘File Transfer [Default Data]
Scanned by CamScanner
FP cryer _& Sys, Securi
ty (MU- “Sem. 6-Comp) __L-42
TCP FIN -sF This scan attempts to pass through packet filters by sendinga
TCP FIN packet.
Amas Tree -sX Sends a packet with FIN, URG and push flags set.
Null -sN Sends a packet without any flags turned on.
| Scan Type Switch | Description
ACK scan “SA An ACK packet with random acknowledgment and sequence
numbers is sent.
UDP scan -sU__| This sends 0 byte UDP packets to each port on the target
machine(s). |
Scanned by CamScanner
oii a SYS: Security (MU-Sem. 6-Comp) L.43
a iY
w Lab Manual
along
So Manu ion steps
installa tion steps along with output in Linux environm ent are listed
wink i Pr -=Se s Sudo apt Pp 1 nstall nme
*
be low
gs aoe eee
| Hostlo
+ Naan Outpia Pons /Hosts Topo | Scans |
Detalsgy
~ |3 | Detetsi
ppmap-T4-F wawesecuritytras.com
cn ) at 2018-85-12 21: a
| Starting Nmap 7,40 ( Wttps:7/nmap.org
sue
Be
Pi 03 ;
www. securitytrails.
“|. jimap. scan report forlatenc con (182.139.243.5)
‘| Host és up (@.064s y).
Not 7 9a filtered ports
4
PORE STATE SERVICE
i) eo/tep, open http
i g4z/tep open https
seconds
up) scanned in 5.83
“|| wage donuts 1 IP address a. host
"Barer Hosts
Scanned by CamScanner
ey Crypt. & Sys, Security (MU-Sem. 6- r Lab Mariual
[Hosts Services | Nmap Output Ports / Hosts | Topology | Host Details [Scans |
Port {Protocol |State |Service | Version
@ 21 tcp open ftp vsftpd 2.0,1
1 @ 22 tcp openssh OpenSSH 3.9p1 (;
‘1@ 25 tep open smtp Sendmail 8.13.1/t
1@ 80 ~~ tep apen http Apache httpd 2.0-4
Se | @ 110 ~ tcp closed pop} ;
Phleties (Lo ae
29 hosts shown. Host Filter: : a
Students can also compile and execute the below program
ROSE EE LAM OMERKEKERSANAREnEA RE EOEREOR ERED O DR
TITLE: C Program of PORT-SCANNING compile & tun by using cross
compiler of Linux environment
FASHETHERELER TREE EAA 2S EE NOOR TEER SEES]
include <stdio.h>
#include <stdlib.h>
#include <unistd.h> ee
# include <netdb.h>
#include <netinet/in.h>
#include <sys/eocket.h>
FILE *ps;
a
Scanned by CamScanner
ee, |,
with=getosthyname(arev[1
{
eas
!");
id gont{'Gethosthynameka error!
exit(1);
eat “
"et Rare a :: j for(port= 0; port<=65000; port+-+)
“vironment pet
‘tttctwey !
4 structsockaddr_inaddr;
addr.sin_family = AF_INET;
;
// host byte order
addr.sin_ port = htons(port); // ‘short, network byte order
~ addr.sin_addr = *((structin_addr *)h->h_addr);
j | addr.sin_zero[0]="\0';
i=0;
while(1)
{
addr.sin_zero[i]="\0's
ets
Scanned by CamScanner
of Crypt. & Sys. Security (MU-Sem. 6-Comp). L-46 LD Marne
if(i>8)
break;
}
== -l)
if (connect(sock, (structsockaddr *)&addr, sizeof(structsockaddr))
{
if printf("%ed closed\n", port);
close(sock);
else
}
* eth,);
#222444 AREER REE EEERERES ERES THAR AAR HRS IH EE EH)
fprintf(ps,"\n*#*##4
fclose(ps);
Output
froot@localhost}# ec port_scan.e
{root@localhost]# ./a.outlocalhost
22 open
25 open
111 open
631 open
5335 open
32769 open
[root@localhost]#
*/ - e ~ ‘ ose i dentist eey 2: ED ae Ne E S, | A ae 365
Scanned by CamScanner
ai secuti (MU-Sem.6-Comp) —L-47
, 1 &
!
erent
Lab Manual
Rata 6: : Simulate DOS attack using Hping
, hpin
g3 and
other tool
This can be done In two ways s
one Is Usin
another using IDS tool, g hpings
tool and
once attacker got entire access of network or server he can do the following things :
o Flood the entire network or server with traffic until shutdown occurs because of
overload.
Block ongoing traffic which results in a loss of access to network resources to the
authorized users. Different security policies like firewall, Intrusion detection system
helps to protect such type of attacks.
Different security policies like firewall, Intrusion detection system helps to protect
such type of attacks.
What Is hping3 ?
P protocol. Hping is one of the
i hping3 is a free packet generator and analyzer for the TCP/I
firewalls and networks, and was used to
de-facto tools for security auditing and testing of
implemented in the Nmap port scanner.
exploit the Idle Scan scanning technique now
an
le using th ¢ Tcl language and implements
- The new version of hping, hping3, is scriptab the
so thatnee
i i ription of TCP/IP packets, en:
human readable descrip!
ise See ATH, Ba ow level TCP/IP packet manipulatio
to |
day ea
Scanned by CamScanner
— Perform the idle scan (now implemented in nmap with an easy user interface).
you installed Kali Linux to leam how to DoS. You only need to run a single line
command as shown below :
ot stNerntiroeg stage met rien meen eng SS UR rpg ae meee oneeneneee er
a tee een
santoshdarade:~#‘hping3 -“<¢ 1001 -d 120-5. -w64-p 21. ~flood —rand-souree www hping3testsite.c
om
‘HPING wow bping3testaiteicom fl 27.0; 0.1):S set, 40 headers + 120 databytes
| a
hhping in flood mode, no replies willbe shown C cee
|
— www hpingStestsite.com bping statistic — — .
dasti2 ‘packets transmitted, 0 packets Boeeeds 100% packet loss
round-trip aaa 0190 010.0, ms
eitighslaniteesae
Ee |
-p 21 = Destination port (21 being FTP port). You can use any port
here.
--flood= Sending packets as fast as possible, without
taking care to show incoming
replies. Flood mode.
all
Scanned by CamScanner
. Lab M. J wt j-source = Using Random Source [p Addresses. You can ia
os
or interface) ual
an tnames. See MAN page below, also Use
a OF ~sPoof
i jge HO® ng3tests ite.com = D estination IP address
to
or target machj .
bping?
ww a website name here. In my case~ resoTe] solves to 127.0. Ines [Pp address,
0,1 (as entere
d in fetcthostYou can
* glso .
s file)
command to DoS using hping3 and nping
ppl’
* simple SYN flood— DoS using HPING3
jared: a hping3 -§ flood -V www. hpingStestailecpopes
sag los aaddr: 127.0. 0.1, MTU; 65536
}
Sta
‘ete Hae
cae a oy
darade ey hping3
pos attack using
:
to> simmlate
ssndied how
j
i
icoming ji Cnctusion :: Hence we have
i
Scanned by CamScanner
5 SYS. Security (MU-Som. 6-Co
->
mp) L50_
. Experiment 6(
b): Dos attack
Aim: T © install int detection using Intrusion
rusion System and detect Detection System,
‘wh ether
by capturing the live n any malicious activities detected OF not
of service attacks. ©twork packets, IDS detect IP Spoofing (fake IP
address), Denial
Objective
“An Intrusion Detection
System is software
system s or networks, that monitors the events occur in a computer
indications
analyzing what happe ns during an execution and
that the computer has tries to fing out
b
integrity and availability of a resource oreendata”.
misused: in order to achieve confiden
tiality,
The IDS will continuously run on our system in the background and only generate the
alert when it det ects someth
ing suspicio us as per its own rules
signature present into it and tak and regulation or attack
ing some immediate action to prevent damag
e,
An Intrusion detection : § ystem exam
ines or monitors system or network activity to
find possible attacks on th €
system or network. Signs of violation of system security
Policies, standard security
Practices are analyzed. Intrusion Prevention is the process of
detecting intruders and pre venting them from intrusi
ve effort to system.
Solution: ‘
Refer Chapter 12 - section 12.5 for detail on IDS
For demonstration you can download an y freely
available IDS tool here we have
OeSe
downloade: d Sax2 (Evaluation) IDS tool and tested it. We got following
results .
era Detectol) System - See2fEveluation} -- *
ae \
t
pide se We be
| |” Dashbord | Events
| Corwersatione [logs1
Sart Tine
‘Duration:
Policy
BB re te Events of trereret
QY 100 10 tvents
of rternet
e
Scanned by CamScanner
; Sach oer Oe : _ __Lab Manual
at. SO eS oom
oe
i | purtane bony wenn wip
| Paley _—
aaa Rehort — Datnoase Avatyzet
7 setts ie
_/ CasGener”
9 Adank |
“7, Restek 10/100 1000 Etherrsot NIC (Microsoft's Packet chee Jer)
Scanned by CamScanner
“sini bab Manua
omp) L-52
ey Crypt. & Sys. Security (MU-Sem, 6-C
card (Adaptor)
Start the detection by selecting network interface
t ' emt
rhe sch Cueicboh Sher
ns Heo @
oe
Mew '
Peterson | toda
10.582 KB/s
{4 trafic (eytes’)
Fiche PR stirPies
Scanned by CamScanner
= MU -Sem 6-C
em.. 6- om,
mp) _ L-
“4 pt_&& SYS
I : security ( Mi -s Co
= Le gy =
: nmai ; :
nd to check destination host js
La,
M. ual 1s of Pin goon Teachable
tee ;i er. wi
i frase el! ZEB
Srrmnre iray
5 Wty at e ‘Z|
nes | Ply al wi iG ac ae ~ Cag
| metre Ramorne Batibe
nm Ari
* PF, cn
= et
Hees i
}
Scanned by CamScanner
| Lab Manual
ey & Sys. Security
Crypt. (MU-Sem. 6-Comp) _L-54
- Once again, the default policy is important here, because, while all of the rules are deleted
fom your chains, the default policy will not change with this command. That means that
if you are connected remotely, you should ensure that the default poli : INP
| and chains are set to ACCEPT prior to flushing your valen, — 7
Scanned by CamScanner
g opt. & Sys. Security (MU:Sem.6-Comp) _L.S5 "Lab Manual
§sudsipaAbles
INPUT -m conntrack ~ctetate ESTABLISHED RELATED jACCEPD.
- This may look incredibly complicated, but most of it will make sense
when we go over the
components :
o -A INPU
:TThe -A flag appends a rule to the end of a chain. This
is the portion of
the command that tells iptables that we wish to add a new
rule, that we want that rule
added to the end of the chain, and that the chain we want to opera
te on is the INPUT
chain.
Q -M conntrack : iptables has a set of core functionality,
but also has a set of
extensions or modules that provide extra capabilities.
© In this portion of the command, we're stating that we wish to
have access to the
functionality provided by the conntrack module. This modul
e gives access to
commands that can be used to make decisions based on the
packet's relationship to
previous connections.
° —ttstate : This is one of the commands made available by callin
g the conntrack
module. This command allows us to match packets based on how
they are related to
packets we've seen before.
~
Scanned by CamScanner
-
ET crypt. a sys. Security (MU-Sem. 6-Comp) __-56 canes nual
Seria
Output
ne
— We have told iptables to keep open any connections that are already open and to allow
new connections related to those connections. However, we need to create some tules to
establish when we want to accept new confections that don't meet those criteria.
— We want to keep two ports open specifically. We want to keep our SSH port open (we're
going to assume in this guide that this is the default 22. If you've changed this in your SSH
configuration, modify your value here). We are also going to assume that this computer is
ca
running a web server on the default port 80. If this is not the case for you, you don't have
to add that rule. .
— The two lines we're going to use to add these rules are:
re ia ane
Seudoiptables -A INPUT-p tep = -dport 22 if VEER Bens
$sudoiptables
-A INPUT <p'tep-dport 80-j ACCEPT. ae = igs
- The new options are :
© -p tep : This option matches packets if the protocol being used is TCP. This is a-
connection-based protocol that will be used by most applications because it allows for
reliable communication.
o --dport : This option is available if the -p tep flag is given. It gives a further
requirement of matching the destination port for the matching packet. The first rule
matches for TCP packets destined for port a while the second rule matches TCP
traffic pointed towards port 80.
- There is one more accept rule that we need to ensure that our server can function
correctly. Often, services on the computer communicate with each other by sending |
Scanned by CamScanner
nt & Sys. Security (MU-Som. 6-Come Lab Manual
network packets to each other. They do this by utiliz Ing 4 pseudo network
ork interface called
the loopback device, which directs traffic b ack to itself rather than to other Computers,
So if one service wants to communicate with another service thatat ig18 | listen
connections on port 4555, it can send a packet to port 4555 of the Leow on
devi Ice. We
aus e it is ess ent ial for the corre ct ¢
want this type of behaviv or to be allowed, bec © COTEct J operation of
many programs.
ACCEPT -
3 -gudoiptables -l INPUT L-ilo-j‘j
SLINPUT 1: The -I flag tells iptables to insert a rule. This is different than the -A ia
which appends a tule to the end. The -I flag takes a chain and the rule position where you
want to insert the new rule.
T chain. This will
In this case, we're adding this rule as the very first rule of the INPU
ntal and
bump the rest of the rules down. We want this at the top because it is fundame
should not be affected by subsequent rules.
is the
ilo : This component of the rule matches if the interface that the packet is using
that
"Io" interface. The "lo" interface is another name for the loopback device. This means
our server, for our
any packet using that interface to communicate (packets generated on
server) should be accepted.
doesn't
To see our current rules, we should use the -S flag. This jis because the -L flag
nt
include some information, like the interface that a rule is tied to ‘which is an importa
¥ eet added :
part of the Tule we
$ sudoiptables -a
Output
SPiNPOT ACCEPT enti
? FORWARD ACCEPT
P OUTPUT ACCEPT
A INPUT -i lo -} ACCEPT
BLISHED -j ACCEPT
“AINPUT -m conntrack ~-ctstate RELATED, ESTA is
|
22 -j ACCEPT
“A INPUT -p tep -m tep ~-dport
“A INPUT: -ptep -mtep —-dport80-j ACCEPT -
Scanned by CamScanner
ep Crypt. & Sys, Security (MU-Sem. 6-Comp) _L-58 ee Lab Manual
If a packet enters the INPUT chain and doesn't match one of the four rules that we made,
it is being passed to our default policy, which is to accept the packet anyways. We need to
change this.
There are two different ways that we can do this, with some pretty important differences,
The first way we could do this is to modify the default policy of our INPUT chain. We can
do this by typing : i a ta
ce ee ET ee emr i
$sudoiptables-PINPUTDROP.
This will catch any packets that fall through our INPUT chain, and drop them. This is
what we call a default drop policy. One of the implications of this type of a design is that
it falls back on dropping packets if the rules are flushed.
This may be more secure, but also can have serious consequences if you don't have
another way of accessing your server. With DigitalOcean, you.can log in through our web
console to get access to your server if this happens. The web console acts as a virtual local
connection, so iptables‘rules will not affect it. .
You may like your server to automatically drop all connections in the event that the rules
are dumped. This would prevent your server from being left wide open. This also means
that you can easily append rules to the bottom of the chain easily while still dropping
packets as you'd like.
The alternative approach is to keep the default policy for the chain as accept and add a
tule that drops every remaining packet to the bottom of the chain itself.
If you changed the default policy for the INPUT chain above, you can set it back to
follow
along by typing:
SSeS
UT es ACCEPT.”
INPbl
'$ sudoip-Pta oot ST
Now, you can add a rule to the bottom of the chain that will drop any
remaining
packets:
ET PSS
& sudoiptables -A INPUT eee :
jf DROP _ Ese jet SE of ok a eae ae Seitz. SReteae ey Fe +s
BaSADSER Si Shae ee SOE nS a
Scanned by CamScanner
Gh cost g Sys. Security (MU-Sem. 6-Comp) _L-59 Lab Manual
of course, this also means that any rule that any additional rule that you wish to add to the
end of the chain will have to be added before the drop rule. You can do this either by
temporarily removing the drop rule :
ea EE a
-}-j ‘DROP TTS
su-adoiptables -D INPUT
_here
gsudoiptables -A INPUT new_rule
§ gudoiptables -A INPUT-jDROP _
_ Or, you can insert rules that you need at the end of the chain (but prior to the drop) by
specifying the line number, To insert Houle
a at ae number 4,+s you could type :
Geudoiptables -TINPUT 4 new rule, here,
gsudoiptables -L -line-numbers_
Output
| Chain INPUT (oie Ane nar amare revere Tamer reet ere nae
| pit i
Chain OUTPUT (policy ACCEPT) espe Se
Scanned by CamScanner
> Experiment 8 : Set up Snort and study the logs.
Aim : Intrusion detection has become an extremely important feature of the defense-in-depth
a
strategy. Snort is free network intrusion detection software. It can perform protoco]
to detect a variety of attacks and
analysis, content searching/matching, and can be used
, CGI attacks, SMB Probes, Os
probes, such as buffer overflow, stealth port scans
fingerprinting attempts, and much more. The main aim of the experiment is to
implement snort on windows or Linux platform.
Objective
Theory
Snort is an open source network intrusion prevention and detection system (IDS/IPS)
developed by source fire. Vombining the benefits of signature, protocol, and anomaly-based |
inspection, snort is the most widely deployed IDS/IPS technology worldwide. ‘ |
— Hardware requirements for this system are dependent upon the size of your network and
volume of traffic. The minimum hardware required is 1 GB RAM, a core processor and at
least 2 GB free space on the hard drive. Snort can be implemented on any Linux platform
or on the latest windows systems.
- There are three main modes in which Snort can be configured: sniffer, packet logger, and
network intrusion detection system.
Sniffer mode simply reads the packets off of the network and displays them for you ina
continuous stream on the console. Packet logger mode logs the packets to
the disk.
Network intrusion detection mode is the most complex and configurable configura
tion,
allowing Snort to analyze network traffic for matches against a user defined
rule set and
performs several actions based upon what it sees.
- Snort's open source network-based intrusion detection system (NIDS) has the
ability to
perform real-time traffic analysis and packet logging on Internet Protocol (IP) networks.
Snort performs protocol analysis, content searching, and content matching, The program
can also be used to detect probes or attacks, including, but not limited to, operating system -
fingerprinting attempts, common gateway interface, buffer overflows, server message
block probes, and stealth port scans.
ar Ree . stl
Scanned by CamScanner
ot. & Sys. Security (MU-Sem. 6-Comp)
gots _L-61 Lab Manual
LS
Shaina eet,
plementation on windows platform
im
Installing the base Snort system requires two components : The WinPcap packet capture
SL andee ee the following sections we configure and install
poth oWinPcap Snort.
WinPcap
WinPcap (Windows Packet Captur
e Library) is a packet- capture driver. Functionally,
this
means that WinPcap grabs packets from the
network Wire an d pitches them to Snort. WinPcap
is a Windows version of libpcap, which is used for running
Snort with Linux.
Functions
snort.org distributes a convenient install package for Windows available at its Web site:
http://www.snort.org/dl/binaries/win32/
Download this package (generally called snort-2_1_0.exe) and perform the following
Steps to install Snort
1. Double-click the executable installation file. The GNU Public License appears.
2. Click the I Agree button. Installation Options window appears.
Scanned by CamScanner
Lab Manuaj
When the installation is complete, click the Close button. An information window
appears.
Click the OK button.
A new Snort installation requires a few configuration points. Conveniently, one file has all .
the configuration settings required.
Snortpath/etc/snort.conf
ail
Scanned by CamScanner
+ & SYS: Security (MU-Sem.6-Comp) L-63
i Gh crypt. Lab Manual
ho
i
AS
|
a st ee ae,
5
hrent// Yow, RNOES orgy SmOFt
Centact: 2.0.0 Ruleset
i
OE Stoners. mer ‘
tdi
!
eucct. conf,v 1. 124 e00so5s16 02182145 Sacer Exp 4
TF =
su ai ey THREES
This Zils comeing a sample ROON TH CoM MAN tuRRKY HbR
Fou con ceke the follow enors costiguration,
ing saya TO oreate
ee
Installed; 1,0.0-2ubuntul
‘Candidate: 1,0.0-2ubuntul
Scanned by CamScanner
Lat Mearns i
64
t,& Sys, Securit (MU-Som. 6-Com
Rc
ered-dev
# apt-cache policy libp
libpere3-dlev;
Installed: 7.8-3
; ‘
Candidate: 7.8-3
# cd snort-2.8.6.1
# /configure
# make
# make install
stallation
3, Verlfy the Snort In
to
on as shown below
Verify the installati
# snort --version
~_ -*> Snort! <*- s
/
o" )~ Version 2.8.6.1 (Build 39)
nort/snor t-team
rt Team: hitp://www.enort.oF g/e
™ By Martin Roeschand The Sno |
s etal,
Copyright (C) 1998-2010 Sourcefire, Ine
9-05 2.5 ga caro sse
Using PCRE yersion: 7.8 2008-0
ectory
4. Create the required files and dir
to crea te the con fig ura tio n file, rule file and the log directory.
You have
‘#mkdirfetclsnot
“# mkdir /ete/snort/rules = |
inchide /etc/snort/rules/icmp.rules |
# cat /ete/snort/rules/icmp.rules
_ Blertiomp any any -> any any (msg:"ICMP Packet"; sid:477; rev:3;)
The above basic rule does alerting when there is an ICMP eds Soins .
Following is the structure of the alert:
<Rule Actions> <Protocol> <Sou rce IP : . to
: Address> <Sourc
;
<Destination IP Address> <Destination> (rule options)
so eRe cpa
Scanned by CamScanner
4 Security (MU-Sem. &-Comp)
Lab Maney ‘
7 (Hoot t.
$ & Sys. = — ——=—===
L-65
ee ee ————$—= Lab Manual
Table 1: Rule struct
7
ure and example
/ Structure. Example
Rule Actions Alert
j Protocol Iemp
j Sauces IP Address
Any
Source Port Any
‘Direction Operator
>
Destination IP Address
‘Any
Destination Port Any
AlertExplanation
a A couple of lines are added for each ale
rt, which includes the following :
~ Message is printed in the first line.
- Source IP
tor> ~ Destination IP
Scanned by CamScanner
Type of Packet, an
d header informatio
n,
If you have a di
fferen
t interface for
€xample my ne the network conn
twork interface ection, then us
js Pppo, e -dev -i tion, Ipthis
°0'+« /ete/snort/snort,co a
Execute Snort
as Daemon.
Add -D option *
to run snort \
# snor-Dt -¢ detc/enort
/snoricont l,
O00
Scanned by CamScanner