> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ja/web/sql-injection/sql-injection-in-where-clause.md).

# WHERE句のSQLインジェクション

PortSwigger Web Security Academy のラボ向けメモ。WHERE句のSQLインジェクションに関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### WHERE句におけるSQLインジェクション脆弱性により、隠されたデータを取得できる

* **背景 / 脆弱性：** カテゴリフィルターにSQLインジェクションの脆弱性があります。サーバー上で実行される典型的なリクエスト：/ `SELECT * FROM products WHERE category = 'Gifts' AND released = 1`
* \*\*攻撃の目的（ラボ）：\*\*1つ以上の未公開製品の表示を強制する（`released = 0`).
* **脆弱なパラメータ：** `category` （製品フィルター）。
* **概念実証（提供されたペイロード）：**

```sql
test' or category='Lifestyle' and released=0-- -
```

* 簡単な解釈：このペイロードはWHERE条件を変更して、以下を含むエントリを含めます `category='Lifestyle' AND released=0`、をバイパスして `released = 1` という制約。
* **期待される結果：** ページは `released = 0` （未公開製品）に対応する製品を返して表示します。
* **影響：** マスクされた要素の漏えい、機密データの潜在的な持ち出し、業務ロジックの回避（一般公開向けではない）。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/web/sql-injection/sql-injection-in-where-clause.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
