Documentation Index
Fetch the complete documentation index at: https://roadtocybersec.com/llms.txt
Use this file to discover all available pages before exploring further.
Web Vulnerabilities
Modern web applications are complex systems built on layers of frameworks, libraries, APIs, databases, and third-party services. Each layer introduces potential vulnerabilities that attackers actively hunt for. The OWASP (Open Worldwide Application Security Project) maintains the industry-standard list of the most critical web application security risks. Understanding these vulnerabilities is essential for both developers building applications and security professionals testing them.A01: Broken Access Control
The #1 risk on the OWASP Top 10 (2021). Broken access control occurs when users can act outside their intended permissions.Common Flaws
- Insecure Direct Object Reference (IDOR): Changing a parameter in the URL to access another user’s data.
- Privilege escalation: A regular user accessing admin functionality by navigating directly to
/admin/dashboardor modifying a role field in the request. - Missing function-level access control: The UI hides the “Delete User” button for non-admins, but the API endpoint
DELETE /api/users/123has no server-side authorization check.
Defense
- Implement role-based access control (RBAC) or attribute-based access control (ABAC) on the server.
- Deny by default: require explicit authorization for every endpoint.
- Log and alert on access control failures.
A02: Cryptographic Failures
Previously called “Sensitive Data Exposure.” This covers failures in protecting data in transit and at rest.Common Flaws
- Transmitting sensitive data over HTTP instead of HTTPS
- Using deprecated algorithms (MD5, SHA-1, DES, RC4)
- Storing passwords in plaintext or with unsalted hashes
- Hardcoding encryption keys in source code
- Using weak or default TLS configurations
A03: Injection
Injection flaws occur when untrusted data is sent to an interpreter as part of a command or query.SQL Injection (SQLi)
The most well-known injection attack. An attacker manipulates a SQL query by injecting code through user input. Vulnerable code:-- comments out the password check, granting access to the admin account without knowing the password.
Secure code (parameterized query):
Other Injection Types
| Type | Target | Example | |
|---|---|---|---|
| NoSQL Injection | MongoDB, CouchDB | {"username": {"$gt": ""}, "password": {"$gt": ""}} | |
| OS Command Injection | System shell | ; rm -rf / appended to a filename input | |
| LDAP Injection | Directory services | `)(uid=))( | (uid=*` to bypass authentication |
| Template Injection (SSTI) | Server-side templates (Jinja2, Twig) | {{7*7}} renders as 49; confirming code execution |
A04: Insecure Design
This category addresses flaws in the architecture and design of the application, not implementation bugs, but missing security controls that should have been designed in from the start. Examples:- A password recovery flow that allows unlimited attempts with no rate limiting
- A checkout process that trusts client-side price calculations
- An API that returns full user objects (including sensitive fields) when only the username was requested
A05: Security Misconfiguration
The most common vulnerability in real-world deployments. It occurs when security settings are left at insecure defaults or improperly configured.Common Misconfigurations
- Default admin credentials (
admin/admin,root/password) - Unnecessary services, ports, or features enabled
- Verbose error messages exposing stack traces and internal paths
- Directory listing enabled on web servers
- Missing security headers (
Content-Security-Policy,X-Frame-Options,Strict-Transport-Security) - Cloud storage buckets (S3, GCS) left publicly accessible
A07: Cross-Site Scripting (XSS)
XSS occurs when an application includes untrusted data in a web page without proper validation or encoding.Types of XSS
| Type | Mechanism | Persistence |
|---|---|---|
| Stored XSS | Malicious script saved in the database (e.g., in a comment field). Executes when any user views the page. | Persistent |
| Reflected XSS | Malicious script embedded in a URL. Executes when a victim clicks the crafted link. | Non-persistent |
| DOM-based XSS | Client-side JavaScript modifies the DOM using untrusted data (e.g., document.location.hash). | Non-persistent |
Defense
- Output encoding: Encode all user-supplied data before rendering it in HTML, JavaScript, CSS, or URLs. Use context-aware encoding.
- Content Security Policy (CSP): A browser-enforced header that restricts which scripts can execute on your page.
- Framework protections: React, Angular, and Vue automatically encode output by default. Never bypass these protections (e.g.,
dangerouslySetInnerHTMLin React) without sanitization.
A08: Cross-Site Request Forgery (CSRF)
CSRF tricks a victim’s browser into making an unwanted request to a site where they are authenticated. Attack scenario:- Victim is logged into their bank at
bank.com. - Victim visits a malicious page that contains:
<img src="https://bank.com/transfer?to=attacker&amount=10000"> - The browser automatically includes the victim’s session cookie with the request.
- The bank processes the transfer because the request appears legitimate.
Defense
- Anti-CSRF tokens: Include a unique, unpredictable token in every state-changing form. The server validates the token before processing the request.
- SameSite cookies: Set the
SameSiteattribute on session cookies toStrictorLaxto prevent the browser from sending cookies with cross-origin requests. - Require re-authentication: For sensitive actions (password changes, fund transfers), require the user to re-enter their password.
A10: Server-Side Request Forgery (SSRF)
SSRF occurs when an attacker can make the server send HTTP requests to arbitrary destinations, including internal services that are not directly accessible from the internet. Attack scenario:169.254.169.254) is only accessible from within the cloud instance. An SSRF vulnerability allows the attacker to reach it through the server, potentially stealing cloud credentials.
Real-world example: The 2019 Capital One breach (100M+ customer records exposed) was enabled by an SSRF vulnerability that allowed the attacker to access AWS IAM credentials from the EC2 metadata service.
Defense
- Validate and sanitize all user-supplied URLs
- Use allowlists for permitted domains/IP ranges
- Block requests to internal IP ranges (
10.x.x.x,172.16.x.x,192.168.x.x,169.254.x.x) - Use the IMDSv2 (Instance Metadata Service v2) on AWS, which requires a session token
Key Takeaways
- Never trust user input: Validate, sanitize, and encode everything.
- Authorize on the server: Client-side controls are cosmetic, not security.
- Use parameterized queries: The only reliable defense against SQL injection.
- Implement CSP headers: Defense in depth against XSS.
- Protect against CSRF: Use anti-CSRF tokens and SameSite cookies.
- Block SSRF: Validate URLs, block internal IPs, use cloud metadata service v2.
- Audit configurations: Default settings are almost never secure.