Задача Задача №3620790
А
А
That looks like a time-based SQL injection payload for SQL Server.
What it does
- The attacker is likely inputting something like 555-1 as data, but appends: ; waitfor delay '0:0:15' --
- The semicolon ends the previous statement.
- WAITFOR DELAY '0:0:15' tells SQL Server to pause execution for 15 seconds.
- The double dash -- starts a comment, making the rest of the line ignored (to hide syntax or the rest of the original query).
Why this matters
- If user input is concatenated into a SQL query (i.e., not parameterized), this payload can cause the database to delay its response.
- Repeated delays can reveal that the app is vulnerable (time-based blind SQL injection) and, in more advanced cases, can be used to infer data.
Defensive measures
- Use parameterized queries (prepared statements) so user input is treated as data, not executable code.
- Avoid dynamic SQL built by string concatenation.
- Use stored procedures with properly parameterized inputs.
- Implement input validation and length checks; reject unexpected formats (e.g., when a phone field should only contain digits and certain separators).
- Apply least-privilege principle to the DB account used by the app (no unnecessary rights).
- Consider a Web Application Firewall and logging to detect anomalous inputs.
- For other DBs, equivalent delays exist (e.g., MySQL: SLEEP(15); PostgreSQL: SELECT pg_sleep(15)); the same defense applies.
Example safe pattern (C#-style)
- Unsafe: string sql = "SELECT * FROM Users WHERE Phone = '" + input + "'";
- Safe: string sql = "SELECT * FROM Users WHERE Phone = @phone"; cmd.Parameters.AddWithValue("@phone", input);
If you’re studying for an exam, you can expect questions like:
- What is a time-based blind SQL injection and how does WAITFOR DELAY work in SQL Server?
- How can you defend applications against this vulnerability?
- How would you recognize this pattern in a log or during a code review?