CSS6 Sem
CSS6 Sem
CSS6 Sem
1. Buffer Allocation:
2. Data Overflow:
• If an attacker can input more data into a buffer than it can hold, the extra data will
overflow into adjacent memory locations.
3. Control Hijacking:
• By carefully crafting the overflow data, an attacker can overwrite critical data
structures, such as return addresses, function pointers, or other control data.
4. Exploitation:
• By overwriting control data, attackers can redirect the execution flow of the
program to execute malicious code.
• Arbitrary Code Execution: Attackers can execute arbitrary code on the victim's system.
• Privilege Escalation: Attackers can gain elevated privileges by executing code with the
permissions of the vulnerable process.
• Denial of Service: Buffer overflows can crash applications, leading to denial of service.
Mitigation Techniques:
• Input Validation: Always validate input to ensure it does not exceed the buffer size.
• Bounds Checking: Use programming languages or libraries that perform bounds checking
automatically.
• Stack Canaries: Use stack canaries to detect buffer overflows by placing a random value
before the return address on the stack.
3. SQL injection
SQL injection is a type of security vulnerability that occurs when an attacker is
able to insert malicious SQL code into a query, thereby manipulating the
database and potentially gaining unauthorized access to data or even taking
control of the database server. Here's a detailed explanation of SQL injection:
How SQL Injection Works:
1. Injection Point Identification:
• Attackers identify input fields in web applications where user-
supplied data is directly included in SQL queries without proper
validation or sanitization.
2. Malicious Input Crafting:
• Attackers craft malicious input data, usually in the form of SQL
code, designed to alter the logic of the original SQL query.
3. SQL Query Manipulation:
• Attackers inject SQL code into the input fields to manipulate the
original SQL query.
4. Query Execution:
• The manipulated SQL query is executed by the application's
database server.
5. Database Manipulation:
• If successful, the malicious SQL code allows attackers to perform
various actions, such as extracting, modifying, or deleting data
from the database.
Types of SQL Injection:
1. Classic SQL Injection:
• Occurs when attackers are able to insert malicious SQL code into
input fields directly used in SQL queries.
• Example:
SELECT * FROM users WHERE username = 'admin' AND password = 'password'
Malicious input:
' OR '1'='1'--
Manipulated query:
SELECT * FROM users WHERE username = 'admin' AND password = '' OR '1'='1'-
-
2. Blind SQL Injection:
• Occurs when attackers cannot see the result of their attack
directly, but can infer it based on the application's behavior.
• Example:
SELECT * FROM users WHERE username = 'admin' AND password = 'password'
Malicious input:
' OR SLEEP(10)--
Application delays response if successful.
3. Union Based SQL Injection:
• Occurs when attackers exploit the UNION SQL operator to
combine the result sets of two or more SELECT statements.
• Example:
SELECT * FROM users WHERE username = 'admin' UNION SELECT 1,2,3--
Impact of SQL Injection:
• Data Leakage: Attackers can extract sensitive data such as usernames,
passwords, and credit card numbers from the database.
• Data Manipulation: Attackers can modify or delete data stored in the
database.
• Unauthorized Access: Attackers can bypass authentication mechanisms
and gain unauthorized access to restricted areas of the application.
Mitigation Techniques:
1. Input Validation and Sanitization:
• Implement proper input validation to ensure that user-supplied
data is free from malicious characters.
2. Prepared Statements (Parameterized Queries):
• Use prepared statements with parameterized queries to separate
SQL code from data.
3. Least Privilege Principle:
• Restrict database user permissions to minimize the impact of
successful SQL injection attacks.
4. Web Application Firewall (WAF):
• Implement a WAF to monitor and filter HTTP traffic to and from a
web application.
By understanding SQL injection and implementing appropriate mitigation
techniques, developers and system administrators can effectively protect their
applications and databases from this common and potentially devastating
security vulnerability.
The SSL handshake protocol is the initial step in establishing a secure SSL/TLS
connection between a client and a server. It involves the following steps:
1. Client Hello:
• The client sends a ClientHello message to the server, indicating
the highest SSL/TLS protocol version it supports, a random
number (ClientHello.random), and a list of supported cipher
suites.
2. Server Hello:
• Upon receiving the ClientHello message, the server selects the
highest SSL/TLS protocol version and cipher suite supported by
both the client and the server.
• The server responds with a ServerHello message containing its
selected SSL/TLS protocol version, a random number
(ServerHello.random), and the selected cipher suite.
3. Server Certificate:
• The server sends its digital certificate to the client for
authentication.
• The digital certificate includes the server's public key, its identity
(domain name), and the digital signature of the certificate
authority (CA).
4. Key Exchange:
• The client verifies the server's digital certificate.
• If the certificate is valid and trusted, the client generates a
premaster secret, encrypts it with the server's public key, and
sends it to the server.
• Both the client and the server independently derive the master
secret from the premaster secret and the random numbers
exchanged during the handshake.
5. Finished:
• The client sends a Finished message, which is a hash of all the
exchanged handshake messages so far, encrypted with the
derived master secret.
• The server also sends a Finished message, which is a hash of all
the exchanged handshake messages so far, encrypted with the
derived master secret.
6. Secure Data Transfer:
• If both Finished messages match, the SSL/TLS connection is
considered established, and secure data transfer can begin.
The X.509 standard defines the format for public key certificates. An X.509
certificate typically contains the following information:
1. Version:
• Indicates the version of the X.509 standard used.
2. Serial Number:
• A unique identifier assigned by the CA to the certificate.
3. Signature Algorithm Identifier:
• Identifies the algorithm used by the CA to sign the certificate.
4. Issuer Name:
• The distinguished name (DN) of the CA that issued the certificate.
5. Validity Period:
• The period during which the certificate is considered valid (start
and end dates).
6. Subject Name:
• The DN of the certificate holder (user or entity).
7. Subject Public Key Info:
• Contains the public key of the certificate holder and the algorithm
used.
8. Certificate Extensions:
• Additional information such as key usage, subject alternative
names, and certificate policies.
9. Signature Value:
• The digital signature created by the CA using its private key to sign
the certificate data.
14.Why are digital certificates and signatures required? What is thew role
of digital signature in digital certificates? Explain any one digital
signature algorithm
Why Digital Certificates and Signatures are Required:
1. Authentication:
• Digital certificates verify the identity of the sender or signer.
• Users can trust that the information they receive is from a
legitimate source.
2. Data Integrity:
• Digital signatures ensure that the information has not been
tampered with during transmission.
• Recipients can verify the integrity of the document or message.
3. Non-repudiation:
• Digital signatures prevent the signer from denying their actions.
• The signature provides proof of the signer's identity and actions.
Role of Digital Signature in Digital Certificates:
A digital signature is a cryptographic technique used to verify the authenticity
and integrity of a digital message, document, or software. In the context of
digital certificates, the digital signature plays a crucial role in ensuring the
validity and trustworthiness of the certificate.
1. Authentication:
• The digital signature on the certificate verifies the authenticity of
the certificate data.
• Recipients can trust that the information in the certificate has not
been altered or tampered with.
2. Integrity:
• The digital signature ensures the integrity of the certificate data.
• Any modification to the certificate would invalidate the digital
signature.
3. Non-repudiation:
• The digital signature provides proof that the certificate was issued
by a trusted Certificate Authority (CA).
• The CA cannot deny issuing the certificate, as its digital signature
is securely bound to the certificate.
Digital Signature Algorithm: RSA (Rivest-Shamir-Adleman)
RSA is one of the most widely used digital signature algorithms. It is based on
the mathematical problem of factoring large integers. Here's how the RSA
digital signature algorithm works:
1. Key Generation:
• Choose two large prime numbers, p and q.
• Compute n = p * q.
• Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1,
where φ(n) = (p-1) * (q-1).
• Compute d as the modular multiplicative inverse of e modulo
φ(n), i.e., d ≡ e^(-1) (mod φ(n)).
• Public key: (n, e)
• Private key: (n, d)
2. Signing:
• To sign a message M, the sender calculates the hash value of the
message, h = Hash(M).
• The sender then calculates the signature s as s ≡ h^d (mod n).
3. Verification:
• To verify the signature, the recipient calculates the hash value of
the received message, h' = Hash(M').
• The recipient then calculates the original hash value, h = s^e (mod
n).
• If h equals h', the signature is valid.