天天看點

ysoserial exploit/JRMPClient

ysoserial exploit/JRMPClient

上一篇文章講到,當伺服器反序列化payloads/JRMPListener,即會開啟端口監聽。再使用exploit/JRMPClient子產品發送payload,伺服器就會把payload進行反序列化,進而完成進行攻擊。

調用鍊分析

設定payloads/JRMPListener參數,端口号為1299,debug模式啟動payloads/JRMPListener子產品。

ysoserial exploit/JRMPClient

設定exploit/JRMPClient子產品設定參數為127.0.0.1 1299 CommonsCollections7 "calc"

ysoserial exploit/JRMPClient

啟動exploit/JRMPClient子產品後,服務端的接收到請求,會用TCPTransport的handleMessages來處理請求

ysoserial exploit/JRMPClient

往下看,第277行,把連接配接對象傳入了StreamRemoteCall對象中。

ysoserial exploit/JRMPClient

第278行把StreamRemoteCall對象傳入了serviceCall方法中

ysoserial exploit/JRMPClient

跟進this.serviceCall方法

ysoserial exploit/JRMPClient

前面擷取了ObjID對象,生成Target對象等操作,直接看到101行

ysoserial exploit/JRMPClient

此時的var6是UnicastServerRef,把Target對象(此時的Target對象是DGCImpl類型)和遠端連接配接對象傳入了dispatch方法

ysoserial exploit/JRMPClient

跟進UnicastServerRef的dispatch

ysoserial exploit/JRMPClient

繼續跟進this.oldDispatch

ysoserial exploit/JRMPClient

此時的this.skel是DGCImpl_Skel類型

跟進DGCImpl_Skel的dispatch

ysoserial exploit/JRMPClient

對var3的值做了一個switch判斷,而在case0或者1中都會進行反序列化,進而觸發漏洞調用鍊

ysoserial exploit/JRMPClient

解讀exploit

main方法中拿到傳入的參數,構造出payload,并且傳入了makeDGCCall方法中

ysoserial exploit/JRMPClient

makeDGCCall方法中,objOut.writeInt寫入的值就是前面的var3的值,0或1都行

最後進行了writeObject序列化,flush發送資料到服務端

其實這個payload是在構造DGC請求,然後讓服務端的DGCImpl_Skel處理請求,導緻的反序列化

詳細可以看看這個師傅寫的文章:

https://www.anquanke.com/post/id/225137#h3-3

此篇參考:

https://blog.csdn.net/whatday/article/details/106971531