Network Security 2 v2
Network Security 2 v2
2. Message integrity: it means that content of message must not altered either
maliciously or by accident , this can be done using checksumming techniques, data
link protocol and message integrity.
Principles of Cryptography:
• Cryptography is the science of encryption and decryption of data.
• Cryptographic techniques allow a sender to disguise data so that an intruder can
gain no information from the intercepted data. The receiver, of course, must be able
to recover the original data from the disguised data. Figure 8.2 illustrates some of the
important terminology.
• Encryption: The process of converting plaintext information into CipherText
information which make it unreadable.
• Decryption: The process of converting CipherText back into PlaintText .
KA(m)
m ClearText
Bob will provide a key, (KB), to the decryption algorithm that takes the cipher text and
Bob’s key as input and produces the original plaintext as output. That is, if Bob receives
an encrypted message KA(m), he decrypts it by computing KB(KA(m)) = m.
• Symmetric key system is used for bulk encryption because they are fast and have few
computational requirement.
• There are common symmetric algorithm: DES, 3DES, AES and RC4.
Before studying a modern key-based cryptographic system, we will study a very old,
very simple symmetric key algorithm known as the Caesar cipher .
• Mono-alphabetic Cipher:
- An improvement on the Caesar cipher is the mono-alphabetic cipher, which also
substitutes one letter of the alphabet with another letter of the alphabet.
- In mono-alphabet, rearrange the alphabetic in Random way.
- A mono-alphabetic cipher would also appear to be better than the Caesar cipher in
that there are 26! possible pairings of letters rather than 25 possible pairings.
Mono alphabetic Cipher Proprites:
1. We have to create table first and it’s given from the Instructor.
2. then encrypt.
• R=O
• O=K
• O=K
• T=U
• S=I
• E=C
• C=B
• U=Y
• R=O
• I=S
• T=U
• Y=W
Cipher = OKKU ICBYOSUW
R O O T S E C U R I T Y
C1 C2 C2 C1 C2 C1 C2 C2 C1 C2 C1 C2
W H H Y L J V N K B Y R
• Block Ciphers:
There are two types of symmetric encryption algorithms:
3. Block algorithms. Set lengths of bits are encrypted in blocks of electronic data
with the use of a specific secret key. As the data is being encrypted, the system
holds the data in its memory as it waits for complete blocks.
• Block ciphers, which are used in many secure Internet protocols, including PGP (for
secure e-mail), SSL (for securing TCP connections), and IPsec (for securing the
network-layer transport).
Before encrypting the message (or the stream of data), the sender generates a random
Answer:
Encode = (8)^7 mod ( 3*11) = 2
decode = (2)^3 mod (3*11) = 8
1. First sender chooses a key that will be used to encode the data itself; this key is
2. Sender must inform receiver of the session key, since this is the shared symmetric
key they will use with a symmetric key cipher (e.g., with DES or AES).
3. Sender encrypts the session key using receiver’s public key, that is, computes c =
(KS)^e mod n. Receiver receives the RSA-encrypted session key, c, and decrypts it
to obtain the session key, KS. Receiver now knows the session key that Sender will
use for her encrypted data transfer.
- Hash is a one way function , in the other hand encryption is Two way function.
- The input to the hash function is of arbitrary length but output is always of fixed
length.
- Values returned by a hash function are called message digest or simply hash
values.
- There are Two main hash function: MD5 and SHA
- The longer output length makes SHA-1 more secure.
The 128-bit (16-byte) MD5 hashes (also termed message digests) are typically
represented as a sequence of 32 hexadecimal digits.
Example:
MD5("The quick brown fox jumps over the lazy dog") =
9e107d9d372bb6826bd81d3542a419d6
2. Append step.
3. An initialization of an accumulator.
2. Alice then appends the MAC to the message m, creating an extended message (m,
H(m + s)), and sends the extended message to Bob.
3. Bob receives an extended message (m, h) and knowing s, calculates the MAC H(m
+ s). If H(m + s) = h, Bob concludes that everything is fine.
• When you add Secret key + Crypto function, the MAC becomes HMAC and you
also have the ability to determine authenticity in addition of integrity.
• To create a MAC out of the message, we append an authentication key to the message,
and then take the hash of the result. Note that neither public key nor symmetric key
encryption is involved in creating the MAC.
• To create a digital signature, we first take the hash of the message and then encrypt the
message with our private key (using public key cryptography). Thus, a digital signature is a
“heavier” technique, since it requires an underlying Public Key Infrastructure (PKI) with
certification authorities
• Public key certification is used in many popular secure networking protocols, including
2. Ap 2.0
• Authenticate source IP address is from Alice’s machine
• problem: failure scenarios: [ playback attack ] Trudy can intercept Alice’s message and
masquerade as Alice at a later time.
• The use of a nonce and symmetric key cryptography forms the basis of ap4.0.
• BUT you have to know that Symmetric Key means both end have the same key to encrypt
and decrypt.
using the protocol will enjoy one or more security services, such as confidentiality,
authentication, or integrity.
•When security is provided for a transport-layer protocol, all applications that use that
•When security is provided at the network layer on a host-to-host basis, all transport-
•When security is provided on a link Layer, then the data in all frames traveling over
8. Concatenates the encrypted message and the encrypted symmetric key to form a
“package” .
Concatenation Deconcatenation
12. Signs the result of the hash function with her private key, (KA–), to create a digital
signature.
13. Concatenates the original (unencrypted) message with the signature to create a package.
15. When Bob receives the package, he (1) applies Alice’s public key, (KA+), to the signed
message digest and (2) compares the result of this operation with his own hash, H, of the
message.
16. Figure 8.20. As, if the two results are the same, Bob can be pretty confident that the
message came from Alice and is unaltered.
• This enhanced version of TCP is commonly known as Secure Sockets Layer (SSL).
• A slightly modified version of SSL version 3, called Transport Layer Security (TLS).
• SSL is often used to provide security to transactions that take place over HTTP.
• Because SSL secures TCP, it can be employed by any application that runs over TCP.
• SSL has three phases: handshake, key derivation, and data transfer.
1. Handshake Phase:
• Note that Bob sends Alice a hello message. Alice then responds with her certificate,
which contains her public key for encryption.
• SSL does not mandate that Alice and Bob use a specific symmetric key algorithm, a
specific public-key algorithm, or a specific MAC. Instead, SSL allows Alice and Bob
2. Key Derivation :
Alice and Bob use the MS to generate four keys:
Note that Alice and Bob each generate the four keys from the MS (Master Key), The two
encryption keys will be used to encrypt data; the two MAC keys will be used to verify the
integrity of the data.
3. Data Transfer :
1. First of all SSL breaks the data stream into records.
4. To create the MAC, Bob inputs the record data along with the key MB into a hash function
First create MAC , use
Secondly append MAC
data and key MB as input
with data record and then
for hash function.
encrypt.
The type field indicates
whether the record is a
handshake message or a
message that contains
application data.
1. The client sends a list of cryptographic algorithms it supports, along with a client nonce.
2. From the list, the server chooses a symmetric algorithm (for example, AES), a public key
algorithm (for example, RSA with a specific key length), and a MAC algorithm. It sends
back to the client its choices, as well as a certificate and a server nonce.
1. Confidentiality.
2. Source Authentication.
3. Data integrity.
• A virtual private network (VPN) gives you online privacy and anonymity by creating
a private network over the public internet connection.
3. Pure IPsec.
• Key management refers to the way in which two nodes agree on common
parameters for the keys they will use and it accomplish it two step:
establishes policies for verifying the identity and the encryption methods that nodes
NOTE:
After IKE has managed the shared keys and ISAKMP policies have ensured that both
parties agree on the methods of secure transmission, IPSec invokes its second phase,
encryption.
- If both entities want to send secure datagrams to each other, then two SAs (that is,
two logical connections) need to be established, one in each direction.
SA will include:
1. A 32-bit identifier for the SA, called the Security Parameter Index (SPI)
2. The origin interface of the SA and the destination interface of the SA (in this case
193.68.2.23)
• Wired Equivalent Privacy (WEP) : protocol was designed to provide authentication and data
encryption between a host and a wireless access point (that is, base station) using a
symmetric shared key approach.
• WEP encrypt the data traveling using RC4 ( Streaming Cipher) algorithm to ensure
confidentiality.
2. The access point responds to the authentication request with a 128-byte nonce
value.
3. The wireless host encrypts the nonce using the symmetric key that it shares
with the access point.
5. If the decrypted nonce matches the nonce value originally sent to the host, then
the host is authenticated by the access point.
A secret 40-bit symmetric key ( KS) , is assumed to be known by both a host and the
access point. In addition, a 24-bit Initialization Vector (IV) is appended to the 40-bit
key to create a 64-bit key that will be used to encrypt a single frame.
2. The payload and the four CRC bytes are then encrypted using the RC4 stream
cipher.
3. the RC4 algorithm produces a stream of key values,( k1IV, k2IV, k3IV, . . . ) that are
used to encrypt the data and CRC value in a frame.
4. Encryption is performed by XOR-ing the ith byte of data, di, with the ith key, kiI
“ NOTE “
The IV is the primary reason for the weakness in WEP. (WHY)
Answer:
2. The total key space is approximately 16 million keys, that means that the same key
will be reused.
3. Once the key has been repeated, attacker can retrieve the key easily.
Access ).
• WPA has 2 advantages : provides key distribution and uses authentication server separate
from access point , Separating the authentication server from the AP allows one
• WPA2 uses AES ( Block Cipher ) for better encryption from WEP.
1. Discovery Phase: In the discovery phase, the AP advertises its presence and the forms of
authentication and encryption that can be provided to the wireless client node.
2. Discovery Phase: The client then requests the specific forms of authentication and
encryption that it desires. Although the client and AP are already exchanging messages,
the client has not yet been authenticated nor does it have an encryption key
3. Mutual authentication and Master Key (MK) generation: Authentication takes place
between the wireless client and the authentication server. In this phase, the access point
acts essentially as a relay, forwarding messages between the client and the authentication
server. The Extensible Authentication Protocol (EAP) defines the end-to-end message
formats used in a simple request/response mode of interaction between the client and
authentication server. As shown in Figure 8.32 EAP messages are encapsulated using EAPoL
(EAP over LAN, [IEEE 802.1X]) and sent over the 802.11 wireless link. These EAP messages
are then decapsulated at the access point, and then re-encapsulated using the RADIUS
protocol for transmission over UDP/IP to the authentication server.
2. Only authorized traffic, as defined by the local security policy, will be allowed to pass.
2. Protocol type in IP datagram field: TCP, UDP, ICMP, OSPF, and so on.
• This is possible because the firewall can observe the beginning of a new connection by
observing a three-way handshake (SYN, SYNACK, and ACK);
• Application gateways:
Application gateways look beyond the IP/TCP/UDP headers and make policy decisions
which all application data (inbound and out- bound) must pass. Multiple application gateways
can run on the same host, but each gateway is a separate server with its own processes.
• A device that generates alerts when it observes potentially malicious traffic is called an
intrusion detection system (IDS).
• A device that filters out suspicious traffic is called an intrusion prevention system (IPS).
NOTE
In Figure 8.36, the organization has partitioned its network into two regions: a high- security
region, protected by a packet filter and an application gateway and monitored by IDS sensors;
and a lower-security region—referred to as the demilitarized zone (DMZ)—which is protected
only by the packet filter, but also monitored by IDS sensors.
2. Man in the middle attack : man-in-the-middle attack (MITM) is an attack where the
attacker secretly relays and possibly alters the communications between two
parties who believe that they are directly communicating with each other. One
example of a MITM attack is active eavesdropping, in which the attacker makes
independent connections with the victims and relays messages between them to
make them believe they are talking directly to each other over a private connection,
when in fact the entire conversation is controlled by the attacker.
5. Phishing اص ـ ـ ـ ـ ـطـيـاد: is a type of social engineering attack often used to steal user
data, including login credentials and credit card numbers. It occurs when an
attacker, go under ( )ال ـ ـ ـ ـ ـ ـتـنـكـرas a trusted entity, dupes a victim into opening an email,
instant message, or text message. The recipient is then tricked into clicking a
malicious link, which can lead to the installation of malware, the freezing of the
system as part of a ransomware attack or the revealing of sensitive information.
• Diffe Hellman:
is a public key encryption algorithm that is used to exchange session key that is used foe
encrypting the messages.
1. CipherText only attack: Intruder (Attacker) has cipher-text she can analyze by two
approaches:
• statistical analysis
2. Known Plaintext attack: When an intruder knows some of the ( plaintext, cipher-text )
pairings.