Metasploit 滲透測(cè)試手冊(cè)第三版 第二章 信息收集與掃描 -續(xù)(翻譯)

第二章 信息收集和掃描-續(xù)

我們將學(xué)習(xí)以下內(nèi)容

Nessus結(jié)合使用

NeXpose結(jié)合使用

OpenVAS結(jié)合使用

接上篇:第二章 信息收集與掃描

14悔耘、與Nessus結(jié)合

到目前為止颈将,我們已經(jīng)了解了端口掃描的基礎(chǔ)知識(shí),以及學(xué)會(huì)了Nmap的使用。通過其他一些工具的學(xué)習(xí),進(jìn)一步提高了掃描和信息收集的技術(shù)。在接下來的小節(jié)中曲伊,我們將介紹其他幾種掃描目標(biāo)可用服務(wù)和端口的工具,這些工具還可以幫助我們確定特定服務(wù)和端口可能存在的漏洞類型捣炬。讓我們開始漏洞掃描之旅熊昌。

Nessus是使用最廣泛的漏洞掃描器之一绽榛,它可用通過掃描目標(biāo)發(fā)現(xiàn)漏洞并生成詳細(xì)的報(bào)告湿酸。Nessus是滲透測(cè)試中非常有用的工具。你可用使用它的GUI版本灭美,也可以在Metasploit控制臺(tái)中使用它推溃。本書主要介紹在msfconsole中使用它。

準(zhǔn)備工作

要使用Nessus需要先去Nessus官網(wǎng)注冊(cè)并取得Licenses届腐。你可以使用Nessus家庭版铁坎,此授權(quán)是免費(fèi)的,它允許你掃描個(gè)人家庭網(wǎng)絡(luò)(小于16個(gè)IP地址)犁苏。然后下載軟件安裝包進(jìn)行安裝硬萍。在Kali中需要下載.deb格式的包,然后使用dpkg -i進(jìn)行安裝围详。

家庭版密鑰申請(qǐng)地址:https://www.tenable.com/products/nessus-home

注冊(cè)

填寫注冊(cè)信息朴乖,完成注冊(cè)祖屏,然后會(huì)跳轉(zhuǎn)到下載頁(yè)面

下載頁(yè)面

根據(jù)自己的系統(tǒng)版本,下載32bit或者64bit版本

選擇下載

激活密鑰會(huì)發(fā)到你的郵箱里面买羞,請(qǐng)保存下來袁勺。

收到激活密鑰

下載完成之后進(jìn)行安裝:

root@osboxes:~# cd ~/Downloads/
root@osboxes:~/Downloads# ls
bettercap  bettercap_linux_amd64_2.2.zip  libpcap-1.8.1  libpcap-1.8.1.tar.gz  Nessus-8.3.1-debian6_amd64.deb
root@osboxes:~/Downloads# dpkg -i Nessus-8.3.1-debian6_amd64.deb //安裝
Selecting previously unselected package nessus.
(Reading database ... 435326 files and directories currently installed.)
Preparing to unpack Nessus-8.3.1-debian6_amd64.deb ...
Unpacking nessus (8.3.1) ...
Setting up nessus (8.3.1) ...
Unpacking Nessus Scanner Core Components...

 - You can start Nessus Scanner by typing /etc/init.d/nessusd start
 - Then go to https://osboxes:8834/ to configure your scanner

Processing triggers for systemd (241-1) ...
root@osboxes:~/Downloads#

安裝完成之后,啟動(dòng)Nessus服務(wù)

root@osboxes:~/Downloads# systemctl start nessusd.service

根據(jù)提示畜普,使用瀏覽器打開網(wǎng)址https://osboxes:8834/或者https://127.0.0.1:8834進(jìn)行配置

1期丰、設(shè)置用戶名和密碼:

設(shè)置用戶信息

2、選擇Home,Professional or Manager吃挑,填寫激活密鑰進(jìn)行授權(quán)激活钝荡。

激活

3、激活完成后舶衬,Nessus還會(huì)安裝一系列組件化撕,等待安裝完成(需要一段時(shí)間,請(qǐng)耐心等待)

安裝組件

安裝完成后约炎,就可以進(jìn)行下一步操作了植阴。

怎么做

1、在msfconsole里面載入nessus組件圾浅。

msf5 > load nessus //載入nessus組件
[*] Nessus Bridge for Metasploit
[*] Type nessus_help for a command listing
[*] Successfully loaded plugin: Nessus
msf5 >

2掠手、輸入nessus_help命令,可以查看可用參數(shù)和幫助信息

msf5 > nessus_help

Command                     Help Text
-------                     ---------
Generic Commands
-----------------           -----------------
nessus_connect              Connect to a Nessus server
nessus_logout               Logout from the Nessus server
nessus_login                Login into the connected Nesssus server with a different username and password
nessus_save                 Save credentials of the logged in user to nessus.yml
nessus_help                 Listing of available nessus commands
nessus_server_properties    Nessus server properties such as feed type, version, plugin set and server UUID.
nessus_server_status        Check the status of your Nessus Server
nessus_admin                Checks if user is an admin
nessus_template_list        List scan or policy templates
nessus_folder_list          List all configured folders on the Nessus server
nessus_scanner_list         List all the scanners configured on the Nessus server
Nessus Database Commands

3狸捕、連接到Nessus服務(wù)喷鸽,使用nessus_connect NessusUser:NessusPassword@127.0.0.1命令。

msf5 > nessus_connect nessusroot:Passw0rd@127.0.0.1 //連接到 Nessus 服務(wù)
[*] Connecting to https://127.0.0.1:8834/ as nessusroot
[*] User nessusroot authenticated successfully.
msf5 >

4灸拍、使用nessus_policy_list可用列出Nessus服務(wù)上的所有掃描策略做祝。如果沒有,需要先在WebUI界面中創(chuàng)建策略鸡岗。

msf5 > nessus_policy_list
[-] No policies found
msf5 >

提示沒有策略混槐,我們?nèi)?chuàng)建一個(gè)

新建策略

我們選擇新建一個(gè)Basic Network Scan策略

image

配置好相關(guān)的參數(shù),然后點(diǎn)保存

設(shè)置參數(shù)

回到msfconsole里面再次執(zhí)行nessus_policy_list就看看到了

msf5 > nessus_policy_list
Policy ID  Name       Policy UUID
---------  ----       -----------
4          PenTest01  731a8e52-3ea6-a291-ec0a-d2ff0619c19d7bd788d6be818b65

msf5 >

5轩性、創(chuàng)建nessus掃描声登,使用nessus_scan_new --help查看命令幫助信息:

msf5 > nessus_scan_new --help                                                             
[*] Usage:                                                                                
[*] nessus_scan_new <UUID of Policy> <Scan name> <Description> <Targets>                  
[*] Use nessus_policy_list to list all available policies with their corresponding UUIDs  
msf5 >                                                                                    

6、創(chuàng)建掃描

msf5 > nessus_scan_new 731a8e52-3ea6-a291-ec0a-d2ff0619c19d7bd788d6be818b65 Metasploitable3 Windows_Machine 192.168.177.144
[*] Creating scan from policy number 731a8e52-3ea6-a291-ec0a-d2ff0619c19d7bd788d6be818b65, called Metasploitable3 - Windows_Machine and scanning 192.168.177.144
[*] New scan added
[-] Error while running command nessus_scan_new: undefined method `[]' for nil:NilClass

Call stack:
/usr/share/metasploit-framework/plugins/nessus.rb:979:in `cmd_nessus_scan_new'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:522:in `run_command'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:473:in `block in run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:467:in `each'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:467:in `run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/shell.rb:151:in `run'
/usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
/usr/bin/msfconsole:49:in `<main>'
msf5 >

此次會(huì)報(bào)錯(cuò):Error while running command nessus_scan_new: undefined method []' for nil:NilClass揣苏。這是由于Nessus 7開始對(duì)遠(yuǎn)程調(diào)用進(jìn)行認(rèn)證悯嗓,從而導(dǎo)致Metasploit調(diào)用失敗。現(xiàn)在正在等待修復(fù)卸察。

解決辦法:Nessus Plugin unable to create new scan · Issue #11117 · rapid7/metasploit-framework · GitHub https://github.com/rapid7/metasploit-framework/issues/11117

成功創(chuàng)建掃描:

msf5 > nessus_scan_new 731a8e52-3ea6-a291-ec0a-d2ff0619c19d7bd788d6be818b65 test test 192.168.177.144
[*] Creating scan from policy number 731a8e52-3ea6-a291-ec0a-d2ff0619c19d7bd788d6be818b65, called test - test and scanning 192.168.177.144
[*] New scan added
[*] Use nessus_scan_launch 6 to launch the scan
Scan ID  Scanner ID  Policy ID  Targets          Owner
-------  ----------  ---------  -------          -----
6        1           5          192.168.177.144  nessusroot

msf5 >

7脯厨、使用nessus_scan_list可用查看掃描列表,以及它們的狀態(tài)

msf5 > nessus_scan_list                             
Scan ID  Name  Owner       Started  Status  Folder  
-------  ----  -----       -------  ------  ------  
6        test  nessusroot           empty   3       
                                                    
msf5 >                                              

8坑质、啟動(dòng)掃描合武,使用nessus_scan_launch <Scan ID>啟動(dòng)掃描

msf5 > nessus_scan_launch 6
[+] Scan ID 6 successfully launched. The Scan UUID is 67d8e87c-17a6-7693-0b41-666f40291e1464ae15bc02832ca3
msf5 >

再次查看狀態(tài):

msf5 > nessus_scan_list
Scan ID  Name  Owner       Started  Status   Folder
-------  ----  -----       -------  ------   ------
6        test  nessusroot           running  3

msf5 >

9个少、查看掃描的詳細(xì)信息,使用nessus_scan_details <Scan ID> <info/hosts/vulnerabilities/history>

msf5 > nessus_scan_details 6 info  //查看掃描狀態(tài)
Status   Policy              Scan Name  Scan Targets     Scan Start Time  Scan End Time
------   ------              ---------  ------------     ---------------  -------------
running  Basic Network Scan  test       192.168.177.144  1555301230

msf5 > nessus_scan_details 6 hosts //查看主機(jī)
Host ID  Hostname         % of Critical Findings  % of High Findings  % of Medium Findings  % of Low Findings
-------  --------         ----------------------  ------------------  --------------------  -----------------
2        192.168.177.144  1                       0                   0                     0

msf5 > nessus_scan_details 6 vulnerabilities //查看漏洞信息
Plugin ID  Plugin Name  Plugin Family      Count
---------  -----------  -------------      -----
10114      ICMP Timestamp Request Remote Date Disclosure    General            1
10150      Windows NetBIOS / SMB Remote Host Information Disclosure Windows            1
10287      Traceroute Information   General            1
10394      Microsoft Windows SMB Log In Possible    Windows            1
10736      DCE Services Enumeration Windows            8
10785      Microsoft Windows SMB NativeLanManager Remote System Information Disclosure
.....
msf5 > nessus_scan_details 6 history //查看掃描歷史
History ID  Status   Creation Date  Last Modification Date
----------  ------   -------------  ----------------------
7           running  1555301230

msf5 >

WebUI上也可以看到我們創(chuàng)建的掃描

image
image

10眯杏、當(dāng)完成掃描后夜焦,使用nessus_db_import <Scan ID>將掃描結(jié)果導(dǎo)入到Metasploit中。

msf5 > nessus_scan_details 6 info                                                            
Status     Policy              Scan Name  Scan Targets     Scan Start Time  Scan End Time    
------     ------              ---------  ------------     ---------------  -------------    
completed  Basic Network Scan  test       192.168.177.144  1555301230       1555302154       
                                                                                             
msf5 > nessus_db_import 6                                                                    
[*] Exporting scan ID 6 is Nessus format...                                                  
[+] The export file ID for scan ID 6 is 2110513949                                           
[*] Checking export status...                                                                
[*] Export status: loading                                                                   
[*] Export status: ready                                                                     
[*] The status of scan ID 6 export is ready                                                  
[*] Importing scan results to the database...                                                
[*] Importing data of 192.168.177.144                                                        
[+] Done                                                                                     
msf5 >                                                                                       

導(dǎo)入進(jìn)去之后岂贩,我們就能使用hosts茫经、services命令查看主機(jī)和目標(biāo)服務(wù)的信息了。

msf5 > hosts   
Hosts                                                                                                              
=====                                                                                                              
address          mac                name             os_name       os_flavor  os_sp  purpose  info  comments       
-------          ---                ----             -------       ---------  -----  -------  ----  --------       
192.168.177.1                                        Unknown                         device                        
192.168.177.144  00:0c:29:41:d2:48  METASPLOITABLE3  Windows 2008  Standard   SP1    server                        
192.168.177.145                                      Unknown                         device                   
msf5 > services     
Services       
========                                                                                                                                                                                                              
host             port   proto  name              state  info      
----             ----   -----  ----              -----  ----      
192.168.177.1    21     tcp    ftp               open   220 Serv-U FTP Server v15.0 ready...\x0d\x0a               
192.168.177.144  21     tcp    ftp               open   220 Microsoft FTP Service\x0d\x0a   
192.168.177.144  22     tcp    ssh               open   SSH-2.0-OpenSSH_7.1     
192.168.177.144  80     tcp    www               open   Microsoft IIS httpd 7.5    
192.168.177.144  135    tcp    epmap             open                   
192.168.177.144  137    udp    netbios-ns        open 
.....

查看掃描結(jié)果中的漏洞信息萎津,使用vulns指令

msf5 > vulns                                                    
Vulnerabilities                                                
===============                                               
Timestamp                Host             Name         References                                                                                   
---------                ----             ----           ----------                                                                                   
2019-04-12 07:52:51 UTC  192.168.177.144  MS17-010 SMB RCE Detection                                CVE-2017-0143,CVE-2017-0144,CVE-2017-0145,CVE-2017-0146,CVE-2017-0147,CVE-2017-0148,MSB-MS17-
010,URL-https://zerosum0x0.blogspot.com/2017/04/doublepulsar-initial-smb-backdoor-ring.html,URL-https://github.com/countercept/doublepulsar-detection-script,URL-htt
ps://technet.microsoft.com/en-us/library/security/ms17-010.aspx            
2019-04-12 09:08:20 UTC  192.168.177.144  HTTP Writable Path PUT/DELETE File Access    
                                                                       OSVDB-397       
2019-04-15 04:25:24 UTC  192.168.177.144  Elasticsearch Transport Protocol Unspecified Remote Code Execution  CVE-2015-5377,NSS-105752,NSS-119499                                                          
2019-04-15 04:25:25 UTC  192.168.177.144  MySQL Server Detection      NSS-10719                                                                                    
2019-04-15 04:25:25 UTC  192.168.177.144  Elasticsearch Detection     NSS-109941                                                                                   
2019-04-15 04:25:25 UTC  192.168.177.144  ManageEngine Desktop Central 9 < Build 92027 Multiple Vulnerabilities  CVE-2018-8722,NSS-108752                                                                     
2019-04-15 04:25:25 UTC  192.168.177.144  Elasticsearch Unrestricted Access Information Disclosure  NSS-101025  
....

15卸伞、與NeXpose結(jié)合

在本節(jié),我們將介紹另一個(gè)極佳的漏洞掃描器:NeXpose锉屈。NexPose是領(lǐng)先的漏洞評(píng)估工具之一荤傲。NeXposeRapid7 常用的工具,它執(zhí)行漏洞掃描并將結(jié)果導(dǎo)入到 Metasploit 數(shù)據(jù)庫(kù)中颈渊。NeXpose 的用法與 Nessus 類似遂黍,讓我們快速了解一下如何使用 NeXpose。至于深入探究就留給大家來完成了俊嗽。

準(zhǔn)備工作

NeXpose社區(qū)版雾家,可申請(qǐng)免費(fèi)試用1年:https://www.rapid7.com/info/nexpose-community/

郵箱必須是獨(dú)立的個(gè)人、學(xué)校绍豁、企業(yè)芯咧、機(jī)構(gòu)等域名郵箱;第三方郵箱均無效V褡帷(如:gmail敬飒、新浪、網(wǎng)易芬位、126无拗、騰訊等都視為無效)。

注冊(cè)晶衷,然后下載安裝程序進(jìn)行安裝蓝纲。

image

注冊(cè)完成,然后下載安裝程序

image

安裝:安裝詢問過程晌纫,直接敲回車即可,然后填寫一個(gè)用戶信息永丝,設(shè)置密碼等

root@osboxes:~# chmod +x Rapid7Setup-Linux64.bin
root@osboxes:~# ./Rapid7Setup-Linux64.bin
....
Do you want to continue?                                                                                                                      
Yes [y, Enter], No [n]                                                                                    
Gathering system information....                                                                    
Security Console with local Scan Engine                                                                                                       
If you do not have a console installed yet, this option is recommended. The console manages scan engines and all administrative operations. 
Scan Engine only                          
This distributed engine can start scanning after being paired with a Security Console.   
Select only the set of components you want to install:                                                                                        
Security Console with local Scan Engine [1, Enter]    
Scan Engine only [2]                     
1                                                                                                                                            
Where should Rapid7 Vulnerability Management be installed?                                                                                    
[/opt/rapid7/nexpose]
....
Select any additional installation tasks.    
Initialize and start after installation?     
Yes [y], No [n, Enter]                       
y 
...
If you chose to start the Security Console as part of the installation, then it will be started upon installer completion.
Using the credentials you created during installation, log onto Nexpose at https://localhost:3780.

To start the service run: sudo systemctl start nexposeconsole.service

To start the service run: sudo systemctl start nexposeconsole.service
The Security Console is configured to automatically run at startup. See the
installation guide if you wish to modify start modes.

[Enter]

Finishing installation...

我們?cè)O(shè)置的用戶名:nexpose 密碼:Faq3wANIK0 (根據(jù)自己喜好設(shè)置)

啟動(dòng)腳本锹漱,執(zhí)行/opt/rapid7/nexpose/nsc/nsc.sh 或者systemctl start nexposeconsole,啟動(dòng)需要一段時(shí)間慕嚷,請(qǐng)耐心等待哥牍。

然后訪問https://localhost:3780配置毕泌,等待啟動(dòng)完成,使用用戶名和密碼登錄嗅辣,然后輸入我們申請(qǐng)的Key激活產(chǎn)品

image
image
image

msfconsole中載入nexpose組件撼泛,然后連接到nexpose服務(wù)

msf5 > load nexpose                                                        
                                                                           
 ▄▄▄   ▄▄            ▄▄▄  ▄▄▄                                              
 ███   ██             ██ ▄██                                               
 ██?█  ██   ▄████▄     ████    ██▄███▄    ▄████▄   ▄▄█████▄   ▄████▄       
 ██ ██ ██  ██▄▄▄▄██     ██     ██?  ?██  ██?  ?██  ██▄▄▄▄ ?  ██▄▄▄▄██      
 ██  █▄██  ██??????    ████    ██    ██  ██    ██   ????██▄  ██??????      
 ██   ███  ?██▄▄▄▄█   ██  ██   ███▄▄██?  ?██▄▄██?  █▄▄▄▄▄██  ?██▄▄▄▄█      
 ??   ???    ?????   ???  ???  ██ ???      ????     ??????     ?????       
                               ██                                          
                                                                           
[*] Nexpose integration has been activated                                 
[*] Successfully loaded plugin: nexpose                                    
msf5 > nexpose_connect nexpose:Faq3wANIK0@127.0.0.1:3780
[*] Connecting to Nexpose instance at 127.0.0.1:3780 with username nexpose...
msf5 >
怎么做

NeXpose服務(wù)連接后,我們就可以掃描目標(biāo)生成報(bào)告澡谭。NeXpose支持兩個(gè)掃描命令愿题,一個(gè)是nexpose_scan,此命令會(huì)掃描目標(biāo)然后導(dǎo)入結(jié)果到metasploit數(shù)據(jù)庫(kù)中蛙奖,另外一個(gè)是nexpose_discover潘酗,此命令僅發(fā)現(xiàn)主機(jī)和服務(wù),不導(dǎo)入結(jié)果雁仲。

1仔夺、對(duì)目標(biāo)進(jìn)行快速掃描(執(zhí)行最小服務(wù)發(fā)現(xiàn)掃描)

msf5 > nexpose_discover 192.168.177.144
[*] Scanning 1 addresses with template aggressive-discovery in sets of 32
[*] Completed the scan of 1 addresses
msf5 >

2、查看nexpose_scan幫助

msf5 > nexpose_scan -h
Usage: nexpose_scan [options] <Target IP Ranges>

OPTIONS:

    -E <opt>  Exclude hosts in the specified range from the scan
    -I <opt>  Only scan systems with an address within the specified range
    -P        Leave the scan data on the server when it completes (this counts against the maximum licensed IPs)
    -c <opt>  Specify credentials to use against these targets (format is type:user:pass
    -d        Scan hosts based on the contents of the existing database
    -h        This help menu
    -n <opt>  The maximum number of IPs to scan at a time (default is 32)
    -s <opt>  The directory to store the raw XML files from the Nexpose instance (optional)
    -t <opt>  The scan template to use (default:pentest-audit options:full-audit,exhaustive-audit,discovery,aggressive-discovery,dos-audit)
    -v        Display diagnostic information about the scanning process

msf5 >

3攒砖、要掃描目標(biāo)缸兔,使用nexpose_scan -t <template> <target_id>

msf5 > nexpose_scan -t full-audit 192.168.177.144
[*] Scanning 1 addresses with template full-audit in sets of 32
[*] Completed the scan of 1 addresses
msf5 >

4、掃描完成后吹艇,導(dǎo)入結(jié)果到數(shù)據(jù)庫(kù)中灶体,使用nexpose_site_import <site_id>

msf5 > nexpose_site_import 7
[*] Generating the export data file...
[*] Downloading the export data...
[*] Importing Nexpose data...

16、與OpenVAS結(jié)合

OpenVAS( Open Vulnerability Assessment System)是Nessus項(xiàng)目的分支掐暮。是一個(gè)免費(fèi)開源的漏洞掃描和漏洞管理工具蝎抽。也是當(dāng)前使用最為廣泛的漏洞掃描和管理開源解決方案。

怎么做

1路克、在Kali上安裝 OpenVAS

root@osboxes:~# apt install openvas -y

2樟结、設(shè)置openvas,包括下載規(guī)則精算,創(chuàng)建管理員用戶和服務(wù)瓢宦。

root@osboxes:~# openvas-setup //這一步會(huì)下載很多東西,請(qǐng)耐心等待

[>] Updating OpenVAS feeds
[*] [1/3] Updating: NVT
--2019-04-15 13:54:37--  http://dl.greenbone.net/community-nvt-feed-current.tar.bz2
Connecting to 192.168.1.91:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 22288483 (21M) [application/octet-stream]
....    
經(jīng)過漫長(zhǎng)的等待...
[*] Opening Web UI (https://127.0.0.1:9392) in: 5... 4... 3... 2... 1...

[>] Checking for admin user
[*] Creating admin user
User created with password 'dc63c468-3780-4e3c-b30c-1597f4b91623'.

[+] Done

3灰羽、配置完成后驮履,啟動(dòng)openvas ,其實(shí)在上一步中已經(jīng)啟動(dòng)了廉嚼。也可以用下面的命令啟動(dòng)

root@osboxes:~# openvas-start

訪問https://127.0.0.1:9392可登錄WebUI

image

4玫镐、在msfconsole中載入openvas組件

msf5 > load openvas
[*] Welcome to OpenVAS integration by kost and averagesecurityguy.
[*]
[*] OpenVAS integration requires a database connection. Once the
[*] database is ready, connect to the OpenVAS server using openvas_connect.
[*] For additional commands use openvas_help.
[*]
[*] Successfully loaded plugin: OpenVAS
msf5 >

5、查看幫助信息

msf5 > help openvas

OpenVAS Commands
================

    Command                       Description
    -------                       -----------
    openvas_config_list           Quickly display list of configs
    openvas_connect               Connect to an OpenVAS manager using OMP
    openvas_debug                 Enable/Disable debugging
    openvas_disconnect            Disconnect from OpenVAS manager
    openvas_format_list           Display list of available report formats
    openvas_help                  Displays help
    openvas_report_delete         Delete a report specified by ID
    openvas_report_download       Save a report to disk
    openvas_report_import         Import report specified by ID into framework
    openvas_report_list           Display a list of available report formats
    openvas_target_create         Create target (name, hosts, comment)
    openvas_target_delete         Delete target by ID
    openvas_target_list           Display list of targets
    openvas_task_create           Create a task (name, comment, target, config)
    openvas_task_delete           Delete task by ID
    openvas_task_list             Display list of tasks
    openvas_task_pause            Pause task by ID
    openvas_task_resume           Resume task by ID
    openvas_task_resume_or_start  Resume task or start task by ID
    openvas_task_start            Start task by ID
    openvas_task_stop             Stop task by ID
    openvas_version               Display the version of the OpenVAS server


msf5 >

6怠噪、使用 openvas_connect <username> <password> <host> <port>連接到OpenVAS服務(wù)

msf5 > openvas_connect admin dc63c468-3780-4e3c-b30c-1597f4b91623 127.0.0.1 9390
[*] Connecting to OpenVAS instance at 127.0.0.1:9390 with username admin...
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[+] OpenVAS connection successful
msf5 >

7恐似、添加掃描目標(biāo),使用openvas_target_create <Name> <Hosts> <Comment>指令傍念,參數(shù)包括描述信息矫夷,目標(biāo)的IP

msf5 > openvas_target_create "Metasploitable3" 192.168.177.144 "Windows Target"
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[*] 6455a780-092a-40dd-8c01-191a7612505a
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[+] OpenVAS list of targets

ID                                    Name             Hosts            Max Hosts  In Use  Comment
--                                    ----             -----            ---------  ------  -------
6455a780-092a-40dd-8c01-191a7612505a  Metasploitable3  192.168.177.144  1          0       Windows Target


msf5 >

8葛闷、列出配置列表:openvas_config_list

msf5 > openvas_config_list
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[+] OpenVAS list of configs

ID                                    Name
--                                    ----
085569ce-73ed-11df-83c3-002264764cea  empty
2d3f051c-55ba-11e3-bf43-406186ea4fc5  Host Discovery
698f691e-7489-11df-9d8c-002264764cea  Full and fast ultimate
708f25c4-7489-11df-8094-002264764cea  Full and very deep
74db13d6-7489-11df-91b9-002264764cea  Full and very deep ultimate
8715c877-47a0-438d-98a3-27c7a6ab2196  Discovery
bbca7412-a950-11e3-9109-406186ea4fc5  System Discovery
daba56c8-73ec-11df-a475-002264764cea  Full and fast


msf5 >

9、創(chuàng)建任務(wù)双藕,使用如下指令

 openvas_task_create <name> <Comment> <config_id> <target_id>
msf5 > openvas_task_create  "Metasploitable3" "Windows" 698f691e-7489-11df-9d8c-002264764cea 6455a780-092a-40dd-8c01-191a7612505a
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[*] fb18cf93-a94b-4c9b-aadf-9408bd9a9186
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[+] OpenVAS list of tasks

ID                                    Name             Comment  Status  Progress
--                                    ----             -------  ------  --------
fb18cf93-a94b-4c9b-aadf-9408bd9a9186  Metasploitable3  Windows  New     -1


msf5 >

10淑趾、啟動(dòng)任務(wù),使用openvas_task_start <task_id>

msf5 > openvas_task_start fb18cf93-a94b-4c9b-aadf-9408bd9a9186
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout instead.
[*] <X><authenticate_response status='200' status_text='OK'><role>Admin</role><timezone>UTC</timezone><severity>nist</severity></authenticate_response><start_task_response status='202' status_text='OK, request submitted'><report_id>7993d76a-43b3-48c6-ac94-ca630e20db68</report_id></start_task_response></X>msf5 >

11忧陪、查看進(jìn)度扣泊,使用openvas_task_list

msf5 > openvas_task_list                                                                                                                                 
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeou
t.timeout instead.                                                                                                                                       
[+] OpenVAS list of tasks                                                                                                                                
ID                                    Name             Comment  Status     Progress                                                                      
--                                    ----             -------  ------     --------                                                                      
fb18cf93-a94b-4c9b-aadf-9408bd9a9186  Metasploitable3  Windows  Requested  1      
msf5 >                                               

12、使用openvas_format_list 可以查看OpenVAS支持的報(bào)告格式赤嚼。

msf5 > openvas_format_list                                                                                                                                          
/usr/share/metasploit-framework/vendor/bundle/ruby/2.5.0/gems/openvas-omp-0.0.4/lib/openvas-omp.rb:201: warning: Object#timeout is deprecated, use Timeout.timeout i
nstead.                                                                                                                                                             
[+] OpenVAS list of report formats                                                                                                                                  
ID                                    Name           Extension  Summary                                                                                             
--                                    ----           ---------  -------                                                                                             
5057e5cc-b825-11e4-9d0e-28d24461215b  Anonymous XML  xml        Anonymous version of the raw XML report                                                             
50c9950a-f326-11e4-800c-28d24461215b  Verinice ITG   vna        Greenbone Verinice ITG Report, v1.0.1.                                                              
5ceff8ba-1f62-11e1-ab9f-406186ea4fc5  CPE            csv        Common Product Enumeration CSV table.                                                               
6c248850-1f62-11e1-b082-406186ea4fc5  HTML           html       Single page HTML report.    
77bd6c4a-1f62-11e1-abf0-406186ea4fc5  ITG            csv        German "IT-Grundschutz-Kataloge" report.                                                            
9087b18c-626c-11e3-8892-406186ea4fc5  CSV Hosts      csv        CSV host summary.     
910200ca-dc05-11e1-954f-406186ea4fc5  ARF            xml        Asset Reporting Format v1.0.0.   
9ca6fe72-1f62-11e1-9e7c-406186ea4fc5  NBE            nbe        Legacy OpenVAS report.     
9e5e5deb-879e-4ecc-8be6-a71cd0875cdd  Topology SVG   svg        Network topology SVG image.   
a3810a62-1f62-11e1-9219-406186ea4fc5  TXT            txt        Plain text report.   
a684c02c-b531-11e1-bdc2-406186ea4fc5  LaTeX          tex        LaTeX source file.   
a994b278-1f62-11e1-96ac-406186ea4fc5  XML            xml        Raw XML report.  
c15ad349-bd8d-457a-880a-c7056532ee15  Verinice ISM   vna        Greenbone Verinice ISM Report, v3.0.0.                                                              
c1645568-627a-11e3-a660-406186ea4fc5  CSV Results    csv        CSV result list.  
c402cc3e-b531-11e1-9163-406186ea4fc5  PDF            pdf        Portable Document Format report.  
msf5 >   

13旷赖、在WebUI同樣可以看到我們創(chuàng)建的任務(wù)狀態(tài)信息

image

14、任務(wù)完成后更卒,使用openvas_report_list 查看報(bào)告列表等孵。

msf5 > openvas_report_list
[+] OpenVAS list of reports

ID                                    Task Name        Start Time            Stop Time
--                                    ---------        ----------            ---------
4ee7b572-a470-484c-962e-773d3a7eb7b1  Metasploitable3  2019-04-16T02:40:24Z  2019-04-16T03:07:15Z
7993d76a-43b3-48c6-ac94-ca630e20db68  Metasploitable3  2019-04-16T01:15:44Z

15、使用openvas_report_import命令將報(bào)告導(dǎo)入到Metasploit中蹂空,僅支持NBE(legacy OpenVAS report)和XML格式導(dǎo)入俯萌。

msf5 > openvas_report_import 4ee7b572-a470-484c-962e-773d3a7eb7b1 9ca6fe72-1f62-11e1-9e7c-406186ea4fc5
[*] Importing report to database.

但是這里我們使用的 Metasploit-5.0直接這么導(dǎo)入會(huì)報(bào)錯(cuò),無法導(dǎo)入上枕,我們先導(dǎo)出為文件再用db_import導(dǎo)入就可以了咐熙。

msf5 > openvas_report_download
[*] Usage: openvas_report_download <report_id> <format_id> <path> <report_name>
msf5 > openvas_report_download 4ee7b572-a470-484c-962e-773d3a7eb7b1 9ca6fe72-1f62-11e1-9e7c-406186ea4fc5 /tmp/ Metasploitable3
[*] Saving report to /tmp/Metasploitable3
msf5 > db_import /tmp/Metasploitable3
[*] Importing 'OpenVAS XML' data
[*] Successfully imported /tmp/Metasploitable3
msf5 >

16、查看OpenVAS掃描的漏洞信息

msf5 > vulns

Vulnerabilities
===============

Timestamp                Host             Name      References
---------                ----             ----                                                                    ----------
2019-04-16 08:15:22 UTC  192.168.177.144  ICMP Timestamp Detection    CVE-1999-0524
2019-04-16 08:15:23 UTC  192.168.177.144  Microsoft Windows IIS   CVE-2010-3972,BID-45542
2019-04-16 08:15:23 UTC  192.168.177.144  Microsoft Windows SMB Server Multiple Vulnerabilities-Remote (4013389)  CVE-2017-0143,CVE-2017-0144,CVE-2017-0145,CVE-2017-0146,CVE-2017-0147,CVE-2017-0148,BID-96703,BID-96704,BID-96705,BID-96706,BID-96707,BID-96709
2019-04-16 08:15:23 UTC  192.168.177.144  MS15-034 HTTP.sys Remote Code  CVE-2015-1635
2019-04-16 08:15:23 UTC  192.168.177.144  Oracle Glass Fish Server CVE-2017-1000028
2019-04-16 08:15:23 UTC  192.168.177.144  SSL/TLS: Report 'Anonymous' Cipher Suites                 .....

第三章 服務(wù)端漏洞利用(預(yù)告)

在本章中辨萍,我們將學(xué)習(xí)以下內(nèi)容

1棋恼、攻擊Linux服務(wù)器

2、SQL注入攻擊

3锈玉、shell類型

4爪飘、攻擊Windows服務(wù)器

5、利用公用服務(wù)

6拉背、MS17-010 永恒之藍(lán) SMB遠(yuǎn)程代碼執(zhí)行Windows內(nèi)核破壞

7师崎、MS17-010 EternalRomance/EternalSynergy/EternalChampion

8、植入后門

9椅棺、拒絕服務(wù)攻擊

說明

原書:《Metasploit Penetration Testing Cookbook - Third Edition》

https://www.packtpub.com/networking-and-servers/metasploit-penetration-testing-cookbook-third-edition

本文由合天網(wǎng)安實(shí)驗(yàn)室編譯犁罩,轉(zhuǎn)載請(qǐng)注明來源。

關(guān)于合天網(wǎng)安實(shí)驗(yàn)室

合天網(wǎng)安實(shí)驗(yàn)室(www.hetianlab.com)-國(guó)內(nèi)領(lǐng)先的實(shí)操型網(wǎng)絡(luò)安全在線教育平臺(tái)

真實(shí)環(huán)境两疚,在線實(shí)操學(xué)網(wǎng)絡(luò)安全 床估; 實(shí)驗(yàn)內(nèi)容涵蓋:系統(tǒng)安全,軟件安全鬼雀,網(wǎng)絡(luò)安全顷窒,Web安全,移動(dòng)安全源哩,CTF鞋吉,取證分析,滲透測(cè)試励烦,網(wǎng)安意識(shí)教育等谓着。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市坛掠,隨后出現(xiàn)的幾起案子赊锚,更是在濱河造成了極大的恐慌,老刑警劉巖屉栓,帶你破解...
    沈念sama閱讀 206,214評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件舷蒲,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡友多,警方通過查閱死者的電腦和手機(jī)牲平,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,307評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來域滥,“玉大人纵柿,你說我怎么就攤上這事∑舸拢” “怎么了昂儒?”我有些...
    開封第一講書人閱讀 152,543評(píng)論 0 341
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)委可。 經(jīng)常有香客問我渊跋,道長(zhǎng),這世上最難降的妖魔是什么着倾? 我笑而不...
    開封第一講書人閱讀 55,221評(píng)論 1 279
  • 正文 為了忘掉前任拾酝,我火速辦了婚禮,結(jié)果婚禮上屈呕,老公的妹妹穿的比我還像新娘微宝。我一直安慰自己,他們只是感情好虎眨,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,224評(píng)論 5 371
  • 文/花漫 我一把揭開白布蟋软。 她就那樣靜靜地躺著,像睡著了一般嗽桩。 火紅的嫁衣襯著肌膚如雪岳守。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,007評(píng)論 1 284
  • 那天碌冶,我揣著相機(jī)與錄音湿痢,去河邊找鬼。 笑死,一個(gè)胖子當(dāng)著我的面吹牛譬重,可吹牛的內(nèi)容都是我干的拒逮。 我是一名探鬼主播,決...
    沈念sama閱讀 38,313評(píng)論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼臀规,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼滩援!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起塔嬉,我...
    開封第一講書人閱讀 36,956評(píng)論 0 259
  • 序言:老撾萬榮一對(duì)情侶失蹤玩徊,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后谨究,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體恩袱,經(jīng)...
    沈念sama閱讀 43,441評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,925評(píng)論 2 323
  • 正文 我和宋清朗相戀三年胶哲,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了畔塔。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,018評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡纪吮,死狀恐怖俩檬,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情碾盟,我是刑警寧澤棚辽,帶...
    沈念sama閱讀 33,685評(píng)論 4 322
  • 正文 年R本政府宣布,位于F島的核電站冰肴,受9級(jí)特大地震影響屈藐,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜熙尉,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,234評(píng)論 3 307
  • 文/蒙蒙 一联逻、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧检痰,春花似錦包归、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,240評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至椎椰,卻和暖如春厦幅,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背慨飘。 一陣腳步聲響...
    開封第一講書人閱讀 31,464評(píng)論 1 261
  • 我被黑心中介騙來泰國(guó)打工确憨, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 45,467評(píng)論 2 352
  • 正文 我出身青樓休弃,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親玫芦。 傳聞我的和親對(duì)象是個(gè)殘疾皇子本辐,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,762評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容