> 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/csrf.md).

# 跨站请求伪造（CSRF）

跨站请求伪造、SameSite 绕过、令牌验证缺陷、Referer 验证绕过以及利用服务器载荷。

PortSwigger Web Security Academy 实验的 CSRF 笔记，重点关注实用测试步骤、Burp Suite 验证、payload 行为以及利用流程。

## 测试流程

1. 识别存在漏洞的功能，以及相关的请求、参数、请求头、Cookie 或浏览器端 sink。
2. 在进一步发起攻击之前，先在 Burp Suite 中使用最小有效载荷复现该行为。
3. 使用清晰的概念验证来验证影响，例如账户访问、数据泄露、代码执行、SSRF 或状态变更。
4. 在记录利用路径时，保持有效载荷、URL、令牌和实验室凭据不变。

## 实验

<table><thead><tr><th data-type="content-ref"></th></tr></thead><tbody><tr><td><a href="/zh/web/csrf/csrf-vulnerability-with-no-defenses.md">无防护的 CSRF 漏洞</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-with-broken-referer-validation.md">Referer 验证失效的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-with-duplicated-token-in-a-double-submit-cookie.md">双提交 Cookie 中令牌重复的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-referer-validation-depends-on-header-presence.md">仅在 Referer 存在时才验证的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-token-not-tied-to-session.md">令牌未绑定会话的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-token-tied-to-non-session-cookie.md">令牌绑定 Cookie 但未绑定会话的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/csrf-token-validation-depends-on-http-method.md">基于 HTTP 方法进行令牌验证的 CSRF</a></td></tr><tr><td><a href="/zh/web/csrf/samesite-lax-bypass-via-cookie-refresh.md">通过 Cookie 刷新绕过 SameSite Lax</a></td></tr><tr><td><a href="/zh/web/csrf/samesite-lax-bypass-via-method-override.md">通过方法覆盖绕过 SameSite Lax</a></td></tr><tr><td><a href="/zh/web/csrf/samesite-strict-bypass-via-client-side-redirect.md">通过客户端重定向绕过 SameSite Strict</a></td></tr><tr><td><a href="/zh/web/csrf/samesite-strict-bypass-via-sibling-domain.md">通过同级域绕过 SameSite Strict</a></td></tr></tbody></table>


---

# 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/csrf.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.
