Nikto
首先獲得metasploitable的ip地址:192.168.86.130
Kali的ip地址:192.168.86.134
然後訪問Metasplotiabel的ip地址,進入Dvwa應用網站,選擇DVWA Security的安全等級選擇為low。
基於之前的滲透方法,現在要更進一步的減少與目標主機的互動。Htttrack可以將目標網站克隆下來,以實現離線分析目標網站
Nikto
Nikto是一個用來發現預設網頁檔案、檢查網頁伺服器和CGI安全問題的工具,它是開源的,使用Perl開發,可以對網頁伺服器 進行全面的多種掃描,包含超過3300種有潛在危險的檔案CGIs;超過625種伺服器版本;超過230種特定伺服器問題;以及一些WEB Application層面 的漏洞它也會去掃描。
避免404誤判
很多伺服器不遵守RFC標準,比如對於不存在的物件返回200相應程式碼。那麼當掃描器遇到這種情況下便會產生誤判。
掃描器是如何嘗試解決的?
Nikto的解決方發是:在開始掃描以前,在每條命令執行之前 ,會在自己的資料庫中將web中常見檔案的副檔名 提取出來,隨機使用一些檔名 拼接這些副檔名(這些隨機的檔名+副檔名的檔案對於目標伺服器來說通常是不存在的)讓後再向目標伺服器發起請求。然後根據不同副檔名返回的資訊,進行HASH摘要,以此得到該檔案不存在時得到的響應資訊 。然後Nikto再開始真正的掃描發起。
如果這些還是不能得到404響應的真實性,那麼最新版本的Nikto還會將得到的響應內容去除時間資訊後取得MD5值進行hash校驗。
同時也可以使用引數-no404,去掉前期判斷,但是這種提高效能而捨棄準確率的做法,並不建議。
Nickto的使用
首先升級Nikto:
$: nikto -update
但是由於wall的存在,不一定能更新成功,此時可以訪問到Nikto官網下載安裝包:http://cirt.net/nikto/UPDATES.
nikto host 掃描
root@kali:~# nikto -host 192.168.86.130 -port 80
nikto 進行ssl掃描
root@kali:~# nikto -host www.baidu.com -port 443 -ssl
-ouput 將掃描結果輸出儲存
對host列表進行批量掃描
$: nikto host -host.txt
-host.txt 的文字格式如下:
192.168.0.1:80 https://192.168.1.1:8333 192.168.0.2
nmap配合nikto
將nmap獲得的ip地址結果作為輸出通過管道傳送給nikto
$: nmap -p80 192.168.1.4/24 -oG - | nikto -host -
nikto代理
nikto可以通過代理掃描:
$: nikto -host https://www.baidu.com -useproxy htpp://localhost:1080
nikto的配置檔案
有些網站需要登入以後才可以進行掃描,此時可以設定nikto的配置檔案手動將cookie新增到nikto的中。nikto的配置檔案如下:
$: vi /etc/nikto.conf ######################################################################################################### # CONFIG STUFF # $Id: config.txt 94 2009-01-21 22:47:25Z deity $ ######################################################################################################### # default command line options, can't be an option that requires a value.used for ALL runs. # CLIOPTS=-g -a # ports never to scan SKIPPORTS=21 111 # User-Agent variables: # @VERSION- Nikto version # @TESTID- Test identifier # @EVASIONS- List of active evasions USERAGENT=Mozilla/5.00 (Nikto/@VERSION) (Evasions:@EVASIONS) (Test:@TESTID) # RFI URL. This remote file should return a phpinfo call, for example: <?php phpinfo(); ?> # You may use the one below, if you like. RFIURL=http://cirt.net/rfiinc.txt? # IDs never to alert on (Note: this only works for IDs loaded from db_tests) #SKIPIDS= # The DTD NIKTODTD=/var/lib/nikto/docs/nikto.dtd # the default HTTP version to try... can/will be changed as necessary DEFAULTHTTPVER=1.0 # Nikto can submit updated version strings to CIRT.net. It won't do this w/o permission. You should # send updates because it makes the data better for everyone ;)*NO* server specific information # such as IP or name is sent, just the relevant version information. # UPDATES=yes- ask before each submission if it should send # UPDATES=no- don't ask, don't send # UPDATES=auto- automatically attempt submission *without prompting* UPDATES=yes # Warning if MAX_WARN OK or MOVED responses are retrieved MAX_WARN=20 # Prompt... if set to 'no' you'll never be asked for anything. Good for automation. #PROMPTS=no # cirt.net : set the IP so that updates can work without name resolution -- just in case CIRT=107.170.99.251 # Proxy settings -- still must be enabled by -useproxy #PROXYHOST=127.0.0.1 #PROXYPORT=8080 #PROXYUSER=proxyuserid #PROXYPASS=proxypassword # Cookies: send cookies with all requests # Multiple can be set by separating with a semi-colon, e.g.: # "cookie1"="cookie value";"cookie2"="cookie val" #STATIC-COOKIE= # The below allows you to vary which HTTP methods are used to check whether an HTTP(s) server # is running. Some web servers, such as the autopsy web server do not implement the HEAD method CHECKMETHODS=HEAD GET # If you want to specify the location of any of the files, specify them here EXECDIR=/var/lib/nikto# Location of Nikto PLUGINDIR=/var/lib/nikto/plugins# Location of plugin dir DBDIR=/var/lib//nikto/databases# Location of database dir TEMPLATEDIR=/var/lib/nikto/templates# Location of template dir DOCDIR=/var/lib/nikto/docs# Location of docs dir # Default plugin macros @@MUTATE=dictionary;subdomain @@DEFAULT=@@ALL;-@@MUTATE;tests(report:500) # Choose SSL libs: # SSLeay- use Net::SSLeay # SSL- use Net::SSL # auto- automatically choose whats available #(SSLeay wins if both are available) LW_SSL_ENGINE=auto # Number of failures before giving up FAILURES=20
- User-Agent: 預設的是firefox瀏覽器。此外還可以下載firefox的User-Agent外掛,比如基於freifox瀏覽器的User-Agent Switcher可以進行移動端,PC端,以及作業系統的組合偽裝。
# User-Agent variables: # @VERSION- Nikto version # @TESTID- Test identifier # @EVASIONS- List of active evasions USERAGENT=Mozilla/5.00 (Nikto/@VERSION) (Evasions:@EVASIONS) (Test:@TESTID)
- Proxy settings:代理設定
# Proxy settings -- still must be enabled by -useproxy PROXYHOST=127.0.0.1 PROXYPORT=1080 #PROXYUSER=proxyuserid #PROXYPASS=proxypassword
cookies設定
將已經登入網站的cookies存放再nikto.conf中,便可以登陸該網站了。
隨便開啟一個網站,對該網站啟用Firebug,並啟用cookies功能,登入該網站,分析cookies資訊,比如百度,分析firebug的cookies項可以看到過期時間(Expires),將過期時間下對應的有會話(Session)欄位的項中的名稱(Name)和內容(Value)copy,新增到
/etc/nikto.conf中
# Cookies: send cookies with all requests # Multiple can be set by separating with a semi-colon, e.g.: "HBDRCVFR[Fc9oatPmwxn]="12345678";"BD_CK_SAM"="cookie val" ;"BD_HOME"="cookie val";"H_PS_PSSID"="cookie val";.... "" #STATIC-COOKIE=
-evasion IDS躲避技術
IDS(instruion Detection System) 入侵檢測系統
IDS可以被定義為對計算機和網路資源的惡意使用行為進行識別和相應處理的系統,包括系統外部的入侵和內部使用者的非授權行為,是為保證計算機系統的安全而設計與配置的一種能夠及時發現並報告系統中未授權或異常現象的技術,是一種用於檢測計算機網路中違反安全策略行為的技術。
所以當一個目標中存在IDS技術時可以使用引數-evasion來逃避,nikto的逃避方式一共有八種,可以同時指定多種:
- 1 隨機URL編碼(非utf-8)
- 2 自選擇路徑
- 3 過早結束的URL
- 4 優先考慮長隨機字串
- 5 引數欺騙
- 6 使用TAB作為命令的分隔符
- 7 使用變化的URL
- 8 使用Windows路徑分隔符
例:
$: nikto -host http://192.168.1.34/dvwa/ -evasion 167