1. TOPTOP
  2. Webサービス
  3. Android

Androidで格納されたSMSメッセージを勝手に送信される脆弱性が見つかる。AndroidManifest.xmlの書き換え方法

|

android_sdk0

IPA(JVNiPedia)によると、AndroidのAndroidManifest.xmlで、格納されたSMSメッセージを送信される脆弱性が見つかったそうです。

ぽかーんと、口を開けて眺めているだけでは分からないので、どういうことか詳しく調べていきましょう。

AndroidManifestとは?

そもそもAndroidManifestとは何でしょうか?Android Developers(新しいタブで開く)で概要が説明されています。

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest file presents essential information about your app to the Android system, information the system must have before it can run any of the app’s code.

めっちゃ簡単にまとめると、AndroidManifest.xmlとはルートディレクトリに存在し、Android上でアプリを動作させるにあたって、重要な決まりごとが記述されているファイルのことです。

具体的には、同じAndroid Developersで個別に決まりごとが、箇条書きで説明されています(パッケージの名前やアプリケーションの構成要素など8つ)。

<reciever>にて怪しげな一文が…

もう一度、JVNiPediaの脆弱性対策情報データーベースに戻ると、このように書かれています。

AndroidのAndroidManifest.xml は、SmsReceiver レシーバに対して SEND_SMS パーミッションを要求しないため

ここで注目するのは、レシーバという単語です。Android developersの<reciever>のページ(新しいタブで開く)で、android:permissionの項目の一部を引用すると、

If neither attribute is set, the receiver is not protected by a permission.

なにやら怪しげな一文があります。Security and Permissions.(新しいタブで開く)の部分にハイパーリンクがはられていますので、クリックしてみます。

SMSは使わないように!

The SMS protocol was primarily designed for user-to-user communication and is not well-suited for apps that want to transfer data. Due to the limitations of SMS, we strongly recommend the use of Google Cloud Messaging (GCM) and IP networking for sending data messages from a web server to your app on a user device.

SMSはデータ転送に向かないので、使ってはいけない!と説明されています。通信が傍受されたり、読み取り権限を持つアプリで盗み見されるかもしれないとのことです。元々、AndroidでSMSを使用すること自体が、よろしくなかったみたいですね。

脆弱性への対策

前ふりが長くなってしまいましたが、脆弱性の対策です。AndroidManifest.xmlを次のように書き換えます。

 
</receiver>
 
         <!-- Catch-all receiver for broadcasts that don't have associated security -->
-        <receiver android:name=".transaction.SmsReceiver">
+        <receiver android:name=".transaction.SmsReceiver"
+             android:permission="android.permission.SEND_SMS">
             <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
             </intent-filter>

詳細は、Googleのgitで説明されています。またpython版が、GitHub(新しいタブで開く)上で公開されています。

他にもAndroid関連の脆弱性が

ちなみにAndroidManifest.xml以外にも、同時期にIPA(JVNiPedia)から脆弱性が、3つ指摘されています。気になる方はご参考まで。

〔参考サイト〕