Задача Задача №3620773
А
А
This looks like an attempt at SQL injection. It’s meant to see if unsafely built queries can be turned into a tautology to bypass checks.
Key points:
- 5*5=26 is false (25 vs 26).
- 'URYDiyTw'='' would be false unless that string is actually empty.
- -1' is typically a syntax error in SQL because of the stray quote after -1. So as written, it’s unlikely to execute correctly, but the idea is that if input is not properly handled, an attacker can try to break out of a string literal and inject OR conditions.
Defensive take (exam-ready):
- The vulnerability arises when user input is concatenated into SQL strings without proper binding.
- Prevent it by using parameterized queries / prepared statements, not string concatenation.
- Also validate input length and type, use least-privilege database accounts, and handle errors safely (don’t reveal raw SQL errors).
Example defensive approach (pseudocode):
- Use: SELECT * FROM users WHERE username = ? AND password = ?
- Bind parameters safely from user input.
If you’d like, tell me the language/DB you’re studying and I can show concrete secure code snippets or a short defense-focused explanation for your exam.
