S
Situation
An organisation's database held login attempts and employee records. There had been a possible incident after business hours, and several departments needed security updates on their machines.
T
Task
Write SQL queries that pull exactly the records each investigation or update needs, from tables too large to review by hand.
A
Action
- Found failed login attempts after 18:00 by combining conditions with AND.
- Pulled login attempts on the day of a suspicious event and the day before, using OR.
- Excluded an expected country stored in two formats (MEX and MEXICO) using NOT and LIKE 'MEX%'.
- Listed machines for targeted patching by department and building, using LIKE 'East%'.
R
Result
- Turned large tables into the precise lists the security team needed, in seconds.
- Later reused these skills in the SOC Analyst Toolkit and approached them from the attacker's side with a SQL-injection detection rule.
