WebKit: UXSS via a focus event and a link element CVE-2017-2479 This is somewhat similar to https://crbug.com/663476. Here's a snippet of Container::replaceAllChildren. while (RefPtr child = m_firstChild) { removeBetween(nullptr, child->nextSibling(), *child); notifyChildNodeRemoved(*this, *child); } If the location hash value is set, the page will give focus to the associated element. However, if there is a stylesheet that has not been loaded yet, the focusing will be delayed until the stylesheet gets loaded. The problem is that when the link element linked to the last pending stylesheet is removed from the parent, the notifyChildNodeRemoved function may end up to fire a focus event which runs arbitrary JavaScript code, which can make an iframe(|g| in the PoC) that has an attached frame but has no parent. Tested on Safari 10.0.3(12602.4.8). 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