x remote icmp based os fingerprinting techniques by ofir arkin
DESCRIPTION
X remote ICMP based OS fingerprinting techniques by Ofir Arkin. 武藤研究室 セキュリティグループ INAS ポジション:スーパーサブ 直江健介. Table of Contents. 1. Introduction 2.Remote Active Operating System Fingerprinting Methods Used By X 3.How Does X works? 4.The Future development of X and xprobe. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/1.jpg)
X remote ICMP based OS fingerprinting techniques
by Ofir Arkin
武藤研究室セキュリティグループ INAS
ポジション:スーパーサブ直江健介
![Page 2: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/2.jpg)
Table of Contents
1.Introduction
2.Remote Active Operating System Fingerprinting Methods Used By X
3.How Does X works?
4.The Future development of X and xprobe
![Page 3: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/3.jpg)
1.Introduction – What is X?
• 背景技術> X– “ICMP Usage in Scanning”[1]
• ICMP を使った様々な手法を使ったActive OS Fingerprinting
• コンセプトは簡単で、高速で、効率的で、ホストを特定することに非常に強力である事。
![Page 4: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/4.jpg)
1.1 Why X?(1/2)
• Xprobe は TCP/IP の実装にかなり依存している他のツールとは対極にあるツールだ!
• 既存のツールは特に Microsoft 系を特定するときに大変– Win2K,NT4,ME や 98/98SE の fingerprinting process に差異を
見出すのが非常に困難
• 必要とするデータグラムの数(1~4パケット)• 既存のツールと違い malformed な packet は使わない
ため IDS にも検出されにくい。(通常運用ではありえるデータグラムの形をしているため)
![Page 5: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/5.jpg)
1.1 Why X?(2/2)
• 情報収集の形を変える!?– 今まで1. HostScan で Availability をチェック2.走ってるサービスを調べる3.その下にある OS を特定ホストに known な exploit があるサービスがあればそこを突く >めでたく管理者権限をゲット、無許可アクセス可能
– Xprobe だと・ HostScan の時点で何の OS かが分かる・最高でも4パケットでどの脆弱性があるシステムか分かって
しまう
![Page 6: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/6.jpg)
2. Remote Active Operating System Fingerprinting Methods Used By X
• X は [1] で発見したいくつかの remote active operating system fingerprinting methods を利用している
![Page 7: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/7.jpg)
2.1 ICMP Error Message Quoting Size
• ICMP のエラーメッセージは最低でも IP ヘッダとエラーの原因となったパケットの最初の 8byte のデータバイトを含む。
• ほとんどの OS はこのエラーメッセージを吐く• じゃあ、どの OS が一番長いエラーメッセージを吐
くの?
![Page 8: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/8.jpg)
2.2 ICMP Error Message Echoing Integrity(1/3)
• ICMP エラーメッセージを返すときにスタックの実装でメッセージが若干違う
• 普通、値が変わるのは何処よ?– IP の TTL 値
• ヘッダが読まれるたびに一つ減るから– IP ヘッダのチェックサム
• TTL が減るたびにチェックサムは再計算される
• X は UDP データグラムを閉じられた UDP ポートに送ることで ICMP Port Unreachable error message を得て利用する
![Page 9: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/9.jpg)
2.2 ICMP Error Message Echoing Integrity(2/3)
• IP Total Length Field– OS の IP スタックは
• Offending packet に対するエコーパケットの IP total length に 20byte 足す
• Offending packet に対するエコーパケットと一緒にオリジナルのパケットの IP total length から 20byte 減らす
• 正しい値をエコーする
• IPID– OS の IP スタックは
• ICMP Error message の IPID の値を正しく返さない• ICMP Error message の IPID の値を正しく返す
![Page 10: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/10.jpg)
2.2 ICMP Error Message Echoing Integrity(3/3)
• 3Bits Flags and Offset Fields– 正しく返さない– 正しく返す
• IP Header Checksum– Offending パケットに対するエコーバックの IP ヘッダのチェックサムの計算
ミスをする– 0 を返す– 正しい値を返す
• UDP Header Chekcsum– Offending パケットに対するエコーバックの UDP ヘッダのチェックサムの
計算ミスをする– 0 を返す– 正しい値を返す
結論:いくつかの OS スタックはある値に関して正常にエコーしないものがある
![Page 11: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/11.jpg)
2.3 Precedence Bits Issues with ICMP Error Messages
• 各 IP データグラムには 8byte の“ TOS Byte” がある• TOS(Type of Service) Byte には三つの field がある
– Procedence filed 3bit 長、 IP データグラムの優先度( 8 段階)
• 優先度の高いものは優先度の低いものより先に送られる– TOS 4bit 長、 throughput,delay,reliability,IP データグラムの
ルーティング cost を表現する– MBZ(Must Be Zero) 1bit 長、使用しない、 0 でなくてはいけ
ない• ルータやホストはこの部分を無視する
ICMP Source Quench error message が送信されているのならば、IP Procedence field の値はそれを誘発した IP Procedence fieldと同じでなくてはいけない。
![Page 12: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/12.jpg)
2.4 DF Bit Echoing with ICMP Error Messages
• DF(Dont Frag) bit set, 分割禁止• ICMP error message を誘発する Offending packet と一
緒に DF bit をたてたら、どうなるであろうか?– ICMP error message IP Header の DF bit もたつの?
![Page 13: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/13.jpg)
2.5 IP Identification Field Value with ICMP Query Messages with Linux
Kernel 2.4.x based machines• Linux Kernel 2.4.5 以上では直されているが、 2.4.0-2.
4.4 では ICMP query request と reply message と共に IP Identification field が 0 にセットされる。
![Page 14: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/14.jpg)
2.6 The IP Time-To-Live Field Value with ICMP Messages
• IP Header がプロセスされるたびに1づつ減らされる– RFC791 ではこの値は秒で計る– 最高で 255 秒= 4.25 分
• 0 であればデータは破棄される– 実際のルータなどは 1 秒以上かかるのもあれば一秒以下でプロセ
ス終了する– 実際の使われ方は無限ループに陥ったいわゆるゴーストパケット
の破棄方法としてある(ようなもの)。また、古いデータが新しいデータが届いた後に届くのを防ぐ
– IP TTL 値には ICMP query messeage と ICMP query reply と二つがある
• TTLベースの OS Fingerprinting ではあらかじめ TTL距離(何ホップか)を知らなくてはいけない
![Page 15: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/15.jpg)
2.7 Using Code Field Values Different Than Zero with ICMP Echo Requests
• ICMP code filed を 0 以外の ICMP Echo request を送ると– Microsoft 系は ICMP Echo reply として 0 を返す– それ以外は ICMP Echo request で使った値を返す
• Microsoft 系の OS は RFC792[2] guideline とは対照的な振る舞いをする。
![Page 16: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/16.jpg)
2.8 TOS Echoing
• RFC1349 は ICMP messages の Type-of-Service 値を規定、以下の三つに区別する– ICMP error message(Destination Unreachable,Source
Quench,Redirect,Time Exceeded,Parameter Problem)
– ICMP query message(Echo,Router Solicitation,Timestamp,Information request,Address Mask request)
– ICMP reply messages(Echo reply,Router Advertisement,Timestamp reply,Information reply,AddressMask reply)
• いくつかの OS は RFC1349 を無視して、 ICMP reply messagesの TOS 値を ICMP request messages の TOS 値を返さないものがある。
![Page 17: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/17.jpg)
2.9 DF Bit Echoing With ICMP Query Messages
• ICMP query request messages と一緒に DF bit を立てたらどうなるだろう?– DF bit は ICMP query request message と一緒に立てられるも
のなのか?
![Page 18: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/18.jpg)
2.10 The ?Who Answer What?? Approach
• OS を特定するのに ICMP Query message request を使う– ICMP Echo request
– ICMP Timestamp request
– ICMP Information request
– ICMP Address Mask request
![Page 19: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/19.jpg)
3. How does X works?
• アイデアは最初に静的な決定木を作る– どう似た OS を特定の OS として差別化(判定)するか
• まず UDP パケットを closed な UDP destination ポートに送信 (default:3132byte)– ICMP Destination Unreachable Port Unreachable error message
を利用して OSFingreprint の違いを得る– 送信したホストからリプライが無ければ linsten状態– UDP パケットをブロックするフィルタ機器があれば空いた
UDP ポートの真似をする(従って reply は受け取らない)
![Page 20: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/20.jpg)
3. How does X works?
アタック1• UDP パケットを閉じた UDP ポートに対して送ると
ICMP Port Unreachable error message を受け取れるので1パケットを送る事で判別。– 返ってくればホストは生きてるかトラフィックが許されて
る– かえってこなければフィルタリング機器が存在しているだ
ろう
• どうやって閉ざされたUDPポートを探すか– IANA のポートリストなど
• http://www.Isi.edu/in-notes/Iana/assignments/port-numbers
![Page 21: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/21.jpg)
3. How does X works?
• UDP データグラムに DF bit をたてたものを送ることで 2.4 のノウハウを使う– UDP query は 70byte のデータを持つ– 対象ホストが何バイト返すかを見る
• Error を返せば対象ホストに対してこの手法が使える• 返さなければフィルタリングされているかホストが落ちてい
る– この値が 0xc0 であれば Linux Kernel 2.0.x/2.2.x/2.4.xベースマシン、 CISCO based router(IOS 11.x-12.x) 、 Extreme Networks Switch
![Page 22: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/22.jpg)
3. How does X works?
• 前述した IP Header の先頭 8byte 以上を ICMP error message に含む OS群は Linux Kernel 2.0.x/2.2.x/2.4.xである
• ネットワークデバイスは Precedence bit に 0x0c を立てたものに対しては先頭 8byte しか返さない– これで LinuxKernel と CISCO router と Extreme Network
switch を差別化できる
![Page 23: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/23.jpg)
3. How does X works?
• Linux Kernel 2.0.x は初期 IPTTL 値を 64 にセットされる。 Linux Kernel 2.2.x/2.4.x は初期 IPTTL 値を 255 にセット– Linux Kernel 2.4.0-2.4.4 の ICMP query の IP ID 値は常に 0
– 2.4.5 から直された
• Kernel2.2x/2.4.5 以上と 2.4.0-2.4.4 とに差別か出来る
![Page 24: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/24.jpg)
3. How does X works?
アタック2• ICMP Port Unreachable Error Messages パケットにどの
くらいの echo を返したかで判別– 8byte 返す– 64byte 返す– 64byte 以上返す
• 分かったことは figure5 の通り
![Page 25: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/25.jpg)
3. How does X works?
• Sun Solaris 2.3-2.8,HPUX 11.x,MacOS 7.x-9.x– ICMP Timestamp Request を送信
• リプライがあるもの> Sun Solaris 2.3-2.6
• リプライの無いもの> HPUX 11.x,MacOS7.x-9.x
• アタック1で万が一 Linux 系が判別できなくてもここで判別が出来る
![Page 26: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/26.jpg)
3. How does X works?
アタック3• ICMP Error message が返す IP total length の値で判別
– 正しく返す– 正しい値より 20byte少ない– 正しい値より 20byte多い
• 正しい値より 20byte少ない– OpenBSD 2.6-2.9,Apollo Domain/OS SR10.4,NFR
IDS…..Figure7参照
![Page 27: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/27.jpg)
3. 正しい値より 20byte少ない
• 返ってきた ICMP error message の UDP チェックサムで判別– 正しい値– 0
– 正しくない値
• Figure8 を参照
![Page 28: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/28.jpg)
3. 正しい値より 20byte多い
• AIX,BSDI,NetBSD 1.x-1.2.x の判別• offendingUDP を送ったことで OS が返した ICMP
error message の値で判別– まず IP Header checksum のインテグリティチェック
• AIX は echo された値を micalculate する、それ以外は正しく計算する
– 次に IP Identification field value のインテグリティチェック• BSDI 2.x,3.x と NetBSD1.x-1.2.x は little endian の問題で値を正
しく返さない• BSDI 4.x,NetBSD 1.x-1.2.x の big endian と MacOS X 1.0-1.2 は正
しく返す
![Page 29: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/29.jpg)
3. How does X works?
• 元の branch に戻り話をするめる– IP Total Length field value echoed coreectly
• 3bit flags(Unused,MF,DF) と offset filed を使い判別
• Figure10参照
![Page 30: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/30.jpg)
3. How does X works?
• そして Windowsファミリーを判別する– どきどきしますねぇ~~
![Page 31: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/31.jpg)
3. How does X works?
• Microsoft 系列の OS を判別するには違うquery を使う必要がある。– Code field value different than zero with ICMP Echo
requests
• ICMP Echo Request with the Precedence Bits !=0, DF Bit Set,ICMP Code Field !=0– 0 が返るなら MicrosoftWindowsFamily
– それ以外の値が返るなら、 MSWindows 系以外
![Page 32: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/32.jpg)
3. How does X works?
• Window の中でのバージョンの判別– TTL 値での判別
• TTL が 32– Windows95
• TTL が 128– Windows95 以外
– Precedence Bits での判別• !=0
– 98/98SE/ME/NTsp3-/NTsp4+
• =0– Microsoft Windows 2000,SP1,SP2
![Page 33: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/33.jpg)
3. How does X works?
• 98/98SE/ME/NTsp3-/NTsp4+ の判別– ICMP Time Stamp Request による判別
• Reply– Windows98/98SE/ME
• No Reply– Windows NT SP 3-,Windows NT SP 4+
![Page 34: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/34.jpg)
3. How does X works?
• WIndows98/98SE/ME の判別– ICMP Address Mask Request
• Reply– Windows98/98SE
• No Reply– Windows ME
• Windows NT SP 3-/Windows NT SP 4+ の判別– ICMP Address Mask Request
• Reply– Windows NT SP 3-
• No Reply– Windows NT SP 4+
![Page 35: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/35.jpg)
3. How does X works?
• 残りは?– DF Bit Echoing による Ultrix,Novell,BSD 系の判別
[with the request]• 返す
– Ultrix,Novell
• 返さない– それ以外の OS(BSD 系 )
– TTL が 128 のものが Novell
– TTL が 255 のものが Ultrix
![Page 36: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/36.jpg)
3. How does X works?
– OpenBSD2.1-2.3.x,2.4-2.5 とNetBSD1.5,1.4.1,1.4 の判別手法
• Echoing Integrity Check の UDP Checksum of the Offending Packet Echoed
– !=0
» OpenBSD 2.4.x-2.5.x
» NetBSD 1.5,1.4.1,1.4
– =0
» OpentBSD 2.1.x-2.3.x
![Page 37: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/37.jpg)
4. The Future development of X and xprobe
• AI とシグネチャベースのアプローチ• Custom scenario• Fail over mechanism• 出来ないことから学ぶ
– Static logic である– いくつかの OS と少ない数のネットワークデバイ
スしか判別できない– ICMP/UDPベースであること
– Fingerprint のデータベースとの連携
![Page 38: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/38.jpg)
4. The Future development of X and xprobe
• やりたいこと– Fingerprint のデータベースとの連携– 内部に AI を持たせて、 Dynamic にロジックを構築– 多くのネットワークデバイスの判別を可能にした
い– 違うトポロジには違う手法を用いたい– フィルタリングデバイスを使ったテストをしたい– 実際のアプリケーションデータベースを使い
UDPquery と絡めたい– もっと使える Network mapping も含まれるべき
![Page 39: X remote ICMP based OS fingerprinting techniques by Ofir Arkin](https://reader036.vdocuments.mx/reader036/viewer/2022062409/56814846550346895db55c31/html5/thumbnails/39.jpg)
Demo