0% found this document useful (0 votes)
46 views34 pages

Question Bank Css

Uploaded by

lojojan871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views34 pages

Question Bank Css

Uploaded by

lojojan871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Question Bank

Module 2

1. Elaborate the steps of key generation using RSA. In Rsa system the
public key (e,n) of user A is defined as(7,187). Calculate the private
key d. What is the cipher text for M=5 using public key encryption.

RSA key generation relies on the mathematical difficulty of factoring large prime
numbers. Here's a breakdown of the steps involved:

1. Prime Number Selection:


o Choose two large, distinct prime numbers, often denoted as p and q. The
security of RSA heavily depends on the size of these primes. Bigger
primes make it computationally infeasible to reverse engineer the private
key from the public key.
2. Modulus Calculation:
o Compute n, the modulus, which is the product of the two chosen
primes: n = p * q. This n value is used in both the public and private keys.
3. Totient Function:
o Calculate Euler's totient function, denoted by φ(n) (phi of n). This function
represents the number of positive integers less than n that are relatively
prime to n. In simpler terms, it counts the number of integers below n that
have no common factors with n except 1. There are various ways to
calculate φ(n), but a common method is: φ(n) = (p - 1) * (q - 1).
4. Public Exponent Selection:
o Choose an integer e such that:
▪ 1 < e < φ(n) (e is greater than 1 and less than phi of n).
▪ e and φ(n) are relatively prime (their greatest common divisor
(gcd) is 1). This ensures efficient decryption later.
5. Private Exponent Calculation:
o Find the modular multiplicative inverse of e modulo φ(n). This value,
denoted by d, is mathematically expressed as: d ≡ e^-1 (mod φ(n)). In
simpler terms, d is the number that, when multiplied by e modulo φ(n),
gives a remainder of 1. Finding d can be done using the Extended
Euclidean Algorithm.
6. Key Pair Creation:
o The public key consists of the pair (n, e). This key is made public and
can be shared with anyone who wants to encrypt messages for you.
o The private key is the pair (n, d). This key should be kept secret and
never shared. It is used to decrypt messages encrypted with your public
key.
Encryption with Public Key (7, 187)

Even though we can't decrypt messages for user A without the private key, we can still
encrypt a message (M) using their public key (7, 187). Here's the encryption process:

1. Encryption Function: The RSA encryption uses the formula C = M^e mod n,
where:
o C is the ciphertext (encrypted message)
o M is the plaintext message (message to be encrypted)
o e is the public exponent (7 in this case)
o n is the modulus (187 in this case)
2. Encrypting M = 5: Let's say you want to encrypt the message M = 5 using user
A's public key.
o Apply the formula: C = 5^7 mod 187
o Calculate the exponentiation (5^7) which is 78125.
o Perform the modulo operation (78125 mod 187). This gives the remainder after
dividing 78125 by 187, which is 146.

Therefore, the ciphertext for M = 5 using the public key (7, 187) is 146.

2. Explain DES in detail

DES stands for Data Encryption Standard, a symmetric-key block cipher that was once
widely used. Here's a breakdown of DES in points:

• Type of Cipher: DES is a symmetric-key block cipher. This means:


o Symmetric Key: The same secret key is used for both encryption and
decryption.
o Block Cipher: It operates on fixed-size blocks of data (64 bits in DES).
• Key Length: DES uses a key length of 56 bits. This key size is considered
weak by today's standards and is susceptible to brute-force attacks.
• Algorithm Structure: DES follows a Feistel network structure, consisting of:
o Initial Permutation (IP): Rearranges the 64-bit plain text block.
o 16 Rounds: Each round performs a combination of:
▪ Expansion Permutation: Expands the right half of the data from
32 bits to 48 bits.
▪ Key Mixing: XORs the expanded data with a sub-key derived
from the main key.
▪ S-Boxes (Substitution Boxes): Substitute small blocks of data
using pre-defined tables, adding confusion.
▪ Permutation: Rearranges the data for diffusion.
o Final Permutation (FP): Rearranges the final output from both halves.

3. Explain Modes of block cipher


a. Electronic Codebook (ECB): Simple mode where each block is encrypted
independently. Offers confidentiality but suffers from lack of integrity and
malleability (changing ciphertext can alter plaintext).

b. Cipher Block Chaining (CBC): Uses the previous ciphertext block to


influence the encryption of the current block, providing both confidentiality and
integrity.

c. Cipher Feedback Mode (CFB): Converts the block cipher into a stream
cipher-like mode. Useful for situations requiring bit-by-bit encryption/decryption.
d. Output Feedback Mode (OFB): Similar to CFB, but the output of the block
cipher is used directly for encryption instead of being fed back.

e. Counter (CTR) Mode: Uses a counter value along with the block cipher to
generate a pseudo-random stream for encryption. Offers confidentiality and
allows for parallel processing.
4. Explain Diffie hellman key agreement algorithm consider the example where A and B
decide to use the Diffie Hellman algo to share a key. They choose P=23 G=5 as public
parameters

The Diffie-Hellman key agreement algorithm allows two parties (A and B in this case)
to establish a shared secret key over an insecure communication channel without
needing to exchange the key itself. Here's how it works with the chosen public
parameters:

Public Parameters:

• Prime Number (P): P = 23 (a large prime number)


• Primitive Root (G): G = 5 (a generator of the finite field modulo P)

Steps:

1. Private Key Generation:


o Alice (A): Chooses a random private key a, where 1 < a < P-1 (here, 1 <
a < 22). Let's say Alice picks a = 6.
o Bob (B): Similarly, Bob chooses a random private key b, where 1 < b <
P-1. Let's say Bob picks b = 15.
2. Public Key Calculation:
o Alice (A): Calculates her public key A = G^a mod P. Substituting the
values: A = 5^6 mod 23. Performing the exponentiation (5^6) gives
15625. Taking the modulo 23 gives the remainder, which is 8. So, Alice's
public key is A = 8.
o Bob (B): Calculates his public key B = G^b mod P. Substituting: B =
5^15 mod 23. Performing the calculation, Bob's public key is B = 17.
3. Key Exchange (Public Channel):
o Alice (A): Sends her public key (A = 8) to Bob over the insecure channel.
o Bob (B): Sends his public key (B = 17) to Alice over the insecure
channel.

Shared Secret Key Calculation:


• Alice (A): Receives Bob's public key (B = 17). Now, Alice calculates the shared
secret key using the formula: K = B^a mod P. Substituting: K = 17^6 mod 23.
Performing the exponentiation and modulo operation, Alice gets the key K = 8.
• Bob (B): Receives Alice's public key (A = 8). Similarly, Bob calculates the
shared secret key: K = A^b mod P. Substituting: K = 8^15 mod 23. The
calculation yields the same key K = 8.

5. Explain Kerberos with neat block diagram


Kerberos provides a centralized authentication server whose function is to
authenticate users to servers and servers to users. In Kerberos
Authentication server and database is used for client authentication.
Kerberos runs as a third-party trusted server known as the Key Distribution
Center (KDC). Each user and service on the network is a principal.
The main components of Kerberos are:

• Authentication Server (AS):


The Authentication Server performs the initial authentication and
ticket for Ticket Granting Service.

• Database:
The Authentication Server verifies the access rights of users in the
database.

• Ticket Granting Server (TGS):


The Ticket Granting Server issues the ticket for the Server

• Step-1:
User login and request services on the host. Thus user requests
for ticket-granting service.

• Step-2:
Authentication Server verifies user’s access right using database
and then gives ticket-granting-ticket and session key. Results are
encrypted using the Password of the user.

• Step-3:
The decryption of the message is done using the password then
send the ticket to Ticket Granting Server. The Ticket contains
authenticators like user names and network addresses.

• Step-4:
Ticket Granting Server decrypts the ticket sent by User and
authenticator verifies the request then creates the ticket for
requesting services from the Server.

• Step-5:
The user sends the Ticket and Authenticator to the Server.

• Step-6:
The server verifies the Ticket and authenticators then generate
access to the service. After this User can access the services.

6. Explain AES algorithm. Highlight difference between AES and DES.

AES (Advanced Encryption Standard) is a symmetric block cipher widely used for
secure communication. It's the current standard for electronic government information
(EGI) protection in the US and is employed in various applications like secure
messaging, file encryption, and disk encryption.

Here's a breakdown of AES:

• Symmetric Key: Uses the same secret key for both encryption and decryption.
• Block Cipher: Operates on fixed-size data blocks (usually 128, 192, or 256
bits).
• Substitution-Permutation Network: Relies on a combination of substitution
and permutation operations to achieve confusion and diffusion.
• Rounds: AES performs multiple rounds (usually 10, 12, or 14 depending on the
key size) of substitution and permutation steps on the data block.
• Key Expansion: Derives round keys from the main secret key for each round,
enhancing security.
• Shift Row: Shifts each row of the data block by a specific number of positions
to create confusion.
• Mix Columns: Applies linear transformation to each column of the data block,
enhancing diffusion.
• SubBytes: Uses pre-defined S-boxes (substitution boxes) to replace individual
bytes in the data block with new values, introducing confusion.

Feature AES DES

Type Symmetric Block Cipher Symmetric Block Cipher

56 bits (considered weak by


Key Size 128, 192, or 256 bits
today's standards)

More secure due to larger key Less secure due to smaller key
Security
size and stronger size and potential

algorithm structure for cryptanalysis

10, 12, or 14 depending on key


Rounds 16
size

Substitution-Permutation
Operation Feistel Network
Network

Current Deprecated due to security


Current encryption standard
Status weaknesses

7. If A and B wish to use RSA to communicate, A chooses public key (e,n) as (7,247)
abd B chooses public key as (5,221) calculate A’s Private key and calculate B’s
Private key. What will be the cipher text sent by A to B if A wishes to send M=5 to B.
8. Explain man in middle attack by Diffie Hellman

The Diffie-Hellman key exchange protocol allows two parties to establish a shared
secret key over an insecure channel without needing to exchange the key itself.
However, it's vulnerable to a Man-in-the-Middle (MitM) attack, where an attacker
intercepts and manipulates communication between the two parties, resulting in them
unknowingly agreeing on different secret keys.

Here's a breakdown of the attack in points:

Participants:
• Alice (wants to communicate with Bob)
• Bob (wants to communicate with Alice)
• Mallory (the attacker)

Steps:

1. Mallory Intercepts Initial Communication:


o Alice and Bob decide to use Diffie-Hellman and agree on public
parameters (prime number P and primitive root G).
o Alice generates her private key (a) and public key (A = G^a mod P). She
transmits A to Bob over the insecure channel.
o Mallory intercepts this communication and steals Alice's public key (A).
2. Mallory Creates Fake Identities:
o Mallory generates her own private key (x) and public key (X = G^x mod
P).
o Mallory pretends to be Bob to Alice and sends her own public key (X)
instead of Bob's real public key.
3. Key Mismatch:
o Alice receives Mallory's public key (X) and believes it's from Bob. She
calculates a shared secret key (K_ab) using the formula: K_ab = X^a
mod P.
o Meanwhile, Mallory intercepts Bob's real public key (B = G^b mod P)
sent over the insecure channel.
o Mallory pretends to be Alice to Bob and sends him her public key (X)
instead of Alice's real public key.
o Bob receives Mallory's public key (X) and believes it's from Alice. He
calculates a shared secret key (K_mb) using the formula: K_mb = X^b
mod P.

Outcome:

• Alice and Bob unknowingly end up with different shared secret keys (K_ab ≠
K_mb) because they used the attacker's public key (X) in their calculations.
• Mallory can potentially decrypt messages exchanged between Alice and Bob
(believing they share a secret key) or forge messages as one of them.

Prevention:

• Use trusted communication channels whenever possible to exchange public


keys.
• Implement digital signatures or key authentication techniques to verify the
authenticity of public keys during exchange.
• Consider using Diffie-Hellman variants that offer stronger authentication
properties.

9. Users A and B use Diffie Hellman Key exchange technique with common prime 71
and primitive root 7. Show that 7 is primitive root of 71. If User A has private key
X=5. What is A’s public key? If user B has Private key Y=12, What is B’s public Key?
What is shared secret key?

Module 3
1. Write a short note on MD5 algorithm

• What it is: MD5 (Message-Digest Algorithm 5) is a cryptographic hash function


that takes an input of any length and generates a fixed-length output (128 bits)
called a hash value.
• Developed by: Ronald Rivest in 1991.
• Purpose: Originally designed for digital signature verification, it has various
applications including data integrity checking (checksums).
• Output size: 128 bits (represented as a 32-character hexadecimal number).
• Security concerns: While once widely used, MD5 has known vulnerabilities
and should not be used for security purposes like password storage. There are
more secure hashing algorithms available (e.g., SHA-256).
• Current use: MD5 may still be used in some non-critical applications due to its
simplicity and speed, but it's recommended to use more secure alternatives
whenever possible.

2. Define and explain SHA1 algorithm in detail with diagram.

SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function that takes an


input of any length and produces a unique, fixed-size (160-bit) output called a
message digest.

Here's a breakdown of SHA-1 in points with a diagram for reference:


• Function: SHA-1 processes the input message in stages, applying
mathematical operations to create a unique fingerprint.
• Input: Any data (text, file, etc.)
• Output: 160-bit hash value (often displayed as a 40-character hexadecimal
string)

Key points about SHA-1:

• Collision Resistance: It's highly improbable to find two different messages with
the same hash value.
• Avalanche Effect: Small changes in the input message lead to significant
changes in the hash value.
• Security: SHA-1 is considered cryptographically broken due to theoretical
vulnerabilities. It's not recommended for new security applications (use SHA-
256 or later versions).
• Existing Use: SHA-1 may still be used in some legacy systems or for non-
critical integrity checks.

3. Define MAC. List its types and explain.

MAC address, short for Media Access Control address, is a unique identifier assigned
to a network interface controller (NIC) in a network device. It functions at the Data Link
Layer (layer 2) of the OSI model.

Here's a breakdown of MAC addresses in points:

• Purpose: Identifies a specific network device on a network segment.


• Uniqueness: Globally unique, ensuring no two devices share the same MAC
address.
• Format: 12-digit hexadecimal number (e.g., 00:1A:C2:00:43:56) separated by
colons or hyphens.
• Assignment: Embedded in the NIC by the manufacturer during production
(burned-in address).

Types of MAC Addresses (and explanations):

1. Unicast MAC: The most common type, assigned uniquely to a single network
device. Routers use unicast MAC addresses to deliver data packets to specific
devices on a network.
2. Multicast MAC: A single address representing a group of devices on a
network. Sending data to a multicast address allows efficient transmission to
multiple devices simultaneously.
3. Broadcast MAC: A special MAC address (typically all Fs: FF:FF:FF:FF:FF)
used to send data to all devices on a network segment. This is rarely used due
to network congestion concerns.
4. Locally Administered Address (LAA): A block of MAC addresses reserved for
private use within an organization. These addresses are not routable on the
public internet.

4. Compare CMAC, HMAC, MAC.


Feature CMAC HMAC MAC (General)
Message Message Message
Type Authentication Authentication Authentication
Code (MAC) Code (MAC) Code (MAC)

Secret key,
specific to
Key Secret key Secret key
CMAC
algorithm

Any
Dedicated block cryptographic Any
Hash Function cipher (DES, hash function cryptographic
AES) (MD5, SHA-1, hash function
SHA-256)

Can be based
Based on block Uses a hash
on hash
Construction cipher modes function with a
functions or
(CBC-MAC) secret key
block ciphers

Data integrity Data integrity Data integrity


Purpose
and authenticity and authenticity and authenticity

Security
Generally Security depends
depends on the
Security considered on the underlying
underlying
secure hash function
function

Wide range of
applications
Ethernet Network
(digital
Applications networks, IEEE security, data
signatures,
802.11 Wi-Fi integrity checks
password
storage)

Standardized Not a single


Standardized
Standardization (NIST SP 800- standardized
(RFC 2104)
38B) algorithm

5. What is the need for Message authentication? List various techniques used for
message authentication. Explain anyone.

Why Message Authentication is Needed:

In any communication channel, messages are susceptible to various threats:


• Modification: The content of the message could be altered during
transmission.
• Replay: An attacker could intercept and resend a previous message.
• Impersonation: Someone could pretend to be the sender and send a forged
message.
• Denial of Origin: The sender could deny sending a message they actually
sent.

Message authentication helps ensure the integrity and authenticity of messages. It


verifies that:

• The message has not been tampered with in transit.


• The message originated from the claimed sender.

Techniques for Message Authentication:

There are three main techniques used for message authentication:

1. Message Authentication Code (MAC):


o A symmetric key cryptography technique.
o Sender and receiver share a secret key.
o Sender creates a MAC tag using the message and the key.
o The tag is appended to the message and sent.
o Receiver uses the same key to calculate the MAC tag for the received
message.
o If the calculated tag matches the received tag, the message is
considered authentic.
2. Digital Signatures:
o Uses asymmetric key cryptography.
o Sender has a private key and a corresponding public key.
o Sender creates a digital signature using the message and their private
key.
o The signature is appended to the message and sent.
o Receiver uses the sender's public key to verify the signature.
o A successful verification confirms the message originated from the
sender and has not been modified.
3. Authenticated Encryption (AE):
o Combines encryption and authentication in a single step.
o Offers both confidentiality and integrity of the message.
o Various AE algorithms exist (e.g., GCM, CCM).

Explanation of MAC (Message Authentication Code):

Let's take a closer look at how MAC works:

1. Alice (sender) wants to send a message (M) to Bob (receiver). They both share
a secret key (K).
2. Alice uses a MAC algorithm (e.g., HMAC) along with the key (K) to generate a
MAC tag (T) for the message (M).
3. Alice sends the message (M) along with the MAC tag (T) to Bob.
4. Bob receives the message (M) and the MAC tag (T).
5. Bob uses the same MAC algorithm and the shared key (K) to calculate his own
MAC tag (T') for the received message (M).
6. Bob compares the received tag (T) with his calculated tag (T').
o If T == T', the message is considered authentic (not modified).
o If T != T', the message has been tampered with and should be rejected.

6. Define Hashing. List the properties of Hash function.

Hashing is a fundamental concept in computer science, particularly cryptography, that


involves transforming data of arbitrary size into a fixed-length value. This fixed-length
value, called a hash value or digest, acts like a fingerprint for the original data.

Here are some key properties of a good hash function:

• Deterministic: For a given input, the hash function always produces the same
output (hash value).
• Fixed-size output: Regardless of the input size, the hash function generates a
hash value with a predefined length.
• Avalanche effect: Small changes to the input data should result in significant
changes to the hash value. This ensures even minor modifications are
detectable.
• Collision resistance: It's computationally infeasible to find two different inputs
that generate the same hash value (collisions).
• Efficiency: A good hash function should be efficient to compute, especially for
large data sets.

These properties make hashing a valuable tool for various applications:

• Data integrity verification: Hashing can be used to check if data has been
modified during transmission or storage. By comparing the generated hash
value with the original one, any tampering becomes evident.
• Digital signatures: Hashing plays a crucial role in digital signatures, where a
signed hash value of a message acts as a tamper-proof verification of its origin
and content.
• Data deduplication: Hashing helps identify identical data stored in different
locations, enabling efficient storage optimization by eliminating redundant
copies.
• Password storage: Hashes are commonly used to store passwords securely.
Instead of storing the plain text password, its hash value is saved. When a user
attempts to log in, the system generates the hash of the entered password and
compares it with the stored hash. This approach protects passwords from being
compromised even if the database is breached.

Module 4

1. Explain Kerberos as authentication service and define TGS in Kerberos.

Kerberos is a network authentication protocol that provides secure login and access
control for various network services. It relies on a centralized server called the Key
Distribution Center (KDC) to manage and distribute secret keys for user and service
authentication.

Here's a breakdown of Kerberos and the role of TGS:

1. Kerberos as an Authentication Service:


• Centralized approach: Kerberos uses a trusted KDC to manage user and
service credentials.
• Ticket-based system: The KDC issues temporary tickets to users and services
for secure access.
• Mutual authentication: Both the user and the service are authenticated before
granting access.

2. The Ticket Granting Service (TGS):

The TGS is a component within the KDC responsible for issuing service tickets.
Here's how it works:

1. User obtains Ticket Granting Ticket (TGT): The user first authenticates with
the KDC using their username and password. Upon successful verification, the
KDC issues a TGT encrypted with the service ticket granting service's (TGS)
secret key.
2. User requests service access: When a user wants to access a specific
network service, they send a request to the TGS along with the TGT.
3. TGS issues service ticket: The TGS decrypts the TGT using its secret key
and verifies the user's identity. If valid, the TGS creates a service
ticket encrypted with the requested service's secret key and a session
key unique to the user and service. This session key enables secure
communication between the user and the service.
4. User accesses service: The user sends the service ticket and an authenticator
(containing the user ID and a timestamp) to the requested service.
5. Service verifies and grants access: The service decrypts the service ticket
using its secret key and verifies the user's identity and the validity of the session
key. If everything checks out, the service grants access to the user.

2. Elaborate sign and verification process of RSA as a digital signature scheme.

RSA (Rivest–Shamir–Adleman) is a widely used public-key cryptography system that


can be employed for digital signatures. Here's a detailed explanation of the signing and
verification process in RSA:

Signing Process:

1. Hashing the message: The sender (Alice) first creates a hash value (message
digest) of the message (M) using a secure cryptographic hash function like
SHA-256. This hash value acts as a condensed fingerprint of the original
message.
2. Applying private key: Alice then takes the hash value (H) and performs
mathematical operations on it using her private key (d). This private key is a
large integer kept secret by Alice. The mathematical operation typically involves
modular exponentiation (raising H to the power of d modulo the public key
modulus N). This process creates the digital signature (S).

Signing Process Equation:

S = H^d (mod N)

• H: Hash value of the message (M)


• d: Alice's private key
• N: Public key modulus (shared publicly)
• S: Digital signature

Verification Process:

1. Receiver obtains message and signature: The receiver (Bob) receives the
original message (M) and the digital signature (S) from Alice.
2. Hashing the received message: Bob calculates the hash value (H') of the
received message (M) using the same hash function employed by Alice.
3. Verifying the signature: Bob uses Alice's public key (e) and the signature (S)
to perform a mathematical operation similar to the signing process. This usually
involves raising S to the power of the public exponent (e) modulo N.

Verification Process Equation:

H' = S^e (mod N)

4. Signature verification: If the calculated hash value (H') from the received
message matches the hash value obtained from decrypting the signature using
Alice's public key (H'), then the verification is successful. This confirms that the
message originated from Alice (due to the use of her private key) and has not
been tampered with during transmission (as any modification would change the
hash value).

Key Points:

• The security of RSA digital signatures relies on the difficulty of factoring the
public key modulus (N) into its prime factors. As long as N remains unfactored,
it's computationally infeasible for an attacker to forge a valid signature without
Alice's private key.
• RSA is computationally expensive compared to some other signature schemes.
However, it offers strong security due to its mathematical foundation.

Benefits of RSA Digital Signatures

• Non-repudiation: The sender cannot deny signing the message after the
verification is successful.
• Data integrity: Verifies that the message has not been altered in transit.
• Authentication: Confirms the message originated from the claimed sender.

3. Define i) User Authentication ii) Entity Authentication iii) Digital Signature

i) User Authentication:

User authentication is the process of verifying the identity of a user attempting to


access a system or resource. It confirms that the user is who they claim to be.
Common user authentication methods include:

• Username and password logins


• Multi-factor authentication (MFA) using additional verification factors like codes,
biometrics (fingerprint, facial recognition), or security tokens.
• Biometric authentication (fingerprint, facial recognition, iris scan)

ii) Entity Authentication:


Entity authentication is a broader concept encompassing the verification of the identity
of any entity trying to access a system or network. This entity could be a user, a
device, a server, or any other element requiring access control.

Entity authentication methods can include:

• User authentication methods mentioned above (for user entities)


• Digital certificates for verifying the identity of servers or devices
• Challenge-response protocols where the entity needs to respond to a specific
challenge to prove its legitimacy.

iii) Digital Signature:

A digital signature is a cryptographic technique used to ensure the authenticity and


integrity of a message or document. It's analogous to a handwritten signature in the
physical world.

Here's how it works:

1. Signing: The sender (e.g., Alice) creates a hash value (fingerprint) of the
message using a cryptographic hash function.
2. The sender uses their private key to encrypt the hash value, creating the digital
signature.
3. The message and the digital signature are sent together.

Verification:

1. The receiver (e.g., Bob) receives the message and the signature.
2. Bob calculates the hash value of the received message using the same hash
function.
3. Bob uses the sender's public key (which is publicly known) to decrypt the
signature.
4. If the decrypted value matches the calculated hash value of the received
message, the verification is successful.

Key points about digital signatures:

• They ensure the message originated from the claimed sender (due to the use of
their private key).
• They verify that the message has not been tampered with (as any modification
would change the hash value).
• They do not encrypt the message itself; they only verify its authenticity and
integrity.

4. List attacks on digital signature and explain.

Digital signatures, while providing valuable security features, are susceptible to various
attacks. Here are some common attacks and how they work:

1. Known-Message Attack:

• Description: The attacker has access to some valid message-signature pairs


created with the victim's (signer's) private key.
• Goal: The attacker aims to use the knowledge of these pairs to forge a
signature for a new message they haven't seen before.
• Process: The attacker may try to analyze the relationship between the known
messages and their signatures to identify patterns or weaknesses in the signing
algorithm. However, successfully forging a new signature is generally difficult in
strong digital signature schemes.

2. Chosen-Message Attack:

• Description: The attacker can trick the victim into signing messages of their
choosing. This can be achieved through social engineering or by manipulating
the way messages are presented to the user.
• Goal: The attacker aims to obtain a valid signature for a message they crafted,
allowing them to use it for malicious purposes.
• Process: For instance, an attacker might create a seemingly innocuous
document containing hidden malicious code and trick the victim into signing it.
This signed document could then be used to gain unauthorized access or
perform other actions.

3. Existential Forgery Attack:

• Description: The attacker can create a valid message-signature pair for a


completely new message (not chosen by them and not previously signed by the
victim).
• Goal: The attacker aims to create a seemingly legitimate signed message
without knowledge of the victim's private key or any existing message-signature
pairs.
• Process: This attack is the most challenging to achieve and is generally
considered computationally infeasible for well-designed digital signature
schemes. However, theoretical vulnerabilities might exist in some algorithms,
making them susceptible to this attack.

4. Signature Theft:

• Description: The attacker manages to steal the victim's private key used for
signing.
• Goal: Once the private key is compromised, the attacker can forge any
signature they desire, impersonating the victim.
• Process: This attack typically relies on weaknesses in key management
practices, such as storing private keys insecurely or falling victim to malware
that steals key information.

5. Brute-Force Attack:

• Description: The attacker attempts to guess the victim's private key by trying a
vast number of possible combinations.
• Goal: With the private key, the attacker can forge signatures at will.
• Process: This attack is computationally expensive and often impractical for
strong digital signature schemes with large key sizes. However, advancements
in computing power could make it a potential threat in the future.

Protecting Against Attacks:


• Use strong signature algorithms: Choose digital signature schemes with well-
established security and resistance to known attacks.
• Secure key management: Implement robust practices for generating, storing,
and using private keys. Avoid storing private keys on insecure devices or
transmitting them unencrypted.
• User awareness: Train users to be cautious about signing messages from
untrusted sources or those containing suspicious content.
• Regular updates: Keep cryptographic libraries and software updated to
address any discovered vulnerabilities in signature algorithms.

5. Alice chooses public key as (7,33) and Bob chooses public key as(13,221). Calculate
their private keys. A wish to send message=5 to B. Show the message signing and
verification using RSA Digital Signature.

Public Keys:

• Alice: (7, 33) - (e, N)


• Bob: (13, 221) - (e, N)

Private Keys Calculation:

To find the private key (d) for each party, we use the following formula:

d ≡ e^-1 (mod φ(N))

where:

• φ(N) is Euler's totient function, which represents the number of positive integers
less than N that are relatively prime to N.

1. Alice's Private Key:

We first need to calculate φ(N) for Alice's public key (N = 33):

φ(33) = (33 - 1) * (1 - 2/33) = 32

Now, we can find Alice's private key (d):

d ≡ 7^-1 (mod 32)

This can be calculated using the Extended Euclidean Algorithm. In this example, we'll
find that:

d ≡ 3 (mod 32)

Therefore, Alice's private key is (3, 33).

2. Bob's Private Key:

Following the same steps for Bob's public key (N = 221):

φ(221) = (221 - 1) * (1 - 2/221) = 216

d ≡ 13^-1 (mod 216)


Using the Extended Euclidean Algorithm, we find:

d ≡ 75 (mod 216)

Therefore, Bob's private key is (75, 221).

Message Signing (Alice to Bob):

1. Message: M = 5
2. Hashing: Alice calculates the hash value (H) of the message using a secure
hash function (e.g., SHA-256). Let's assume the hash function returns a value H
= 10.
3. Signing: Alice uses her private key (d = 3) and the hash value (H = 10) to
create the digital signature (S):

S = H^d (mod N)

S = 10^3 (mod 33)

S = 1000 (mod 33)

Due to modular arithmetic, 1000 is equivalent to 29 (remainder after dividing by 33)

Therefore, the signature (S) for Alice is 29.

Message Verification (Bob):

1. Receive Message and Signature: Bob receives the message (M = 5) and the
signature (S = 29) from Alice.
2. Hashing: Bob calculates the hash value (H') of the received message (M = 5)
using the same hash function Alice used.
3. Verification: Bob uses Alice's public key (e = 7, N = 33) and the signature (S =
29) to verify the message:

H' = S^e (mod N)

H' = 29^7 (mod 33)

H' = (29 * 29 * 29 * 29 * 29 * 29 * 29) (mod 33)

H' = 10 (mod 33)


Module-5
1. What are different types of firewalls?

Firewalls are network security devices that control incoming and outgoing traffic based
on a set of security rules. They act as a barrier between a trusted internal network and
an untrusted external network (like the internet). There are different ways to classify
firewalls, here are some common types based on their functionality and deployment:

1. By Functionality:

• Packet-filtering firewalls: These basic firewalls examine individual data


packets and allow or deny them based on pre-defined rules like
source/destination IP address, port number, and protocol type.
• Stateful inspection firewalls: These more advanced firewalls analyze not just
individual packets but also the state of the connection. They keep track of
established connections and allow traffic only relevant to those connections.
This provides better security compared to simple packet filtering.
• Application-level firewalls (Proxy firewalls): These firewalls inspect the
actual content of data packets at the application layer (e.g., HTTP, FTP). They
can filter traffic based on specific applications or protocols, offering deeper
inspection capabilities.

2. By Deployment:

• Network firewalls: These are physical hardware devices deployed at the


perimeter of a network, typically between the internal network and the internet
router. They act as the first line of defense, filtering traffic entering or leaving the
network.
• Host-based firewalls: These are software programs installed on individual
devices (computers, servers) within a network. They provide additional security
by controlling traffic entering and leaving those specific devices.
• Cloud firewalls: These are security services offered by cloud providers that
filter traffic at the cloud level. They can be used to protect resources deployed
within a cloud environment.

3. Other Firewall Types:

• Next-generation firewalls (NGFWs): These advanced firewalls combine


features of traditional firewalls (packet filtering, stateful inspection) with
additional functionalities like deep packet inspection (DPI), intrusion
detection/prevention systems (IDS/IPS), and malware analysis.
• Demilitarized Zone (DMZ) firewalls: These firewalls are used to create a
segmented network zone (DMZ) between the internal network and the internet.
The DMZ can host public-facing servers while keeping the internal network
more secure.

2. How is firewall different from IDS


Feature Firewall IDS (Intrusion Detection System)

Detects and alerts for


Function Controls network traffic
suspicious network activity
Alerts security personnel or
Allows or denies traffic
Action takes pre-configured actions
based on rules
(optional)

Anomaly and signature-based


Focus Network traffic filtering
detection of intrusions

Prevention vs. Primarily for detection and


Primarily preventative
Detection alerting

Network perimeter Network or host-based


Deployment
(hardware/software) (hardware/software)

May not see all traffic (e.g.,


Visibility Sees all network traffic
encrypted)

Can occur with overly More likely due to the nature


False Positives
restrictive rules of anomaly detection

Example Packet filtering, stateful Signature detection, anomaly


Technologies inspection detection

3. Define SSL and explain SSL handshake protocol with diagram

SSL stands for Secure Sockets Layer. It's a cryptographic protocol that provides
secure communication between a web server and a client (usually a web browser).
SSL ensures the following:

• Confidentiality: Data transmitted between the server and client is encrypted,


protecting it from eavesdropping.
• Data integrity: Ensures data is not tampered with during transmission.
• Authentication: Verifies the identity of the server (optional client authentication can
also be implemented).

SSL has been largely superseded by its successor, Transport Layer Security (TLS).
However, the terms "SSL" and "TLS" are often used interchangeably.

SSL Handshake Protocol

The SSL handshake is a crucial initial stage that establishes a secure connection
before data transfer. It involves an exchange of messages between the client and
server to agree on encryption algorithms, generate session keys, and optionally
authenticate each other. Here's a breakdown of the handshake process with a
diagram:

1. Client Hello:

• The client initiates the handshake by sending a "Client Hello" message to the server.
• This message includes:
o Supported SSL/TLS versions
o Cipher suites (supported encryption algorithms)
o Session ID (for resuming existing sessions)
o Random data (used for generating session keys)

2. Server Hello:

• The server responds with a "Server Hello" message containing:


o Chosen SSL/TLS version (from client's supported options)
o Selected cipher suite (agreed-upon encryption algorithm)
o Session ID (new or the same as client's suggestion)
o Server's random data
o Server certificate (if server authentication is enabled)

3. Certificate Verification (Optional):

• If the server sends a certificate, the client verifies its authenticity by checking the digital
signature and certificate chain.
• The client may also perform additional checks like certificate revocation.

4. Pre-Master Secret Generation:

• Both the client and server use their randomly generated data to create a temporary
secret key called the Pre-Master Secret.

5. Client Key Exchange:

• The client encrypts the Pre-Master Secret with the server's public key (obtained from
the certificate) and sends it to the server.

6. Change Cipher Spec (Optional):

• This message indicates the client is switching to the negotiated cipher suite for future
messages.

7. Finished Message:
• Both the client and server send "Finished" messages containing a hash of all previous
handshake messages, encrypted with the negotiated keys. This ensures both parties
used the same handshake data for key generation.

4. What is meant by denial-of-service attack? Explain different types of denial-of-


service attack.

A denial-of-service (DoS) attack is an attempt to make a computer system or network


resource unavailable to its intended users. Attackers achieve this by overwhelming the
target with a flood of traffic or exploiting vulnerabilities to crash the system. DoS
attacks can disrupt critical services, cause financial losses, and damage an
organization's reputation.

Here's a breakdown of different types of DoS attacks:

1. Volume-based Attacks:

• These attacks aim to overwhelm the target system's resources (bandwidth,


CPU, memory) with a massive amount of traffic, making it incapable of handling
legitimate requests. Common types include:
o SYN Flood: Attackers send a large number of SYN packets (connection
initiation requests) to a server, leaving it waiting for completion of non-
existent connections and exhausting resources.
o UDP Flood: Attackers bombard the target with UDP packets,
overwhelming its ability to process incoming data.
o ICMP Flood (Ping Flood): A barrage of ICMP ping requests can
overload the target system's capacity to respond.

2. Protocol Attacks:

• These attacks exploit weaknesses in network protocols to disrupt normal


operations. Examples include:
o Smurf Attack: Attackers spoof the source IP address of the target in
ICMP echo requests sent to a large number of broadcast addresses. The
target gets flooded with replies from these addresses.
o Teardrop Attack: Malformed packets with overlapping fragments are
sent to the target, causing its operating system to crash while trying to
reassemble them.

3. Application Layer Attacks:

• These attacks target specific vulnerabilities in web applications or services to


overload them. Examples include:
o HTTP Flood: Attackers bombard a web server with a massive number of
HTTP requests, exhausting its resources and preventing legitimate users
from accessing the website.
o Application-Specific Attacks: Exploiting vulnerabilities in specific
applications (e.g., login forms) to trigger resource-intensive processes
and crash the application.

4. Distributed Denial-of-Service (DDoS) Attacks:

• In a DDoS attack, the attack traffic originates from a large network of


compromised computers (botnet) instead of a single source. This makes it
harder to identify and mitigate the attack. DDoS attacks can be even more
disruptive than traditional DoS attacks due to the sheer volume of traffic they
generate.

5. Write a short note on DDOS (distributed Denial of service attack)

A Distributed Denial-of-Service (DDoS) attack is a malicious attempt to cripple a


website, server, or online service by overwhelming it with a flood of internet traffic.
Unlike a DoS attack that originates from a single source, a DDoS attack leverages a
network of compromised computers, often referred to as a botnet, to bombard the
target with traffic.

How it Works:

1. Botnet Recruitment: Attackers infect a vast number of devices (computers, IoT


devices) with malware, turning them into controllable bots.
2. Command and Control: Attackers use a command and control center to
remotely control the botnet.
3. DDoS Launch: The attacker instructs the botnet to simultaneously bombard the
target with massive amounts of traffic (e.g., HTTP requests, data packets).

Impact of DDoS Attacks:

• Service Disruption: The target service becomes overloaded and inaccessible


to legitimate users, causing downtime and financial losses.
• ** reputational Damage:** Frequent DDoS attacks can erode user trust and
damage an organization's reputation.
• Resource Drain: Mitigating a DDoS attack can be resource-intensive, requiring
significant time and effort from security teams.

Protection Measures:

• DDoS Mitigation Services: Security providers offer services that can filter and
absorb DDoS attack traffic before it reaches the target.
• Rate Limiting: Implement mechanisms to limit the number of requests a user or
IP address can send within a specific timeframe.
• Web Application Firewalls (WAFs): These firewalls can help detect and block
malicious traffic targeting vulnerabilities in web applications.
• Staying Informed: Regularly update software and firmware on devices to patch
vulnerabilities that attackers might exploit.

6. Define PGP.
Pretty Good Privacy (PGP) in Points:

• Encryption Tool: PGP stands for Pretty Good Privacy and is a software program used
for encrypting and decrypting electronic communications.
• Public Key Cryptography: PGP utilizes public-key cryptography, where users have a
pair of keys: a public key for encryption (shared with others) and a private key for
decryption (kept secret).
• Confidentiality and Authentication: PGP primarily ensures the confidentiality of
messages by encrypting them before sending. It can also provide authentication by
allowing users to digitally sign messages, verifying the sender's identity.
• Open Standard: Originally a proprietary product, OpenPGP emerged as a free and
open standard, allowing for wider adoption and development of compatible software.
• Email Security: PGP is commonly used to secure email communication, encrypting
the message content and attachments.
• Flexibility: PGP can also be used to encrypt files and folders, not just email
messages.
• Key Management: Managing public and private keys securely is crucial for effective
PGP usage.

7. Define IDS. List its types.

An Intrusion Detection System (IDS) is a security tool that monitors network traffic or
system activity for malicious activities or suspicious patterns. It acts as a security
watchdog, aiming to identify and alert security personnel of potential security breaches
or unauthorized access attempts.

Here's a breakdown of the different types of IDS based on their deployment and
detection methods:

1. By Deployment:

• Network Intrusion Detection System (NIDS): These systems monitor network


traffic at strategic points on the network (e.g., firewalls, routers). They analyze
network packets for suspicious activity based on predefined rules or signatures
of known attacks.
• Host-based Intrusion Detection System (HIDS): These systems are installed
on individual devices (servers, workstations) and monitor system activity for
signs of compromise. They can track file changes, system logs, and user
activity for suspicious patterns.

2. By Detection Method:

• Signature-based IDS (SIDS): These systems rely on a pre-defined database of


attack signatures (patterns of known malicious activity). They compare network
traffic or system activity against these signatures to detect potential attacks.
• Anomaly-based IDS (AIDS): These systems establish a baseline of normal
activity for the network or system. They then identify deviations from this
baseline as potential anomalies or suspicious activity.

8. Explain 2 phases in IPSec protocol

The IPSec protocol establishes a secure tunnel for communication between two
endpoints over an untrusted network (like the internet) using two key phases:

Phase 1: Main Mode (IKE - Internet Key Exchange)

1. Initiation: One device (initiator) sends a message to the other (responder)


proposing to establish a secure channel.
2. Authentication: Both devices authenticate each other. This can be done using
pre-shared keys (PSK) or digital certificates.
3. Negotiation: The devices negotiate security parameters for the secure tunnel,
including:
o Encryption Algorithm: They agree on a strong encryption algorithm to
be used for data confidentiality (e.g., AES).
o Hashing Algorithm: They select a hashing algorithm to ensure data
integrity (e.g., SHA-256).
o Diffie-Hellman Key Exchange: This cryptographic technique
establishes a shared secret key used to generate session keys for
encryption and decryption within the tunnel.
o Lifetime: They define the duration for which the established security
association (SA) will be valid.

Outcome: After successful negotiation, a secure tunnel is established using the


agreed-upon encryption algorithms and a shared session key derived from the IKE
exchange.

Phase 2: Quick Mode (ESP - Encapsulating Security Payload)

1. SA Creation: Each device creates a Security Association (SA) specifying the


chosen algorithms and session key for data traffic within the tunnel. There can
be multiple SAs for different traffic flows.
2. Data Transfer: Data packets are encapsulated within the ESP protocol. This
involves:
o Encryption: The data is encrypted using the negotiated algorithm and
the session key.
o Authentication Header (Optional): An optional header can be added to
ensure data integrity and prevent tampering.

Outcome: Encrypted and optionally authenticated data packets are securely


transmitted within the IPSec tunnel.

9. Define i)Packet sniffing ii) ARP spoofing iii) IP spoofing.

i) Packet Sniffing:

• Definition: Packet sniffing is the process of capturing data packets traveling


across a network. It's like eavesdropping on a conversation on a shared line.
• Technique: Packet sniffers are software programs that can monitor network
traffic on a specific segment. They can capture various details within the
packets, including:
o Source and destination IP addresses
o Port numbers
o Protocol information (e.g., HTTP, HTTPS)
o In some cases, even the data content (if not encrypted)
• Security Risks: If unencrypted sensitive information (like usernames,
passwords, credit card details) travels through the network, packet sniffers can
be used to steal that data.

ii) ARP Spoofing (ARP Poisoning):

• Definition: ARP spoofing, also known as ARP poisoning, is a cyberattack


technique that exploits the Address Resolution Protocol (ARP).
• Process:
1. Attacker sends fake ARP messages to devices on the network.
2. These messages claim the attacker's MAC address is associated with
the IP address of a legitimate device (e.g., router, server).
3. Network devices update their ARP cache with the attacker's MAC
address, believing it's the legitimate device.
4. Data intended for the legitimate device is unknowingly sent to the
attacker instead.
• Attack Goals: Once traffic is redirected, the attacker can:
o Intercept data: Capture sensitive information flowing through the
network.
o Launch Man-in-the-Middle (MitM) attack: Modify or tamper with data
before forwarding it to the intended recipient.
o Disrupt network communication: Redirect traffic and cause network
issues.

iii) IP Spoofing:

• Definition: IP spoofing is a technique where a cybercriminal disguises their


device's IP address with a different IP address.
• Process: Attackers use software tools to modify the source IP address in
outgoing data packets.
• Attack Goals: By spoofing a legitimate IP address, attackers can:
o Launch denial-of-service (DoS) attacks: Appear to be originating from
a trusted source and overwhelm a target system with traffic.
o Bypass security restrictions: Spoof an authorized IP address to gain
access to restricted resources.
o Hide their identity: Make it harder to trace the source of a cyberattack.

10. Explain IPSec protocol in detail. How security is achieved in Transport and
Tunnelmode.

IPSec (Internet Protocol Security) is a suite of protocols that provide secure


communication over unsecured networks like the internet. It establishes a secure
tunnel between two communicating parties to ensure confidentiality, integrity, and
authentication of data. IPSec achieves this security through two key phases and
different operating modes:

Phases of IPSec:

1. Main Mode (IKE - Internet Key Exchange): This phase focuses on


establishing a secure channel for negotiating security parameters. It involves:
o Initiation: One device initiates communication proposing a secure
tunnel.
o Authentication: Both devices authenticate each other using pre-shared
keys (PSK) or digital certificates.
o Negotiation: They agree on encryption algorithms, hashing algorithms,
key exchange methods (Diffie-Hellman), and lifetime for the secure
association (SA).
2. Quick Mode (ESP - Encapsulating Security Payload): This phase defines
how data is secured within the established tunnel. It involves:
o SA Creation: Each device creates an SA specifying the chosen
algorithms and session key for data traffic. There can be multiple SAs for
different traffic flows.
o Data Encapsulation: Data packets are encapsulated with the ESP
protocol, which includes:
▪ Encryption: Data is encrypted using the negotiated algorithm and
the session key from Phase 1.
▪ Authentication Header (Optional): An optional header can be
added to ensure data integrity and prevent tampering.
IPSec Modes: Transport vs. Tunnel

IPSec offers two primary modes for securing communication: Transport Mode and
Tunnel Mode. They differ in how they handle the security association (SA) and what
data is encrypted:

• Transport Mode:
o Focus: Primarily used to secure communication between specific
applications or ports on the communicating devices.
o Security Association (SA): The SA is established between the source
and destination processes (applications) on the communicating devices.
o Data Encrypted: Only the payload (data portion) of the original IP packet
is encrypted using the ESP protocol. The IP header remains intact.
• Tunnel Mode:
o Focus: Provides end-to-end security for the entire communication
channel. Often used to secure communication between entire networks.
o Security Association (SA): The SA is established between the entire IP
layer of the sending and receiving devices.
o Data Encrypted: The entire original IP packet, including the header and
payload, is encapsulated and encrypted using the ESP protocol. A new
outer IP header is added for routing purposes.

Security Achieved in Each Mode:

• Confidentiality: Both modes achieve confidentiality by encrypting the data


using a strong encryption algorithm. In Transport Mode, only the payload is
encrypted, while in Tunnel Mode, the entire packet is encrypted.
• Integrity: Optional Authentication Header (AH) can be used with both modes to
ensure data integrity and prevent tampering during transmission.
• Authentication: Authentication is achieved during the IKE phase for both
modes. Additionally, AH can provide origin authentication if used.

Choosing the Right Mode:

The choice between Transport Mode and Tunnel Mode depends on your specific
security needs:

• Transport Mode: Use this mode when you want to secure communication
between specific applications or services on the hosts. It offers a more granular
approach to securing specific data flows.
• Tunnel Mode: Use this mode when you want to achieve end-to-end security for
the entire communication channel. This is often used to secure communication
between entire networks or to encrypt traffic sent over a public network like the
internet.

11. Explain TCP/IP Vulnerabilities layer wise.


**Layer Vulnerability Description Example Attacks**

This layer deals with specific * SQL Injection Attacks *


Application applications and services. Cross-Site Scripting (XSS) *
Layer (Layer Vulnerabilities can arise from: * Poor Insecure Direct Object
7) coding practices in applications * References (IDOR) *
Unintended functionality * Lack of Denial-of-Service (DoS)
proper input validation * Missing attacks targeting specific
authentication or authorization applications
mechanisms

This layer focuses on data formatting


Presentation and presentation. Vulnerabilities can * Man-in-the-Middle attacks
Layer (Layer exist in: * Data encoding/decoding that alter data encoding
6) issues * Exploitable features within during transmission
data compression formats

This layer manages communication


Session sessions. Vulnerabilities can include:
* Session Hijacking by
Layer (Layer * Session hijacking by attackers
stealing session cookies
5) exploiting weaknesses in session
management protocols

This layer deals with reliable data


transfer. Vulnerabilities can include: *
Transport * TCP SYN flooding (DoS
Spoofing of source or destination
Layer (Layer attack) * UDP amplification
ports * Sequence number
4) attacks
manipulation in TCP * Buffer
overflow attacks in UDP

This layer handles routing and


addressing. Vulnerabilities can
Network * IP spoofing attacks to
include: * IP spoofing to impersonate
Layer (Layer launch DoS attacks or gain
trusted devices * ARP spoofing (ARP
3) unauthorized access
poisoning) to redirect traffic * Routing
protocol vulnerabilities

This layer manages physical


addressing and media access
Data Link control. Vulnerabilities can include: * * Man-in-the-Middle attacks
Layer (Layer MAC spoofing to impersonate by exploiting weaknesses in
2) authorized devices * Address MAC address management
Resolution Protocol (ARP) cache
poisoning

This layer deals with the physical


transmission of data. Vulnerabilities
Physical * Eavesdropping on
can be: * Physical access to network
Layer (Layer unencrypted data
cables for eavesdropping * Jamming
1) transmissions
or interference with the physical
signal

12. Give examples of Replay Attack. List three general approaches for dealing with
Replay attack.
Replay Attack Examples:

Replay attacks involve capturing a legitimate network transmission and resending it


later to deceive a system into accepting it as valid. Here are some real-world
examples:

• Financial Transactions: An attacker intercepts a money transfer request from your


bank and replays it later to transfer the same amount to their account.
• Login Attempts: An attacker captures a successful login attempt (username and
password) and replays it to gain unauthorized access to a system.
• Security Tokens: An attacker intercepts a temporary security code sent via SMS for
two-factor authentication and replays it to bypass the login process.
• Routing Protocols: In a network, an attacker could replay routing information to
disrupt communication paths and misdirect traffic.

These are just a few examples, and replay attacks can be used against various
communication channels and protocols.

General Approaches for Dealing with Replay Attacks:

1. Sequence Numbers and Timestamps:

• Sequence numbers are unique identifiers assigned to messages in a communication


session. The receiver keeps track of the expected sequence number and rejects
messages with a duplicate or unexpected sequence number.
• Timestamps add a time reference to messages. The receiver can reject messages with
timestamps that are too old or appear in an illogical sequence.

2. Challenge-Response Mechanisms:

• This approach involves the receiving party sending a random challenge (e.g., a
number) to the sender after receiving the initial message.
• The sender then responds with a message that incorporates the received challenge,
proving they possess the original message and can decrypt it.
• This additional step ensures the message hasn't been simply copied and replayed.

3. Cryptographic Nonces:

• Nonces are random, unpredictable values used only once in a communication session.
They are added to messages during encryption.
• The receiver can verify that the nonce hasn't been used before, preventing replay of an
intercepted message.

13. Explain Denial of service and its types

Denial of service (DOS) is a network security attack, in which, the hacker


makes the system or data unavailable to someone who needs it. Denial of
service is of various types :
1. Browser Redirection – This happens when you are trying to reach
a webpage, however, another page with a different URL opens.
You can view only the directed page and are unable to view the
contents of the original page. This is because the hacker has
redirected the original page to a different page.
2. Closing Connections – After closing the connection, there can be
no communication between the sender(server) and the
receiver(client). The hacker closes the open connection and
prevents the user from accessing resources.
3. Data Destruction – This is when the hacker destroys the resource
so that it becomes unavailable. He might delete the resources,
erase, wipe, overwrite or drop tables for data destruction.
4. Resource Exhaustion – This is when the hacker repeatedly
requests access for a resource and eventually overloads the web
application. The application slows down and finally crashes. In
this case the user is unable to get access to the webpage.

Module 6
1. Explain in brief Software Vulnerabilities such as Buffer Overflow, Format
String,cross-site scripting

Here's a quick explanation of three common software vulnerabilities:

1. Buffer Overflow:

• Imagine a container (buffer) meant to hold a specific amount of liquid (data).


• A buffer overflow occurs when a program tries to pour more data into the
container than it can hold.
• This excess data spills over (overflows) into adjacent memory locations,
corrupting their contents.
• Attackers can exploit this overflow to inject malicious code and potentially gain
control of the program or system.

2. Format String Vulnerability:

• This vulnerability involves weaknesses in how certain functions (like printf)


handle user-supplied strings used for formatting output.
• An attacker can craft a specially formatted string that tricks the function into
reading and writing data from unexpected memory locations.
• This can lead to code execution, sensitive information disclosure, or program
crashes.

3. Cross-Site Scripting (XSS):

• Imagine a website allowing users to post comments.


• XSS vulnerability exists if the website doesn't properly validate user input before
displaying it.
• An attacker can inject malicious scripts into their comments.
• When another user views the comment, the script embedded within is executed
by their browser.
• These malicious scripts can steal user data, redirect users to phishing sites, or
deface the website.
2. Explain SQL injection, Logic bomb.
1. SQL Injection

What it is: SQL injection (SQLi) is a type of cyberattack that exploits vulnerabilities in
how web applications interact with databases. Attackers inject malicious SQL code into
user inputs or data fields to manipulate database queries.

How it works:

1. Attacker submits crafted input: The attacker enters malicious code disguised as
regular user input (e.g., login form, search bar).
2. Application fails to sanitize: The web application doesn't properly sanitize the input,
allowing the malicious code to be passed to the database as part of the SQL query.
3. Database executes malicious code: The database interprets and executes the
attacker's code, potentially leading to various harmful actions.

Possible consequences:

• Data theft: Attackers can steal sensitive data like usernames, passwords, credit card
numbers, etc.
• Data manipulation: Attackers can alter or delete data stored in the database.
• Website takeover: In severe cases, attackers might gain control of the entire database
or web application server.

Prevention tips:

• Input validation and sanitization: Validate and sanitize all user input before passing it
to database queries.
• Use parameterized queries: Use parameterized queries that separate data from the
SQL statement, preventing malicious code injection.
• Keep software updated: Regularly update web application software and database
servers to patch known vulnerabilities.
2. Logic Bomb

What it is: A logic bomb is a malicious piece of code secretly planted within a software
program, system, or network. It lies dormant until a specific condition is met, triggering
a harmful action.

How it works:

1. Logic bomb is planted: The attacker inserts the malicious code into the system, often
disguised as legitimate code.
2. Trigger condition is met: The logic bomb is programmed to activate when a specific
event occurs (e.g., a certain date, deletion of a file, user termination).
3. Harmful action is executed: Upon activation, the logic bomb can perform destructive
actions like deleting files, corrupting data, or disabling functionalities.

Motives for using logic bombs:

• Disgruntled employee sabotage: A disgruntled employee might plant a logic bomb to


cause damage to the company's systems upon termination.
• Cybercrime: Attackers might use logic bombs for extortion purposes, threatening to
trigger destruction unless a ransom is paid.

Prevention tips:
• Code reviews and audits: Regularly review code for suspicious logic or unusual
functionalities.
• Strong access control: Implement strict access controls to prevent unauthorized
modifications to programs and systems.
• Data backups: Maintain regular backups of critical data to minimize potential damage
from logic bomb attacks.

3. Differentiate virus and worm.


Feature Virus Worm

Yes, needs to attach to a host No, can replicate


Needs Host File
file to replicate independently

Spreading Spreads through infected files Spreads through network


Mechanism or programs connections

Replication Replicates code within the host


Creates copies of itself
Method file

Consume system resources


Primary Goal Modify, corrupt, or delete data
and slow it down

Network congestion, system


Harm Caused Data loss, system crashes
slowdown

Activation Requires user action (e.g., Automatic upon gaining


Method opening file) network access

Example Macro virus, File infector virus Morris worm, Code Red worm

You might also like