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

555-1) OR 519=(SELECT 519 FROM PG_SLEEP(22.811))--

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

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

What it does (high level):

  • pg_sleep(22.811) makes the database sleep for about 22.8 seconds.
  • The inner query (SELECT 519 FROM PG_SLEEP(...)) returns the value 519 only after the sleep.
  • The surrounding comparison (519 = ) plus an OR is used to force the overall condition to be true while the server is busy sleeping. The trailing -- comments out the rest of the original query.
  • This is a time-based technique: you infer information by measuring how long the query takes to respond.

Common exam-oriented points:

  • Time-based blind injection versus boolean-based blind injection:
    • Time-based uses forced delays to infer true/false via response time.
    • Boolean-based relies on changes in the application’s output or behavior to reveal information.
  • Why this is dangerous: it often doesn’t reveal data directly but can be used to enumerate data and bypass auth in poorly protected code.

Defensive measures (good to know for exams and practical defense):

  • Use parameterized queries/prepared statements instead of string concatenation with user input.
  • Apply least privilege to the database account used by the app (no superuser rights).
  • Validate and sanitize inputs; avoid passing raw input into SQL.
  • Disable or tightly monitor usage of powerful functions like pg_sleep, or restrict them to trusted roles.
  • Use ORM layers or proper escaping to separate code from data.
  • Implement input validation, logging, and anomaly detection (look for long delays, unusual payloads).
  • Web Application Firewall (WAF) rules to detect time-delay patterns and known payload fragments.
  • Regular security testing (static analysis, dynamic testing, and safe, isolated pentests in non-production environments).

If you want, I can summarize this into a quick exam-ready note or walk through a safe, high-level example of how to distinguish time-based vs boolean-based injections.