Navigation to restricted origins via "Open in new tab"
The browser allowed navigation from a web page to a local file URL via the 'Open in new tab' context menu action, enabling execution of a downloaded HTML file on the local filesystem. An attacker could learn the victim's OS username via an ssh:// link and control the downloaded file name, then craft a file:// URL to execute the file.
- Triaged in 48 hours
- Fixed in 2 months
- Paid in 16 days
- Disclosed after 4 months
Summary:
It's possible to open links pointing to file:/// origin from web pages using "Open link in a new tab" in context menu.
https://hackerone.com/bugs?report_id=369185 shows unsafe
ssh://protocol handling, which leads to information leak using ssh(OS username and etc.). The vulnerability is highly available, so it's possible to leverage it.
As of, we could get username, it's easy to predict path of the downloaded file:
file:///Users/${USERNAME_FROM_SSH}/Download/${DOWNLOADED_FILE_NAME}
USERNAME_FROM_SSH
When user initiates ssh session through browser, it's equal to running ssh [email protected]. So the host which receives connection request knows user's OS username.
DOWNLOADED_FILE_NAME
DOWNLOADED_FILE_NAME is download attribute of the link. That means, it's under the attacker's control.
Products affected:
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 OS: macOS 10.13.5 17F77 x86_64
Steps To Reproduce:
Live PoC: https://brave-download-execute-local-fs-ifhsmtsbik.now.sh
I could provide a PoC with "ssh step", if it could increase a bounty. Currently, OS username is hardcoded in
exploit.html. Insert your OS username to run the exploit. (e.g. using devtools or locally)
- Webpage requests navigation to
ssh://- user agrees. - Navigation happens, attacker's host received ssh connection request. Attacker knows user's OS username.
- Webpage asks to download the file. Let's name it
file-load.html. Downloading happens. - User opens a link(using "Open in a new tab") which points to
file:///Users/${USERNAME_FROM_SSH}/Download/file-load.html - Navigation happens, downloaded HTML file executes on local file system.
Screencast attached.
Impact
Navigation from web pages to file:/// and executing downloaded (from the web) files on local filesystem is definitely a vulnerability, which additionally opens a wider attack surface for an attacker.
Bypassing SOP onfile:///origin could lead to a full-chain exploit 😈.
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 browser did not restrict navigation to file:/// URLs from web content when using the 'Open in new tab' context menu action.
Impact
An attacker could execute a downloaded HTML file on the local filesystem, which may lead to further attacks.
What the attacker needed
Victim uses Brave browser; victim agrees to ssh:// navigation; victim downloads a file; victim opens a link in new tab
How it was found
- Webpage requests navigation to ssh:// and user agrees.
- Attacker's host receives ssh connection request and learns user's OS username.
- Webpage asks to download a file named file-load.html.
- User opens a link using 'Open in a new tab' pointing to file:///Users/${USERNAME_FROM_SSH}/Download/file-load.html.
- Navigation happens and the downloaded HTML file executes on local file system.
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.
A web page could trick the browser into opening a local file (one already downloaded) in a new tab, and that file could run code on the computer. The attacker first learns the victim's username by making the browser connect to an SSH server they control, then uses that to guess the file's location.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.