Case: the web shop SQL injection
15 min · 2 ejercicio(s)
Friday evening. The shop developers see many HTTP 500 errors on /products. Errors on a parameterised URL are a strong hint for SQL injection attempts (MITRE ATT&CK T1190, Exploit Public-Facing Application).
Useful filters for web logs:
| Question | KQL |
|---|---|
| Server errors | http.response.status_code >= 500 |
| Requests with parameters | url.query: * |
| Known attack tools | user_agent.original: (sqlmap* or *Nikto* or *nuclei*) |
| SQL keywords | url.query: (*UNION* or *SELECT* or *SLEEP*) |
Once you know the attacker IP, always check everything that IP did, not only the obvious attack. Attackers switch tools (and user agents) after a successful injection.
🔎 Profundiza: funciones, errores habituales y práctica
Reading web logs
| ECS field | Use |
|---|---|
url.original |
the complete request incl. query string, evidence for payloads |
url.path / url.query |
split parts, better for grouping and exact filters |
http.response.status_code |
5xx = server error, often triggered by broken SQL |
http.response.body.bytes |
unusually large responses = data leaving |
user_agent.original |
tool fingerprints (sqlmap, Nikto, nuclei, curl, python-requests) |
Indicators of SQL injection in URLs
', --, UNION SELECT, ORDER BY 10, SLEEP(, OR '1'='1', information_schema, often URL-encoded (%27, %20UNION%20). Normalised URLs (url.original after decoding) make hunting much easier. Make sure your ingest pipeline decodes them.
Don't stop at the user agent
User agents are trivial to fake. In the lab the attacker switches from sqlmap to a normal browser user agent for the admin login. Always pivot on the source IP and the time window as well.
Response size as an exfiltration signal
http.response.body.bytes > 1000000 on an admin export endpoint is a strong signal. In production, compare against the normal size of that endpoint, e.g. with ES|QL STATS AVG(http.response.body.bytes) BY url.path.