Задача Задача №3621780
А
А
That looks like a time-based SQL injection payload aimed at SQL Server.
What it does (high level):
- WAITFOR DELAY '0:0:15' is a T-SQL command that pauses the current SQL session for 15 seconds.
- The semicolon ends the prior statement; the -- starts a comment, so the rest of the query is ignored.
- If an application constructs SQL by concatenating user input, an attacker could inject this to cause a deliberate delay and perform timing-based inference (a time-based blind SQLi).
Why this matters in exams:
- It demonstrates a time-based blind SQL injection technique.
- It shows how poorly sanitized input and string-concatenated queries can lead to security flaws.
Defensive measures (recommended):
- Use parameterized queries / prepared statements for all database access.
- Example (conceptual):
- SQL Server: SELECT * FROM users WHERE user_id = @id; with @id bound to user input.
- Python (pyodbc) or C# (SqlCommand) examples should bind parameters rather than concatenating strings.
- Example (conceptual):
- Validate and sanitize input; enforce strict data types (e.g., numeric IDs as INT, not strings).
- Use stored procedures with parameters instead of dynamic SQL (though parameterized dynamic SQL is fine too).
- Enforce least privilege on the app DB account (no unnecessary rights like bulk delete, etc.).
- Disable or constrain dangerous statements on the server (e.g., restrict WAITFOR or monitor for unusual delays).
- Implement proper error handling and generic error messages to avoid leaking details.
- Use a Web Application Firewall (WAF) and run regular security scans/static analysis to catch injection flaws.
If you want, I can give you a quick exam-style question and model answer, or show concrete code examples in a language you’re studying.
