1 / 10

システムコール引数の暗号化によるコード注入攻撃の防止

システムコール引数の暗号化によるコード注入攻撃の防止. 大山 恵弘 米澤 明憲 (東京大学 ). コード注入攻撃. 悪意コードを 注入!. バッファ. バッファ. 011100001011 011101010010 110011000100 011011001101 101010110110 …. return address. return address. return address を上書き!. スタック. スタック. 注入されるコードの例. unsigned char exploit[]= ...

derek-cohen
Download Presentation

システムコール引数の暗号化によるコード注入攻撃の防止

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. システムコール引数の暗号化によるコード注入攻撃の防止システムコール引数の暗号化によるコード注入攻撃の防止 大山 恵弘 米澤 明憲 (東京大学) 第16回コンピュータシステム・シンポジウム

  2. コード注入攻撃 悪意コードを 注入! バッファ バッファ 011100001011 011101010010 110011000100 011011001101 101010110110 … return address return address return addressを上書き! スタック スタック

  3. 注入されるコードの例 unsigned char exploit[]= ... "\xb8\x1b\x11\x11\x11" /* movl $0x1111111b, %eax */ "\x2d\x10\x11\x11\x11" /* subl $0x11111110, %eax */ "\x8b\x5d\x08" /* movl 0x8(%ebp), %ebx */ "\x8b\x4d\x0c" /* movl 0xc(%ebp), %ecx */ "\x8b\x55\x10" /* movl 0x10(%ebp), %edx */ "\xcd\x80"; /* int $0x80 */ execveのシステムコール 番号11をeaxにセット システムコール引数を ebx, ecx, edxにセット システムコール割り込み

  4. 提案方式 • システムコール番号と引数を暗号化/復号 アプリケーション syscall(11, 12000, 800) 暗号化 改造libc syscall(39406, 57614, 20881) 復号 カーネルモジュール syscall(11, 12000, 0) カーネル

  5. 効果 • 悪意コードが発行するシステムコールは異常な番号と引数に変わる • 攻撃者によるexecveなどの実行が失敗する • 悪意コードはエラーで終了する

  6. 実装 • libcとカーネルモジュールで鍵を共有 • プロセス生成時に暗号化の鍵を作成 • プロセスごとに異なる鍵を使用 • RC4などのストリーム暗号を利用 • LD_PRELOADなどを用い、動的リンクするlibcを変更する

  7. 鍵の生成と共有 アプリケーション fork() ここに鍵を保持 改造libc p cfork(p) カーネルモジュール ここに鍵を保持 cfork(char *buf){ … } q • 鍵を生成 • bufとqに鍵を書き込む fork() カーネル

  8. 制限 • return-into-libc攻撃を防止できない • 元のlibcを静的リンクしたプログラムでは暗号化が行われない • 巧妙な攻撃コードは鍵を盗める • システムコールフックを利用するシステム(デバッガ、トレーサなど)が使えなくなる

  9. 関連研究 • システムコール表をかきまぜてカーネルを再コンパイルする • [Chew & Song ’02] • スタック上の制御情報(return address等)に乱数をXORする • [StackGuard] • CPU命令セットを乱数でかきまぜる • [Barrantes et al ’03] • [Kc et al. ’03] • [大澤 et al. ’00]

  10. 今後の仕事 • オーバヘッドの計測 • 実際の攻撃コードを用いた実証実験 • マルチスレッド、SMPへの拡張

More Related