信息對抗技術PPT演示文稿_第1頁
信息對抗技術PPT演示文稿_第2頁
信息對抗技術PPT演示文稿_第3頁
信息對抗技術PPT演示文稿_第4頁
信息對抗技術PPT演示文稿_第5頁
已閱讀5頁,還剩63頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、1信息對抗技術信息對抗技術韓 宏2入侵檢測3入侵檢測系統(tǒng)定義n入侵檢測系統(tǒng)是通過諸如,數據審計,網絡報文分析等手段,檢測各種入侵行為,保證網絡安全。英文是intrusion detection system (ids)。4ids的存在理由 網絡防護中僅使用防火墻、訪問控制、加解密技術并不能徹底解決安全問題。n因為首先入侵者可尋找防火墻和訪問控制背后敞開的后門;n其次防火墻完全不能阻止內部襲擊;n第三,由于性能限制,防火墻通常不能提供實時入侵檢測能力,而訪問控制對取得根權限的入侵者束手無策。n另外,加解密認證技術不能完全杜絕ip欺騙、重放攻擊(replay attack)等入侵。特別對于危害十分

2、嚴重的緩沖區(qū)溢出(buffer overflow)攻擊,以上傳統(tǒng)技術均無有效防護措施。 5ids的歷史n在80年代就開展了早期基礎理論研究工作。隨著計算機系統(tǒng)軟、硬件飛速發(fā)展,以及網絡技術、分布式計算、系統(tǒng)工程、人工智能等計算機新興技術與理論的不斷完善,入侵檢測理論也在發(fā)展變化中,至今仍未形成比較成熟的理論體系 67ids的分類n根據檢測原理可分為異常入侵檢測,誤用入侵檢測。n根據數據來源和系統(tǒng)結構可分為基于主機的入侵檢測和基于網絡的入侵檢測和分布式入侵檢測。8誤用入侵檢測n或稱為基于特征的入侵檢測系統(tǒng)(signature-based ids) 必須從一個或多個網絡數據包或審計數據中提取出特定

3、模式。如果這些模式與已知入侵模式匹配,系統(tǒng)就能檢測出攻擊,因此它只能鑒別已知模式,不能檢測新型攻擊。同時,對特征錯誤理解將產生誤報。獲取特征有多種方法,包括手工提取特征和用傳感器自動學習等。 9snort是誤用入侵檢測的代表n網站:n該軟件是開源軟件。其基本原理是將網卡設定為混雜模式,然后監(jiān)聽網絡上的報文,并將報文和用戶自定義的規(guī)則進行比較,如果滿足規(guī)則,則會根據用戶要求將該次匹配命中的事件紀錄到日志。10n一個簡單的規(guī)則如下: alert tcp any any - any 7026 (msg: “glacier”).這條規(guī)則的意思是:凡是從任何機器的任何端口到任何

4、機器的7026端口的tcp訪問,就紀錄下來,而紀錄的名字為glacier. 因為后門冰河的缺省端口實7026所以滿足該規(guī)則的就可能是冰河11n紀錄下來的日志具有如下格式:* 1:0:0 glacier *priority: 0 02/14-09:32:25.367646 11123- 47 7026tcp ttl:255 tos:0 x0 id:46482 iplen:20 dgmlen:6012nsnort的規(guī)則中還有一個重要的選項,就是content,它指出如果報文中包含指定的字符串就告警。alert tcp any any - any a

5、ny (content: “hell”).比如上面的規(guī)則就表明,如果報文中包含hell字符串就告警。13n很明顯,snort的準確率依賴規(guī)則的準確性,更為重要的是,其判斷依據往往會造成虛假告警或遺漏。nsnort也對其加以改進。比如,它增加了一中規(guī)則叫動態(tài)規(guī)則,就是,當一個規(guī)則滿足后,檢測另外一條規(guī)則。這里有一定專家系統(tǒng)的影子。14nsnort在網絡抓包方面,使用了一種libpcap庫,這是unix上的一個抓包庫,再linux和windows上都有相關的版本,windows上叫winpcap??梢栽趙inpcap網站上下載到相關軟件。15異常入侵檢測n基于異常的入侵檢測系統(tǒng)(anomaly-b

6、ased ids),其思路如下:正常系統(tǒng)有一“正常基準”,如cpu利用率、磁盤活動、用戶注冊、文件活動等等。一旦偏離這一“正?;鶞省?,檢測系統(tǒng)將觸發(fā)?;诋惓z測的主要優(yōu)點是能識別新型攻擊。但正常操作產生變化時會導致誤報,而入侵行為表現為正常又將導致漏報,且系統(tǒng)很難確定攻擊類型。 16n檢測用戶行為模式是一種異常入侵檢測。nh. s. javitz and a. valdes. the sri ides statistical anomaly detector. in proceedings of the 1991 ieee symposium on security and privacy,

7、 pages 316c326, oakland, california, may 20c22, 1991. ieee computer society press. 17基于系統(tǒng)調用序列的免疫系統(tǒng)n該系統(tǒng)認為,對任何系統(tǒng)而言,存在一個基因庫,該庫中的基因是如下定義的:即一組系統(tǒng)調用序列,比如長度為45個系統(tǒng)調用。例如:socketbindlistenaccept.就是一個基因。n通過在正常無攻擊環(huán)境下運行一個網絡服務程序,可以得到其基因庫。然后在檢測時,比較這些庫,如果基因出現偏差,就意味著異?;蚬舭l(fā)生。18n參見相關文章nstephanie forrest, steven hofmeyer

8、, a sense of self for unxi processes. in proceedings of the 1996 ieee symposium on security and privacy. 1996.nsteven a. hofmeyr, stephanie forrest, intrusion detection using sequences of system calls, journal of computer security 1998.19按ids結構分類n基于主機的入侵檢測系統(tǒng)基于主機的入侵檢測系統(tǒng) 基于主機的入侵檢測系統(tǒng)歷史最久,多用戶計算機系統(tǒng)出現不久已有

9、雛形。最早用于審計用戶的活動,比如用戶的登陸、命令操作、應用程序使用資源情況等方面。此類系統(tǒng)一般使用操作系統(tǒng)的審計日志作為輸入,某些也會主動與主機系統(tǒng)交互獲得其它信息。收集的信息集中在系統(tǒng)調用和應用層審計上,試圖從日志記錄中判斷出濫用和入侵事件的線索。典型的有nides和netstat 20n基于網絡的入侵檢測系統(tǒng)基于網絡的入侵檢測系統(tǒng) 由于來自網絡的攻擊事件逐漸成為信息系統(tǒng)的最大威脅,因而基于網絡的入侵檢測系統(tǒng)具有重要價值。基于網絡的入侵檢測系統(tǒng)監(jiān)聽網絡原始流量,通過線路監(jiān)聽手段對捕獲的網絡報文進行處理,從中獲取有用的信息?;诰W絡的入侵檢測系統(tǒng)通過流量分析提取特征模式,與已知攻擊特征匹配或

10、與正常網絡行為原型比較識別出攻擊事件,如snort、bro。與基于主機的入侵檢測不同,基于網絡的ids更適用于檢測系統(tǒng)應用層以下的底層攻擊事件 21n混合分布式入侵檢測系統(tǒng)混合分布式入侵檢測系統(tǒng) 合分布式入侵檢測系統(tǒng)能從不同的主機、網絡組件、或通過網絡監(jiān)聽方式收集數據,系統(tǒng)可利用網絡數據也可收集分析來自主機系統(tǒng)的高層事件發(fā)現可疑行為。 22掌握libpcapn掌握libpcap可以為我們自主開發(fā)基于網絡的入侵檢測提供方便。23主要內容: 一、winpcap使用介紹 二、面象對象對winpcap的封裝。24一、winpcap介紹 winpcap是unix下的libpcap移植到windows下的

11、產物,他是一個free and open source的項目。winp-cap工作于驅動(driver)層,所以能以很高的效率進行網絡操作。一、winpcap提供了以下強大的功能: 1捕獲原始的數據包 見源碼:capturepacket 2設置filter,只捕獲自己感興趣的數據包253方便的把捕獲的數據包輸出到文件和從文件輸入 見源碼:dumptofile4發(fā)送原始的數據包 見源碼 sendpacket5統(tǒng)計網絡流量 見源碼:displaystatus26二、winpcap的安裝使用方法 1到http:/winpcap.polito.it下載winpcap的安裝包, 程序員開發(fā)包。2執(zhí)行安裝

12、包,運行winpcap 程序3解壓開發(fā)包,在vc的option的include和lib中加 入winpcap的include和lib274. 在你的程序中加入#include ,#include .然后在工程的setting中加入預定義宏:wpcap,hav e_remote.導入wpcap.lib, wsock32.lib庫5編寫wpcap程序28三、winpcap的一些基本的功能的實現 (一)捕獲數據包 1、. 枚舉所有的可用的設備pcap_findalldevs_ex (可選) 2. 通過名字打開一個設備pcap_open() 3、在這里可以打開一個文件,只是在打開這個文 件之前需要通過

13、pcap_createsrcstr創(chuàng)建相應的name string 4、設置filterpcap_compile, pcap_setfilter (可選) 5、 捕獲數據29 有幾種捕獲數據的方法(捕獲數據的數據都是最原始的數 據包,即包含數據鏈路層的數據頭)a 是以回調的方式 pcap_loop,pcap_dispatch() . 這兩種方法基本相同,底層收集數據包,當滿足一定的條件(timeout 或者緩沖區(qū)滿),就會調用回調函數,把收集到 的原始數據包s,交給用戶。他們返回的數據緩沖區(qū)包含多個包 例子見:capturepacketb. pcap_next_ex()的方式每當一個包到到達以

14、后,pcap_next_ex就會返回,返回的數據緩沖區(qū)里只包含一個包。 30(二)發(fā)送數據包 winpcap中有發(fā)送單個包和發(fā)送多個包的方法。這里只說說發(fā)送單個包1 通過名字打開一個設備pcap_open2 自己構造一個原始數據包(這個數據包會不經過任何處理就發(fā)送出去,所以必須把包中的各個字段設置好。另外這個數據包是包含數據鏈路層報頭的)3 使用pcap_sendpacket()發(fā)送數據包見源碼sendpacket工程31(三)統(tǒng)計網絡流量 通過名字打開一個設備pcap_open通過 read_timeout來設置統(tǒng)計的時間間隔 設置filterpcap_compile, pcap_setfi

15、lter (可選) 設置設備的為統(tǒng)計模式 pcap_setmode(mode _stat); 4. 開始統(tǒng)計,pcap_loop/pcap_dispatch() 5在回調函數中的參數中就包含了統(tǒng)計信息 32/下面是一個應用winpcap寫的一個網絡流量統(tǒng)計的例子,也可參見 源碼displaystatus工程/ nettraffic.cpp : defines the entry point for the console /application.#include stdafx.h#include #include #include #include 33using namespace std

16、;/-/-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* alldevs;34pcap_if_t* dev;char errorbufpcap_errbuf_size;int choice;pcap_t* stathandle;wsadata wsadata;struct timeval timestamp;if( wsastartup( mak

17、eword(2,2), &wsadata) != 0 )cerrwsastartup failed wsagetlasterror() “ endl;return (-1);35/enum all deviceif( pcap_findalldevs_ex( pcap_src_if_string, null, &alldevs, errorbuf ) = -1 )wsacleanup();cerrpcap_findalldevs_ex failed! (errorbuf)next )cout+itnameendl;if( i= 0 )wsacleanup();cerrno device fou

18、nd!endl;return (-2);37/let user choicewhile( 1)coutchoice;if( choice = 1 & choice =i )break;cerrinput error, you shall choice a device from upon list“endl;38/move to the choosen devicefor( i=0, dev = alldevs; inext );if( (stathandle = pcap_open( dev-name, 100, pcap_openflag_promiscuous, 500,null, er

19、rorbuf ) ) = null )cerropen device failed! device:name errorbufendl;39pcap_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 = (*(longlong*)(pktdata) * 1000000 ) / delay;bps.quadpart = (*(longlong*)(p

20、ktdata + 8) * 1000000 ) / delay;42struct 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;43 二、面象對象對winpcap的封裝 1、封裝的原因: winpcap提供的是c函數,是面向過程的 對包進行協(xié)議解析。 2

21、、封裝的目標: 使對winpcap的操作類似于對文件的操作。 register,open,close,443、封裝的申明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:ccapture();ccaptu

22、re();int capregister(ccapcallback * pcbobject);int capopen(int nic);int capclose();45class ccapcallbackprivate:public:ccapcallback();ccapcallback();virtual handlepacket(char * buff,int len);46/ 這個文件包括兩個類的實現 ccapture ccapcallback/*說明:ccapcallback是一個純虛類,不能直接使用,必須繼/*承后才能使用,ccapcallback 作為類ccapture 的接口類

23、,*/#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);47/ 以下是ccapture 類的實現/ccap

24、ture:ccapture() ccapture:ccapture() int ccapture:capregister(ccapcallback * pcbobject) if (pcbobject) pcallbackobject=pcbobject;return 0; elsereturn -1;48int ccapture:capopen(int nic)int result;int realbytes;adhandle=open(nic);if (adhandle=null)return -1;while (1)result=getpackets(adhandle,buff,1536

25、,1,realbytes);pcallbackobject-handlepacket(buff,realbytes);if (result!=1)break;return -1;49int ccapture:capclose()int res=0;res=close(adhandle);return res;50pcap_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_siz

26、e; /* retrieve the device list from the local machine */ if (pcap_findalldevs( &alldevs, errbuf) = -1) fprintf(stderr,error in pcap_findalldevs_ex: %sn, errbuf); return null; 51 /* print the list */ for(d= alldevs; d != null; d= d-next) nictotal+; / check the paramer if (nicnictotal-1) | (nictotal=0

27、) )return null;for(d=alldevs, i=0; inext, i+); 52/* open the device */ if ( (adhandle= 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 errbu

28、f / error buffer) ) = null) fprintf(stderr,nunable to open the adapter. %s is not supported by winpcapn, d-name); /* free the device list */ pcap_freealldevs(alldevs); return null; 53 /* we dont need any more the device list. free it */ pcap_freealldevs(alldevs);/messagebox(null,this is a test,examp

29、le,mb_ok);#ifdef debug printf(%sn,open succeed);#endifreturn adhandle;54int ccapture:getpackets(pcap_t *adhandle,char * 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)55

30、 if(res = 0) continue;/36 reference to the size of the ethernet_frameif (retainlen=(header-len+36) /resolve the packetdecode_eth(pbuf,pkt_data,header-len); / decide whether to receive the next packetpbuf+=(sizeof(export_packet)+header-len);count+;56reallen+=header-len+36;retainlen-=(sizeof(export_pa

31、cket)+ header-len);if (retainlen=36)#ifdef debugprintf(%sn,memory size less than 36 and exit);#endifreturn count;57if (retainlenlen+36)#ifdef debugprintf(%sn,retainlen len+36 and exit);#endifreturn count;if (count=packetcount) #ifdef debugprintf(%sn, the count required have enough);#endifreturn coun

32、t;58 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);#endifreturn count; if(res = -1)#ifdef debug printf(error reading the packets: %sn, pcap_geterr(adhandle);#endif return -1; return count;59int

33、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+36;temp-pethheader=(ethernet_frame *)(buff+36);ethernet_frame * tef=(ethernet_frame *)packetbuf;if (tef-h_type=0 x08 &

34、tef-l_type=0 x00)60#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-pipheader-saddr.byte2, temp-pipheader-saddr.byte3,temp-pipheader-saddr.byte4,temp-pipheader-daddr.byte1, temp-

35、pipheader-daddr.byte2,temp-pipheader-daddr.byte3,temp-pipheader-daddr.byte4);#endif 61decode_iph(temp);if (tef-h_type=0 x08 & tef-l_type=0 x06)#ifdef debugprintf(%sn, this is a arp packet);/printf(target hardaddress %x =%dt source address =%xn,(ethernet_frame*)packetbuf- h_dest,(ethernet_frame*)packetbuf-h_source);#endiftemp-parpheader=(arp_header *)(temp-buffer+14);62if (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);return 1;6

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論