Новая Школа - онлайн-школа подготовки к ЕГЭ
Задача Задача №3621708
А
Аноним
18 июня 2026 04:46 · публичный вопрос
А
Аноним

(select(0)from(select(sleep(29.223)))v)/*'+(select(0)from(select(sleep(29.223)))v)+'"+(select(0)from(select(sleep(29.223)))v)+"*/

Нейросеть18 июня 2026 04:46

That looks like a time-based blind SQL injection payload, likely targeting MySQL.

What the pieces are doing

  • sleep(29.223): In MySQL, SLEEP(n) pauses execution for n seconds. Here it would delay the response by about 29.223 seconds.
  • (select(0)from(select(sleep(29.223)))v): This is a derived table that essentially runs the sleep() call and returns a constant (0) from the derived result. The alias v is just a table alias MySQL requires for derived tables.
  • The whole thing is wrapped in a comment/string-tampering sequence: /'+(select(0)from(select(sleep(29.223)))v)+'"+(select(0)from(select(sleep(29.223)))v)+"/ This demonstrates typical obfuscation: attempting to close a string literal, inject the payload, and then start a comment to swallow the rest of the original query.

What this achieves

  • Time-based blind SQL injection: if an application unsafely concatenates user input into SQL, this payload can cause the database to sleep and thus delay the response. By measuring delays, an attacker can infer whether certain conditions are true (e.g., whether a given SQL expression evaluates to true, or whether a certain value exists), even if the attacker cannot see the query’s results directly.

Notes for exams and learning

  • This is a classic example of time-based blind SQL injection in MySQL.
  • Key signals: using SLEEP, unusual delay, and obfuscation with comments to bypass simple filters.
  • Similar variants exist for other databases (for example, PostgreSQL uses pg_sleep(seconds); SQL Server uses WAITFOR DELAY).

Defensive takeaways (what to study for exams)

  • Prevention:
    • Always use parameterized queries prepared statements; never concatenate user input into SQL.
    • Validate and sanitize input; prefer allowlists over blacklists.
    • Use least-privilege database accounts and enable proper error handling.
    • Consider a WAF and logging/monitoring to detect unusual delays or sleep() usage.
  • Detection and testing (in a safe, legal lab environment):
    • Look for unusually long response times when user input is included in SQL.
    • Use automated vulnerability scanners with time-based payload tests, but only on systems you own or have explicit permission to test.
  • Examples of fixes:
    • In many languages: use placeholders (e.g., ? or %s) and pass user input as parameters.
    • If using ORM, rely on its query-building mechanisms to avoid raw string concatenation.

If you want, I can break down a sample vulnerable query vs. a fixed, parameterized version or show how a lab-safe test harness might demonstrate the concept without compromising real systems.

(select(0)from(select(sleep(29.223)))v)/*'+(select(0)from(select(sleep(29.223)))v)+'"+(select(0)from(select(sleep(29.223)))v)+"*/
That looks like a time-based blind SQL injection payload, likely targeting MySQL. What the pieces are doing - sleep(29.223): In MySQL, SLEEP(n) pauses execution for n seconds. Here it would delay the response by about 29.223 seconds. - (select(0)from(select(sleep(29.223)))v): This is a derived table that essentially runs the sleep() call and returns a constant (0) from the derived result. The alias v is just a table alias MySQL requires for derived tables. - The whole thing is wrapped in a comment/string-tampering sequence: /*'+(select(0)from(select(sleep(29.223)))v)+'"+(select(0)from(select(sleep(29.223)))v)+"*/ This demonstrates typical obfuscation: attempting to close a string literal, inject the payload, and then start a comment to swallow the rest of the original query. What this achieves - Time-based blind SQL injection: if an application unsafely concatenates user input into SQL, this payload can cause the database to sleep and thus delay the response. By measuring delays, an attacker can infer whether certain conditions are true (e.g., whether a given SQL expression evaluates to true, or whether a certain value exists), even if the attacker cannot see the query’s results directly. Notes for exams and learning - This is a classic example of time-based blind SQL injection in MySQL. - Key signals: using SLEEP, unusual delay, and obfuscation with comments to bypass simple filters. - Similar variants exist for other databases (for example, PostgreSQL uses pg_sleep(seconds); SQL Server uses WAITFOR DELAY). Defensive takeaways (what to study for exams) - Prevention: - Always use parameterized queries prepared statements; never concatenate user input into SQL. - Validate and sanitize input; prefer allowlists over blacklists. - Use least-privilege database accounts and enable proper error handling. - Consider a WAF and logging/monitoring to detect unusual delays or sleep() usage. - Detection and testing (in a safe, legal lab environment): - Look for unusually long response times when user input is included in SQL. - Use automated vulnerability scanners with time-based payload tests, but only on systems you own or have explicit permission to test. - Examples of fixes: - In many languages: use placeholders (e.g., ? or %s) and pass user input as parameters. - If using ORM, rely on its query-building mechanisms to avoid raw string concatenation. If you want, I can break down a sample vulnerable query vs. a fixed, parameterized version or show how a lab-safe test harness might demonstrate the concept without compromising real systems.