Задача Задача №3619848
А
А
Short explanation:
- This is a MySQL time-based blind SQL injection payload. It uses IF(now()=sysdate(), sleep(36.956), 0).
- If the condition is true, the database sleeps for 36.956 seconds; if false, it returns immediately.
- The multiplication by 555 doesn’t change the delay (the sleep happens and both branches of IF return 0, so the final result is 0). The attacker only observes the delay via response time to infer whether the condition was true.
Key points to know (exam prep):
- NOW() vs SYSDATE(): They return current time, but in MySQL they can differ slightly in how they’re evaluated within a statement (often due to fractional seconds or timing granularity). Equality now()=sysdate() is therefore not guaranteed and is used to force a detectable delay only under very specific timing.
- Purpose: Time-based blind SQL injection relies on observable delays to infer boolean conditions about the database (e.g., whether a guess about a value is true).
- How it’s detected: An attacker measures response time for injected payloads to see which ones cause delays; long delays indicate a true condition.
- Defense:
- Use parameterized queries/prepared statements; avoid string-concatenated SQL.
- Do not expose raw error messages or timing-based clues to users.
- Least privilege: restrict database user capabilities (e.g., limit ability to call sleep-like functions if possible).
- Input validation and WAF/logging to detect anomalous patterns.
- Consider disabling or sandboxing dangerous functions where feasible.
If you’re studying this for an exam, focus on: why the timing-based approach works, the role of NOW() vs SYSDATE(), and the typical mitigations. If you want, I can summarize a few more related payloads and their defenses in a compact study sheet.