Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Issue 1825873002: Deal with frame removal by content scripts (Closed)

Created:
4 years, 9 months ago by robwu
Modified:
4 years, 9 months ago
Reviewers:
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@2661
Target Ref:
refs/pending/branch-heads/2661
Project:
chromium
Visibility:
Public.

Description

Deal with frame removal by content scripts Blink and the RenderFrame implementations are currently not prepared to deal with frame detachments in their callbacks. Consequently, extension code (content scripts, chrome.app.window.create) that run arbitrary code in the "document element created" and "document loaded" notifications may result in unexpected invalidation of memory, resulting in a UAF. This patch fixes the bug by moving all code that runs untrusted code from observers to dedicated callbacks, which are only run at a safe point. All document parsers in Blink have been modified to make sure that they still work even when the document creation is interrupted by frame removal. An extensive set of tests for all different kinds of documents, frame removal methods (e.g. synchronously / in mutation events / ...) and injection points (document start/end) have been added to avoid regressions. BUG=582008 Review URL: https://codereview.chromium.org/1642283002 Cr-Commit-Position: refs/heads/master@{#382162} (cherry picked from commit 43ea0649d4b70fdcf3e9fa5c03aee1bbba0b04bb) Committed: https://chromium.googlesource.com/chromium/src/+/9eaa751c333792682865e0705444eca748899637

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+791 lines, -28 lines) Patch
M chrome/browser/extensions/execute_script_apitest.cc View 2 chunks +78 lines, -0 lines 0 comments Download
M chrome/renderer/chrome_content_renderer_client.h View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/renderer/chrome_content_renderer_client.cc View 1 chunk +18 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/chrome_extensions_renderer_client.h View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/chrome_extensions_renderer_client.cc View 1 chunk +10 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/about_blank_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/audio.oga View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/audio.oga.mock-http-headers View 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/audio_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/empty.html View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/empty_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/flag_document_end.js View 1 chunk +7 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/image.png View Binary file 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/image_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/manifest.json View 1 chunk +33 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/no_url_frame.html View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/plain.txt View 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/plugin_file.pdf View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/plugin_file.pdf.mock-http-headers View 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/plugin_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/remove_self.js View 1 chunk +93 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/srcdoc_html_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/srcdoc_text_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/test.html View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/test.js View 1 chunk +241 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/txt_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/executescript/destructive/video.ogv View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/video.ogv.mock-http-headers View 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/video_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/xhtml_document.xhtml View 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/xhtml_document.xhtml.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/xhtml_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/xml_document.xml View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/destructive/xml_frame.html View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/renderer/content_renderer_client.h View 2 chunks +9 lines, -1 line 0 comments Download
M content/renderer/mojo_bindings_controller.h View 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/mojo_bindings_controller.cc View 1 chunk +5 lines, -5 lines 0 comments Download
M content/renderer/render_frame_impl.h View 2 chunks +3 lines, -0 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 2 chunks +32 lines, -0 lines 0 comments Download
M extensions/renderer/dispatcher.h View 1 chunk +6 lines, -0 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 chunk +18 lines, -0 lines 0 comments Download
M extensions/renderer/extension_frame_helper.h View 3 chunks +27 lines, -0 lines 0 comments Download
M extensions/renderer/extension_frame_helper.cc View 3 chunks +41 lines, -1 line 0 comments Download
M extensions/renderer/render_frame_observer_natives.cc View 1 chunk +4 lines, -5 lines 0 comments Download
M extensions/renderer/script_injection_manager.cc View 4 chunks +16 lines, -2 lines 0 comments Download
M extensions/shell/renderer/shell_content_renderer_client.h View 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/shell/renderer/shell_content_renderer_client.cc View 1 chunk +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/ImageDocument.cpp View 5 chunks +15 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/html/MediaDocument.cpp View 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/PluginDocument.cpp View 4 chunks +15 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp View 2 chunks +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentLoader.cpp View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/EmptyClients.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.cpp View 3 chunks +14 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoaderClient.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/FrameLoaderClientImpl.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp View 1 chunk +14 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebFrameClient.h View 2 chunks +10 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
robwu
4 years, 9 months ago (2016-03-23 17:04:57 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
9eaa751c333792682865e0705444eca748899637.

Powered by Google App Engine
This is Rietveld 408576698