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

555-1 OR 831=(SELECT 831 FROM PG_SLEEP(19.687))--

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

That string is a time-based blind SQL injection payload targeting PostgreSQL.

What it does (conceptually)

  • It tries to inject into a SQL query by using an OR condition to override the original logic.
  • The fragment 831=(SELECT 831 FROM PG_SLEEP(19.687)) calls the PostgreSQL function pg_sleep(19.687). This makes the database wait about 19.687 seconds before returning.
  • The subquery returns a value (typically 831) after sleeping, and the equality 831 = 831 is true, which helps the attacker confirm the vulnerability.
  • The trailing -- comments out the rest of the original query, so the injected portion ideally executes without syntax errors.

Why this is important for exams

  • It demonstrates a time-based (blind) SQL injection technique, not an error-based one. The tester gauges vulnerability by measuring response time rather than by seeing error messages or data returned.
  • It shows how an attacker can bypass certain input checks by using logical OR and a harmless-looking subquery that delays the response.

Defenses (high-level)

  • Use parameterized queries / prepared statements so user input is never concatenated into SQL strings.
  • Validate and constrain inputs (type checks, length limits, allowed characters).
  • Avoid dynamic SQL; use bound parameters and ORM features that enforce safe query construction.
  • Run the application with a database user that has least privilege (no unnecessary SUPER or schema-wide rights).
  • Enable and monitor logging for long query times; consider a WAF or application-layer protections that detect anomalous input patterns.
  • Consider stricter database-side protections (e.g., input validation at the API layer, or using stored procedures with strict typing).

If you want, I can:

  • Break down other SQLi payloads in a similar exam-friendly way.
  • Create a quick study note with common injection types and their mitigations.
  • Provide practice questions focusing on recognizing time-based vs. error-based vs. union-based injection.
555-1 OR 831=(SELECT 831 FROM PG_SLEEP(19.687))--
That string is a time-based blind SQL injection payload targeting PostgreSQL. What it does (conceptually) - It tries to inject into a SQL query by using an OR condition to override the original logic. - The fragment 831=(SELECT 831 FROM PG_SLEEP(19.687)) calls the PostgreSQL function pg_sleep(19.687). This makes the database wait about 19.687 seconds before returning. - The subquery returns a value (typically 831) after sleeping, and the equality 831 = 831 is true, which helps the attacker confirm the vulnerability. - The trailing -- comments out the rest of the original query, so the injected portion ideally executes without syntax errors. Why this is important for exams - It demonstrates a time-based (blind) SQL injection technique, not an error-based one. The tester gauges vulnerability by measuring response time rather than by seeing error messages or data returned. - It shows how an attacker can bypass certain input checks by using logical OR and a harmless-looking subquery that delays the response. Defenses (high-level) - Use parameterized queries / prepared statements so user input is never concatenated into SQL strings. - Validate and constrain inputs (type checks, length limits, allowed characters). - Avoid dynamic SQL; use bound parameters and ORM features that enforce safe query construction. - Run the application with a database user that has least privilege (no unnecessary SUPER or schema-wide rights). - Enable and monitor logging for long query times; consider a WAF or application-layer protections that detect anomalous input patterns. - Consider stricter database-side protections (e.g., input validation at the API layer, or using stored procedures with strict typing). If you want, I can: - Break down other SQLi payloads in a similar exam-friendly way. - Create a quick study note with common injection types and their mitigations. - Provide practice questions focusing on recognizing time-based vs. error-based vs. union-based injection.