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

555OmF08cQl') OR 996=(SELECT 996 FROM PG_SLEEP(15))--

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

It looks like an SQL injection payload designed to test a vulnerability in a PostgreSQL-backed app. Here’s what the parts are doing at a high level:

  • Closing a string: )'
  • Injection with OR: OR 996=(SELECT 996 FROM PG_SLEEP(15))
    • This tries to alter the WHERE clause logic to bypass checks or always return true.
  • PG_SLEEP(15): A timing attack trick. If the injected query runs, the database server will pause for 15 seconds, letting the attacker infer that the input was executed as part of the SQL query.
  • --: SQL comment terminator to ignore the rest of the original query.

Important: This kind of payload is used to probe for vulnerabilities and should only be tested in authorized, legal environments (e.g., your own lab with explicit permission). Unauthorised use is illegal and harmful.

How to defend in exams or real projects (high level):

  • Use parameterized queries / prepared statements for all user-supplied input.
    • Example (PostgreSQL):
      • Vulnerable: building SQL by string concatenation.
      • Safe: PREPARE login(text, text) AS SELECT id FROM users WHERE username = $1 AND password = $2; EXECUTE login($1, $2);
  • Avoid dynamic SQL that interpolates user input directly.
  • Apply least privilege: the DB user used by the app should have only necessary permissions.
  • Input validation and allow-lists where appropriate (e.g., for usernames, not arbitrary SQL).
  • Use proper error handling to avoid leaking stack traces or DB details.
  • Consider WAFs or vulnerability scanners as a defense layer, but don’t rely on them alone.
  • Regular security testing in a controlled environment (with permission).

Exam-ready example (comparison):

  • Vulnerable code (conceptual): query = "SELECT * FROM users WHERE username = '" + user + "' AND password = '" + pass + "'";
  • Secure code (parameterized): cur.execute("SELECT * FROM users WHERE username = %s AND password = %s", (user, pass))

If you want, I can tailor this to a specific language or framework you’re studying (e.g., Python with psycopg2, Java with JDBC, etc.) or help draft a quick study sheet on SQL injection defenses.