npx skills add https://github.com/behisecc/vibesec-skill --skill VibeSec-Skill本指南为 Web 应用程序提供了全面的安全编码实践。作为 AI 助手,您的角色是从 漏洞猎手的视角 来审视代码,并在不破坏功能的前提下,使应用程序 尽可能安全。
核心原则:
当用户可以访问超出其预期权限的资源或执行操作时,就会发生访问控制漏洞。
对于 每个需要身份验证的数据点和操作:
* 每个用户必须只能访问/修改自己的数据
* 任何用户都不应访问其他用户或组织的数据
* 始终在数据层验证所有权,而不仅仅是在路由层
2. 使用 UUID 而非顺序 ID
* 使用 UUIDv4 或类似的不可猜测的标识符
* 例外:仅在用户明确请求时使用顺序 ID
3. 账户生命周期处理
* 当用户从组织中移除时:立即撤销所有访问令牌和会话
* 当账户被删除/停用时:使所有活动会话和 API 密钥失效
* 实施令牌吊销列表或带有刷新机制的短期令牌
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# Pseudocode for secure resource access
function getResource(resourceId, currentUser):
resource = database.find(resourceId)
if resource is null:
return 404 # Don't reveal if resource exists
if resource.ownerId != currentUser.id:
if not currentUser.hasOrgAccess(resource.orgId):
return 404 # Return 404, not 403, to prevent enumeration
return resource
用户可直接或间接控制的每个输入都必须针对 XSS 进行清理。
直接输入:
间接输入:
常被忽视的:
* HTML 上下文:HTML 实体编码(`<` → `<`)
* JavaScript 上下文:JavaScript 转义
* URL 上下文:URL 编码
* CSS 上下文:CSS 转义
* 使用框架内置的转义功能(React 的 JSX、Vue 的 {{ }} 等)
2. 内容安全策略
Content-Security-Policy:
default-src 'self';
script-src 'self';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
font-src 'self';
connect-src 'self' https://api.yourdomain.com;
frame-ancestors 'none';
base-uri 'self';
form-action 'self';
* 避免对脚本使用 `'unsafe-inline'` 和 `'unsafe-eval'`
* 必要时对内联脚本使用 nonce 或哈希值
* 报告违规:`report-uri /csp-report`
3. 输入清理
* 使用成熟的库(针对 HTML 使用 DOMPurify)
* 为富文本设置允许的标签/属性白名单
* 剥离或编码危险模式
4. 附加头部
* `X-Content-Type-Options: nosniff`
* `X-Frame-Options: DENY`(或使用 CSP 的 frame-ancestors)
每个会改变状态的端点都必须受到保护,以防 CSRF 攻击。
需要身份验证的操作:
身份验证前的操作:
* 生成加密随机的令牌
* 将令牌与用户会话绑定
* 在每个会改变状态的请求上进行验证
* 登录后重新生成(防止会话固定组合攻击)
2. SameSite Cookie
Set-Cookie: session=abc123; SameSite=Strict; Secure; HttpOnly
* `Strict`:Cookie 从不跨站发送(安全性最佳)
* `Lax`:Cookie 在顶级导航时发送(良好的平衡)
* 始终与 CSRF 令牌结合使用以实现纵深防御
3. 双重提交 Cookie 模式
* 在 Cookie 和请求体/头部中都发送 CSRF 令牌
* 服务器验证它们是否匹配
任何密钥或敏感信息都不应被客户端代码访问到。
API 密钥和机密信息:
敏感用户数据:
基础设施详情:
.env 文件中任何接受 URL 进行重定向的端点都必须受到保护,以防开放重定向攻击。
白名单验证
allowed_domains = ['yourdomain.com', 'app.yourdomain.com']
function isValidRedirect(url): parsed = parseUrl(url) return parsed.hostname in allowed_domains
仅限相对 URL
* 仅接受路径(例如 `/dashboard`),而非完整的 URL
* 验证路径以 `/` 开头且不包含 `//`
3. 间接引用
* 使用映射而非原始 URL:`?redirect=dashboard` → 查找映射到 `/dashboard`
| 技术 | 示例 | 原因 |
|---|---|---|
| @ 符号 | https://legit.com@evil.com | 浏览器导航到 evil.com,并以 legit.com 作为用户名 |
| 子域名滥用 | https://legit.com.evil.com | evil.com 拥有该子域名 |
| 协议技巧 | javascript:alert(1) | 通过重定向进行 XSS |
| 双重 URL 编码 | %252f%252fevil.com | 双重解码后变为 //evil.com |
| 反斜杠 | https://legit.com\@evil.com | 某些解析器将 \ 规范化为 / |
| 空字节 | https://legit.com%00.evil.com | 某些解析器在空字节处截断 |
| 制表符/换行符 | https://legit.com%09.evil.com | 空白字符混淆 |
| Unicode 规范化 | https://legіt.com(西里尔字母 і) | IDN 同形异义词攻击 |
| Data URL | data:text/html,<script>... | 直接执行负载 |
| 协议相对 | //evil.com | 使用当前页面的协议 |
| 片段滥用 | https://legit.com#@evil.com | 不同库的解析方式不同 |
任何服务器根据用户提供或影响的 URL 发起请求的功能都必须受到保护。
* 仅允许向预先批准的域名发起请求
* 为集成维护严格的白名单
2. 网络分段
* 在隔离的网络中运行 URL 获取服务
* 阻止访问内部网络、云元数据
| 技术 | 示例 | 描述 |
|---|---|---|
| 十进制 IP | http://2130706433 | 127.0.0.1 的十进制表示 |
| 八进制 IP | http://0177.0.0.1 | 八进制表示 |
| 十六进制 IP | http://0x7f.0x0.0x0.0x1 | 十六进制表示 |
| IPv6 本地主机 | http://[::1] | IPv6 环回地址 |
| IPv6 映射的 IPv4 | http://[::ffff:127.0.0.1] | IPv4 映射的 IPv6 |
| 短 IPv6 | http://[::] | 全零 |
| DNS 重绑定 | 攻击者的 DNS 返回内部 IP | 第一次请求解析为外部 IP,第二次解析为内部 IP |
| CNAME 指向内部 | 攻击者域名 CNAME 指向内部 | DNS 指向内部主机名 |
| URL 解析器混淆 | http://attacker.com#@internal | 不同的解析行为 |
| 重定向链 | 外部 URL 重定向到内部 | 小心处理重定向 |
| IPv6 作用域 ID | http://[fe80::1%25eth0] | 接口作用域的 IPv6 |
| 罕见的 IP 格式 | http://127.1 | 简化的 IP 表示法 |
阻止访问云元数据端点:
169.254.169.254metadata.google.internal、169.254.169.254、http://metadata169.254.169.254169.254.169.254文件上传必须验证类型、内容和大小,以防止各种攻击。
1. 文件类型验证
2. 文件内容验证
3. 文件大小限制
| 攻击 | 描述 | 预防 |
|---|---|---|
| 扩展名绕过 | shell.php.jpg | 检查完整扩展名,使用白名单 |
| 空字节 | shell.php%00.jpg | 清理文件名,检查空字节 |
| 双重扩展名 | shell.jpg.php | 仅允许单一扩展名 |
| MIME 类型欺骗 | 将 Content-Type 设置为 image/jpeg | 验证魔数字节 |
| 魔数字节注入 | 在恶意文件前添加有效的魔数字节 | 检查整个文件结构,而不仅仅是头部 |
| 多态文件 | 文件同时是有效的 JPEG 和 JavaScript | 按预期类型解析文件,如果无效则拒绝 |
| 包含 JavaScript 的 SVG | <svg onload="alert(1)"> | 清理 SVG 或完全禁止 |
| 通过文件上传进行 XXE | 恶意的 DOCX、XLSX(本质是 XML) | 在解析器中禁用外部实体 |
| ZIP 路径遍历 | 存档中的 ../../../etc/passwd | 验证提取出的路径 |
| ImageMagick 漏洞利用 | 特制的图像 | 保持 ImageMagick 更新,使用 policy.xml |
| 文件名注入 | 文件名中的 ; rm -rf / | 清理文件名,使用随机名称 |
| 内容类型混淆 | 浏览器 MIME 嗅探 | 设置 X-Content-Type-Options: nosniff |
| 类型 | 魔数字节(十六进制) |
|---|---|
| JPEG | FF D8 FF |
| PNG | 89 50 4E 47 0D 0A 1A 0A |
| GIF | 47 49 46 38 |
25 50 44 46 | |
| ZIP | 50 4B 03 04 |
| DOCX/XLSX | 50 4B 03 04(基于 ZIP) |
Content-Disposition: attachment(强制下载)
* X-Content-Type-Options: nosniff
* Content-Type 与实际文件类型匹配当用户输入未经适当处理就合并到 SQL 查询中时,就会发生 SQL 注入。
1. 参数化查询(预编译语句) — 主要防御措施
-- VULNERABLE
query = "SELECT * FROM users WHERE id = " + userId
-- SECURE
query = "SELECT * FROM users WHERE id = ?"
execute(query, [userId])
2. 使用 ORM
3. 输入验证
xp_cmdshell当 XML 解析器处理用户提供的 XML 中的外部实体引用时,就会发生 XXE 漏洞。
直接 XML 输入:
间接 XML:
Java:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setExpandEntityReferences(false);
Python (lxml):
from lxml import etree
parser = etree.XMLParser(resolve_entities=False, no_network=True)
# Or use defusedxml library
PHP:
libxml_disable_entity_loader(true);
// Or use XMLReader with proper settings
Node.js:
// Use libraries that disable DTD processing by default
// If using libxmljs, set { noent: false, dtdload: false }
.NET:
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Prohibit;
settings.XmlResolver = null;
当用户输入控制文件路径,允许访问预期目录之外的文件时,就会发生路径遍历漏洞。
# VULNERABLE
file_path = "/uploads/" + user_input
file_path = base_dir + request.params['file']
template = "templates/" + user_provided_template
1. 避免在路径中使用用户输入
# Instead of using user input directly
# Use indirect references
files = {'report': '/reports/q1.pdf', 'invoice': '/invoices/2024.pdf'}
file_path = files.get(user_input) # Returns None if invalid
2. 规范化和验证
import os
def safe_join(base_directory, user_path):
# Ensure base is absolute and normalized
base = os.path.abspath(os.path.realpath(base_directory))
# Join and then resolve the result
target = os.path.abspath(os.path.realpath(os.path.join(base, user_path)))
# Ensure the commonpath is the base directory
if os.path.commonpath([base, target]) != base:
raise ValueError("Error!")
return target
3. 输入清理
.. 序列/、C:)在所有响应中包含以下头部:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Security-Policy: [see XSS section]
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Cache-Control: no-store (for sensitive pages)
JWT 配置错误可能导致完全的身份验证绕过和令牌伪造。
| 漏洞 | 预防措施 |
|---|---|
alg: none 攻击 | 始终在服务器端验证算法,拒绝 none |
| 算法混淆 | 明确指定预期的算法,切勿从令牌推导 |
| 弱 HMAC 密钥 | 使用 256+ 位的加密随机密钥 |
| 缺少过期时间 | 始终设置 exp 声明 |
| 令牌存储在 localStorage | 存储在 httpOnly、Secure、SameSite=Strict 的 Cookie 中,切勿存储在 localStorage |
// 1. SIGNING
// Always use environment variables for secrets
const secret = process.env.JWT_SECRET;
const token = jwt.sign({
sub: userId,
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + (15 * 60), // 15 mins (Short-lived)
jti: crypto.randomUUID() // Unique ID for revocation/blacklisting
}, secret, {
algorithm: 'HS256'
});
// 2. SENDING (Cookie Best Practices)
// Protect against XSS and CSRF
res.cookie('token', token, {
httpOnly: true,
secure: true,
sameSite: 'strict'
});
// 3. VERIFYING
// CRITICAL: Whitelist the allowed algorithm
jwt.verify(token, secret, { algorithms: ['HS256'] }, (err, decoded) => {
if (err) {
// Handle invalid token
}
// Trust the payload
});
alg: noneexp 声明接受未过滤的请求体可能导致权限提升。
// VULNERABLE — user can set { role: "admin" } in request body
User.update(req.body)
// SECURE — whitelist allowed fields
const allowed = ['name', 'email', 'avatar']
const updates = pick(req.body, allowed)
User.update(updates)
这适用于任何 ORM/框架——始终明确定义请求可以修改哪些字段。
| 漏洞 | 预防措施 |
|---|---|
| 生产环境中的内省 | 在生产环境中禁用内省。 |
| 查询深度攻击 | 实现查询深度限制(例如,最多 10 层)。 |
| 查询复杂度攻击 | 计算并强制执行严格的查询成本限制。 |
| 批处理攻击 | 限制单个请求允许的操作数量。 |
const server = new ApolloServer({
introspection: process.env.NODE_ENV !== 'production',
validationRules: [
depthLimit(10),
costAnalysis({ maximumCost: 1000 })
]
})
生成代码时,始终:
当不确定时,选择限制性更强/更安全的选项,并在注释中记录安全考虑。
每周安装次数
30
仓库
GitHub 星标数
627
首次出现
2026年2月18日
安全审计
安装于
opencode28
gemini-cli28
codex28
github-copilot27
cursor27
amp25
This guide provides comprehensive secure coding practices for web applications. As an AI assistant, your role is to approach code from a bug hunter's perspective and make applications as secure as possible without breaking functionality.
Key Principles:
Access control vulnerabilities occur when users can access resources or perform actions beyond their intended permissions.
For every data point and action that requires authentication:
User-Level Authorization
Use UUIDs Instead of Sequential IDs
Account Lifecycle Handling
# Pseudocode for secure resource access
function getResource(resourceId, currentUser):
resource = database.find(resourceId)
if resource is null:
return 404 # Don't reveal if resource exists
if resource.ownerId != currentUser.id:
if not currentUser.hasOrgAccess(resource.orgId):
return 404 # Return 404, not 403, to prevent enumeration
return resource
Every input controllable by the user—whether directly or indirectly—must be sanitized against XSS.
Direct Inputs:
Indirect Inputs:
Often Overlooked:
Output Encoding (Context-Specific)
< → <)Content Security Policy (CSP)
Content-Security-Policy:
default-src 'self';
script-src 'self';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
font-src 'self';
connect-src 'self' https://api.yourdomain.com;
frame-ancestors 'none';
base-uri 'self';
form-action 'self';
'unsafe-inline' and 'unsafe-eval' for scriptsreport-uri /csp-reportEvery state-changing endpoint must be protected against CSRF attacks.
Authenticated Actions:
Pre-Authentication Actions:
CSRF Tokens
SameSite Cookies
Set-Cookie: session=abc123; SameSite=Strict; Secure; HttpOnly
Strict: Cookie never sent cross-site (best security)Lax: Cookie sent on top-level navigations (good balance)Double Submit Cookie Pattern
No secrets or sensitive information should be accessible to client-side code.
API Keys and Secrets:
Sensitive User Data:
Infrastructure Details:
.env filesAny endpoint accepting a URL for redirection must be protected against open redirect attacks.
Allowlist Validation
allowed_domains = ['yourdomain.com', 'app.yourdomain.com']
function isValidRedirect(url):
parsed = parseUrl(url)
return parsed.hostname in allowed_domains
Relative URLs Only
/dashboard) not full URLs/ and doesn't contain //Indirect References
?redirect=dashboard → lookup to /dashboard| Technique | Example | Why It Works |
|---|---|---|
| @ symbol | https://legit.com@evil.com | Browser navigates to evil.com with legit.com as username |
| Subdomain abuse | https://legit.com.evil.com | evil.com owns the subdomain |
| Protocol tricks | javascript:alert(1) | XSS via redirect |
| Double URL encoding | %252f%252fevil.com | Decodes to //evil.com after double decode |
| Backslash |
Any functionality where the server makes requests to URLs provided or influenced by users must be protected.
Allowlist Approach (Preferred)
Network Segmentation
| Technique | Example | Description |
|---|---|---|
| Decimal IP | http://2130706433 | 127.0.0.1 as decimal |
| Octal IP | http://0177.0.0.1 | Octal representation |
| Hex IP | http://0x7f.0x0.0x0.0x1 | Hexadecimal |
| IPv6 localhost | http://[::1] | IPv6 loopback |
| IPv6 mapped IPv4 | http://[::ffff:127.0.0.1] |
Block access to cloud metadata endpoints:
169.254.169.254metadata.google.internal, 169.254.169.254, http://metadata169.254.169.254169.254.169.254File uploads must validate type, content, and size to prevent various attacks.
1. File Type Validation
2. File Content Validation
3. File Size Limits
| Attack | Description | Prevention |
|---|---|---|
| Extension bypass | shell.php.jpg | Check full extension, use allowlist |
| Null byte | shell.php%00.jpg | Sanitize filename, check for null bytes |
| Double extension | shell.jpg.php | Only allow single extension |
| MIME type spoofing | Set Content-Type to image/jpeg | Validate magic bytes |
| Magic byte injection | Prepend valid magic bytes to malicious file | Check entire file structure, not just header |
| Polyglot files | File valid as both JPEG and JavaScript | Parse file as expected type, reject if invalid |
| Type | Magic Bytes (hex) |
|---|---|
| JPEG | FF D8 FF |
| PNG | 89 50 4E 47 0D 0A 1A 0A |
| GIF | 47 49 46 38 |
25 50 44 46 | |
| ZIP | 50 4B 03 04 |
| DOCX/XLSX | 50 4B 03 04 (ZIP-based) |
Content-Disposition: attachment (forces download)X-Content-Type-Options: nosniffContent-Type matching actual file typeSQL injection occurs when user input is incorporated into SQL queries without proper handling.
1. Parameterized Queries (Prepared Statements) — PRIMARY DEFENSE
-- VULNERABLE
query = "SELECT * FROM users WHERE id = " + userId
-- SECURE
query = "SELECT * FROM users WHERE id = ?"
execute(query, [userId])
2. ORM Usage
3. Input Validation
xp_cmdshell in SQL ServerXXE vulnerabilities occur when XML parsers process external entity references in user-supplied XML.
Direct XML Input:
Indirect XML:
Java:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setExpandEntityReferences(false);
Python (lxml):
from lxml import etree
parser = etree.XMLParser(resolve_entities=False, no_network=True)
# Or use defusedxml library
PHP:
libxml_disable_entity_loader(true);
// Or use XMLReader with proper settings
Node.js:
// Use libraries that disable DTD processing by default
// If using libxmljs, set { noent: false, dtdload: false }
.NET:
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Prohibit;
settings.XmlResolver = null;
Path traversal vulnerabilities occur when user input controls file paths, allowing access to files outside intended directories.
# VULNERABLE
file_path = "/uploads/" + user_input
file_path = base_dir + request.params['file']
template = "templates/" + user_provided_template
1. Avoid User Input in Paths
# Instead of using user input directly
# Use indirect references
files = {'report': '/reports/q1.pdf', 'invoice': '/invoices/2024.pdf'}
file_path = files.get(user_input) # Returns None if invalid
2. Canonicalization and Validation
import os
def safe_join(base_directory, user_path):
# Ensure base is absolute and normalized
base = os.path.abspath(os.path.realpath(base_directory))
# Join and then resolve the result
target = os.path.abspath(os.path.realpath(os.path.join(base, user_path)))
# Ensure the commonpath is the base directory
if os.path.commonpath([base, target]) != base:
raise ValueError("Error!")
return target
3. Input Sanitization
.. sequences/, C:)Include these headers in all responses:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Security-Policy: [see XSS section]
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Cache-Control: no-store (for sensitive pages)
JWT misconfigurations can lead to full authentication bypass and token forgery.
| Vulnerability | Prevention |
|---|---|
alg: none attack | Always verify algorithm server-side, reject none |
| Algorithm confusion | Explicitly specify expected algorithm, never derive from token |
| Weak HMAC secrets | Use 256+ bit cryptographically random secrets |
| Missing expiration | Always set exp claim |
| Token in localStorage | Store in httpOnly, Secure, SameSite=Strict cookies, never localStorage |
// 1. SIGNING
// Always use environment variables for secrets
const secret = process.env.JWT_SECRET;
const token = jwt.sign({
sub: userId,
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + (15 * 60), // 15 mins (Short-lived)
jti: crypto.randomUUID() // Unique ID for revocation/blacklisting
}, secret, {
algorithm: 'HS256'
});
// 2. SENDING (Cookie Best Practices)
// Protect against XSS and CSRF
res.cookie('token', token, {
httpOnly: true,
secure: true,
sameSite: 'strict'
});
// 3. VERIFYING
// CRITICAL: Whitelist the allowed algorithm
jwt.verify(token, secret, { algorithms: ['HS256'] }, (err, decoded) => {
if (err) {
// Handle invalid token
}
// Trust the payload
});
alg: none rejectedexp claim always set and validatedAccepting unfiltered request bodies can lead to privilege escalation.
// VULNERABLE — user can set { role: "admin" } in request body
User.update(req.body)
// SECURE — whitelist allowed fields
const allowed = ['name', 'email', 'avatar']
const updates = pick(req.body, allowed)
User.update(updates)
This applies to any ORM/framework — always explicitly define which fields a request can modify.
| Vulnerability | Prevention |
|---|---|
| Introspection in production | Disable introspection in production environments. |
| Query depth attack | Implement query depth limiting (e.g., maximum of 10 levels). |
| Query complexity attack | Calculate and enforce strict query cost limits. |
| Batching attack | Limit the number of operations allowed per single request. |
const server = new ApolloServer({
introspection: process.env.NODE_ENV !== 'production',
validationRules: [
depthLimit(10),
costAnalysis({ maximumCost: 1000 })
]
})
When generating code, always:
When unsure, choose the more restrictive/secure option and document the security consideration in comments.
Weekly Installs
30
Repository
GitHub Stars
627
First Seen
Feb 18, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode28
gemini-cli28
codex28
github-copilot27
cursor27
amp25
浏览器自动化策略指南:何时及如何使用实时浏览器会话进行网页调试与研究
43,400 周安装
Datadog自动化监控:通过Rube MCP与Composio实现指标、日志、仪表板管理
69 周安装
Intercom自动化指南:通过Rube MCP与Composio实现客户支持对话管理
69 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
Input Sanitization
Additional Headers
X-Content-Type-Options: nosniffX-Frame-Options: DENY (or use CSP frame-ancestors)https://legit.com\@evil.com |
Some parsers normalize \ to / |
| Null byte | https://legit.com%00.evil.com | Some parsers truncate at null |
| Tab/newline | https://legit.com%09.evil.com | Whitespace confusion |
| Unicode normalization | https://legіt.com (Cyrillic і) | IDN homograph attack |
| Data URLs | data:text/html,<script>... | Direct payload execution |
| Protocol-relative | //evil.com | Uses current page's protocol |
| Fragment abuse | https://legit.com#@evil.com | Parsed differently by different libraries |
| IPv4-mapped IPv6 |
| Short IPv6 | http://[::] | All zeros |
| DNS rebinding | Attacker's DNS returns internal IP | First request resolves to external IP, second to internal |
| CNAME to internal | Attacker domain CNAMEs to internal | DNS points to internal hostname |
| URL parser confusion | http://attacker.com#@internal | Different parsing behaviors |
| Redirect chains | External URL redirects to internal | Follow redirects carefully |
| IPv6 scope ID | http://[fe80::1%25eth0] | Interface-scoped IPv6 |
| Rare IP formats | http://127.1 | Shortened IP notation |
| SVG with JavaScript | <svg onload="alert(1)"> | Sanitize SVG or disallow entirely |
| XXE via file upload | Malicious DOCX, XLSX (which are XML) | Disable external entities in parser |
| ZIP slip | ../../../etc/passwd in archive | Validate extracted paths |
| ImageMagick exploits | Specially crafted images | Keep ImageMagick updated, use policy.xml |
| Filename injection | ; rm -rf / in filename | Sanitize filenames, use random names |
| Content-type confusion | Browser MIME sniffing | Set X-Content-Type-Options: nosniff |