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

555-1 OR 95=(SELECT 95 FROM PG_SLEEP(15.758))--

Нейросеть18 июня 2026 10:38

I can’t help with crafting or using exploits against systems. But I can help you understand the concept for exam prep and discuss defenses.

High-level concept of the payload

  • This is a time-based blind SQL injection payload designed for PostgreSQL.
  • It uses the pg_sleep function to introduce a deliberate delay (sleep) in the SQL query.
  • The idea is to cause a observable delay when a condition is true, which lets an attacker infer information even if there are no visible errors.
  • The pattern often looks like: a boolean condition is injected into a WHERE clause or similar, and if the condition is true, the query sleeps for a while; if false, it returns quickly. By measuring the response time, the attacker can infer values.

Key defensive concepts

  • Use parameterized queries/prepared statements for all user-supplied data. Do not concatenate strings to build SQL.
  • Avoid dynamic SQL or sanitize any dynamic parts rigorously; prefer bound parameters.
  • Principle of least privilege: the database user used by the application should have only the necessary rights (no broad access or ability to call risky functions like pg_sleep in production).
  • Disable or restrict dangerous functions in production (or sandbox them so they can’t cause delays or expose data).
  • Input validation and whitelisting where possible, and use ORM or query builders that automatic parameter binding.
  • Use a Web Application Firewall (WAF) and logging/monitoring to detect unusual query patterns or excessive sleep-related behavior.
  • Regular security testing: use safe, legal lab environments to practice (e.g., OWASP WebGoat, DVWA, Web Security Dojo) and conduct authorized penetration testing.

Exam-style practice questions (conceptual)

  • Question: What distinguishes a time-based blind SQL injection from an error-based SQL injection? Answer: Time-based blind relies on intentional delays (e.g., by sleep functions) to infer data based on response time, whereas error-based relies on database error messages revealing information.

  • Question: How would you defend a login form to protect against time-based blind SQL injection? Answer: Use parameterized queries, validate and sanitize inputs, restrict the database user’s privileges, avoid exposing DB error messages, and consider disabling risky functions like sleep in production.

  • Question: Why is PostgreSQL’s pg_sleep function relevant to time-based injections, and what would you look for in code to determine if it’s vulnerable? Answer: pg_sleep can cause a deliberate delay, which attackers exploit to infer true/false conditions. In code, look for dynamic SQL that includes user input and references to sleep-like functions or time delays, especially inside conditional branches.

Would you like me to:

  • Provide a few more safe, exam-style questions and answers on SQL injection and defenses, or
  • Compare time-based injections across different databases (e.g., PostgreSQL pg_sleep vs MySQL SLEEP) at a high level for study?
555-1 OR 95=(SELECT 95 FROM PG_SLEEP(15.758))--
I can’t help with crafting or using exploits against systems. But I can help you understand the concept for exam prep and discuss defenses. High-level concept of the payload - This is a time-based blind SQL injection payload designed for PostgreSQL. - It uses the pg_sleep function to introduce a deliberate delay (sleep) in the SQL query. - The idea is to cause a observable delay when a condition is true, which lets an attacker infer information even if there are no visible errors. - The pattern often looks like: a boolean condition is injected into a WHERE clause or similar, and if the condition is true, the query sleeps for a while; if false, it returns quickly. By measuring the response time, the attacker can infer values. Key defensive concepts - Use parameterized queries/prepared statements for all user-supplied data. Do not concatenate strings to build SQL. - Avoid dynamic SQL or sanitize any dynamic parts rigorously; prefer bound parameters. - Principle of least privilege: the database user used by the application should have only the necessary rights (no broad access or ability to call risky functions like pg_sleep in production). - Disable or restrict dangerous functions in production (or sandbox them so they can’t cause delays or expose data). - Input validation and whitelisting where possible, and use ORM or query builders that automatic parameter binding. - Use a Web Application Firewall (WAF) and logging/monitoring to detect unusual query patterns or excessive sleep-related behavior. - Regular security testing: use safe, legal lab environments to practice (e.g., OWASP WebGoat, DVWA, Web Security Dojo) and conduct authorized penetration testing. Exam-style practice questions (conceptual) - Question: What distinguishes a time-based blind SQL injection from an error-based SQL injection? Answer: Time-based blind relies on intentional delays (e.g., by sleep functions) to infer data based on response time, whereas error-based relies on database error messages revealing information. - Question: How would you defend a login form to protect against time-based blind SQL injection? Answer: Use parameterized queries, validate and sanitize inputs, restrict the database user’s privileges, avoid exposing DB error messages, and consider disabling risky functions like sleep in production. - Question: Why is PostgreSQL’s pg_sleep function relevant to time-based injections, and what would you look for in code to determine if it’s vulnerable? Answer: pg_sleep can cause a deliberate delay, which attackers exploit to infer true/false conditions. In code, look for dynamic SQL that includes user input and references to sleep-like functions or time delays, especially inside conditional branches. Would you like me to: - Provide a few more safe, exam-style questions and answers on SQL injection and defenses, or - Compare time-based injections across different databases (e.g., PostgreSQL pg_sleep vs MySQL SLEEP) at a high level for study?