By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Web application attacks exploit vulnerabilities in web-based software (e.g., e-commerce sites, banking portals, SaaS platforms) to steal data, hijack sessions, or execute malicious code. These attacks are among the most common and damaging in cybersecurity, often leading to data breaches, financial fraud, or full system compromise. For example: - SQL Injection (SQLi): In 2017, Equifax suffered a breach exposing 147 million records due to an unpatched Apache Struts vulnerability, which allowed SQLi attacks to extract sensitive data (SSNs, credit card numbers). - Cross-Site Scripting (XSS): In 2018, British Airways was hacked via an XSS attack, leading to the theft of 500,000 customers’ payment details and a £20M GDPR fine. - Cross-Site Request Forgery (CSRF): In 2016, uTorrent had a CSRF flaw that allowed attackers to execute arbitrary code on users’ machines by tricking them into clicking a malicious link.
Mastering these attacks is critical for certifications (CISSP, Security+, CEH) and real-world roles (penetration testing, secure coding, incident response).
OWASP (Open Web Application Security Project): A nonprofit foundation that publishes the OWASP Top 10, a ranked list of the most critical web application security risks. Used as a baseline for secure coding (NIST SP 800-53, ISO 27001).
SQL Injection (SQLi): An attack where malicious SQL queries are injected into input fields (e.g., login forms, search boxes) to bypass authentication, dump databases, or execute OS commands. Example: ' OR '1'='1 in a login form.
' OR '1'='1
sqlmap
Standards: OWASP A1 (2021), MITRE ATT&CK T1190.
Cross-Site Scripting (XSS): A client-side attack where malicious JavaScript is injected into a web app and executed in a victim’s browser. Types:
<script>alert('Hacked!')</script>
Standards: OWASP A3 (2021), MITRE ATT&CK T1189.
Cross-Site Request Forgery (CSRF): An attack that tricks a logged-in user into submitting a malicious request (e.g., changing their password, transferring funds) without their knowledge. Relies on session cookies being automatically sent by the browser.
https://bank.com/transfer?to=attacker&amount=1000
Standards: OWASP A8 (2021), MITRE ATT&CK T1204.
Input Validation: The process of sanitizing and validating user input to prevent injection attacks. Techniques:
Output Encoding (for XSS).
Same-Origin Policy (SOP): A browser security mechanism that restricts scripts from one origin (domain, protocol, port) from interacting with resources from another origin. CSRF and XSS bypass SOP.
Content Security Policy (CSP): An HTTP header (Content-Security-Policy) that restricts sources of executable scripts, mitigating XSS. Example: Content-Security-Policy: script-src 'self' https://trusted.cdn.com
Content-Security-Policy
Content-Security-Policy: script-src 'self' https://trusted.cdn.com
HTTPOnly & Secure Flags:
Secure: Ensures cookies are only sent over HTTPS (prevents MITM attacks).
Session Hijacking: Stealing or predicting a session token (e.g., via XSS or sniffing unencrypted traffic) to impersonate a user. Defenses:
Regenerating session IDs after login.
OWASP Top 10 (2021): The latest ranking of web app risks (A1-A10). SQLi, XSS, and CSRF are historically top 3.
A7: Identification and Authentication Failures (e.g., weak passwords).
MITRE ATT&CK Framework: A knowledge base of adversary tactics and techniques. Web app attacks fall under:
Execution (T1203 – Exploitation for Client Execution).
Burp Suite / OWASP ZAP: Interception proxies used for manual and automated web app testing (e.g., fuzzing, scanning for SQLi/XSS).
' OR 1=1 --
<script>alert(1)</script>
eval()
innerHTML
bash sqlmap -u "https://example.com/login?user=1&pass=1" --dbs
sql ' UNION SELECT username, password FROM users --
https://example.com/#<script>alert(1)</script>
html <form action="https://bank.com/transfer" method="POST"> <input type="hidden" name="to" value="attacker"> <input type="hidden" name="amount" value="1000"> </form> <script>document.forms[0].submit();</script>
DROP TABLE
Strict
Lax
SELECT * FROM users WHERE username = 'admin' --
UNION
DROP
EXEC
<script>
onerror=
javascript:
' OR 1=1
#<script>alert(1)</script>
UN//ION
<img src=x onerror=alert(1)>
A) Cross-Site Scripting (XSS) B) Cross-Site Request Forgery (CSRF) C) SQL Injection (SQLi) D) Directory Traversal
Correct Answer: C) SQL Injection (SQLi) Explanation: The payload ' OR '1'='1 is a classic SQLi technique to bypass login forms by making the SQL query always true.
document.getElementById("comment").innerHTML = userInput;
Which vulnerability is present, and what is the BEST mitigation? A) SQL Injection – Use parameterized queries B) XSS – Encode output and implement CSP C) CSRF – Add CSRF tokens D) Insecure Direct Object Reference (IDOR) – Implement access controls
Correct Answer: B) XSS – Encode output and implement CSP Explanation: The code directly inserts user input into the DOM without encoding, making it vulnerable to XSS. Mitigations include output encoding and Content Security Policy (CSP).
bank.com
A) XSS – Use HTTPOnly cookies B) CSRF – Implement CSRF tokens C) SQL Injection – Use prepared statements D) Session Hijacking – Regenerate session IDs
Correct Answer: B) CSRF – Implement CSRF tokens Explanation: The attack tricks the victim into submitting a malicious request while authenticated, which is CSRF. The best defense is CSRF tokens (unique per session).
Content-Security-Policy: script-src 'self'
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.