#WEB ATTACKS
Web attacks are various forms of cyberattacks targeting websites and web applications. They exploit vulnerabilities in the web-based systems to gain unauthorized access, steal data, disrupt services, or manipulate information. Here are some common types of web attacks:
1. SQL Injection (SQLi)
SQL Injection involves inserting malicious SQL queries into input fields, such as search boxes or login forms, to manipulate or access the database. Attackers can retrieve, modify, or delete database records, and in some cases, execute administrative operations on the database.
Example : SELECT * FROM users WHERE username = ‘admin’ — ‘ AND password = ‘password’;
The -- comment sequence causes the rest of the query to be ignored, bypassing the password check.
2. Cross-Site Scripting (XSS)
XSS attacks involve injecting malicious scripts into web pages viewed by other users. There are three main types: Stored XSS, Reflected XSS, and DOM-based XSS.
- Stored XSS: The malicious script is permanently stored on the target server, such as in a database or message forum.
- Reflected XSS: The script is reflected off a web server, such as in an error message or search result.
- DOM-based XSS: The attack occurs within the client’s browser, where the malicious script modifies the DOM environment.
Example : <script>alert(‘XSS’);</script>
3. Cross-Site Request Forgery (CSRF)
CSRF attacks trick users into performing actions on a web application where they are authenticated, without their knowledge. This can be used to change user settings, initiate transactions, or perform other actions on behalf of the victim.
Example : <img src=”http://example.com/change-email?email=attacker@example.com" />
When the authenticated user views the image, the request changes their email address.
4. Remote Code Execution (RCE)
RCE attacks allow attackers to execute arbitrary code on a server by exploiting vulnerabilities. This can lead to full system compromise, data theft, and service disruption.
Example: <?php $command = $_GET[‘cmd’]; eval($command); ?>
An attacker could pass a malicious command through the URL to execute it on the server.
5. File Inclusion Attacks
File inclusion attacks, such as Local File Inclusion (LFI) and Remote File Inclusion (RFI), involve including files without proper validation. Attackers can include local files (LFI) or remote files (RFI) to execute malicious code or disclose sensitive information.
Example: <?php include($_GET[‘page’]); ?>
Get Neeli_Sashank’s stories in your inbox
Join Medium for free to get updates from this writer.
An attacker could manipulate the page parameter to include arbitrary files.
6. Directory Traversal
Directory traversal attacks (also known as Path Traversal) involve manipulating file paths to access directories and files outside the web root folder. This can disclose sensitive information such as configuration files, passwords, and database contents.
Example: GET /index.php?page=../../../../etc/passwd HTTP/1.1
he above request attempts to access the /etc/passwd file on a Unix-based system.
7. Denial of Service (DoS) and Distributed Denial of Service (DDoS)
DoS and DDoS attacks aim to make a web service unavailable by overwhelming it with traffic. A DoS attack is initiated by a single source, while a DDoS attack involves multiple compromised systems (a botnet) to flood the target.
Example: Sending a large number of requests to the server:
while true; do curl http://example.com; done
8. Man-in-the-Middle (MitM)
MitM attacks involve intercepting and altering communication between two parties without their knowledge. This can lead to data theft, session hijacking, and unauthorized access.
Example: An attacker intercepts HTTP traffic and captures login credentials.
9. Clickjacking
Clickjacking tricks users into clicking on something different from what they perceive, by overlaying a transparent layer over a legitimate web page. This can result in unintended actions, such as changing settings or initiating transactions.
Example: A hidden button placed over a legitimate “Play” button on a video.
10. Brute Force and Credential Stuffing
Brute force attacks involve systematically guessing passwords or encryption keys until the correct one is found. Credential stuffing uses a list of known username-password pairs to gain unauthorized access.
Example: hydra -l admin -P passwords.txt http://example.com/login
11. Session Hijacking
Session hijacking exploits the web session control mechanism to steal and use another user’s session ID. This allows attackers to impersonate the victim and perform actions on their behalf.
Example: Stealing a session cookie using XSS and using it to authenticate as the victim.
12. XML External Entity (XXE) Injection
XXE attacks occur when XML input containing a reference to an external entity is processed by an XML parser. This can lead to disclosure of confidential data, server-side request forgery (SSRF), and other impacts.






