> 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，带编码引号

### 带双引号 HTML 编码的锚点 href 属性中的存储型 XSS

该实验室包含一个存储在评论功能中的 XSS 漏洞。属性中的双引号 `href` 会被 HTML 编码（"），这会影响负载的注入方式。

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

<figure><img src="/files/f547317aa4f8111c29bd2c9e189ffc1c8d6a2a8e" alt=""><figcaption></figcaption></figure>

提交一条评论，以便当点击作者姓名时，会触发一个 `alert()` 会在访问者的浏览器中运行。

在评论中使用 JavaScript URI `href`，例如

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

<figure><img src="/files/e9dec7c0d52eaa683cf50c65cc1ad823223a3587" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/98e2b124b72f1df034deb0a6fdf8fdd41f687e5b" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/web/xss/stored-xss-in-anchor-href-with-encoded-quotes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
