Ambiguity in Risk of Exporting FirebaseMessagingService-type Services Without Permissions

Đang mở
#868 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
android
Lĩnh vực
mobile-dev, security

Hướng nghiên cứu

Xem xét pull request #850, các khai báo FirebaseMessagingService trong manifest và các kiểm tra thời gian chạy được ghi lại, được tham chiếu trong issue. Xác nhận liệu một service được export mà không có quyền có gây ra rủi ro thực sự hay không, sau đó cập nhật sample hoặc tài liệu liên quan để cấu hình dự kiến và cơ sở bảo mật được nêu rõ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)?

Ngôn ngữ chính
Kotlin
Star
9.3k
Fork
7.4k
Merge trung bình
7 ngày 9 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/quickstart-android

Tất cả issue của firebase/quickstart-android

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.