Cyber-Security_Viva
Cyber-Security_Viva
1. Confidentiality:
Ensuring that information is accessible only to authorized individuals or
systems.
Protecting sensitive data from unauthorized disclosure, whether through
physical or digital means.
Example: Implementing access controls to prevent unauthorized users from
viewing sensitive documents or accessing restricted applications.
2. Integrity:
Guaranteeing that information is accurate, complete, and consistent.
Protecting data from unauthorized modification, corruption, or destruction.
Example: Using checksums or hash functions to verify the integrity of files or
data during transmission or storage.
3. Availability:
Ensuring that authorized users have timely and reliable access to information
and resources.
Protecting against disruptions or outages that could prevent users from
accessing necessary data or services.
Example: Implementing backup systems, redundancy, and disaster recovery
plans to ensure data and system availability during outages.
and attacks
In cryptography, confusion and diffusion are key principles for building secure
ciphers. Confusion makes the relationship between the encryption key and the
ciphertext complex, while diffusion spreads the statistical structure of the plaintext
across the ciphertext. Substitution and permutation are the primary techniques used to
achieve these properties.
Confusion:
• Objective:
To obscure the relationship between the key and the ciphertext, making it difficult to
determine the key from the ciphertext alone.
• Technique:
• Effect:
A change in a single key bit should affect multiple ciphertext bits, making it harder to
deduce the key.
• Analogy:
Imagine a complex puzzle where each piece is replaced by a new one based on a secret
code. This makes it difficult to reconstruct the puzzle from just the replaced pieces.
Diffusion:
• Objective:
To dissipate the redundancy and patterns in the plaintext across the ciphertext, making
it hard to analyze the ciphertext for statistical clues about the plaintext.
• Technique:
• Effect:
A change in a single plaintext bit should affect multiple ciphertext bits, spreading the
impact of the change.
• Analogy:
Imagine mixing a deck of cards thoroughly. The original order is lost, and any patterns in
the original arrangement are spread across the deck.
In summary:
Confusion and diffusion are crucial for creating strong ciphers. Confusion makes the
key-ciphertext relationship complex, while diffusion spreads out plaintext
characteristics. Substitution and permutation are the core techniques used to
implement these properties, often combined in substitution-permutation networks.
S-DES is a simple encryption algorithm for learning. It takes a small block of data and a
small key, and goes through a series of steps (permutation, substitution using S-boxes,
and combining with parts of the key) to encrypt it. You need to understand each step in
your code and how the data and key are transformed.
>>From the provided Java code, here's an explanation of the S-DES (Simplified Data
Encryption Standard) algorithm implementation:
Overall Structure:
• Permutation Tables: Predefined integer arrays (tP10, P8, IP, EP, P4, IP_inv)
representing the permutation operations. Note that tP10 seems to be a typo and
should likely be P10.
• Round Keys: Two 8-bit round keys (key1 and key2) generated from the initial key.
• Methods:
1. P10 Permutation: The initial 10-bit key is permuted according to the P10 table
(which is likely tP10 in the code: {3, 5, 2, 7, 4, 10, 1, 9, 8, 6}). This means the bit at
position 3 of the original key moves to position 1 of the new key, the bit at
position 5 moves to position 2, and so on.
2. Left Shifts: The 10-bit permuted key is split into two 5-bit halves (left half Ls and
right half Rs). Both halves are then left-circularly shifted by 1 bit.
3. P8 Permutation (Key 1): The 10-bit result after the first left shift is permuted
according to the P8 table ({6, 3, 7, 4, 8, 5, 10, 9}). This selects 8 bits from the 10
bits to form the first round key key1.
4. Second Left Shifts: The original 5-bit halves (Ls and Rs) are left-circularly shifted
again, this time by 2 bits from their initial permuted state.
5. P8 Permutation (Key 2): The 10-bit result after the second left shift is permuted
according to the P8 table again to produce the second round key key2.
This function takes the right half of the current data block (R) and a subkey (subkey) as
input and produces an output that is XORed with the left half.
2. XOR with Subkey: The 8-bit result from the EP step is XORed with the 8-bit
subkey.
3. S-Box Substitution: The 8-bit result is split into two 4-bit halves.
o The first 4 bits are fed into the S0 S-box. The first and last bits of the 4-bit
input determine the row of the S-box (0-3), and the middle two bits
determine the column (0-3). The 2-bit value at that position in S0 is the
output.
o The second 4 bits are fed into the S1 S-box in the same way to produce
another 2-bit output.
4. Permutation (P4): The resulting 4 bits (2 bits from S0 and 2 bits from S1
concatenated) are permuted according to the P4 table ({2, 4, 3, 1}).
1. Initial Permutation (IP): The 8-bit plaintext is permuted according to the IP table
({2, 6, 3, 1, 4, 8, 5, 7}).
2. Round 1:
o The 8-bit result is split into a 4-bit left half (L0) and a 4-bit right half (R0).
o The output of f_k is XORed with L0 to produce the new right half (R1).
o The original right half R0 becomes the new left half (L1).
3. Round 2:
o The output of f_k is XORed with L1 to produce the new right half (R2).
o The original right half R1 becomes the new left half (L2).
4. Switch: The left half (L2) and right half (R2) are swapped.
5. Inverse Initial Permutation (IP⁻¹): The 8-bit result after the swap is permuted
according to the IP_inv table ({4, 1, 3, 5, 7, 2, 8, 6}) to produce the final ciphertext.
The decryption process is essentially the reverse of encryption. The same steps are
followed, but the round keys are used in reverse order (key2 in the first round and key1 in
the second round) before the swap operation inherent in the Feistel structure.
1. Initial Permutation (IP): The 8-bit ciphertext is permuted using the IP table.
4. Inverse Initial Permutation (IP⁻¹): The 8-bit result (concatenation of L2' and R2')
is permuted using the IP_inv table to get the original plaintext.
main Method:
The main method demonstrates the usage of the implemented S-DES algorithm:
8. Prints the resulting decrypted text, which should be the same as the original
plaintext if the implementation is correct.
7. Different symmetric cryptographic algorithms.
Symmetric means the same key is used for encryption and decryption. Examples
include:
• Security: AES is the clear winner in terms of security and is the current standard.
DES is completely insecure. 3DES offered a temporary fix but is slow. Blowfish
and Twofish are strong alternatives but less widely adopted than AES.
• Key Size: Larger key sizes generally mean stronger security. AES offers the
largest key size options. DES's small key size is its main weakness.
• Speed: AES is generally very fast, while 3DES is slow due to the triple encryption
process.
• Block Size: AES operates on larger blocks of data than DES, which contributes to
its security.
Q.9. S-AES is a simplified version of the Advanced Encryption Standard (AES) designed
for educational purposes to illustrate the core principles of AES in a more manageable
way. It operates on 16-bit blocks of data and uses a 16-bit key (in this implementation).
• Key Expansion: The original key is expanded into a set of round keys.
• Mix Column: Mixes the nibbles in each column (involves Galois Field
multiplication).
1. S-boxes:
8. Encryption (encrypt(ptext)):
9. Decryption (decrypt(ctext)):
Finite fields, also known as Galois fields (GF), are sets with a finite number of
elements that form a field under defined arithmetic operations. Polynomial arithmetic
plays a crucial role in constructing and understanding finite fields, particularly in the
context of GF(p^n) where p is a prime and n is a positive integer.
Finite Fields:
• Definition:
A finite field is a field with a finite number of elements. The number of elements in a
finite field is always a prime power, denoted as p^n, where p is a prime and n is a
positive integer.
• Examples:
• Importance:
Finite fields are fundamental in various areas, including cryptography, coding theory,
and digital communication.
Addition and multiplication of polynomials follow standard rules, but the coefficients
are taken modulo the characteristic of the field (p in GF(p^n)).
• Irreducible Polynomials:
• Efficient Computation:
Polynomial arithmetic in GF(2^n) is particularly efficient due to bitwise XOR and shift
operations. Modulo reduction is achieved using the irreducible polynomial, according to
a SlideShare presentation.
Key Concepts:
• GF(p):
The integers modulo p (where p is prime) form a finite field under addition and
multiplication modulo p.
• GF(p^n):
• Primitive Elements:
In a finite field, the non-zero elements form a cyclic group, and a primitive element
generates all non-zero elements.
• Isomorphism:
All finite fields with the same number of elements are isomorphic.
In summary: Finite fields are finite sets with field properties. Polynomial arithmetic,
particularly modulo irreducible polynomials, provides a powerful and efficient way to
represent and manipulate elements within these fields, making them essential in
various applications.
Symmetric: Encrypting large amounts of data quickly (like files on your computer,
secure communication channels after a key exchange).
Asymmetric: Secure key exchange, digital signatures (proving the sender's identity and
message integrity), encrypting small amounts of data like passwords during login.
• File Encryption: Rapidly encrypting large files, databases, and other storage
devices.
• Public Key Infrastructure (PKI): Used for securing online transactions, digital
certificates, and establishing trust between parties.
• SSL/TLS: Ensuring secure connections between web browsers and servers for
secure browsing.
Goal of Diffie-Hellman:
The primary goal of the Diffie-Hellman key exchange is for two parties (Alice and Bob in
this example) to establish a shared secret key over an insecure communication
channel. This shared secret key can then be used for symmetric encryption 1 to secure
their subsequent communication.
Code Breakdown:
1. import random: This line imports the random module, which is necessary for
generating random numbers, particularly the secret keys and the prime number.
2. is_prime(num) function:
o If the loop completes without finding any divisors, the number is prime,
and the function returns True.
3. generate_prime(bits) function:
o Inside the loop, it generates a random integer num with the given number
of bits using random.getrandbits(bits).
o If is_prime(num) returns True, the function returns the prime number num
and exits the loop.
4. find_primitive_root(p) function:
o To check if g is a primitive root, it verifies that for every prime factor factor
of phi, g^(phi / factor) mod p is not equal to 1. If this condition holds for all
prime factors, then g is a primitive root, and the function returns g.
5. generate_secret_key() function:
o It takes the primitive root g, the secret key secret_key, and the prime
number p as input.
8. main() function:
▪ Alice computes her shared secret s_alice using Bob's public key B,
her own private key a, and the prime p.
▪ Bob computes his shared secret s_bob using Alice's public key A,
his own private key b, and the prime p.
▪ It checks if s_alice and s_bob are equal. If they are, it means the
Diffie-Hellman key exchange was successful, and it prints the
shared secret.
1. Alice and Bob publicly agree on a large prime number (p) and a primitive root (g)
modulo p. These are the public parameters.
2. Alice chooses a secret number (a) and computes her public key A = g^a mod p.
3. Bob chooses a secret number (b) and computes his public key B = g^b mod p.
Since a * b is the same as b * a, both Alice and Bob arrive at the same shared secret key
without ever transmitting their secret keys (a and b) over the insecure channel.
Security of Diffie-Hellman:
Goal of RSA:
RSA is an asymmetric (public-key) cryptographic algorithm used for two main purposes:
1. Encryption: To encrypt a message so that only the holder of the private key can
decrypt it, ensuring confidentiality.
2. Digital Signatures: To create a digital signature that verifies the sender's identity
and ensures the integrity of the message.
Code Breakdown:
1. import random: Imports the random module for generating random numbers,
specifically for choosing the public exponent e.
2. gcd(a, b) function:
o The GCD is the largest positive integer that divides both a and b without
leaving a remainder. This is crucial for selecting the public exponent e.
3. mod_inverse(a, m) function:
4. generate_keypair(p, q) function:
o This is the core function for generating the RSA public and private key
pairs.
o Steps:
▪ Return Key Pairs: Returns the public key as a tuple (e, n) and the
private key as a tuple (d, n).
o Input: The public key pk (a tuple (e, n)) and the plaintext (a string).
o Steps:
▪ Unpacks the public key into key (which is e) and n.
o Input: The private key pk (a tuple (d, n)) and the ciphertext (a list of
encrypted integers).
o Steps:
▪ Returns the joined characters in the plain list to form the original
plaintext string.
o Decrypt Message: Calls the decrypt() function with the private key and
the encrypted_msg to get the decrypted_msg.
1. Key Generation:
3. Decryption: To decrypt the ciphertext c, the receiver uses their private key (d, n)
and computes the original message m = c^d mod n.
Security of RSA:
The security of RSA relies on the mathematical difficulty of factoring the modulus n
back into the original prime numbers p and q, especially when p and q are very large. If
an attacker could factor n, they could easily calculate phi and then d, allowing them to
decrypt messages.
This code provides a basic implementation for understanding the core concepts of RSA.
Real-world implementations use much larger prime numbers (hundreds or thousands
of bits) to ensure sufficient security.
Q.15 Difference between RSA and Diffie Hellman algorithms
RSA: Used for both encryption/decryption and digital signatures. Relies on the difficulty
of factoring large numbers.
Diffie-Hellman: Used only for key exchange. Relies on the difficulty of the discrete
logarithm problem.
Q.16 Different sources of Malware: worms, viruses, trojan etc
• Viruses: Attach to other programs and spread when those programs are run.
• Worms: Can replicate and spread on their own without needing a host program.
• Ransomware: Encrypts your files and demands payment for their release.
Gemini:
Sources of Malware:
• Email:
Phishing emails often contain malicious attachments or links that, when opened, can
install malware.
• Internet:
• Outdated Software:
Software that is not up-to-date may have vulnerabilities that can be exploited by
malware.
• Physical Media:
Connecting to infected devices like USB flash drives can transfer malware to a
computer.
• Social Networks:
Malware can spread through local networks, especially if devices are not properly
secured.
Types of Malware:
• Viruses:
• Worms:
Malware that can self-replicate and spread across networks without needing a host
program.
• Trojans:
Malware disguised as legitimate software that can install other malicious programs.
• Ransomware:
Malware that encrypts a victim's files and demands a ransom for their release.
• Spyware:
Malware that collects and transmits private information without the user's knowledge.
• Adware:
Malware that displays unwanted advertisements and can also install other malicious
programs.
• Rootkits:
Malware that hides other malicious software and gains administrative access to a
system.
• Keyloggers:
Malware that records keystrokes, allowing attackers to steal passwords and other
sensitive information.
• Bots:
Malware that can be used to create botnets, which are networks of infected devices
controlled by attackers.
• Cryptojacking:
Malware that uses a victim's computer resources to mine cryptocurrency without their
knowledge.
Q. 17 Difference between active and passive cyber attacks
Q.18 What is Firewall? How does it work? Types of firewalls.
A firewall is a network security device that acts as a barrier, monitoring and controlling
incoming and outgoing network traffic based on predefined security rules. It protects a
network by allowing authorized traffic while blocking unauthorized or potentially
harmful traffic. Firewalls can be implemented as either hardware or software.
1. Monitoring Traffic:
2. Applying Rules:
They use a set of rules to determine which traffic is allowed and which is blocked. These
rules can be based on various factors like IP addresses, port numbers, protocols, and
even application-level details.
3. Filtering Traffic:
Based on the rules, the firewall filters traffic, allowing legitimate requests to proceed
while dropping or blocking malicious or unauthorized traffic.
4. Protecting Networks:
Types of Firewalls:
These firewalls examine the headers of data packets and make decisions based on
information like IP addresses, port numbers, and protocol types.
• Circuit-Level Gateways:
These firewalls operate at the session layer, establishing and managing connections
between devices.
• Proxy Firewalls:
These firewalls act as intermediaries between the internal network and the external
world, inspecting and filtering traffic on behalf of the internal network.
These firewalls track the state of network connections, providing a more robust level of
protection by examining traffic in the context of ongoing conversations.
• Next-Generation Firewalls (NGFWs):
These firewalls combine packet filtering and stateful inspection with advanced features
like deep packet inspection and intrusion prevention.
• Cloud Firewalls:
These firewalls are deployed in the cloud and offer features like centralized
management and scalability.
These firewalls combine multiple security features into a single device, offering a
comprehensive security solution.
Firewalls act as a first line of defense against unauthorized access attempts, helping to
prevent hackers and malicious actors from accessing a network or system.
They can block traffic linked to known malware, viruses, and other security threats,
helping to prevent infections.
Firewalls can be configured to prevent sensitive data from being accessed or leaked,
enhancing data privacy.
• Access Control:
Firewalls monitor and filter network traffic, allowing administrators to identify and block
suspicious activity.
Firewalls can log all network traffic, providing a record of activities for auditing and
security analysis.
• Compliance:
Limitations of Firewalls:
• False Positives:
Firewalls can sometimes block legitimate traffic or requests if they incorrectly identify
them as malicious.
• Performance Impact:
Firewalls can slow down network speeds, especially when handling large volumes of
traffic.
Traditional firewalls may not be effective against advanced persistent threats (APTs) or
sophisticated attacks that bypass basic filtering rules.
Relying solely on a firewall can create a false sense of security, as it may not protect
against all threats, such as internal threats or social engineering attacks.
• Configuration Errors:
Misconfigured firewalls can create vulnerabilities and make it easier for attackers to
bypass security measures.
Attackers can sometimes use techniques like tunneling to bypass firewalls by hiding
malicious traffic within legitimate communications.
Applications of Firewalls:
Firewalls are used to block unauthorized access from external sources, such as
hackers, malicious websites, or infected devices.
Firewalls can be deployed to protect internal networks from unauthorized access and
data breaches, such as those caused by employees or malicious software.
Firewalls can be used to secure cloud-based applications by filtering network traffic and
controlling access to cloud resources.
• Ensuring Compliance:
Firewalls can help protect user data and privacy by blocking access to malicious
websites or tracking mechanisms.
1. Traffic Filtering:
Packet filtering firewalls examine each packet, checking its header for information like
IP addresses, ports, and protocols. They then compare this information against a set of
rules to determine if the packet should be allowed or blocked.
2. Access Control:
Packet filtering firewalls use rules to control access to the network. They can permit
traffic from specific IP addresses or ranges, block traffic on certain ports, or allow only
particular protocols, according to Palo Alto Networks.
Packet filtering firewalls can help prevent the entry of malicious code by blocking
packets that match signatures of known malware or viruses.
Packet filtering firewalls are a fundamental layer of network security, providing a basic
level of protection by regulating traffic flow.
Limitations:
They don't track the state of connections, which means they may allow a connection to
be established even if it shouldn't have.
• Limited logging:
They often have limited logging capabilities, making it difficult to track suspicious
activities or troubleshoot issues.
• Inflexibility:
They are less flexible than other types of firewalls, making it difficult to adapt to
changing security needs.
Note: Packet filtering firewalls are often used as a first line of defense and can be
combined with other security measures to provide more robust protection.
Q. 21. What is DMZ? Need of DMZ.
DMZ (Demilitarized Zone) is a buffer network between your internal private network and
the untrusted public internet. It hosts publicly accessible services (like web servers,
email servers) so that if they are compromised, the attacker doesn't directly gain access
to your internal network. It adds a layer of security.
• Security:
A DMZ acts as a buffer zone, preventing attackers from directly reaching the internal
network if a DMZ server is compromised.
• Access Control:
It allows controlled access to public-facing services like web servers and email servers
while keeping the rest of the internal network protected.
By isolating public-facing services in the DMZ, organizations can limit the potential
attack surface and make it more difficult for hackers to penetrate the internal network.
DMZs can help prevent IP spoofing attacks, where attackers try to masquerade as a
trusted source to gain access.
• Intrusion Detection:
DMZs allow for better monitoring of network traffic between the external network and
the internal network, aiding in intrusion detection.
• Managing Access:
DMZs provide a dedicated area for managing access to sensitive data and resources,
preventing unauthorized access to critical assets.
Q. 22. Concept of hashing and hashing algorithms (MD5 or SHA)
Hashing is like creating a unique fingerprint of a piece of data. A hashing algorithm takes
any input and produces a fixed-size output (the hash or digest). Good hashing
algorithms are one-way (hard to go from the hash back to the original data) and
collision-resistant (very unlikely that two different inputs will produce the same hash).
MD5 and SHA are examples of hashing algorithms.
Hashing involves converting data of any size into a fixed-size string called a hash value,
or message digest, using a mathematical function. This process, also known as a
hashing algorithm, is one-way and difficult to reverse. Common examples include MD5
(Message Digest 5) and SHA (Secure Hash Algorithm).
Hashing Explained:
• One-way function:
• Fixed-length output:
Regardless of the input data's size, the output hash value will always be the same
length, for instance, MD5 produces a 128-bit hash.
Ideally, different inputs should produce different hash values. While collisions (two
different inputs producing the same hash) are theoretically possible, good hashing
algorithms minimize the chance of this happening.
• Data integrity:
Hashing is used to ensure data integrity by verifying if a file or message has been
altered. If the hash value of the data changes, it indicates that the data has been
modified, according to TechTarget.
• Data security:
Hashing is also used for data security, particularly in password storage, where storing
the hash value instead of the plain text password makes it much harder for attackers to
steal sensitive information.
This is a family of hashing algorithms, including SHA-1, SHA-2, and SHA-3, that are
designed to provide a more robust and secure hashing function. According to Brilliant,
SHA algorithms are used in various applications, including digital signatures and
message authentication.
• SHA-1:
SHA-1 produces a 160-bit hash value and was initially designed for digital
signatures. However, it has also been found to have weaknesses and is no longer
recommended for new applications.
• SHA-2:
This family includes algorithms like SHA-256 and SHA-512, which produce longer hash
values (256-bit and 512-bit, respectively) and are considered more secure than SHA-1.
• SHA-3:
Elaboration:
• Password-based authentication:
This is the most widely used method, relying on users remembering and entering a
secret password.
MFA adds an extra layer of security by requiring users to provide multiple forms of
authentication, such as a password and a code from a mobile device.
• Biometric authentication:
This method uses unique physical or behavioral traits, like fingerprints, facial
recognition, or voice recognition, to verify identity.
• Token-based authentication:
This method uses a token, such as a hardware token or a code sent to a mobile device,
to verify identity.
• Other methods:
The best authentication method for a particular application or situation will depend on
factors such as the security requirements, the user experience, and the cost of
implementation. For example, a high-security application might require MFA, while a
simpler application might be suitable for password-based authentication.
Q.24. What is two factor authentication
Two-factor authentication (2FA) is a security process that requires users to provide two
different authentication factors, rather than just a password, before accessing a system
or application. This extra layer of security adds a significant boost to account security,
making it harder for attackers to gain unauthorized access even if they have obtained a
user's password.
• What it is:
• How it works:
After a user enters their password, they are prompted to provide a second verification
method, like a code from an authenticator app or a verification code sent via SMS.
2FA significantly reduces the risk of unauthorized access to accounts, even if the
password is compromised. It's a valuable tool for protecting sensitive data and
accounts from cyberattacks.
• Examples:
Using two different categories of authentication methods (e.g., password + OTP sent to
your phone) to provide stronger security.
Q.25 TCP handshake process
1. SYN (Synchronize): Client sends a SYN packet to the server, asking to start a
connection.
3. ACK (Acknowledge): Client sends an ACK packet back to the server, confirming
the connection. After this, data transfer can begin.
Q.26 What is SSL? Explain SSL handshake process
SSL (Secure Sockets Layer) and its successor TLS (Transport Layer Security) are
protocols that provide secure communication over a network, often used for HTTPS. The
SSL/TLS handshake is the process of establishing a secure connection:
1. Client Hello: Client sends information like supported protocols and cipher
suites.
2. Server Hello: Server responds with its chosen protocol and cipher suite, and its
digital certificate (to prove its identity).
4. Premaster Secret: Client generates a secret key, encrypts it with the server's
public key from the certificate, and sends it to the server.
5. Key Generation: Both client and server use the premaster secret to generate the
actual session keys for encrypting data.
6. Change Cipher Spec: Both sides signal that they will now use the agreed-upon
encryption.
Authentication: The server (and optionally the client) is authenticated using digital
certificates.
Gemini:
SSL (Secure Sockets Layer) protocol offers several key security features,
including encryption for confidentiality, authentication to verify identities, and data
integrity to ensure data hasn't been tampered with. It encrypts data transmitted
between a server and a client, making it unreadable to unauthorized parties, and uses
digital certificates to verify the identity of both the server and client.
1. Encryption:
• Confidentiality:
SSL encrypts data, scrambling it so that only the intended recipient can decrypt it. This
prevents eavesdropping and ensures that sensitive information, like login credentials or
credit card numbers, remains private during transmission.
• Data Integrity:
SSL uses hashing and other techniques to ensure that data is not modified during
transmission. This prevents malicious actors from tampering with data and ensures that
the client receives the data in its original form.
2. Authentication:
• Server Authentication:
SSL uses digital certificates issued by trusted Certificate Authorities (CAs) to verify the
identity of the server. This prevents "man-in-the-middle" attacks where an attacker
intercepts communication and impersonates the server.
While not always required, SSL can also authenticate the client's identity using similar
mechanisms, offering an additional layer of security.
3. Secure Connection:
• Handshake:
SSL establishes a secure connection through a "handshake" process, which involves
exchanging information and negotiating encryption algorithms to establish a secure
session.
• HTTPS:
SSL is the foundation of HTTPS, which is the secure version of the Hypertext Transfer
Protocol, used for secure web browsing and transactions.
• Digital Signatures:
SSL uses digital signatures to verify the authenticity and integrity of certificates,
ensuring they haven't been tampered with during transmission.
• Forward Secrecy:
Modern TLS protocols, which are built on SSL, often include forward secrecy, which
ensures that if a long-term key is compromised, past sessions remain secure.
SSL can also be used to secure file transfers, making it a crucial protocol for
applications like email and FTP.
A proxy server acts as an intermediary between your computer and the internet. Its
purposes include:
• Security: Can hide your IP address, filter content, and block malicious sites.
Unlike packet filtering firewalls that look at network headers, application layer firewalls
understand the specific protocols of applications (like HTTP, FTP, SMTP). They can filter
traffic based on the content of the application data (e.g., blocking specific commands
in HTTP requests, preventing certain file uploads).
An application layer firewall, also known as an Application Layer Gateway (ALG) or Web
Application Firewall (WAF), operates at the application layer of the OSI model (Layer
7). It analyzes and controls network traffic based on the content of the data packets and
the specific application protocols. This allows for more granular control over network
traffic than traditional firewalls, enabling protection against application-specific threats
like SQL injection and cross-site scripting.
• OSI Model:
The application layer is the highest layer in the OSI model, where applications interact
with the network.
• Data Inspection:
Application firewalls examine the content of data packets, not just the headers, to
identify and filter traffic based on application-specific rules.
• Application-Specific Control:
They allow for fine-grained control over which applications can access the network and
what types of data are allowed through them.
2. Key Functionality:
• Traffic Filtering:
• Threat Protection:
• Content Inspection:
They can inspect the content of data packets, including headers, body, and even file
content, to identify malicious traffic and enforce security policies.
3. Benefits:
• Enhanced Security:
They offer more granular control over network traffic, allowing for specific rules to be
applied to different applications and users.
4. Examples:
These are a common type of application firewall that protects web applications from
various attacks, such as SQL injection, XSS, and more.
• Email Firewalls:
These firewalls can filter email traffic, blocking spam, phishing attacks, and other
malicious emails.
• Proxy Servers:
Some proxy servers can act as application firewalls, inspecting and filtering traffic
based on application-specific rules.
A Certificate Authority (CA) is a trusted entity that verifies the identity of websites,
organizations, or individuals and issues digital certificates to bind them to cryptographic
keys. These certificates establish trust by verifying domain ownership, confirming
legitimacy, and enabling secure online communication. CAs are fundamental to the
Public Key Infrastructure (PKI), which underpins secure internet transactions.
CAs issue digital certificates that act as digital IDs, binding a public key to an entity's
identity.
• Why they're important:
CAs ensure that websites and other online entities are who they claim to be, protecting
users from malicious actors who might try to impersonate legitimate websites.
When you visit a secure website (HTTPS), your browser verifies the website's certificate
against the CAs it trusts.
• Trust hierarchy:
CAs operate within a hierarchy, with root CAs being trusted by browsers and operating
systems. Intermediate CAs are issued by root CAs and can issue further certificates.
• Benefits:
CAs enable secure online communication, protecting sensitive data like passwords,
credit card details, and personal information.
• Examples:
Hashing and encryption are both used in cybersecurity to protect data, but they work
differently and serve distinct purposes. Hashing is a one-way process that creates a
unique, fixed-size "fingerprint" of data, primarily used for verifying data integrity and
securely storing passwords. Encryption, on the other hand, is a reversible process that
transforms data into an unreadable format (ciphertext) that can only be decrypted with
a key, protecting data's confidentiality and ensuring only authorized individuals can
access it.
Q.32 How do you set up a firewall?
1. Open Control Panel: You can search for "Control Panel" in the Windows search
bar and open it.
2. Navigate to System and Security: In the Control Panel, click on "System and
Security".
The "Windows Defender Firewall with Advanced Security" console is where you create
rules to filter network traffic. You'll see two main sections in the left pane:
• Outbound Rules: These control outgoing network traffic from your computer.
1. Select Rule Type: In the left pane, click on either "Inbound Rules" or "Outbound
Rules" depending on the type of traffic you want to control.
2. Open New Rule Wizard: In the right-hand pane (under "Actions"), click on "New
Rule...". This will open the "New Inbound Rule Wizard" or "New Outbound Rule
Wizard".
3. Choose Rule Type: The wizard will ask you what type of rule you want to create
(e.g., Program, Port, Predefined, Custom). Choose the option that best suits your
needs.
5. Port: To control connections based on TCP or UDP port numbers. You would
specify the port(s) and protocol.
7. Custom: Allows you to define more specific rules based on various criteria.
8. Specify Scope (if applicable): Depending on the rule type, you might be asked
to specify the IP addresses or network ranges that the rule applies to (e.g., "Any
IP address" or specific remote IP addresses).
9. Choose Action: You will need to specify what happens when traffic matches
your rule:
11. Name and Description: Give your rule a descriptive name and optionally add a
description to help you remember its purpose.
Enabling/Disabling Rules:
1. In the "Windows Defender Firewall with Advanced Security" console, select the
rule you want to modify.
2. In the right-hand pane (under "Actions"), you will see options like "Enable Rule"
or "Disable Rule". Click the desired action.
By creating appropriate inbound and outbound rules with the "Block the connection"
action, you can filter network traffic and prevent unauthorized connections to and from
your computer. You need to define specific rules based on the applications, ports, and
protocols you want to allow or block
Q. 33 What is VLAN? What is the difference between VLAN and VPN?
VLAN (Virtual Local Area Network): A logical grouping of network devices that appear
to be on the same local network, regardless of their physical location. It allows you to
segment your network for better organization and security.
VPN (Virtual Private Network): Creates a secure, encrypted connection over a public
network (like the internet) to a private network. It provides privacy and security for
remote access.
Difference: VLAN is for local network segmentation, while VPN is for secure remote
access over a wider network.
Phishing is a type of social engineering attack where criminals try to trick you into
revealing sensitive information (like passwords, credit card details) by disguising
themselves as trustworthy entities (e.g., through fake emails or websites). Prevention
includes:
SQL injection is a web security vulnerability that allows attackers to interfere with the
queries that an application makes to its database. By injecting malicious SQL code into
input fields, attackers can bypass security measures, view sensitive data, modify the
database, or even execute arbitrary commands. Prevention includes:
• Input Validation: Carefully checking and sanitizing user input before using it in
SQL queries.
1. What is SQL?
2. What is a database?
o Explain how it gets the category from the URL, constructs a SQL query,
executes it, and returns the results.
20. Can you show me the exact URL you used to perform the attack?
o Other examples:
▪ ' UNION SELECT * FROM products WHERE '1'='1 (If the database
supports UNION)
o All the data stored in the products table (product names, descriptions,
prices, etc.).
o A technique where the SQL query structure is defined separately from the
user-provided data. Placeholders (?) are used for the data, and the
database library handles the safe insertion of the data, preventing it from
being interpreted as SQL code.
o They force the database to treat the input as data, not as executable
code, regardless of what the input contains.
29. What is the difference between execute() and execute many() in a database
cursor?
30. What is an ORM (Object-Relational Mapper)? How does it help prevent SQL
injection?
o An ORM maps database tables to objects in the programming language,
often providing built-in protection against SQL injection by using
parameterized queries.
31. What are web application firewalls (WAFs)? How can they help?
o WAFs are security devices that monitor HTTP traffic and can filter out
malicious requests, including those containing SQL injection attempts.
• Be prepared to explain your code in detail. Walk the examiners through the
vulnerable and secure versions.
• Show that you understand the security implications. Emphasize the potential
damage that SQL injection can cause.