> 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/xss/stored-xss-in-anchor-href-with-encoded-quotes.md).

# エンコードされた引用符を含むaタグhref内の保存型XSS

PortSwigger Web Security Academy のラボ向けメモ。エンコードされた引用符を含むaタグhref内の保存型XSSに関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### 二重引用符がHTMLエンコードされたアンカーの href 属性への格納型XSS

このラボには、コメント機能に格納型XSSの脆弱性があります。二重引用符は、 `href` 属性がHTMLエンコードされています（"）。そのため、ペイロードの注入方法に影響します。

保存されたコメントで、 `href` コメント欄の投稿者名の属性を制御できます。この属性は、たとえば次のようなアンカーとして返されます `&lt;a href="..."&gt;`、そして二重引用符はエンコードされますが、アンカーのURIは引き続き使用できます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5db99338e8c66b19151aa1d935f210d597f988e1%2F%7BA69FED61-6A73-40EA-9542-A5251320CB15%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

コメントを送信し、投稿者名がクリックされたときに、 `alert()` 訪問者のブラウザで実行されます。

コメント内でJavaScript URIを使用します `href`。たとえば

```javascript
javascript:alert(document.cookie)
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-131efd966b875608203c08f27fdfc06f425a8ddd%2F%7BAA7246A7-E75D-4FAF-B5C5-066833D26D20%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0a58b493a9314ce072c86bbbd05660bad1cbea62%2F%7B534A1E11-FCCD-4E87-9691-C965D601782F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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/xss/stored-xss-in-anchor-href-with-encoded-quotes.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.
