Skip to content

Commit af79355

Browse files
Check that the renderer can access files it claims are part of a drag.
BUG=123054 TEST=manual that nothing broke Review URL: http://codereview.chromium.org/10302006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135252 0039d316-1c4b-4281-b951-d872f2087c98
1 parent 1c26de1 commit af79355

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

content/browser/renderer_host/render_view_host_impl.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,21 @@ void RenderViewHostImpl::OnMsgStartDragging(
13421342
if (!filtered_data.url.SchemeIs(chrome::kJavaScriptScheme))
13431343
FilterURL(policy, GetProcess()->GetID(), true, &filtered_data.url);
13441344
FilterURL(policy, GetProcess()->GetID(), false, &filtered_data.html_base_url);
1345+
// Filter out any paths that the renderer didn't have access to. This prevents
1346+
// the following attack on a malicious renderer:
1347+
// 1. StartDragging IPC sent with renderer-specified filesystem paths that it
1348+
// doesn't have read permissions for.
1349+
// 2. We initiate a native DnD operation.
1350+
// 3. DnD operation immediately ends since mouse is not held down. DnD events
1351+
// still fire though, which causes read permissions to be granted to the
1352+
// renderer for any file paths in the drop.
1353+
filtered_data.filenames.clear();
1354+
for (std::vector<string16>::const_iterator it = drop_data.filenames.begin();
1355+
it != drop_data.filenames.end(); ++it) {
1356+
FilePath path(FilePath::FromUTF8Unsafe(UTF16ToUTF8(*it)));
1357+
if (policy->CanReadFile(GetProcess()->GetID(), path))
1358+
filtered_data.filenames.push_back(*it);
1359+
}
13451360
view->StartDragging(filtered_data, drag_operations_mask, image, image_offset);
13461361
}
13471362

0 commit comments

Comments
 (0)