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

555-1) OR 738=(SELECT 738 FROM PG_SLEEP(39.374))--

Нейросеть17 июня 2026 22:54

That looks like a time-based blind SQL injection payload for PostgreSQL, using pg_sleep.

What it does (at a high level)

  • The attacker injects a condition that, if the input is evaluated as part of the SQL query, causes the database to sleep for about 39 seconds (pg_sleep(39.374)).
  • The OR clause and the comparison (738 = SELECT 738 FROM pg_sleep(...)) are designed to make the condition true and trigger the delay, while -- comments out the rest of the query.
  • By measuring response times, the attacker can infer whether the injection point is vulnerable.

Key concepts you might be tested on

  • Time-based blind SQL injection: relies on delays to infer true/false information when error messages aren’t shown.
  • The role of pg_sleep: used to create a measurable delay in PostgreSQL.
  • Why the payload ends with --: to comment out the remainder of the original query.

Defenses (recommended for exams and real apps)

  • Use parameterized queries/prepared statements (never concatenate user input into SQL).
  • Validate and sanitize input; enforce type/length constraints.
  • Principle of least privilege for the DB user (limit what the app user can do).
  • Avoid exposing detailed error messages; implement generic error handling.
  • Consider application-level timeouts and database-side protections (e.g., restrict or monitor use of dangerous functions like pg_sleep, or implement proper timeouts).

If you want, I can show a quick side-by-side example:

  • vulnerable code vs. safe code (in Python, Java, or Node.js) to illustrate how parameterization blocks this kind of attack.
555-1) OR 738=(SELECT 738 FROM PG_SLEEP(39.374))--
That looks like a time-based blind SQL injection payload for PostgreSQL, using pg_sleep. What it does (at a high level) - The attacker injects a condition that, if the input is evaluated as part of the SQL query, causes the database to sleep for about 39 seconds (pg_sleep(39.374)). - The OR clause and the comparison (738 = SELECT 738 FROM pg_sleep(...)) are designed to make the condition true and trigger the delay, while -- comments out the rest of the query. - By measuring response times, the attacker can infer whether the injection point is vulnerable. Key concepts you might be tested on - Time-based blind SQL injection: relies on delays to infer true/false information when error messages aren’t shown. - The role of pg_sleep: used to create a measurable delay in PostgreSQL. - Why the payload ends with --: to comment out the remainder of the original query. Defenses (recommended for exams and real apps) - Use parameterized queries/prepared statements (never concatenate user input into SQL). - Validate and sanitize input; enforce type/length constraints. - Principle of least privilege for the DB user (limit what the app user can do). - Avoid exposing detailed error messages; implement generic error handling. - Consider application-level timeouts and database-side protections (e.g., restrict or monitor use of dangerous functions like pg_sleep, or implement proper timeouts). If you want, I can show a quick side-by-side example: - vulnerable code vs. safe code (in Python, Java, or Node.js) to illustrate how parameterization blocks this kind of attack.