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

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

Нейросеть18 июня 2026 10:23

What you pasted looks like a time-based blind SQL injection payload. Here’s a concise breakdown and how to think about it for exam prep (and how to defend against it).

What the payload is trying to do (high level)

  • It uses a sleep/delay function (sleep(15)) to cause the database to pause for 15 seconds if the injected condition is true. The idea is to observe the delay and deduce information about the database when you don’t get a straightforward error or result.
  • The nested SELECTs (select(0) from (select(sleep(15))) v) are a way to trigger the delay while returning a value that keeps the query syntactically valid.
  • The surrounding fragments (/'+ ... +'"+ ... +"/ or similar) simulate breaking out of a string literal and/or attempting to comment out the rest of the query to bypass filters.
  • Different databases have different sleep-like functions (MySQL uses SLEEP(), PostgreSQL has pg_sleep(), SQL Server uses WAITFOR DELAY, etc.). The concept is the same: cause a delay if the injected condition is true, to infer information bit-by-bit.

Why this is a vulnerability concept

  • Time-based blind SQL injection does not rely on visible error messages or direct data exposure. An attacker can infer information by measuring response time.
  • It often targets unsafely concatenated SQL strings where user input is inserted directly into a query.

Defensive measures (how to prevent)

  • Use parameterized queries / prepared statements:
    • Do not concatenate user input into SQL strings.
    • Bind user input as parameters so the DB treats them as data, not executable code.
  • Validate and constrain input:
    • Implement allow-lists (e.g., only numbers for IDs, fixed-length tokens, etc.) and reject anything outside the expected format.
    • Don’t rely on escaping alone.
  • Principle of least privilege:
    • Run the app with a DB user that has only the needed permissions (no dangerous operations). Even if an injection payload gets through, limited privileges reduce impact.
  • Disable or restrict dangerous database functions:
    • If possible, restrict or monitor use of sleep/pg_sleep/WAITFOR DELAY, or at least log and alert on their invocation.
  • Error handling and information disclosure:
    • Don’t leak database errors or stack traces to users. Show generic messages.
  • App security testing and monitoring:
    • Use automated scanners in a legal, authorized test environment.
    • Implement WAF rules and anomaly detection for unusual query patterns or repeated delays.
  • Secure coding practices:
    • Use ORM/query builders that automatically parameterize queries.
    • Avoid building dynamic SQL from strings.
  • In a lab/exam context:
    • Understand the concept of time-based injection and why parameterization and least-privilege defenses stop it, even if you can’t demonstrate the exact exploit in a live system.

Exam-style takeaways you can memorize

  • What is time-based blind SQL injection? A technique where an attacker uses database sleep/delay functions to infer information from response times when input is injected into a query.
  • Why is naive string concatenation dangerous? It can turn user input into executable SQL code.
  • How do you fix it in code? Use parameterized queries/prepared statements; validate input; apply least-privilege principles; avoid exposing DB errors.
  • What are common defenses beyond code changes? WAFs, proper error handling, and restricting dangerous DB functions/users.

Brief example of safe practice (language-agnostic)

  • Instead of:
    • query = "SELECT * FROM users WHERE id = " + user_id
    • execute(query)
  • Use:
    • query = "SELECT * FROM users WHERE id = ?"
    • execute(query, (user_id,))

If you want, tell me your exam topics (e.g., SQL injection types, defenses, or a specific language) and I’ll tailor a quick study guide with sample questions and code snippets. Also, if you’re practicing, I can help you set up a safe lab environment with intentionally vulnerable apps like DVWA or similar resources for learning in a controlled way.

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
What you pasted looks like a time-based blind SQL injection payload. Here’s a concise breakdown and how to think about it for exam prep (and how to defend against it). What the payload is trying to do (high level) - It uses a sleep/delay function (sleep(15)) to cause the database to pause for 15 seconds if the injected condition is true. The idea is to observe the delay and deduce information about the database when you don’t get a straightforward error or result. - The nested SELECTs (select(0) from (select(sleep(15))) v) are a way to trigger the delay while returning a value that keeps the query syntactically valid. - The surrounding fragments (/*'+ ... +'\"+ ... +\"*/ or similar) simulate breaking out of a string literal and/or attempting to comment out the rest of the query to bypass filters. - Different databases have different sleep-like functions (MySQL uses SLEEP(), PostgreSQL has pg_sleep(), SQL Server uses WAITFOR DELAY, etc.). The concept is the same: cause a delay if the injected condition is true, to infer information bit-by-bit. Why this is a vulnerability concept - Time-based blind SQL injection does not rely on visible error messages or direct data exposure. An attacker can infer information by measuring response time. - It often targets unsafely concatenated SQL strings where user input is inserted directly into a query. Defensive measures (how to prevent) - Use parameterized queries / prepared statements: - Do not concatenate user input into SQL strings. - Bind user input as parameters so the DB treats them as data, not executable code. - Validate and constrain input: - Implement allow-lists (e.g., only numbers for IDs, fixed-length tokens, etc.) and reject anything outside the expected format. - Don’t rely on escaping alone. - Principle of least privilege: - Run the app with a DB user that has only the needed permissions (no dangerous operations). Even if an injection payload gets through, limited privileges reduce impact. - Disable or restrict dangerous database functions: - If possible, restrict or monitor use of sleep/pg_sleep/WAITFOR DELAY, or at least log and alert on their invocation. - Error handling and information disclosure: - Don’t leak database errors or stack traces to users. Show generic messages. - App security testing and monitoring: - Use automated scanners in a legal, authorized test environment. - Implement WAF rules and anomaly detection for unusual query patterns or repeated delays. - Secure coding practices: - Use ORM/query builders that automatically parameterize queries. - Avoid building dynamic SQL from strings. - In a lab/exam context: - Understand the concept of time-based injection and why parameterization and least-privilege defenses stop it, even if you can’t demonstrate the exact exploit in a live system. Exam-style takeaways you can memorize - What is time-based blind SQL injection? A technique where an attacker uses database sleep/delay functions to infer information from response times when input is injected into a query. - Why is naive string concatenation dangerous? It can turn user input into executable SQL code. - How do you fix it in code? Use parameterized queries/prepared statements; validate input; apply least-privilege principles; avoid exposing DB errors. - What are common defenses beyond code changes? WAFs, proper error handling, and restricting dangerous DB functions/users. Brief example of safe practice (language-agnostic) - Instead of: - query = "SELECT * FROM users WHERE id = " + user_id - execute(query) - Use: - query = "SELECT * FROM users WHERE id = ?" - execute(query, (user_id,)) If you want, tell me your exam topics (e.g., SQL injection types, defenses, or a specific language) and I’ll tailor a quick study guide with sample questions and code snippets. Also, if you’re practicing, I can help you set up a safe lab environment with intentionally vulnerable apps like DVWA or similar resources for learning in a controlled way.