HexBrain

Brave Software · Report #1668723

Security token and handler name leak from window.braveBlockRequests

Validstatus
highseverity
12upvotes
22 Jun 2023disclosed

How it was found

Summary:

Brave for iOS protects privileged JS to native bridges by using random JavaScript handler names and security tokens. However, by altering window.braveBlockRequests property from scripts on the web page, these secret values can be stolen.

To be specific, braveBlockRequests property is set after the execution of the script on the page. Thus, by setting the malicious property as an immutable property from the page beforehand as shown below, it is possible to prevent overwriting by the legitimate property.

Object.defineProperty(window, "braveBlockRequests", {
    enumerable: false,
    configurable: false,
    writable: false,
    value: function(args) { window.args = args } // Steal handler name and token here
});

Products affected:

  • Brave for iOS Version 1.41.1 (22.7.27.20) with the default settings

Steps To Reproduce:

Supporting Material/References:

  • Attached is a movie file that demonstrate the above steps to reproduce.

Impact

The impact depends on which bridge is abused. As further features are implemented in the Brave, its potential risk tends to be increased.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original