
Android Blueborne リモートコード実行 CVE-2017-0781
Android Blueborne RCE CVE-2017-0781
2017年11月、Armis社はBluetoothを介したAndroidのリモートコード実行脆弱性(CVE-2017-0781)の概念実証(PoC)を公開しました。これはBlueBorneとして知られています。BlueBorneは8つの脆弱性のセットを指しますが、この記事のPoCではそのうちの2つだけを使用して目的を達成しています。
BlueBorneに必要なのは、デバイスでBluetooth接続がアクティブになっていることだけです。ユーザーの操作は不要で、ペアリングすら必要ありません。攻撃者はデバイスのBluetooth範囲内にいるだけで、端末を乗っ取ることができます。
エクスプロイトプロセスは2つのフェーズに分かれています。最初にメモリリーク脆弱性(CVE-2017-0785)を使用してメモリアドレスを取得し、ASLR保護を迂回します。そして、libcライブラリのsystem関数を呼び出して電話上でコードを実行し、ファイル("/data/local/tmp/test")を作成します。ペイロードは自由に変更可能で、携帯電話を自分に接続させる(リバースシェル)こともできます。
この記事では、影響を受ける電話(BlueBorneパッチ、Androidの2017年9月のセキュリティパッチが適用されていないもの)に対して、コードを実行および/または乗っ取ることが可能であることを示したいと思います。
興味があれば、以下にデバッガログと実行ログ、およびペイロード実行の証拠を示します。
テスト目的で、CVE-2017-0781のパッチを削除し、テスト用携帯Samsung S3 Neo+ GT-9301I上でAndroid 7.1.2(LineageOS CM 14.1)をコンパイルしました。
詳細情報はこちら:
https://github.com/marcinguy/S3NEO--GT301I
数十回の実行後、この状態になりました。各実行は約2~3秒です。つまり、30秒以内に携帯を乗っ取ることができます。```asm License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-androideabi". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) attach 15513 Attaching to process 15513 [New LWP 15518] [New LWP 15519] [New LWP 15520] [New LWP 15521] [New LWP 15522] [New LWP 15523] [New LWP 15524] [New LWP 15525] [New LWP 15526] [New LWP 15529] [New LWP 15530] [New LWP 15531] [New LWP 15532] [New LWP 15533] [New LWP 15534] [New LWP 15535] [New LWP 15536] [New LWP 15537] [New LWP 15538] [New LWP 15539] [New LWP 15541] [New LWP 15540] [New LWP 15543] [New LWP 15544] [New LWP 15545] [New LWP 15546] [New LWP 15547] [New LWP 15548] [New LWP 15549] [New LWP 15550] [New LWP 15551] [New LWP 15552] [New LWP 15556] [New LWP 15557] [New LWP 15558] [New LWP 15559] [New LWP 15560] [New LWP 15562] [New LWP 15563] [New LWP 15565] [New LWP 15569] [New LWP 15570] [New LWP 15577] [New LWP 15578] 0xb5219114 in __epoll_pwait () from target:/system/lib/libc.so (gdb) b *0xb5216b4d warning: Breakpoint address adjusted from 0xb5216b4d to 0xb5216b4c. Breakpoint 1 at 0xb5216b4c (gdb) disass system Dump of assembler code for function system: 0xb5216b4c <+0>: push {r4, r5, r6, lr} 0xb5216b4e <+2>: sub sp, #72 ; 0x48 0xb5216b50 <+4>: ldr r1, [pc, #236] ; (0xb5216c40 <system+244>) 0xb5216b52 <+6>: cmp r0, #0 0xb5216b54 <+8>: ldr r2, [pc, #236] ; (0xb5216c44 <system+248>) 0xb5216b56 <+10>: add r1, pc 0xb5216b58 <+12>: ldr r1, [r1, #0] 0xb5216b5a <+14>: add r2, pc 0xb5216b5c <+16>: vld1.64 {d16-d17}, [r2] 0xb5216b60 <+20>: ldr r1, [r1, #0] 0xb5216b62 <+22>: str r1, [sp, #68] ; 0x44 0xb5216b64 <+24>: add r1, sp, #48 ; 0x30 0xb5216b66 <+26>: vst1.64 {d16-d17}, [r1] 0xb5216b6a <+30>: beq.n 0xb5216bf6 <system+170> 0xb5216b6c <+32>: add r4, sp, #12 0xb5216b6e <+34>: str r0, [sp, #56] ; 0x38 0xb5216b70 <+36>: mov r0, r4 0xb5216b72 <+38>: blx 0xb51e4a38 sigemptyset@plt 0xb5216b76 <+42>: mov r0, r4 0xb5216b78 <+44>: movs r1, #17 0xb5216b7a <+46>: blx 0xb51e511c sigaddset@plt 0xb5216b7e <+50>: add r2, sp, #8 ---Type to continue, or q to quit---q Quit (gdb) cont Continuing. [New LWP 15912] [Switching to LWP 15540] warning: Breakpoint 1 address previously adjusted from 0xb5216b4d to 0xb5216b4c.