Zero user-interaction triggering of intents over LAN
Firefox for Android's SSDP discovery accepted a LOCATION value that was an Android intent URI, so a device on the same wireless LAN could make the phone launch other apps or open a browser without any user action. An attacker could use this for phishing, pushing malicious add-ons, or triggering intents in other apps.
Originally disclosed on Mozilla
- Fixed in 37 days
- Paid in 11 days
- Disclosed after 37 days
Created attachment 9170296 ssdp.py
Hi Mozilla!
First, thanks for all your hard work over the years. I've been an avid user for a long time and in general am a huge fan of the work that you do. Thanks so much, and I hope you are all ok during both these crazy times and the unfortunate downsizing. Now, on to the bug...
Overview
The SSDP engine in Firefox Mobile 68.11.0 can be tricked into triggering Android intent URIs with zero user-interaction, by attackers on the same wireless LAN. This manifests in applications running on the target device suddenly launching, without the user's permission or awareness, and conducting activities allowed by the intent.
The target simply has to have the Firefox application running on their phone. They do not need to access any malicious website or click any malicious links.
Technical details
The Firefox application periodically sends out SSDP broadcasts, looking for devices on the network. My assumption is that this is for discovering second-screen type devices (Roku, for example). These broadcasts look like this:
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: roku:ecp
Man: "ssdp:discover"
MX: 3
Any device on the local network can respond to these broadcasts, and provide the LOCATION of a UPNP device descriptor file. Firefox will then attempt to access that LOCATION to learn more about the UPNP device.
This is where the vulnerability comes in. Instead of providing the location of an XML file describing a UPNP device, an attacker can run a malicious SSDP server that responds with a specially crafted message pointing to an Android intent. Then, that intent will be invoked by the Firefox application itself.
For example, responding with a message like the following would force any Android phones on the local network with Firefox running to suddenly launch a browser to http://example.com:
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1800
DATE: Tue, 16 Oct 2018 20:17:12 GMT
EXT:
LOCATION: intent://example.com/#Intent;scheme=http;package=org.mozilla.firefox;end
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: uuid:7f7cc7e1-b631-86f0-ebb2-3f4504b58f5c
SERVER: UPnP/1.0
ST: roku:ecp
USN: uuid:7f7cc7e1-b631-86f0-ebb2-3f4504b58f5c::upnp:rootdevice
BOOTID.UPNP.ORG: 0
CONFIGID.UPNP.ORG: 1
POC
I've spent a bit of time developing attack POCs for SSDP vulnerabilities on other platforms, using a tool I wrote called evil-ssdp. I created a modified version of that tool specifically to demonstrate the Firefox vulnerability. It's attached to this bug report as ssdp.py.
Here is a way to demonstrate forcing all phones on the LAN to pop up a web browser to http://example.com:
First, run the exploit on a Linux laptop that is connected to the same wireless network as your Android device. Disable the local firewall while testing.
# Replace "wlps0" with the wireless device on your attacking machine.
python3 ./ssdp.py wlps0 -t "intent://example.com/#Intent;scheme=http;package=org.mozilla.firefox;end"
Then, open Firefox for Android on your Android device. It should go to http://example.com within a few seconds, and you'll see some logging in the attack tool as well. If Firefox is already running on your Android device, the attack will occur at the next SSDP polling interval.
An attacker may use a URL a bit more dangerous than example.com, such as an xpi file with a malicious browser extension or a phishing site, etc. Because the POC tool is quite persistent (it will force the user to the site over and over), it is likely the user will eventually click past warnings just to make the device usable.
Another example is to call other applications. Running the attack tool like this will pop the mail application with arbitrary text. Pretty scary to have happen on your device when you're just minding your own business:
# Replace "wlps0" with the wireless device on your attacking machine.
python3 ./ssdp.py wlps0 -t "mailto:[address removed]?subject=I've%20been%20hacked&body=OH%20NOES!!!"
And one more, just for testing purposes. This will just pop the dialer:
python3 ./ssdp.py wlps0 -t "tel://111"
Remediation
Strict validation of the LOCATION header in SSDP replies should be performed. The protocol should be "HTTP" or "HTTPS", and the content at the actual location should be XML. Redirects should not be followed.
Impact
This vulnerability resembles RCE (remote code execution) in that a remote (on same local area network) attacker can trigger the device to perform unauthorized functions with zero interaction from the end user. However, that execution is not totally arbitrary in that it can only access defined intents. This could be executed to carry out highly-effective phishing attacks, trick users into installing malicious apps or plugins, or to target intents of other applications that expose their own vulnerabilities.
Testing Details
Tested successfully on:
- Xperia XZ1 Compact w/ Android 9 and Firefox 68.11.0
- Nexus 6P w/ Android 8.1 and Firefox 68.11.0
- Pixel 2 w/ Android 9 and Firefox 68.11.0
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 SSDP response handler did not validate that the LOCATION value was an HTTP or HTTPS URL pointing to XML, so it passed an intent URI to Android's intent resolution.
Impact
A same-LAN attacker could force the phone to launch apps or open sites with no user interaction, enabling effective phishing, malicious add-on installs, or abuse of other apps' intents, though only defined intents can be reached.
What the attacker needed
Attacker on the same wireless LAN; Firefox for Android running on the victim device
The fix
The LOCATION header in SSDP replies should be strictly validated to allow only HTTP or HTTPS URLs whose content is XML, and redirects should not be followed.
How it was found
- Run the modified SSDP attack tool on a Linux laptop on the same wireless network as the Android device.
- Give the tool an intent URI as the target, for example one that opens a browser to a chosen site.
- Open Firefox for Android on the target device and wait for its next SSDP poll.
- The phone opens the browser to the chosen site within a few seconds.
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.
Firefox on Android quietly asks the local network whether any media devices are nearby, using a discovery protocol called SSDP. A malicious device on the same Wi-Fi can answer with a special Android 'intent' link instead of a normal device description, and Firefox opens that link itself. The phone then launches another app or a web page without the owner doing anything.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.