《信息对抗技术》PPT课件.ppt

上传人:wuy****n92 文档编号:70949633 上传时间:2023-01-30 格式:PPT 页数:68 大小:250.49KB
返回 下载 相关 举报
《信息对抗技术》PPT课件.ppt_第1页
第1页 / 共68页
《信息对抗技术》PPT课件.ppt_第2页
第2页 / 共68页
点击查看更多>>
资源描述

《《信息对抗技术》PPT课件.ppt》由会员分享,可在线阅读,更多相关《《信息对抗技术》PPT课件.ppt(68页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、信息对抗技术信息对抗技术韩 宏入侵检测入侵检测系统定义n入侵检测系统是通过诸如,数据审计,网络报文分析等手段,检测各种入侵行为,保证网络安全。英文是intrusion detection system(IDS)。IDS的存在理由 网络防护中仅使用防火墙、访问控制、加解密技术并不能彻底解决安全问题。n因为首先入侵者可寻找防火墙和访问控制背后敞开的后门;n其次防火墙完全不能阻止内部袭击;n第三,由于性能限制,防火墙通常不能提供实时入侵检测能力,而访问控制对取得根权限的入侵者束手无策。n另外,加解密认证技术不能完全杜绝IP欺骗、重放攻击(replay attack)等入侵。特别对于危害十分严重的缓冲

2、区溢出(buffer overflow)攻击,以上传统技术均无有效防护措施。IDS的历史n在80年代就开展了早期基础理论研究工作。随着计算机系统软、硬件飞速发展,以及网络技术、分布式计算、系统工程、人工智能等计算机新兴技术与理论的不断完善,入侵检测理论也在发展变化中,至今仍未形成比较成熟的理论体系 IDS的分类n根据检测原理可分为异常入侵检测,误用入侵检测。n根据数据来源和系统结构可分为基于主机的入侵检测和基于网络的入侵检测和分布式入侵检测。误用入侵检测n或称为基于特征的入侵检测系统(Signature-based IDS)必须从一个或多个网络数据包或审计数据中提取出特定模式。如果这些模式与已

3、知入侵模式匹配,系统就能检测出攻击,因此它只能鉴别已知模式,不能检测新型攻击。同时,对特征错误理解将产生误报。获取特征有多种方法,包括手工提取特征和用传感器自动学习等。Snort是误用入侵检测的代表n网站:n该软件是开源软件。其基本原理是将网卡设定为混杂模式,然后监听网络上的报文,并将报文和用户自定义的规则进行比较,如果满足规则,则会根据用户要求将该次匹配命中的事件纪录到日志。n一个简单的规则如下:alert tcp any any-any 7026(msg:“glacier”).这条规则的意思是:凡是从任何机器的任何端口到任何机器的7026端口的tcp访问,就纪录下来,而纪录的名字为glac

4、ier.因为后门冰河的缺省端口实7026所以满足该规则的就可能是冰河n纪录下来的日志具有如下格式:*1:0:0 glacier*Priority:0 02/14-09:32:25.367646 202.115.14.1 11123-202.115.14.147 7026TCP TTL:255 TOS:0 x0 ID:46482 IpLen:20 DgmLen:60nSnort的规则中还有一个重要的选项,就是content,它指出如果报文中包含指定的字符串就告警。alert tcp any any-any any(content:“hell”).比如上面的规则就表明,如果报文中包含hell字符串

5、就告警。n很明显,snort的准确率依赖规则的准确性,更为重要的是,其判断依据往往会造成虚假告警或遗漏。nSnort也对其加以改进。比如,它增加了一中规则叫动态规则,就是,当一个规则满足后,检测另外一条规则。这里有一定专家系统的影子。nSnort在网络抓包方面,使用了一种libpcap库,这是unix上的一个抓包库,再linux和windows上都有相关的版本,windows上叫winpcap。可以在winpcap网站上下载到相关软件。异常入侵检测n基于异常的入侵检测系统(Anomaly-based IDS),其思路如下:正常系统有一“正常基准”,如CPU利用率、磁盘活动、用户注册、文件活动等

6、等。一旦偏离这一“正常基准”,检测系统将触发。基于异常检测的主要优点是能识别新型攻击。但正常操作产生变化时会导致误报,而入侵行为表现为正常又将导致漏报,且系统很难确定攻击类型。n检测用户行为模式是一种异常入侵检测。nH.S.Javitz and A.Valdes.The SRI IDES statistical anomaly detector.In Proceedings of the 1991 IEEE Symposium on Security and Privacy,pages 316C326,Oakland,California,May 20C22,1991.IEEE Compute

7、r Society Press.基于系统调用序列的免疫系统n该系统认为,对任何系统而言,存在一个基因库,该库中的基因是如下定义的:即一组系统调用序列,比如长度为45个系统调用。例如:socketbindlistenaccept.就是一个基因。n通过在正常无攻击环境下运行一个网络服务程序,可以得到其基因库。然后在检测时,比较这些库,如果基因出现偏差,就意味着异常或攻击发生。n参见相关文章nStephanie Forrest,Steven Hofmeyer,A sense of self for UNXI processes.In Proceedings of the 1996 IEEE Symp

8、osium on Security and Privacy.1996.nSteven A.Hofmeyr,Stephanie Forrest,Intrusion Detection using Sequences of System Calls,Journal of Computer Security 1998.按IDS结构分类n基于主机的入侵检测系统基于主机的入侵检测系统 基于主机的入侵检测系统历史最久,多用户计算机系统出现不久已有雏形。最早用于审计用户的活动,比如用户的登陆、命令操作、应用程序使用资源情况等方面。此类系统一般使用操作系统的审计日志作为输入,某些也会主动与主机系统交互获得其它

9、信息。收集的信息集中在系统调用和应用层审计上,试图从日志记录中判断出滥用和入侵事件的线索。典型的有NIDES和NetStat n基于网络的入侵检测系统基于网络的入侵检测系统 由于来自网络的攻击事件逐渐成为信息系统的最大威胁,因而基于网络的入侵检测系统具有重要价值。基于网络的入侵检测系统监听网络原始流量,通过线路监听手段对捕获的网络报文进行处理,从中获取有用的信息。基于网络的入侵检测系统通过流量分析提取特征模式,与已知攻击特征匹配或与正常网络行为原型比较识别出攻击事件,如Snort、Bro。与基于主机的入侵检测不同,基于网络的IDS更适用于检测系统应用层以下的底层攻击事件 n混合分布式入侵检测系

10、统混合分布式入侵检测系统 合分布式入侵检测系统能从不同的主机、网络组件、或通过网络监听方式收集数据,系统可利用网络数据也可收集分析来自主机系统的高层事件发现可疑行为。掌握libpcapn掌握libpcap可以为我们自主开发基于网络的入侵检测提供方便。主要内容:一、Winpcap使用介绍 二、面象对象对Winpcap的封装。一、Winpcap介绍 Winpcap是UNIX下的libpcap移植到windows下的产物,他是一个free and open source的项目。Winp-cap工作于驱动(Driver)层,所以能以很高的效率进行网络操作。一、Winpcap提供了以下强大的功能:1捕获

11、原始的数据包 见源码:CapturePacket 2设置filter,只捕获自己感兴趣的数据包3方便的把捕获的数据包输出到文件和从文件输入 见源码:DumpToFile4发送原始的数据包 见源码 SendPacket5统计网络流量 见源码:DisplayStatus二、Winpcap的安装使用方法 1到http:/下载winpcap的安装包,程序员开发包。2执行安装包,运行winpcap 程序3解压开发包,在VC的option的include和lib中加 入winpcap的include和lib4.在你的程序中加入#include,#include.然后在工程的setting中加入预定义宏:W

12、PCAP,HAV E_REMOTE.导入wpcap.lib,wsock32.lib库5编写wpcap程序三、Winpcap的一些基本的功能的实现(一)捕获数据包 1、.枚举所有的可用的设备pcap_findalldevs_ex (可选)2.通过名字打开一个设备pcap_open()3、在这里可以打开一个文件,只是在打开这个文 件之前需要通过pcap_createsrcstr创建相应的name string 4、设置Filterpcap_compile,pcap_setfilter(可选)5、捕获数据 有几种捕获数据的方法(捕获数据的数据都是最原始的数 据包,即包含数据链路层的数据头)a 是以回

13、调的方式 pcap_loop,pcap_dispatch().这两种方法基本相同,底层收集数据包,当满足一定的条件(timeout 或者缓冲区满),就会调用回调函数,把收集到 的原始数据包s,交给用户。他们返回的数据缓冲区包含多个包 例子见:CapturePacketb.pcap_next_ex()的方式每当一个包到到达以后,pcap_next_ex就会返回,返回的数据缓冲区里只包含一个包。(二)发送数据包 Winpcap中有发送单个包和发送多个包的方法。这里只说说发送单个包1 通过名字打开一个设备pcap_open2 自己构造一个原始数据包(这个数据包会不经过任何处理就发送出去,所以必须把包

14、中的各个字段设置好。另外这个数据包是包含数据链路层报头的)3 使用pcap_sendpacket()发送数据包见源码SendPacket工程(三)统计网络流量 1.通过名字打开一个设备pcap_open通过 read_timeout来设置统计的时间间隔2.设置filterpcap_compile,pcap_setfilter(可选)3.设置设备的为统计模式 pcap_setmode(MODE4._STAT);5.4.开始统计,pcap_loop/pcap_dispatch()6.5在回调函数中的参数中就包含了统计信息/下面是一个应用winpcap写的一个网络流量统计的例子,也可参见 源码Dis

15、playStatus工程/nettraffic.cpp:Defines the entry point for the console/application.#include stdafx.h#include#include#include#include using namespace std;/-/-void dispatcher_handler(u_char*user_data,const struct pcap_pkthdr*pkthdr,const u_char*pktdata);/-int main(int argc,char*argv)int i;pcap_if_t*allde

16、vs;pcap_if_t*dev;char errorbufPCAP_ERRBUF_SIZE;int choice;pcap_t*stathandle;WSADATA wsadata;struct timeval timestamp;if(WSAStartup(MAKEWORD(2,2),&wsadata)!=0)cerrWSAStartup failed WSAGetLastError()“endl;return(-1);/enum all deviceif(pcap_findalldevs_ex(PCAP_SRC_IF_STRING,NULL,&alldevs,errorbuf)=-1)W

17、SACleanup();cerrpcap_findalldevs_ex failed!(errorbuf)next)cout+itnameendl;if(i=0)WSACleanup();cerrno device found!endl;return(-2);/let user choicewhile(1)coutchoice;if(choice=1&choice=i)break;cerrinput error,you shall choice a device from upon list“endl;/move to the choosen devicefor(i=0,dev=alldevs

18、;inext);if(stathandle=pcap_open(dev-name,100,PCAP_OPENFLAG_PROMISCUOUS,500,NULL,errorbuf)=NULL)cerropen device failed!device:name errorbufendl;pcap_freealldevs(alldevs);WSACleanup();return(-3);coutis Stat name.ts.tv_sec-tstamp.tv_sec)*1000000 tstam p.tv_usec+pkthdr-ts.tv_usec;Pps.QuadPart=(*(LONGLON

19、G*)(pktdata)*1000000)/delay;Bps.QuadPart=(*(LONGLONG*)(pktdata+8)*1000000)/delay;struct tm*ltime=localtime(&(pkthdr-ts.tv_sec);strftime(strtime,sizeof(strtime),%H:%M:%S,ltime);printf(%s:,strtime);printf(tPps=%I64utBps=%I64urn,Pps.QuadPart,Bps.QuadPart);tstamp=pkthdr-ts;二、面象对象对Winpcap的封装 1、封装的原因:Winp

20、cap提供的是C函数,是面向过程的 对包进行协议解析。2、封装的目标:使对Winpcap的操作类似于对文件的操作。register,open,close,3、封装的申明class CCapture private:pcap_t*adhandle;char buff1536;CCapCallback*PCallbackObject;pcap_t*Open(int);int GetPackets(pcap_t*adhandle,char*pbuf,int len,int packetcount,int&RealLen);int Close(pcap_t*adhandle);public:CCapt

21、ure();CCapture();int CapRegister(CCapCallback*PCbObject);int CapOpen(int NIC);int CapClose();class CCapCallbackprivate:public:CCapCallback();CCapCallback();virtual HandlePacket(char*buff,int len);/这个文件包括两个类的实现 CCapture CCapCallback/*说明:CCapCallback是一个纯虚类,不能直接使用,必须继/*承后才能使用,CCapCallback 作为类CCapture 的

22、接口类,*/#include stdafx.h#include WCapDll.hpcap_t*adhandle;struct tm*ltime;char timestr16;struct pcap_pkthdr*header;const u_char*pkt_data;int res;export_packet recvpacket;int decode_iph(pexport_packet packet);int decode_eth(char*buff,const unsigned char*packetbuf,int len);/以下是CCapture 类的实现/CCapture:CC

23、apture()CCapture:CCapture()int CCapture:CapRegister(CCapCallback*PCbObject)if(PCbObject)PCallbackObject=PCbObject;return 0;elsereturn-1;int CCapture:CapOpen(int NIC)int result;int RealBytes;adhandle=Open(NIC);if(adhandle=NULL)return-1;while(1)result=GetPackets(adhandle,buff,1536,1,RealBytes);PCallba

24、ckObject-HandlePacket(buff,RealBytes);if(result!=1)break;return-1;int CCapture:CapClose()int res=0;res=Close(adhandle);return res;pcap_t*CCapture:Open(int nic)/static pcap_t*adhandle;pcap_if_t*alldevs;pcap_if_t*d;int i=0;int NicTotal=0;char errbufPCAP_ERRBUF_SIZE;/*Retrieve the device list from the

25、local machine*/if(pcap_findalldevs(&alldevs,errbuf)=-1)fprintf(stderr,Error in pcap_findalldevs_ex:%sn,errbuf);return NULL;/*Print the list*/for(d=alldevs;d!=NULL;d=d-next)NicTotal+;/check the paramer if(nicNicTotal-1)|(NicTotal=0)return NULL;for(d=alldevs,i=0;inext,i+);/*Open the device*/if(adhandl

26、e=pcap_open_live(d-name,/name of /the device8000,/portion of the packet to capture /65536 guarantees that the whole packet will be /captured on all the link layers1,/promiscuous mode1000,/read timeout errbuf /error buffer)=NULL)fprintf(stderr,nUnable to open the adapter.%s is not supported by WinPca

27、pn,d-name);/*Free the device list*/pcap_freealldevs(alldevs);return NULL;/*We dont need any more the device list.Free it*/pcap_freealldevs(alldevs);/MessageBox(NULL,this is a test,example,MB_OK);#ifdef DEBUG printf(%sn,open succeed);#endifreturn adhandle;int CCapture:GetPackets(pcap_t*adhandle,char*

28、pbuf,int len,int packetcount,int&RealLen)int count=0;RealLen=0;u_int retainlen=len;ZeroMemory(void*)pbuf,len);while(res=pcap_next_ex(adhandle,&header,&pkt_data)=0)if(res=0)continue;/36 reference to the size of the ethernet_frameif(retainlen=(header-len+36)/resolve the packetdecode_eth(pbuf,pkt_data,

29、header-len);/decide whether to receive the next packetpbuf+=(sizeof(export_packet)+header-len);count+;RealLen+=header-len+36;retainlen-=(sizeof(export_packet)+header-len);if(retainlen=36)#ifdef DEBUGprintf(%sn,memory size less than 36 and exit);#endifreturn count;if(retainlenlen+36)#ifdef DEBUGprint

30、f(%sn,retainlen len+36 and exit);#endifreturn count;if(count=packetcount)#ifdef DEBUGprintf(%sn,the count required have enough);#endifreturn count;else if(retainlenlen+36)/at first /the buff is not enough to load a packet#ifdef DEBUGprintf(%sn,retainlen less than(header-len+36)bytes and exit);#endif

31、return count;if(res=-1)#ifdef DEBUG printf(Error reading the packets:%sn,pcap_geterr(adhandle);#endif return-1;return count;int decode_eth(char*buff,const unsigned char*packetbuf,int len)export_packet*temp;memcpy(buff+36),packetbuf,len);temp=(export_packet*)buff;temp-buffer=buff+36;temp-totallen=len

32、+36;temp-pethheader=(ethernet_frame*)(buff+36);ethernet_frame*tef=(ethernet_frame*)packetbuf;if(tef-h_type=0 x08&tef-l_type=0 x00)#ifdef DEBUGprintf(this is a IP packetn);#endiftemp-pipheader=(ip_header*)(temp-buffer+14);#ifdef DEBUGprintf(n%d.%d.%d.%d-%d.%d.%d.%dn,temp-pipheader-saddr.byte1,temp-pi

33、pheader-saddr.byte2,temp-pipheader-saddr.byte3,temp-pipheader-saddr.byte4,temp-pipheader-daddr.byte1,temp-pipheader-daddr.byte2,temp-pipheader-daddr.byte3,temp-pipheader-daddr.byte4);#endif decode_iph(temp);if(tef-h_type=0 x08&tef-l_type=0 x06)#ifdef DEBUGprintf(%sn,this is a arp packet);/printf(Tar

34、get Hardaddress%X =%dt Source address=%Xn,(ethernet_frame*)packetbuf-h_dest,(ethernet_frame*)packetbuf-h_source);#endiftemp-parpheader=(arp_header*)(temp-buffer+14);if(tef-h_type=0 x80&tef-l_type=0 x35)#ifdef DEBUGprintf(%sn,this is a rarp packet);#endiftemp-parpheader=(arp_header*)(temp-buffer+14);

35、return 1;int decode_iph(pexport_packet packet)pip_header tempip;tempip=packet-pipheader;int ip_len=(tempip-ver_ihl&0 xf)*4;/uh=(udp_header*)(u_char*)ih+ip_len);switch(tempip-proto)case IPPROTO_TCP:/tcp protocal/printf(tcp Sport:%d tDport:%dn,packet-ptcpheader-sport,packet-ptcpheader-dport);packet-pt

36、cpheader=(tcp_header*)(packet-pipheader+ip_len);#ifdef DEBUGprintf(%sn,tcp packet);#endifbreak;case IPPROTO_UDP:/udp protocalpacket-pudpheader=(udp_header*)(packet-pipheader+ip_len);/printf(udp Sport:%d t Dport%dn,packet-pudpheader-sport,packet-pudpheader-dport);#ifdef DEBUGprintf(%sn,udp packet);#e

37、ndifbreak;case IPPROTO_ICMP:/icmp protocal packet-picmpheader=(icmp_header*)(packet-pipheader+ip_len);#ifdef DEBUG printf(%sn,icmp packet);#endif break;case IPPROTO_IGMP:/igmp protocal packet-pigmpheader=(igmp_header*)(packet-pipheader+ip_len);#ifdef DEBUG printf(%sn,igmp packet);#endif break;default:#ifdef DEBUG printf(%sn,do not resolve the ip packet);#endif ;return 1;nt CCapture:Close(pcap_t*handle)if(handle!=NULL)pcap_close(handle);return 0;/以下是CCapCallback类的实现文件/CCapCallback:CCapCallback()CCapCallback:CCapCallback()PortScanKicker 检测网络扫描。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com