SQLi
SQL injection (SQLi)
Section titled “SQL injection (SQLi)”Metes SQL donde la app esperaba un valor. Solo en labs / bug bounty con scope.
SELECT * FROM users WHERE user = '$input' AND pass = '...'Si $input es ' OR '1'='1, la condición se vuelve siempre verdadera (según query).
Dónde suele salir
Section titled “Dónde suele salir”- Login, búsqueda, filtros,
id=en URL - A veces headers / cookies
Prueba mínima (lab)
Section titled “Prueba mínima (lab)”- Encuentra un param que hable con DB.
- Prueba comilla:
'→ ¿error SQL / 500? - Lógica:
' OR '1'='1/" OR "1"="1 - Comenta resto:
' OR 1=1--(sintaxis según motor)
GET /item?id=1' HTTP/1.1Si hay error de MySQL/Postgres/MSSQL, hay pista del motor.
Tipos (mapa)
Section titled “Tipos (mapa)”| Tipo | Idea |
|---|---|
| In-band | Resultado en la misma respuesta (UNION, error) |
| Blind | Sí/no por tiempo o contenido |
| Out-of-band | Canal aparte (DNS/HTTP) — menos frecuente en CTF |
Defensa (para reportes)
Section titled “Defensa (para reportes)”Prepared statements / queries parametrizadas. Escapar a mano suele fallar.
Herramienta: Burp. Ref: PortSwigger SQLi.