Firefox Lite Address Bar Spoofing with Secure Lock using Back Button or Forward Button
Firefox Lite updated the address bar to the previous history entry before the page navigation actually completed. By using an onbeforeunload handler to keep the user on the current page after pressing back, an attacker could make the address bar show a different site (with a secure lock) than the one actually displayed.
Originally disclosed on Mozilla
- Fixed in 2 months
- Paid in 2 months
- Disclosed after 2 months
Created attachment 9199373 backspoof.bundle.html
After pressing the back button, Firefox Lite was too early to set the address bar to the previous webBackForwardList. Therefore the address bar has been changed earlier than the the actual page (out of sync).
The vulnerable code is at app/src/main/java/org/mozilla/focus/fragment/BrowserFragment.kt:1005 with following code:
private fun goBack() {
val currentTab = sessionManager.focusSession
if (currentTab != null) {
val current = currentTab.engineSession?.tabView
// The Session.canGoBack property is mainly for UI display purpose and is only sampled
// at onNavigationStateChange which is called at onPageFinished, onPageStarted and
// onReceivedTitle. We do some sanity check here.
if (current == null || !current.canGoBack()) {
return
}
val webBackForwardList = (current as WebView).copyBackForwardList()
val item = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex - 1)
updateURL(item.url)
current.goBack()
}
The updateURL(item.url) was updated the address bar, before the browser successfully navigate to the destination address.
With the above vulnerability, I able to spoof the address bar with secure lock using back button functionality.
By using onbeforeunload event handler, after press back button Firefox Lite will prompts the user before unloading, if user choose "Stay on This Page" Firefox Lite will stay on the website, but the address bar has been updated to previous website at webBackForwardList.
Steps to reproduce:
- Visit attached backspoof. bundle.html
- Tap "Start Spoof" button
- Tap "Login with Google" link
- You'll navigated to real Google Login page
- After ~2 second, you'll redirected back to backspoof page
- Tap "Login with Google" link
- After alert message appears, tap "Ok"
- Press back button
- Tap "Stay On This Page"
- Address bar successfully spoofed
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
The goBack function called updateURL with the previous history entry's URL before the WebView had actually navigated, so the address bar and the displayed page could fall out of sync.
Impact
An attacker could make the address bar display a trusted site with a secure lock while the actual page remained under their control, which could help phishing.
What the attacker needed
Firefox Lite browser; victim opens attacker page; victim presses back and stays
How it was found
- Open the provided test page in Firefox Lite
- Tap the button that starts the spoof
- Tap the Google login link and wait to be redirected back
- Tap the Google login link again and dismiss the alert
- Press back and choose to stay on the page
- Observe the address bar now shows the previous site
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 browser's address bar is supposed to always show the site you are really looking at. Here the browser changed the address bar too soon, before the page had actually changed. A malicious page could exploit this timing so the bar showed a trusted site while the attacker's page stayed on screen.
What is UI spoofing?
The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.