지식로그
G6ZWyaht')) OR 742=(SELECT 742 FROM PG_SLEEP(15))--

[질문] G6ZWyaht')) OR 742=(SELECT 742 FROM PG_SLEEP(15))--

2024.11.22. 04:38:39 | 문서번호: 20913

전체 답변:
[무물보AI]

That looks like an SQL‑injection payload meant to trigger a time delay in a PostgreSQL database (a time‑based blind SQLi test). Brief breakdown:

  • The initial apostrophe (' / ') is used to break out of a string literal in the original query.
  • The OR ... expression tries to inject a boolean condition.
  • 742=(SELECT 742 FROM PG_SLEEP(15)) is intended to make the database execute pg_sleep(15) (sleep for 15 seconds) and then evaluate the condition.
  • The -- comments out the rest of the original SQL so the injected part executes alone.
  • A delayed response indicates the injected expression was evaluated, which is a common way to detect blind SQL injection vulnerabilities.

Important: do not run injection tests against systems you do not own or have explicit permission to test.

How to mitigate and detect this class of attack

  • Use parameterized queries / prepared statements (bind parameters) everywhere — never concatenate user input into SQL.
  • Apply strict input validation / whitelisting for expected values wherever possible.
  • Use ORM query APIs that avoid raw SQL, or safely parameterize any raw SQL.
  • Run the DB with least privilege for the application account (no superuser privileges).
  • Restrict or revoke EXECUTE on dangerous functions where feasible (e.g., pg_sleep) for non‑trusted roles.
  • Deploy a WAF / Web Application Firewall and add rules to flag patterns like pg_sleep, sleep(, waitfor delay, long response times, or suspicious comment markers.
  • Monitor logs and alert on unusual latency spikes for input that looks like injection attempts.
  • Rate‑limit unauthenticated endpoints and require authentication where appropriate.
  • Do regular authorized security testing (code review, static analysis, and penetration testing).

If you want, tell me what language/framework and a short code snippet (the vulnerable query), and I can show a secure, parameterized version and specific hardening suggestions.

댓글 달기:
이전 질문:

다음 질문:

비밀번호를 입력하세요.