Unsafe handling of protocol handlers
Brave browser on macOS handles protocol handlers such as ssh:// and telnet:// without proper confirmation, unlike other browsers. An attacker could trick a user into opening an external app or automatically initiate an SSH session via an iframe, potentially leaking the user's IP address and username.
- Triaged in 42 hours
- Fixed in 16 days
- Paid in 16 days
- Disclosed after 3 months
Summary:
Brave browser (macOS) handles protocol handlers in unsafe way (and differently from other browsers). Key differences between protocol handlers handling in Brave and other browsers:
Open external app vs Open "Terminal"
Brave only asks about opening external app. Other browsers (e.g. Chrome) asks about opening a specific app.
Try to open a ssh:// link in Chrome: browser opens a popup with a question similar to "Do you want to open "Terminal"?"
Opening ssh:// in Brave results in a popup with a content similar to : "Do you want to open external app for ssh://"
Sorry, I didn't remember actual popups' content + I've got RU version
Impact
User doesn't know which app will be opened after allowing to open an external app. That means it easier for attacker to trick user to open an external app in Brave compared to other browsers.
This applies to all protocol handlers in Brave browser, not only ssh:// or telnet://.
ssh:// and telnet:// without confirmation
In Chrome/Safari/FF, after opening Terminal using ssh:// link, Terminal shows an alert with a text similar to "Do you want to initiate ssh session with *example.com?".
Next things worth noting:
- There is an additional confirmation dialog in Terminal while navigating to ssh:// through browser.
- Default answer in the confirmation dialog is negative. ("Don't connect")
- example.com: user sees exact host
Brave browser initiates ssh:// and telnet:// sessions automatically after opening the external app (Terminal) without confirmation messages.
If browser handles ssh:// URLs by default, any iframe with src="ssh://example.com" could automatically start ssh session without user's interaction. Additionally, it's possible to silently initiate ssh connection, by running alert() on window.onblur event - Terminal isn't visible in this case.
Same applies to telnet:// too.
Version:
Brave 0.22.810 V8 6.7.288.43 rev 8f30eeb Muon 7.0.6 OS Release 17.6.0 Update Channel Release OS Architecture x64 OS Platform macOS Node.js 7.9.0 Brave Sync v1.4.2 libchromiumcontent 67.0.3396.71
Steps To Reproduce:
-
Open exploit.html
-
Click
ssh://google.comlink -
Allow opening an external app
-
Terminal launched without additional alerts/warnings
-
Open
exploit.html -
Click
ssh://google.comlink -
Remember
ssh://(set as default handler) -
Add iframe <-- Any iframe could automatically trigger ssh connection without confirmation
Impact
-
No confirmation message for external apps. - definitely bad behavior. Brave handles all protocol handlers in this way, not only
ssh://||telnet:// -
SSH connection without confirmation - ssh sessions leak important user info: IP, username, etc. Also, it opens a wider attack surface.
-
If
ssh://is allowed to open by default (i.e. "remembered"): Any iframe could automatically trigger ssh session. It's possible to start ssh session without user's notice by callingalert()after navigation tossh:// -
Terminal doesn't alert hostname in confirmation dialog (because of no confirmation dialog), so it's possible to spoof host to which user connects.
Example/Attack scenario for #4:
- link points to
ssh://abc.xyzand the text of the link is "Connect to google.com". - User clicks and initiates connection to abc.xyz.
- In most cases host will be visible in terminal tab's header. However, because ssh command isn't printed in terminal output while navigating through
ssh://URLs, it's ease to not notice real host name and continue treat it asgoogle.com.
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 browser does not display the specific application name in the confirmation prompt and does not enforce a second confirmation from the terminal before initiating ssh:// or telnet:// sessions.
Impact
An attacker could trick a user into opening an unintended external app or silently initiate an SSH connection, leaking the user's IP address and username and expanding the attack surface.
What the attacker needed
Brave browser on macOS; User clicks a crafted link or visits a page with an iframe; ssh:// or telnet:// set as default handler (for automatic…
The fix
The browser should name the specific app in the prompt and confirm before starting ssh:// or telnet:// sessions.
How it was found
- Open exploit.html
- Click the ssh://google.com link
- Allow opening an external app
- Terminal launches without additional alerts or warnings
- Set ssh:// as the default handler
- Add an iframe with src set to an ssh:// URL to automatically trigger a connection
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.
When you click a link like ssh://example.com, your browser asks if you want to open an external program. Brave only asks 'open external app?' without saying which app, and then it starts the connection without a second warning. Other browsers show which app will open and the terminal asks for confirmation. This makes it easier for an attacker to trick you into connecting to a malicious server.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.