20155330 《網絡攻防》 Exp4 惡意代碼分析

20155330 《網絡攻防》 Exp4 惡意代碼分析

實驗後回答問題

(1)若是在工做中懷疑一臺主機上有惡意代碼,但只是猜測,全部想監控下系統一每天的到底在幹些什麼。請設計下你想監控的操做有哪些,用什麼方法來監控。

  • 使用Windows自帶的schtasks指令設置一個計劃任務,指定每隔必定時間記錄主機的聯網記錄或端口開放、註冊表信息等;
  • 經過sysmon工具,配置須要記錄事件的文件,以後在事件查看器裏找到相關日誌文件查看;
  • 使用Process Explorer工具,監視進程執行狀況,查看是否有程序調用了異常的dll庫之類的。html

    (2)若是已經肯定是某個程序或進程有問題,你有什麼工具能夠進一步獲得它的哪些信息

  • 使用systracer工具分析某個程序執行先後,計算機註冊表、文件、端口的一些變化狀況。算法

    實驗過程

    使用schtasks指令監控系統

  • 在C盤目錄下創建一個netstatlog.bat文件,用來將記錄的聯網結果格式化輸出到netstatlog.txt文件中,netstatlog.bat內容爲:
date /t >> c:\netstatlog.txt
time /t >> c:\netstatlog.txt
netstat -bn >> c:\netstatlog.txt
  • 此時C盤中的文件:
  • 打開Windows下命令提示符,輸入指令schtasks /create /TN netstat /sc MINUTE /MO 2 /TR "c:\netstatlog.bat"建立一個每隔兩分鐘記錄計算機聯網狀況的任務
  • 右鍵點擊「計算機」|「管理」,在計算機管理中點擊「任務程序計劃」|「任務程序計劃庫」,雙擊netstat任務計劃項目,點擊「操做」頁籤,「編輯」|修改「程序或腳本」爲C:\netstatlog.bat



  • 在「操做」中,將「只有在計算機使用交流電源時才啓動此任務」選項取消
  • 過了一會查看netstatlog.txt文件……
  • 再次雙擊netstat任務計劃項目,在「常規」頁籤中勾選「使用最高權限運行」
  • 隔了大約一天以後,再次查看記錄的主機聯網日誌。
  • 根據張競予同窗的博客,製做了相關表格和餅狀圖。因爲使用的是虛擬機進行實踐,因此聯網的應用程序種類較少。

    chrome

    使用sysmon工具監控系統

  • 首先建立配置文件Sysmon20155303.xml,內容以下:
<Sysmon schemaversion="3.10">
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
<!-- Log all drivers except if the signature -->
<!-- contains Microsoft or Windows -->
<DriverLoad onmatch="exclude">
  <Signature condition="contains">microsoft</Signature>
  <Signature condition="contains">windows</Signature>
</DriverLoad>

<NetworkConnect onmatch="exclude">
  <Image condition="end with">chrome.exe</Image>
  <Image condition="end with">iexplorer.exe</Image>
  <SourcePort condition="is">137</SourcePort>
</NetworkConnect>

<CreateRemoteThread onmatch="include">
  <TargetImage condition="end with">explorer.exe</TargetImage>
  <TargetImage condition="end with">svchost.exe</TargetImage>
  <TargetImage condition="end with">winlogon.exe</TargetImage>
  <SourceImage condition="end with">powershell.exe</SourceImage>
</CreateRemoteThread>
  </EventFiltering>
</Sysmon>
  • 使用命令Sysmon.exe -i C:\Sysmon20155330.xml安裝Sysmon
  • 在「事件查看器」中查看程序相關信息。

  • Sysmon.exe -c C:\Sysmon20155330.xml更改配置文件,監聽443和80端口,無異常發生。
<Sysmon schemaversion="3.10">
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
<!-- Log all drivers except if the signature -->
<!-- contains Microsoft or Windows -->
<DriverLoad onmatch="exclude">
  <Signature condition="contains">microsoft</Signature>
  <Signature condition="contains">windows</Signature>
</DriverLoad>

<NetworkConnect onmatch="exclude">
  <Image condition="end with">SogouExplorer.exe</Image>
</NetworkConnect>

<NetworkConnect onmatch="include">     
  <DestinationPort condition="is">80</DestinationPort>      
  <DestinationPort condition="is">443</DestinationPort>    
</NetworkConnect>

<CreateRemoteThread onmatch="include">
  <TargetImage condition="end with">explorer.exe</TargetImage>
  <TargetImage condition="end with">svchost.exe</TargetImage>
  <TargetImage condition="end with">winlogon.exe</TargetImage>
  <SourceImage condition="end with">powershell.exe</SourceImage>
</CreateRemoteThread>
  </EventFiltering>
</Sysmon>

使用VirusTotal分析惡意軟件

  • 把後門軟件上傳到VirusTotal進行掃描,只有16個軟件沒有檢測出病毒……
  • 查看這個惡意代碼的基本屬性
  • 算法庫支持狀況

    shell

    使用Process Monitor分析惡意軟件

  • Process Monitor是一個高級的 Windows 系統和應用程序監視工具,使用者能夠對系統中的任何文件和註冊表操做同時進行監視和記錄,經過註冊表和文件讀寫的變化,診斷系統故障或是發現惡意軟件、病毒或木馬。
  • 如下爲軟件記錄狀況(部分)。
    windows

    使用Process Explorer分析惡意軟件

  • Process Explorer讓使用者能瞭解看不到的在後臺執行的處理程序,能顯示目前已經載入哪些模塊,分別是正在被哪些程序使用着,還可顯示這些程序所調用的 DLL進程,以及他們所打開的句柄。
  • 後門軟件運行狀況記錄:
    網絡

    使用PEiD分析惡意軟件

  • PEiD(PE Identifier)是一款著名的查殼工具。
  • 未加殼掃描結果:
  • 加殼後:
    工具

使用systracer分析惡意軟件

  • 在kali對windows主機進行回連先後使用軟件進行快照,而後對比。
  • 首先是註冊表發生了變化:
  • 端口狀況

實驗體會

經過此次的學習和實踐,主要對惡意代碼的分析方式有了必定的瞭解。惡意代碼分析主要分爲靜態分析和動態分析兩種方式。經過和上一次的實踐相結合,對惡意代碼的隱蔽性有了更加深入的瞭解。學習

相關文章
相關標籤/搜索