xss-detection
БесплатноБез исполняемых скриптовНе проверенDetect and prevent Cross-Site Scripting (XSS) vulnerabilities in web applications. Use when tasks involve testing for reflected, stored, or DOM-based XSS on…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
XSS Detection
Overview
Find, confirm, and fix Cross-Site Scripting vulnerabilities. XSS lets attackers inject scripts into web pages viewed by other users — stealing sessions, redirecting to phishing sites, or modifying page content.
Instructions
Reflected, stored and DOM-based XSS
Reflected: the payload comes from the current request (a URL or form field) and is echoed back in the response unsanitized — https://shop.northfield-outfitters.internal/search?q=<script>alert(1)</script>, sent to a victim as a link.
Stored: the payload is saved server-side (a comment, a profile field) and served to every visitor who later views that page, so it needs no link-click to trigger — more dangerous than reflected because it is persistent and scales to every viewer.
DOM-based: the payload never reaches the server. Client-side JavaScript reads untrusted data and writes it into the page:
// URL: https://shop.northfield-outfitters.internal/page#<img src=x onerror=alert(1)>
const hash = window.location.hash.substring(1);
document.getElementById('content').innerHTML = hash; // XSS — server-side scanning won't see this
Manual testing
Test every input point — URL parameters, form fields, headers, cookies:
- Inject a canary string (e.g.
test12345xss) and find where it lands in the response: inside HTML body text, an HTML attribute, a<script>block, a URL, or CSS. - Craft a payload for that context:
- HTML body:
<img src=x onerror=alert(1)> - HTML attribute (
<input value="test12345xss">):"><script>alert(1)</script>or" onfocus=alert(1) autofocus=" - JavaScript string (
var x = "test12345xss";):";alert(1)// - URL/
hrefcontext:javascript:alert(1)
- HTML body:
- If the basic payload is blocked, try a filter-bypass variant (below).
Automated scanning
# dalfox — specialized XSS scanner, rewritten in Rust as v3 (the old Go v2 line only gets
# security backports now). Install with a package manager or a release binary, not `go install`:
# brew install dalfox # macOS/Linux, tracks latest stable
# cargo install dalfox # needs Rust 1.93+
# sudo snap install dalfox # Ubuntu
# Everything now sits under the `scan` subcommand.
dalfox scan "https://staging.example.org/search?q=test"
dalfox scan urls-with-params.txt --output results.txt
cat urls-with-params.txt | dalfox scan
# XSStrike — Python-based context-aware payload generator. It is not published to PyPI by
# its maintainer (the "xsstrike" PyPI package is an unrelated third-party fork), so run it
# from a clone instead:
# git clone https://github.com/s0md3v/XSStrike && cd XSStrike
# python3 -m pip install -r requirements.txt
python3 xsstrike.py -u "https://staging.example.org/search?q=test"
python3 xsstrike.py -u "https://staging.example.org/search?q=test" --fuzzer # Fuzzing mode
DOM XSS detection
DOM XSS requires analyzing JavaScript source code for dangerous patterns:
// DANGEROUS SINKS — functions that execute or render content
// Look for these being called with user-controlled input:
document.write() // Writes raw HTML
document.writeln()
element.innerHTML = ... // Parses and renders HTML
element.outerHTML = ...
element.insertAdjacentHTML()
eval() // Executes JavaScript string
setTimeout(string) // Executes if passed a string
setInterval(string)
Function(string)
$.html() // jQuery — same as innerHTML
$(user_input) // jQuery selector injection
window.location = ... // Open redirect / javascript: URLs
// SOURCES — where user input comes from:
window.location.hash
window.location.search
window.location.href
document.URL
document.referrer
document.cookie
window.name
window.postMessage data
localStorage / sessionStorage
Filter bypass techniques
When a WAF or input filter blocks the obvious <script> payload, a few categories of variant
usually reveal whether the filter does real parsing or just pattern-matching: tag/attribute
alternatives that avoid the word "script" (<svg onload=alert(1)>, <img src=x onerror=alert(1)>),
case variation (<ScRiPt>), HTML-entity or double-URL encoding of the payload, and bracket
notation (window['alert'](1)) when parentheses or specific identifiers are blocked. Report
which category defeated the filter and why, rather than a bare payload list.
Prevention
Server-side output encoding
The primary defense — encode output based on context:
# output_encoding.py
# Context-aware output encoding prevents XSS
import html
import json
def encode_html(value: str) -> str:
"""Encode for HTML body context.
Converts: & < > " ' to HTML entities
Use when inserting into: <p>{value}</p>
"""
return html.escape(value, quote=True)
def encode_attribute(value: str) -> str:
"""Encode for HTML attribute context.
Use when inserting into: <input val
Установить xss-detection в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл xss-detection?
Detect and prevent Cross-Site Scripting (XSS) vulnerabilities in web applications. Use when tasks involve testing for reflected, stored, or DOM-based XSS on systems you are authorized to test, scanning with dalfox, reviewing code for dangerous DOM sinks, implementing Content Security Policy, encoding output, sanitizing user input, or auditing web applications for injection vulnerabilities. Covers detection and remediation.
Как установить скилл xss-detection?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xss-detection запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic