Security token and handler name leak from window.braveBlockRequests
Brave for iOS sets a JavaScript property on the window object after page scripts run, allowing a malicious page to define it as non-configurable and intercept the secret handler name and security token.
Originally disclosed on HackerOne
- Disclosed after 10 months
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:
- Open https://csrf.jp/2022/brave_token_leak.php
- Push "Attack" button in the page
- Secret handler name and security token is shown on the page
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.
Attachments
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the script that sets window.braveBlockRequests runs after page scripts, so a page can predefine the property as non-configurable and capture the secret values when the legitimate script tries to assign them.
Impact
The impact depends on which bridge is abused; as more features are added, the potential risk could increase.
What the attacker needed
Victim uses Brave for iOS; victim visits a malicious page
How it was found
- Open the provided demonstration page.
- Press the Attack button.
- Observe the secret handler name and security token displayed on the page.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Brave for iOS uses hidden JavaScript function names and secret tokens to let its own web pages talk safely to the app. A malicious website can trick the browser into revealing those secrets by locking the property before Brave sets it. With the secrets, an attacker might be able to use the app's internal features in unintended ways.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.