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

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

Нейросеть18 июня 2026 11:12

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

What it does (high level):

  • The snippet is trying to alter the SQL logic of a query by injecting an OR clause: OR 922=(SELECT 922 FROM PG_SLEEP(15)).
  • PG_SLEEP(15) makes the database wait for 15 seconds (a delay), which can be used to infer whether the injection is being evaluated.
  • The subquery (SELECT 922 FROM PG_SLEEP(15)) is designed to return a value (922) after the delay, and the outer comparison 922 = (subquery) will be true only if the subquery is executed, causing the delay to occur under a vulnerable condition.
  • The trailing -- is a SQL comment marker, used to ignore the rest of the original query, helping the attacker bypass remaining syntax.

Why this is a concern:

  • It indicates the input is being concatenated into SQL without proper parameterization.
  • An attacker can learn about vulnerability by measuring response times (time-based blind SQL injection), or escalate access if the condition is evaluated.

Defensive ideas (how to prevent this):

  • Use parameterized queries / prepared statements for all user input (never concatenate input into SQL strings).
    • Example: use placeholders and bind values rather than building SQL with string concatenation.
  • Validate and sanitize inputs; enforce strict types (e.g., numeric IDs should be numbers, not arbitrary strings).
  • Disable or restrict dangerous database functions for untrusted users (e.g., limit or revoke access to pg_sleep or other side-effecting functions) and apply least-privilege for DB accounts.
  • Use a web/app firewall or input monitoring to detect anomalous patterns that look like injection attempts.
  • Enable robust logging and duration-based alerts:
    • log_min_duration_statement to catch long-running queries.
    • Set statement_timeout to kill queries that exceed an acceptable limit.
  • Consider using ORMs or database access layers that automatically parameterize queries.
  • Audit and test with proper authorization (penetration testing) and use safe, controlled test environments.

If you’d like, I can show you a concrete, safe example of how to rewrite a vulnerable pattern into a parameterized query in PostgreSQL, or craft practice exam questions around time-based SQL injection and defenses.

555-1) OR 922=(SELECT 922 FROM PG_SLEEP(15))--
That looks like a classic time-based blind SQL injection payload for PostgreSQL, using pg_sleep. What it does (high level): - The snippet is trying to alter the SQL logic of a query by injecting an OR clause: OR 922=(SELECT 922 FROM PG_SLEEP(15)). - PG_SLEEP(15) makes the database wait for 15 seconds (a delay), which can be used to infer whether the injection is being evaluated. - The subquery (SELECT 922 FROM PG_SLEEP(15)) is designed to return a value (922) after the delay, and the outer comparison 922 = (subquery) will be true only if the subquery is executed, causing the delay to occur under a vulnerable condition. - The trailing -- is a SQL comment marker, used to ignore the rest of the original query, helping the attacker bypass remaining syntax. Why this is a concern: - It indicates the input is being concatenated into SQL without proper parameterization. - An attacker can learn about vulnerability by measuring response times (time-based blind SQL injection), or escalate access if the condition is evaluated. Defensive ideas (how to prevent this): - Use parameterized queries / prepared statements for all user input (never concatenate input into SQL strings). - Example: use placeholders and bind values rather than building SQL with string concatenation. - Validate and sanitize inputs; enforce strict types (e.g., numeric IDs should be numbers, not arbitrary strings). - Disable or restrict dangerous database functions for untrusted users (e.g., limit or revoke access to pg_sleep or other side-effecting functions) and apply least-privilege for DB accounts. - Use a web/app firewall or input monitoring to detect anomalous patterns that look like injection attempts. - Enable robust logging and duration-based alerts: - log_min_duration_statement to catch long-running queries. - Set statement_timeout to kill queries that exceed an acceptable limit. - Consider using ORMs or database access layers that automatically parameterize queries. - Audit and test with proper authorization (penetration testing) and use safe, controlled test environments. If you’d like, I can show you a concrete, safe example of how to rewrite a vulnerable pattern into a parameterized query in PostgreSQL, or craft practice exam questions around time-based SQL injection and defenses.