Commit dbe13c06 authored by Charlie Reis's avatar Charlie Reis Committed by Commit Bot

Add SYSLOGs for renderer kills for cookies, passwords, and localStorage.

This helps system administrators notice when compromised renderer
processes are trying to access cross-site data.

BUG=780106

Change-Id: Ib5b2581376d11ead1947bc385410ddf387dbc1a1
Reviewed-on: https://chromium-review.googlesource.com/989654Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556849}
parent 805ee510
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <utility> #include <utility>
#include "base/syslog_logging.h"
#include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver.h"
#include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
...@@ -329,6 +330,8 @@ bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( ...@@ -329,6 +330,8 @@ bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy(
// about:blank frames as well as data URLs. If that's not the case, kill the // about:blank frames as well as data URLs. If that's not the case, kill the
// renderer, as it might be exploited. // renderer, as it might be exploited.
if (url.SchemeIs(url::kAboutScheme) || url.SchemeIs(url::kDataScheme)) { if (url.SchemeIs(url::kAboutScheme) || url.SchemeIs(url::kDataScheme)) {
SYSLOG(WARNING) << "Killing renderer: illegal password access from about: "
<< " or data: URL. Reason: " << static_cast<int>(reason);
bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason);
return false; return false;
} }
...@@ -337,6 +340,8 @@ bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy( ...@@ -337,6 +340,8 @@ bool ContentPasswordManagerDriver::CheckChildProcessSecurityPolicy(
content::ChildProcessSecurityPolicy::GetInstance(); content::ChildProcessSecurityPolicy::GetInstance();
if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(), if (!policy->CanAccessDataForOrigin(render_frame_host_->GetProcess()->GetID(),
url)) { url)) {
SYSLOG(WARNING) << "Killing renderer: illegal password access. Reason: "
<< static_cast<int>(reason);
bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason); bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(), reason);
return false; return false;
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/syslog_logging.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/download/public/common/download_url_parameters.h" #include "components/download/public/common/download_url_parameters.h"
...@@ -490,8 +491,11 @@ void RenderFrameMessageFilter::SetCookie(int32_t render_frame_id, ...@@ -490,8 +491,11 @@ void RenderFrameMessageFilter::SetCookie(int32_t render_frame_id,
ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance(); ChildProcessSecurityPolicyImpl::GetInstance();
if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { if (!policy->CanAccessDataForOrigin(render_process_id_, url)) {
bad_message::ReceivedBadMessage(this, bad_message::BadMessageReason reason =
bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); bad_message::RFMF_SET_COOKIE_BAD_ORIGIN;
SYSLOG(WARNING) << "Killing renderer: illegal cookie write. Reason: "
<< reason;
bad_message::ReceivedBadMessage(this, reason);
return; return;
} }
...@@ -531,8 +535,11 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, ...@@ -531,8 +535,11 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id,
ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance(); ChildProcessSecurityPolicyImpl::GetInstance();
if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { if (!policy->CanAccessDataForOrigin(render_process_id_, url)) {
bad_message::ReceivedBadMessage(this, bad_message::BadMessageReason reason =
bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); bad_message::RFMF_GET_COOKIES_BAD_ORIGIN;
SYSLOG(WARNING) << "Killing renderer: illegal cookie read. Reason: "
<< reason;
bad_message::ReceivedBadMessage(this, reason);
std::move(callback).Run(std::string()); std::move(callback).Run(std::string());
return; return;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/syslog_logging.h"
#include "content/browser/background_fetch/background_fetch_context.h" #include "content/browser/background_fetch/background_fetch_context.h"
#include "content/browser/blob_storage/blob_registry_wrapper.h" #include "content/browser/blob_storage/blob_registry_wrapper.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h"
...@@ -831,6 +832,7 @@ void StoragePartitionImpl::OpenLocalStorage( ...@@ -831,6 +832,7 @@ void StoragePartitionImpl::OpenLocalStorage(
int process_id = bindings_.dispatch_context(); int process_id = bindings_.dispatch_context();
if (!ChildProcessSecurityPolicy::GetInstance()->CanAccessDataForOrigin( if (!ChildProcessSecurityPolicy::GetInstance()->CanAccessDataForOrigin(
process_id, origin.GetURL())) { process_id, origin.GetURL())) {
SYSLOG(WARNING) << "Killing renderer: illegal localStorage request.";
bindings_.ReportBadMessage("Access denied for localStorage request"); bindings_.ReportBadMessage("Access denied for localStorage request");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment