EXPERIMENT
EXPERIMENT
SQL injection is a type of security vulnerability that occurs when an attacker can manipulate
an SQL query by injecting arbitrary SQL code into a query that is executed by a database.
This can happen when an application fails to properly sanitize user input before including it
in SQL statements. SQL injection can allow attackers to access or manipulate the database in
unauthorized ways, potentially leading to data breaches, data corruption, or even full system
compromise.
SQL injection is called "injection" because the attacker "injects" malicious SQL code into a
query. This injected code alters the intended execution of the SQL query in ways that
compromise the security of the application.
SQL commands are used to perform various operations on the data stored in databases.
These commands can be categorized into several types based on their functionality
1. SQLMap
Key Features:
o Reflected XSS: Injected script reflects off a web application to the user.
o Stored XSS: Injected script is permanently stored on the target server.
o DOM-based XSS: Client-side JavaScript modifies the DOM environment.
Reflective XSS occurs when an attacker injects a script that is reflected off the web
server, typically in response to a user's request. This script is then executed by the
user's browser.
Persistent XSS (Stored XSS) involves injecting a malicious script that is permanently
stored on the target server, such as in a database. It's called "Stored" because the
injected script persists and can affect multiple users who access the affected web
page.
5. Are all web applications vulnerable to XSS attacks? Why or why not?
Not all web applications are vulnerable to XSS attacks. Vulnerability depends on
how the application handles and sanitizes user input. Proper input validation, output
encoding, and security practices can mitigate XSS vulnerabilities.
6. Is it possible to prevent XSS in most cases without any user interaction?
Yes, XSS prevention is possible through various security measures such as input
validation, output encoding, and using Content Security Policy (CSP). These
measures can be implemented without requiring specific user actions.
EXPERIMENT 3
1) What is CSRF?
CSRF Tokens: Include a unique token in each form submission or request that
validates the origin and intent of the request.
SameSite Cookies: Set cookies to SameSite=Strict or SameSite=Lax to prevent
cross-origin requests.
Verify Origin: Check the Origin or Referer header in requests to verify the request's
origin.
Double-Submit Cookie: Use a separate cookie value sent as both a cookie and a
request parameter to validate the request.
Custom Headers: Use custom headers or authentication mechanisms that cannot be
automatically included in a cross-site request.
5) Mention some examples of how a CSRF attack might occur?
Unauthorized Transactions: An attacker tricks a user into clicking a link that makes
a transaction (e.g., funds transfer) using the user's session in a banking application.
Changing Account Settings: An attacker forces a user to change their password or
email address on a web service without their knowledge.
Social Media Post: An attacker posts a message or shares content on a social media
platform using the victim's authenticated session.
Data Manipulation: An attacker modifies data, such as deleting records or updating
settings, by exploiting the victim's active session in a vulnerable application.
EXPERIMENT 4
Local File Inclusion (LFI): Exploits the ability to include files that are
already present on the server.
Remote File Inclusion (RFI): Exploits the ability to include files from a
remote server.
Data Exposure: Attackers can read sensitive files such as configuration files,
user credentials, or system files.
Code Execution: Inclusion of malicious files can lead to remote code
execution, allowing attackers to take control of the server.
Server Compromise: Attackers can use file inclusion to install backdoors,
malware, or perform further attacks on the server or other systems.
Data Manipulation: Files can be modified or deleted, leading to data loss or
corruption.
EXPERIMENT 5
Techniques: