查偉金
摘要:隨著互聯(lián)網(wǎng)技術(shù)的快速發(fā)展,網(wǎng)絡(luò)服務(wù)于各類行業(yè),域名數(shù)量與日俱增的同時(shí)惡意域名的檢測(cè)也變得愈來(lái)愈困難且更加重要。惡意服務(wù)常利用域名生成算法(DGA)逃避域名檢測(cè),DGA域名常見(jiàn)于一些僵尸網(wǎng)絡(luò)和APT攻擊中,針對(duì)DGA域名可以輕易地繞過(guò)傳統(tǒng)防火墻和入侵檢測(cè)設(shè)備、現(xiàn)有方法檢測(cè)速度慢、實(shí)用性不強(qiáng)等問(wèn)題,采用深度學(xué)習(xí)技術(shù),基于LSTM設(shè)計(jì)了DGA域名檢測(cè)方法,從海量域名樣本中分辨出異常域名,借助機(jī)器代替人力完成這樣重復(fù)性的工作。經(jīng)實(shí)驗(yàn)結(jié)果證明,該方法檢測(cè)準(zhǔn)確率高達(dá)99.1%以上,是有效可行的。同時(shí)結(jié)合流量探針構(gòu)建實(shí)時(shí)監(jiān)測(cè)系統(tǒng),實(shí)時(shí)準(zhǔn)確地監(jiān)測(cè)流量中的DGA域名,提高網(wǎng)絡(luò)空間安全性。
關(guān)鍵詞:域名生成算法;僵尸網(wǎng)絡(luò);深度學(xué)習(xí);LSTM;網(wǎng)絡(luò)空間安全
Abstract: With the rapid development of Internet technology, the network had served various industries, While the number of domain names is increasing day by day, the detection of malicious domain names has become more and more difficult and more important. Domain Generate Algorithm (DGA) was used by malicious services to evade domain detection. DGA was common in some botnets and APT attacks, aiming at the problem of DGA domain can easily bypass traditional firewalls and intrusion detection devices, slow detection speed and poor real-time performance in existing detection methods. a DGA domain detection algorithm based on Long Short-Term Memory (LSTM) model was designed by using deep learning, which candistinguish abnormal domain names from a large number of domain name samples, and use machines to replace humans to complete such repetitive tasks. The experimental results prove that the detection accuracy of this method is as high as 99.1%, which is effective and feasible. Meanwhile, a Real-time Monitoring System for DGA Domain based on LSTM was proposed in combination with flow probe to monitor network traffic in real time and improve cyberspace protection capabilities.
Key words: domain generation algorithm; botnet; deep learning; LSTM; cyberspace security
1引言
目前,網(wǎng)絡(luò)安全問(wèn)題日益突出。網(wǎng)絡(luò)攻擊、網(wǎng)絡(luò)恐怖主義等安全事件時(shí)有發(fā)生。隨著公共云、私有云和大型局域網(wǎng)在企業(yè)、軍隊(duì)和學(xué)校的廣泛使用,用戶在互聯(lián)網(wǎng)上的各種操作和行為每天都會(huì)產(chǎn)生大量的信息,不法分子也一直想通過(guò)網(wǎng)絡(luò)攻擊等手段獲取機(jī)密信息和情報(bào)。
惡意軟件經(jīng)常使用DGA域名來(lái)提高其與C&C服務(wù)器通信的可靠性,從而避免常規(guī)的黑名單檢測(cè)。從大量域名樣本中識(shí)別異常域名的任務(wù)應(yīng)該由機(jī)器來(lái)完成,而不是由人工來(lái)完成。傳統(tǒng)的DGA域檢測(cè)方法通常有很大的缺點(diǎn)。黑名單過(guò)濾方法[1]雖然準(zhǔn)確率高,但需要手工補(bǔ)充黑名單之外的DGA域名,難以解決DGA域名快速增長(zhǎng)帶來(lái)的問(wèn)題。機(jī)器學(xué)習(xí)檢測(cè)方法[2-7]需要通過(guò)技術(shù)人員的實(shí)驗(yàn)構(gòu)造特征值,并設(shè)計(jì)檢測(cè)算法,實(shí)現(xiàn)對(duì)未知DGA域名的檢測(cè),但是也存在一些問(wèn)題,如手工特征提取工作量大,無(wú)法準(zhǔn)確提取出所需的全部特征,檢測(cè)速度慢,檢測(cè)精度低等。
近幾年深度學(xué)習(xí)[8]在自然語(yǔ)言處理有很好的表現(xiàn),比傳統(tǒng)的機(jī)器學(xué)習(xí)更有優(yōu)勢(shì)。它能自動(dòng)提取特征,并通過(guò)訓(xùn)練大量樣本獲得較高的精度。經(jīng)典的循環(huán)神經(jīng)網(wǎng)絡(luò)(RNN)能很好地保留語(yǔ)言處理中的上下文信息。但是,隨著訓(xùn)練過(guò)程中時(shí)間和輸入數(shù)據(jù)的增加,RNN對(duì)語(yǔ)句中上下文信息的感知能力就會(huì)下降,導(dǎo)致梯度的消失或爆炸。而在RNN基礎(chǔ)上改進(jìn)的LSTM[9-11]可以解決上述問(wèn)題,并在DGA域名檢測(cè)中取得良好的結(jié)果。基于此并結(jié)合流量探測(cè)器,設(shè)計(jì)了基于LSTM的DGA域名實(shí)時(shí)監(jiān)測(cè)系統(tǒng)。為保證該算法的良好檢測(cè)性能,本文選擇360和Alexa分別提供的DGA域名和合法域名進(jìn)行合理的建模和評(píng)估,以獲得最優(yōu)的檢測(cè)算法。
2基于LSTM的DGA域名檢測(cè)算法
基于LSTM的DGA域名檢測(cè)算法包括域名向量化、上下文信息提取、分類輸出等三個(gè)步驟。
2.1 域名向量化
在輸入一個(gè)域名作為模型之前,有必要對(duì)域名進(jìn)行向量化。常用的向量化方法有bag of words(BoW)、One hot和n-gram(n元語(yǔ)法)。由于域名字符串中沒(méi)有語(yǔ)法和詞序元素,我們選擇Bow模型從統(tǒng)計(jì)數(shù)據(jù)集中的所有字符生成一個(gè)字符字典,并以鍵值對(duì)('a':2)的形式存儲(chǔ)。