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

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

2025.02.20. 15:13:20 | 문서번호: 22006

전체 답변:
[무물보AI]

It looks like a SQL‑injection style payload. Briefly:

  • The expression: "-1" OR 2+989-989-1 = 0+0+0+1 --
  • Arithmetic: 2+989-989-1 = 1 and 0+0+0+1 = 1, so the comparison is 1 = 1 (true).
  • The OR true makes the whole WHERE condition true, and the trailing -- begins a SQL comment that ignores the rest of the query.
  • Intent: force the WHERE clause to always be true so the query returns data (classic authentication bypass / data-exfiltration technique).

If your goal is defense, here are practical recommendations (don’t run this against systems you don’t own or have permission to test):

  1. Use parameterized queries / prepared statements (do not build SQL by concatenating user input).

    • Python (psycopg2): cursor.execute("SELECT * FROM users WHERE username = %s AND password = %s", (user, pwd))
    • PHP (PDO): $stmt = $pdo->prepare('SELECT * FROM users WHERE username = ? AND password = ?'); $stmt->execute([$user, $pwd]);
    • Node (mysql2): connection.execute('SELECT * FROM users WHERE id = ?', [id]);
  2. Validate and constrain input:

    • For numeric fields, cast/validate to integers.
    • Enforce length and allowed character sets for text fields.
    • Reject obviously malicious payloads in input validation (as an additional layer, not a primary defense).
  3. Least privilege and safe error handling:

    • DB accounts should have only necessary privileges.
    • Don’t display raw DB errors to users.
  4. Use ORM or stored procedures where appropriate (still use parameterized APIs).

  5. Additional controls:

    • Web application firewall (WAF) to block common injection patterns.
    • Logging and alerting for suspicious queries.
    • Regular penetration testing in an authorized environment and secure code review.

If you’d like, tell me what language/framework and query you’re using and I can show a secure version of that specific query.

댓글 달기:
이전 질문:

다음 질문:
관련 질문:

인기 질문:

이야기 로드하기

당신은 어느 그룹입니까?

비밀번호를 입력하세요.