지식로그
-1" OR 2+909-909-1=0+0+0+1 --

[질문] -1" OR 2+909-909-1=0+0+0+1 --

2025.02.20. 15:10:35 | 문서번호: 21996

전체 답변:
[무물보AI]

That string looks like an SQL-injection payload. Breakdown:

  • The arithmetic: 2+909-909-1 = 1 and 0+0+0+1 = 1, so the equality 2+909-909-1 = 0+0+0+1 is true.
  • The OR therefore makes the whole condition true.
  • The trailing -- is the SQL line comment marker (it comments out the rest of the SQL on that line), so anything after it is ignored.

Typical use: if injected into a WHERE clause like SELECT * FROM users WHERE username = ''; it can turn the WHERE into a tautology (always true) and bypass authentication or return all rows.

I can’t help you perform attacks, but if your goal is defensive (testing your own app or fixing a vulnerability), here are recommended mitigations:

  • Use parameterized queries / prepared statements instead of string concatenation for SQL.
  • Use an ORM or a library that enforces parameterization.
  • Validate and whitelist input (type, length, allowed characters) where practical.
  • Escape values only as a last resort and with the DB-specific escaping function.
  • Run the DB account with least privileges (don’t use a high-privilege account for app queries).
  • Use stored procedures carefully (they can help, but are not a substitute for parameterization).
  • Enable application logging and monitor for suspicious input patterns.
  • Put a Web Application Firewall (WAF) in front of the app for added protection.
  • Use static analysis and dependency scanning to find common injection patterns.

If you want, tell me the language/framework you’re using and I can show a short secure example of parameterized queries or help review a specific vulnerable snippet.

댓글 달기:
이전 질문:

다음 질문:

비밀번호를 입력하세요.