简单的 bash 脚本,用于测试你的 WAF 或其他设备对 Log4Shell 攻击字符串及各种绕过方式的防护能力
绕过技巧来自:https://github.com/Puliczek/CVE-2021-44228-PoC-log4j-bypass-words
运行方式:
./cve-2021-44228.sh -t <目标 URL> -c <预期的 HTTP 状态码>
或者使用默认值 https://127.0.0.1 和 403:
./cve-2021-44228.sh
对于每个测试字符串,脚本会通过多种向量将其传入对目标的请求中,例如:
User-Agent 请求头示例输出:
Test String: ${jndi:}
-------------------------------------------------------------
HEADERS: curl -ksg -w "%{http_code}" https://127.0.0.1 -A '${jndi:}'
403
URI: curl -ksg -w "%{http_code}" 'https://127.0.0.1/${jndi:}'
403
Cookies: curl -ksg -w "%{http_code}" https://127.0.0.1 -b 'session=${jndi:}'
403
Query String: curl -ksg -w "%{http_code}" 'https://127.0.0.1/something?session=${jndi:}'
403
POST Data: curl -X POST -ksg -w "%{http_code}" https://127.0.0.1 -d '${jndi:}'
403