Upload
toshiharu-harada-phd
View
1.169
Download
2
Embed Size (px)
DESCRIPTION
PacSec 2008講演資料 関連動画 http://www.youtube.com/watch?v=jYaPascaUZw http://www.youtube.com/watch?v=iSHg9Sec_QE http://www.youtube.com/watch?v=-2AQSqNa58c
Citation preview
振る舞いに基づくSSHブルートフォース対策
平成20年11月13日
TOMOYO Linux Project
半田 哲夫
TOMOYO is a registered trademark of NTT DATA CORPORATION in Japan.
Linux is a trademark of Linus Torvalds.
Other names and trademarks are the property of their respective owners.
PacSec2008 at 青山ダイヤモンドホール
はじめに
• 遠隔管理などで利用されるSSHサービスへの不正なログインを許してしまうと、情報漏えいだけでなく、踏み台やトロイの木馬の設置のような被害が生じます。
– 近年の攻撃手法は高度化・洗練化されてきており、従来の防御手法だけでは対処しきれない可能性が増えてきています。
• 「アクセス制御機能を強化したOS」を用いて、全く新しい防御手法を紹介します。
– 例として TOMOYO Linux を利用します。
2008.11.13 1
準備:フローチャート
• この図の見方はご存じですよね?
2008.11.13 2
1
2
3
4
Yes
No
準備:状態遷移図
• この図の見方はご存じですよね?
2008.11.13 3
A
B
D
C
E
B
A
A
C
B
E
D
C
準備:Linux における状態遷移図の例
• /sbin/initを起点にツリー状に広がります。
2008.11.13 4
/sbin/init
/etc/rc.d/rc.sysinit
/sbin/mingetty
/bin/unicode_start
/sbin/start_udev
/bin/setfont
/bin/kbd_mode
/sbin/mingetty
/etc/rc.d/rc.sysinit
/sbin/start_udev
/bin/unicode_start
/bin/kbd_mode
/bin/setfont
/bin/login/bin/login
準備:TOMOYO Linuxとは
• 状態遷移をデザインし強制するツール
– プログラムの中で発生するプログラムの実行要求を監視し、その可否を制限する。
– プログラムの実行により状態遷移を行う。
• リクエストを観測し制限するツール
– プログラムの中で発生するファイルの読み書き要求を監視し、その可否を制限する。
– プログラムの実行要求やファイルのオープン要求によりプロセスの内部状態を更新する。
2008.11.13 5
準備:SSHセッションの種類
• 対話型シェルセッション
– シェルが提供され、自由にコマンドを入力できる
• 自由に資源にアクセスできる
• 非対話型シェルセッション
– シェル起動時に -c で指定されたコマンドが実行される
• scp や sftp など
• 非シェルセッション
– シェルが提供されない
• ポートフォワーディングなど
2008.11.13 6
/usr/sbin/sshd
/bin/bash
??????
/bin/bash
従来の対策
• 知識に基づく認証
– ブルートフォース攻撃の対象になります。
• ログイン認証を突破されないことを前提とした対策
– 突破される確率を減らす
• ファイアウォールと連動して認証に失敗したクライアントを一定期間再接続禁止にする
• 公開鍵認証を用いる
– 攻撃の分散化やパスワード・秘密鍵の漏洩が始まっています。
2008.11.13 7
提案する対策
• 振る舞いに基づく認証
– 状態遷移を活用します。
• 従来のログイン認証を突破されることを前提とした対策
– 従来のログイン認証から先を制限します。
– とりあえずログインシェルを与えてみて、期待通りの振る舞いをするかどうかを観察します。
• 労働契約における試用期間をイメージしてください。
2008.11.13 8
従来の対策のフロー
• ログイン認証までをカスタマイズする
2008.11.13 9
SSHサーバがクライアントからの接続を受け付ける
ログイン認証を行う
作業を行う
SSHサーバとの接続を切断する
成功失敗
提案する対策のフロー
• ログイン認証から先をカスタマイズする
2008.11.13 10
SSHサーバがクライアントからの接続を受け付ける
ログイン認証を行う
作業を行う
SSHサーバとの接続を切断する
振る舞いを検査不審
正常
成功失敗
扉をあけて
• 常識は捨ててください。
– 「なんでもあり」の世界です。
– あなた自身のアイデアを実装してください。
• 新しい世界の始まりです。
– セキュアな世界へようこそ!
2008.11.13 11
ケース1:対話型シェルセッション
• 打鍵タイミングを利用します。
– 利用するもの
• 自作プログラム /bin/timeauth
2008.11.13 12
/usr/sbin/sshd
/bin/bash
/bin/bash
/bin/timeauth
/bin/timeauth
/bin/bash
/bin/bash
??????
??????
ケース1:対話型シェルセッション
2008.11.13 13
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 14
Authenticate me!
Enter password.
ケース1:対話型シェルセッション
2008.11.13 15
Authenticate me!
Enter password.
Password is ******
ケース1:対話型シェルセッション
2008.11.13 16
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
ケース1:対話型シェルセッション
2008.11.13 17
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
ケース1:対話型シェルセッション
2008.11.13 18
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 19
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 20
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is PacSec
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 21
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
NG. Go away!
Password is PacSec
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 22
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 23
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 24
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Password is
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 25
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 26
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
P
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 27
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 28
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa c
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 29
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa c S
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 30
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa c Se
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 31
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa c Se c
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース1:対話型シェルセッション
2008.11.13 32
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Pa c Se c
ケース1:対話型シェルセッション
• 利点
– 使える要素が制限されない
• RFCなどの標準に従う必要がない
• どんな要素を使っているかを秘匿できる
– 想定外の認証方式
• 侵入者が思いも付かない方法を使える
• パスワード文字数が少なくても、タイミング情報と組み合わせることでブルートフォースを無意味に
2008.11.13 33
ケース1:対話型シェルセッション
• 難点
– 「アクセス制御機能を強化したOS」が必要
• ログインシェルから実行できるコマンドを制限するため
• MAC(強制アクセス制御)と呼ばれる機能を利用
– Round Trip Timeが大きいと使いにくい
• 外国からのアクセスを防ぐのには好都合?
2008.11.13 34
ケース2:対話型シェルセッション
• ワンタイムパスワードとメールを利用します。
– 利用するもの
• SMTPサーバ
• 自作プログラム /bin/mailauth
2008.11.13 35
/usr/sbin/sshd
/bin/bash
/bin/bash
/bin/mailauth
/bin/mailauth
/bin/bash
/bin/bash
??????
??????
ケース2:対話型シェルセッション
2008.11.13 36
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 37
Authenticate me!
Enter password.
ケース2:対話型シェルセッション
2008.11.13 38
Authenticate me!
Enter password.
Password is ******
ケース2:対話型シェルセッション
2008.11.13 39
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
ケース2:対話型シェルセッション
2008.11.13 40
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
ケース2:対話型シェルセッション
2008.11.13 41
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 42
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース2:対話型シェルセッション
2008.11.13 43
Authenticate me!
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース2:対話型シェルセッション
2008.11.13 44
Authenticate me!
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース2:対話型シェルセッション
2008.11.13 45
Authenticate me!
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース2:対話型シェルセッション
2008.11.13 46
Authenticate me!
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
ケース2:対話型シェルセッション
2008.11.13 47
Authenticate me!
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 48
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 49
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 50
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 51
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 52
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 53
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 54
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 55
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 56
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 57
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 58
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 59
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 60
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 61
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 62
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 63
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 64
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 65
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 66
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 67
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 68
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 69
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 70
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 71
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 72
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 73
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 74
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 75
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 76
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 77
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 78
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 79
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 80
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 81
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 82
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 83
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 84
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 85
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 86
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 87
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 88
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 89
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
NG. Go away!
Password is
Enter password.
Authenticate me!
ケース2:対話型シェルセッション
2008.11.13 90
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース2:対話型シェルセッション
• 利点
– ワンタイムパスワードを生成したプロセス自身が検証も行う
• 時刻やカウンタなどの同期機構が不要
• プロセスの消滅と同時にワンタイムパスワードも失効
– ワンタイムパスワードが侵入者以外に漏洩しても問題にならない
• プロセスを生成したユーザ以外には何の価値もない
2008.11.13 91
ケース2:対話型シェルセッション
• 難点
– メールを受信できる必要がある
• 携帯電話のようなメール受信端末を所持していること
– メールを送信できる必要がある
• SMTPサーバやWebサーバのメール送信CGIなどが利用可能なこと
2008.11.13 92
ケース3:非対話的シェルセッション
• 環境変数の有無やその内容を利用します。
– 利用するもの
• SSH サーバの AcceptEnv ディレクティブ
• SSH クライアントの SendEnv ディレクティブ
• 自作プログラム /bin/env_check
• TOMOYO Linux の execute_handler ディレクティブ
2008.11.13 93
/usr/sbin/sshd
/bin/env_chk
/bin/env_chk
/bin/bash
/bin/bash
ケース3:非対話的シェルセッション
2008.11.13 94
SSHサーバがクライアントからの接続を受け付ける
ログイン認証を行う
要求されたコマンドを実行する
SSHサーバとの接続を切断する
認証成功
失敗
失敗
成功
SSHサーバが環境変数を設定する
SSHサーバが execute_handler を起動する
環境変数の検査を行う
ログインシェルを起動する
成功
ケース3:非対話的シェルセッション
2008.11.13 95
Authenticate me!
ケース3:非対話的シェルセッション
2008.11.13 96
Authenticate me!
Enter password.
ケース3:非対話的シェルセッション
2008.11.13 97
Authenticate me!
Enter password.
Password is ******
ケース3:非対話的シェルセッション
2008.11.13 98
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
ケース3:非対話的シェルセッション
2008.11.13 99
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
NG. Go away!
ケース3:非対話的シェルセッション
2008.11.13 100
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
ケース3:非対話的シェルセッション
2008.11.13 101
Use this environ.
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
ケース3:非対話的シェルセッション
2008.11.13 102
Use this environ.
OK. Ready.
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
ケース3:非対話的シェルセッション
2008.11.13 103
Use this environ.
OK. Ready.
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
OK. Go ahead.
ケース3:非対話的シェルセッション
2008.11.13 104
Use this environ.
OK. Ready.
Authenticate me!
Enter password.
Password is ******
OK. Authenticated.
Let me access shell.
ケース3:非対話的シェルセッション
• 利点
– クライアントからは透過に見える
• コマンドラインでの操作が不要
• 標準入出力の扱いが不変
– 環境変数をパスワードの代わりに使える
• 環境変数名を秘密にできる
• 環境変数の内容に応じて権限を分割することも可能
– 対話的シェルセッションを開始する前に適用することも可能
2008.11.13 105
ケース3:非対話的シェルセッション
• 難点
– TOMOYO Linux 専用
• execute_handler を備えているのは TOMOYO Linux だけ
– SSHクライアントが環境変数を送信する機能(SendEnv)をサポートしていない可能性
2008.11.13 106
ケース3:非対話的シェルセッション
• 応用例:環境変数による権限分割
2008.11.13 107
/usr/sbin/sshd
/usr/libexec/openssh/sftp-server
/bin/bash
玄関
ログインシェル
読み書きモード
ケース3:非対話的シェルセッション
2008.11.13 108
/usr/sbin/sshd
/bin/env_chk
/bin/ro-sftp
/bin/rw-sftp
/usr/libexec/openssh/sftp-server
/usr/libexec/openssh/sftp-server
/bin/bash
/bin/bash
再検査ダミー
ダミー
読み書きモード
読み込み専用モード
ケース4:非対話的シェルセッション
• 独自のレイヤーを構築します。
– 利用するもの
• scp や sftp コマンドの -S オプション
• 振る舞いを監視するためのサーバ側プログラム
• 振る舞いを指定するためのクライアント側プログラム
• TOMOYO Linux の execute_handler ディレクティブ
2008.11.13 109
ケース4:非対話的シェルセッション
2008.11.13 110
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
1
ケース4:非対話的シェルセッション
2008.11.13 111
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
12
ケース4:非対話的シェルセッション
2008.11.13 112
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
12
3
ケース4:非対話的シェルセッション
2008.11.13 113
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
12
34
ケース4:非対話的シェルセッション
2008.11.13 114
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
12
34
5
ケース4:非対話的シェルセッション
2008.11.13 115
アプリケーション層
振る舞い指示機能(独自プログラム)
/usr/bin/ssh
アプリケーション層
振る舞い監視機能(独自プログラム)
/usr/sbin/sshd
12
34
Go!5
ケース4:非対話的シェルセッション
2008.11.13 116
アプリケーション層
/usr/bin/ssh
アプリケーション層
/usr/sbin/sshd
ケース4:非対話的シェルセッション
• 利点
– 標準の機能で利用できない要素(標準入出力やコマンドラインパラメータなど)を使える
– 環境変数と組み合わせて利用できる
• 独自認証対応の可否に応じた権限分割ができる
2008.11.13 117
ケース4:非対話的シェルセッション
• 難点
– クライアント側にもプログラムを用意する必要がある。
2008.11.13 118
PAMではできないの?
• 自由度・難易度が違います。
– 標準入出力やパラメータなどを独占できるので、他のPAMモジュールとの干渉が起こりません。
• 誰にでも作ることができます。
– RFCなどの標準に縛られません。
2008.11.13 119
PAMではできないの?
• クライアント側の対応が不要です。
– PAMの場合はクライアントが対応していないと使えません。
– PAMを通過後に実行される処理(シェルなど)に対応していないクライアントはありえません。
2008.11.13 120
PAMではできないの?
• 強制することができます。
– 他のPAMモジュールの設定や実行結果により省略される心配がありません。
– 生じうる状態遷移がMACにより規定されているので、想定外の抜け道(バッファオーバーフローやコマンドインジェクション)の心配がありません。
– 外部プログラムの助けを借りるのが容易です。
2008.11.13 121
まとめ
• ホスト内での認証なので独自プロトコルを利用可能です。
– アイデアの勝負です。
• 利用可能な要素は無限にあります。
– 正しい振る舞い(状態遷移)を知られない限りブルートフォースは不可能です。
• 安価に構築でき、負担の少ない方法を選べます。
2008.11.13 122
ケース5:非シェルセッション
• クライアントプログラムをカスタマイズします。
– 利用する機能
• 独自のSSHクライアントプログラム(例えば JSCH)
• TOMOYO Linux の task.state キーワード
2008.11.13 123
アプリケーション層 /usr/sbin/sshd
要求順序監視機能(TOMOYO Linux)
ケース5:非シェルセッション
• 利点
– プログラムの実行を伴わずに権限を切り替えできる
• アクセス要求の順序をパスワードの代わりに使用
– 対話的・非対話的シェルセッションを開始する前に適用することも可能
2008.11.13 124
ケース5:非シェルセッション
• 難点
– 使える要素が少ない
• プログラムの実行を伴わないで実現する必要がある
– おそらく TOMOYO Linux 専用
• SSHサーバプログラム(/usr/sbin/sshd)を改造することなくプロセスの状態変数(task.state)を操作しているため
– クライアントを自作する必要性
2008.11.13 125
ケース6:即席ハニーポットの構築
• 侵入者をハニーポットへリダイレクトできます。
– もちろん、強制ログアウトもできます。
2008.11.13 126
/usr/sbin/sshd
/bin/bash
/bin/bash
/bin/timeauth
/bin/timeauth
/bin/bash
/bin/bash
/bin/force-logout???
??????
論文はこちらです。
• セキュリティ強化OSによるログイン認証の強化手法
– http://sourceforge.jp/projects/tomoyo/docs/winf2005.pdf
– http://sourceforge.jp/projects/tomoyo/docs/winf05-slides.pdf
– 3年前に書かれた内容ですので内容が古いです。
– しかし、考え方は現在でも役に立ちますし、実際に適用することができます。
2008.11.13 127