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

# Stored XSS in an Anchor href with Encoded Quotes

Stored XSS in an Anchor href with Encoded Quotes notes for PortSwigger Web Security Academy labs, including exploitation workflow, payload testing, Burp Suite validation, and remediation context.

### Stored XSS Into Anchor href Attribute with Double Quotes HTML-encoded

This lab contains an XSS vulnerability stored in the comment feature. Double quotes in the `href` attribute are HTML-encoded ("), which affects how to inject payload.

A saved comment can control the `href` attribute of the author's name in the comments section; the attribute is returned as an anchor such as `&lt;a href="..."&gt;`, and the double quotes are encoded, but the anchor URI remains usable.

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

Submit a comment so that when the author's name is clicked, a `alert()` will run in the visitor's browser.

Use a JavaScript URI in the comment `href`, for example

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

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