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

555-1 OR 272=(SELECT 272 FROM PG_SLEEP(23.733))--

Ответ нейросети
18 июня 2026 14:15

What you posted is a time-based blind SQL injection payload intended for PostgreSQL.

High-level breakdown:

  • It’s designed to be injected into an SQL query where user input is unsafely concatenated into the SQL string.
  • The core idea is to cause the database to sleep (delay) for a set time, so an attacker can infer information from the response time.
  • The expression 272=(SELECT 272 FROM PG_SLEEP(23.733)) is a trick: the subquery calls pg_sleep(23.733) which pauses execution for about 23.7 seconds, and returns 272 in a way that makes the comparison true. The surrounding OR and the trailing -- turn the rest of the query into a comment, so the attack payload isn’t interrupted by syntax requirements.

Why this is a vulnerability type:

  • Time-based blind SQL injection: instead of returning data directly, the attacker uses controlled delays to deduce whether certain conditions are true.
  • PostgreSQL-specific: pg_sleep is a common function used in such payloads on PostgreSQL.

Key components in this string:

  • 555-1: Likely part of the input being injected (could be a numeric field like a phone number). The exact semantics depend on the surrounding SQL context.
  • OR: Used to alter the logic of a WHERE clause so that injected code can run.
  • (SELECT 272 FROM PG_SLEEP(23.733)): A subquery that triggers a delay. If the query runs, the sleep happens.
  • --: SQL comment initiator to ignore the rest of the original query after the injection point.

What it accomplishes (in essence):

  • If the server is vulnerable, the response will be delayed by about 23.7 seconds, signaling to the attacker that the injection point is exploitable.
  • It’s a diagnostic technique, not a payload that directly dumps data.

Defenses and safe practices:

  • Use parameterized queries (prepared statements) with bound variables, never string-concatenate user input into SQL.
  • Do input validation and type checks; constrain inputs to expected formats (e.g., digits only for a phone field).
  • Apply the principle of least privilege: the DB user used by the app should have only the permissions it needs.
  • Use ORM facilities or query builders that automatically handle parameterization.
  • Consider WAFs and query-length/character-set controls, but don’t rely on them alone.
  • Enable logging and monitoring for unusual delays or patterns that suggest time-based injections.
  • In testing (authorized environments): perform security testing in a controlled lab, use approved tools, and avoid testing against production systems without permission.

If you’re studying for an exam, this payload is a classic example of a time-based blind SQL injection on PostgreSQL and illustrates:

  • Why pg_sleep-based delays indicate a vulnerability.
  • How an attacker might attempt to alter query logic via input.
  • Why parameterization and input handling are essential defenses.