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

555-1)) OR 822=(SELECT 822 FROM PG_SLEEP(15))--

Ответ нейросети
18 июня 2026 00:04

It looks like you pasted a time-based SQL injection payload that uses PostgreSQL’s pg_sleep to delay the response. This is a classic technique for blind SQL injection: if an input is unsafely combined into a query, an attacker can interrupt the normal logic and cause the database to sleep, revealing whether the injection is feasible by observing the delay.

Key concepts to know for exams:

  • pg_sleep(n) pauses the database server for n seconds. In a vulnerable query, an attacker can cause the server to sleep under certain conditions, enabling them to infer information based on how long the response takes.
  • Time-based blind SQL injection relies on observable delays rather than returned data, making it useful when error messages aren’t disclosed.

Defensive strategies (things you should know for exams and practical security):

  • Use parameterized queries/prepared statements everywhere (never concatenate user input into SQL). Example (PostgreSQL style):
    • Wrong (vulnerable): "SELECT * FROM users WHERE username = '" + userInput + "'"
    • Right (safe): "SELECT * FROM users WHERE username = $1" with the value bound to $1
  • Do not expose dangerous database functions to untrusted users. If possible, run applications with a least-privilege DB role that cannot perform risky operations.
  • Validate and sanitize input, enforce strict types, and use ORM/abstractions that handle binding safely.
  • Disable or restrict dangerous features/functions where feasible (e.g., limit use of pg_sleep in production by using proper permissions and auditing).
  • Implement robust error handling and avoid leaking database error details to clients.
  • Enable query logging and anomaly detection (long-running queries, unusual sleeps, repeated failed injections).
  • Use defense-in-depth: input validation, parameterized queries, least privilege, and monitoring together.

Safe practice for exams or labs:

  • Build a small test environment (no production data). Practice turning unsafe SQL into safe parameterized queries.
  • Practice identifying vulnerable patterns: direct string interpolation of user input into SQL, dynamic SQL generation without parameters, and missing input validation.
  • Learn how to explain why a payload like the one you posted would or would not work in a given context (e.g., depending on query structure and whether the database allows the used syntax).

If you want, I can:

  • Explain with a concrete, safe example how to convert a vulnerable query into a parameterized one.
  • Walk through typical exam questions about SQL injection defense and time-based blind injection.
  • Create a small, safe practice quiz to test your understanding of these concepts.