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

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

Нейросеть18 июня 2026 01:44

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

What it does (high level):

  • pg_sleep(15) makes the database wait for 15 seconds.
  • SELECT 629 FROM pg_sleep(15) returns a row after that delay; then the outer expression checks 629 = (that result).
  • The OR 629=(SELECT 629 ... ) part is a boolean condition. If the vulnerable query evaluates to true due to the injection, the overall SQL logic can be altered.
  • The trailing -- comments out the rest of the SQL line, helping the attacker bypass trailing syntax.

In practice, if an application builds SQL by concatenating user input, injecting something like this can cause a long delay (about 15 seconds). Observing such a delay can reveal that the input is being interpreted as part of SQL, which is a sign of a vulnerability. In time-based blind SQLi, attackers infer data by measuring response times rather than seeing error messages.

Important safety and exam notes:

  • Do not use this on systems you don’t own or don’t have permission to test. It can disrupt services.
  • In exams, the goal is to understand the concept: time-based blind SQL injection, how pg_sleep works, and why comments are used.

Defensive measures (how to fix in practice):

  • Use parameterized queries / prepared statements. Do not concatenate user input into SQL strings.
  • Bind all user-supplied values (e.g., in PostgreSQL: use $1, $2 placeholders, not string concatenation).
  • Apply least-privilege principle: the application DB user should have only the permissions it needs.
  • Validate and sanitize inputs, and use ORM safeguards where applicable.
  • Consider input whitelisting for fields (e.g., numeric IDs should be digits only).
  • Implement logging and anomaly detection for unusual query latency patterns.
  • Use a web application firewall or query-level protections to block obvious injection patterns.
  • For testing in an academic setting: use a sandbox environment or intentionally vulnerable apps (DVWA, Damn Vulnerable Web App, WebGoat) to study without risking real systems.

If you want, I can give a concise exam-style example showing how to identify a vulnerable query and how to fix it with parameterized statements.

555-1) OR 629=(SELECT 629 FROM PG_SLEEP(15))--
That looks like a time-based blind SQL injection payload for PostgreSQL. What it does (high level): - pg_sleep(15) makes the database wait for 15 seconds. - SELECT 629 FROM pg_sleep(15) returns a row after that delay; then the outer expression checks 629 = (that result). - The OR 629=(SELECT 629 ... ) part is a boolean condition. If the vulnerable query evaluates to true due to the injection, the overall SQL logic can be altered. - The trailing -- comments out the rest of the SQL line, helping the attacker bypass trailing syntax. In practice, if an application builds SQL by concatenating user input, injecting something like this can cause a long delay (about 15 seconds). Observing such a delay can reveal that the input is being interpreted as part of SQL, which is a sign of a vulnerability. In time-based blind SQLi, attackers infer data by measuring response times rather than seeing error messages. Important safety and exam notes: - Do not use this on systems you don’t own or don’t have permission to test. It can disrupt services. - In exams, the goal is to understand the concept: time-based blind SQL injection, how pg_sleep works, and why comments are used. Defensive measures (how to fix in practice): - Use parameterized queries / prepared statements. Do not concatenate user input into SQL strings. - Bind all user-supplied values (e.g., in PostgreSQL: use $1, $2 placeholders, not string concatenation). - Apply least-privilege principle: the application DB user should have only the permissions it needs. - Validate and sanitize inputs, and use ORM safeguards where applicable. - Consider input whitelisting for fields (e.g., numeric IDs should be digits only). - Implement logging and anomaly detection for unusual query latency patterns. - Use a web application firewall or query-level protections to block obvious injection patterns. - For testing in an academic setting: use a sandbox environment or intentionally vulnerable apps (DVWA, Damn Vulnerable Web App, WebGoat) to study without risking real systems. If you want, I can give a concise exam-style example showing how to identify a vulnerable query and how to fix it with parameterized statements.