Ambiguity in Risk of Exporting FirebaseMessagingService-type Services Without Permissions

Abierto
#868 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Documentación
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
android

Línea de trabajo

Revisa el pull request #850, las declaraciones de FirebaseMessagingService en el manifest y las comprobaciones de tiempo de ejecución documentadas a las que se hace referencia en la issue. Confirma si un servicio exportado sin permisos supone un riesgo real y, después, actualiza el ejemplo o la documentación relevantes para que la configuración esperada y la justificación de seguridad queden claras.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

api: messaging type: question

I have a general question.

This pull request: https://github.com/firebase/quickstart-android/pull/850

explicitly disables the export of the sample FirebaseMessaging Service, i.e.

<service android:name=".java.MyFirebaseMessagingService" android:exported="false">

because, and it says, "Set FirebaseMessagingServices to exported="false" to explicitly
prevent other apps from being able to send messages to it."

This is a good practice, but other documentation (see e.g. https://stackoverflow.com/a/43991861) notes that runtime checks (in the FCM code) prevent other applications from calling into this Service arbitrarily.

Experimentally, this seems to be the case:

  1. Create some app that extends the FirebaseMessaging class, and notes the following block in its manifest

<service android:name=".java.MyFirebaseMessagingService"> <service android:name=".java.MyFirebaseMessagingService""> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter>

which was the default before the noted PR.

  1. Set a breakpoint on the extended class's onMessageReceived method, in e.g. Android Studio

  2. Run the application under Debug, foreground it, and issue the following ADB command (with suitably replaced options) to start the Service with an intent

adb shell am startservice -n com.test.android.app/com.foo.java.MyFirebaseMessagingService -a com.google.firebase.MESSAGING_EVENT

  1. Notice that your breakpoint is not hit, even though the Intent was sent successfully

This was repeated with various intent extras, as well. And with runtime method hooking of onMessageReceived with https://www.frida.re/, to log if it is called.

So, just wondering if someone could clear up this ambiguity-- is it actually a risk to export said service (i.e. com.google.firebase.messaging.FirebaseMessagingService and classes that extend it) without permissions (as the PR implies), or is it not (as the noted documentation states)?

Lenguaje dominante
Kotlin
Estrellas
9.3k
Forks
7.4k
Merge medio
7 d 9 h
PR fusionados (30 d)
6

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/quickstart-android

Todos los issues de firebase/quickstart-android

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.