Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    86375813

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

0x00 前言關於Tomcat Filter型內存馬的介紹資料有很多,但是Jetty Filter型內存馬的資料很少,本文將要參照Tomcat Filter型內存馬的設計思路,介紹Jetty Filter型內存馬的實現思路和細節。

0x01 簡介本文將要介紹以下內容:

Jetty調試環境搭建

實現思路

實現代碼

Zimbra環境下的Filter型內存馬

0x02 Jetty調試環境搭建1.png

0x03 實現思路相關參考資料:

https://github.com/feihong-cs/memShell/blob/master/src/main/java/com/memshell/jetty/FilterBasedWithoutRequest.java

https://blog.csdn.net/xdeclearn/article/details/125969653

參考資料1是通過JmxMBeanServer獲得webappclassloaer,進而通過反射調用相關方法添加一個Filter

參考資料2是通過Thread獲得webappclassloaer,進而通過反射調用相關方法添加Servlet型內存馬的方法

我在實際測試過程中,發現通過JmxMBeanServer獲得webappclassloaer的方法不夠通用,尤其是無法在Zimbra環境下使用

因此,最終改為使用Thread獲得webappclassloaer,進而通過反射調用相關方法添加Filter型內存馬。

0x04 實現代碼1.添加FilterJetty下可用的完整代碼如下:

2.png 3.png 4.png 5.png 6.png

2.枚舉Filter 7.png 8.png(2)通過Thread獲得webappclassloaer,通過反射讀取_filters屬性來枚舉Filter

9.png0x05 Zimbra環境下的Filter型內存馬在Zimbra環境下,思路同樣為使用Thread獲得webappclassloaer,進而通過反射調用相關方法添加Filter型內存馬

但是由於Zimbra存在多個名為WebAppClassLoader的線程,所以在添加Filter時需要修改判斷條件,避免提前退出,在實例代碼的基礎上直接修改即可

0x06 利用思路Filter型內存馬的優點是不需要寫入文件,但是會在服務重啟時失效

0x07 小結本文介紹了Jetty Filter型內存馬的實現思路和細節,給出了可供測試的代碼,分享了Zimbra環境的利用方法。