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

# 锚点 href 中的存储型 XSS，带编码的引号

锚点 href 中的存储型 XSS，带编码的引号笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和修复上下文。

### 存储型 XSS 注入锚点 href 属性，双引号被 HTML 编码

此实验室包含一个存储在评论功能中的 XSS 漏洞。该属性中的双引号 `href` 属性会进行 HTML 编码（"），这会影响如何注入有效载荷。

已保存的评论可以控制 `href` 评论区中作者姓名的属性；该属性会以如下锚点形式返回： `&lt;a href="..."&gt;`，并且双引号会被编码，但锚点 URI 仍然可用。

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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/zh/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.
