Back to list
[WHERE条件により隠されたデータの取得が可能] – SQL注入 vulnerability
[WHERE clause allowing retrieval of hidden data] – [SQL injection vulnerability ]
Translated: 2026/3/7 7:33:12
Japanese Translation
ターゲット:
Lab URL: https://portswigger.net/web-security/sql-injection/lab-retrieve-hidden-data
使用工具:ブラウザ
Vulnerability Summary:
種類: SQL注入
説明: WHERE条件の脆弱性で、隠されているデータを取得するためのSELECT文へのアクセスが可能です。
攻撃ステップ:
URLとクエリ「filter?category」がSELECT文に送れていたので、WHERE条件部分を使って攻撃しました。
仮定: SELECT * FROM products WHERE category = 'Gifts' AND released = 1
ペイロード ?category=Gifts'+OR+1=1+- を作成して、全てのカテゴリーを表示するコードにします。
影響:
解決策:
学び:
'はSQLで文字列を終了します。
1=1という事実が常にTrueであるため、クエリは全アイテムを返す状態になります
+はスペースを表し
注記: --の部分がSQLで注釈の開始ととらえられます。
Original Content
Target:
Lab URL : https://portswigger.net/web-security/sql-injection/lab-retrieve-hidden-data
Tools Used: Browser
Vulnerability Summary:
Type: SQL Injection
Description: SQL injection vulnerability in WHERE clause allowing retrieval of hidden data
Steps to Exploit:
Observed the URL and found 'filter?category' being sent as a query in a SELECT statement to the database, so tried modifying the WHERE clause
Guess that the command submitted to the database is: SELECT * FROM products WHERE category = 'Gifts' AND released = 1
Created the payload ?category=Gifts'+OR+1=1+-- to try to make it display all categories.
Impact:
Remediation:
Lessons Learned:
' can terminate a string in SQL
As 1=1 is always true, the query returns all items
+ represents a space
note that -- is a comment indicator in SQL