Site Security 資安掃描

OpenVAS 5:

更新: http://myip.tw/itsmw/index.php?title=OpenVAS6#Lubuntu_.2B_OpenVAS6

還有一套叫 Paros 也可以參考安裝一下,或採紙本申請市級網路資安掃描方式執行。 

2013 依建議修改伺服器設定:

(1) linux 伺服器依 OpenVAS 的建議加上以下兩行在 httpd.conf 檔中的 <VirtualHost> </VirtualHost> 段落中。http://www.vmadmin.co.uk/linux/44-redhat/218-linuxhttptracktrace

RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)

RewriteRule .* - [F]

存檔 

Check the apache config:

/usr/sbin/apachectl -t

service httpd restart

(2)封掉沒有在用的 443 port

舊版 openvas 無法使用,改用新版 openvas6 :

http://myip.tw/itsmw/index.php?title=OpenVAS6

前置作業

第一步打開終端機,切換成 root 身份

「開始選單」/「附屬應用程式」/「LX終端機」

openvas@lu1204:~& sudo -i

[sudo] Password for openvas:(←輸入 openvas 的密碼 654321)

root@lu1204:~# _

若「第一次」若「很久沒做過」,請先依序執行下面指令:

root@lu1204:~# openvas-nvt-sync ; openvas-nvt-sync

root@lu1204:~# openvas-scapdata-sync

root@lu1204:~# openvas-certdata-sync

root@lu1204:~# openvasmd --rebuild

再繼續執行以下指令

root@lu1204:~# openvassd

root@lu1204:~# openvasmd

root@lu1204:~# openvasad

root@lu1204:~# gsad --http-only

若出現 「Login failed: OMP Service is down.」

對 Lubuntu 重開機

在執行啟動指令前(openvasxx...),先以 root 身份完成以下三個動作。

root@lu1204:~# openvasmd --rebuild

root@lu1204:~# openvasmd --update

root@lu1204:~# openvasmd --migrate

update: 2014-07-31 發現在虛擬機 lubuntu 裏的 openvas6 無法正常掃瞄 server,掃到 1% 即停止。改用下面的 debian7 + openvas 6 虛擬機來運作。

debian7 + openvas 6 虛擬機:

http://myip.tw/itsmw/index.php?title=OpenVAS6

匯入 ova 失敗,後來取出該 ova 包裝裏的 vmdk ,再創一個 vm 即可運作。設定好該 debian 的 ip 及 dns 資料,再進行 openvas 的設定。

該 vm 的帳號為 root,密碼為 d654321

啟動掃描前置作業

同步各種弱點資料庫

root@debvas:~# openvas-nvt-sync

註:系統會問要不要整合資料庫(migration),按「y」。

root@debvas:~# openvasmd --rebuild

root@debvas:~# openvas-scapdata-sync

root@debvas:~# openvas-certdata-sync

啟動 OpenVAS 服務

root@debvas:~# service openvas-scanner start

root@debvas:~# service openvas-manager start start

root@debvas:~# service openvas-administrator start

root@debvas:~# service greenbone-security-assistant start

進入掃描畫面

找一台同網段之 Windows ,啟動瀏覽器(firefox, chrome...etc),輸入網址「https://xxx.xxx.xxx.xxx:9392」

帳號:admin

密碼:d654321

UPDATE: 後來這個虛擬機不太穩定,改用 openvas 官網 http://www.openvas.org/vm.html 提供的 ova 檔就解決了。帳號 root 密碼 root 。帳號 openvas ,密碼 openvas 。網頁掃瞄介面帳號: admin 、密碼 admin。在修改 ip 的過程中,因為是該 vm 是用德文鍵盤,所以可以利用數字鍵盤來打- 與 / 符號。y 與z 符號互調, # 符號互調 \。

若要改成英語鍵盤,則鍵入: loadkeys us 即可改為英語鍵盤。若要每次開機自動執行修改為英語鍵盤,則參考:

http://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian

http://forum.directadmin.com/showthread.php?t=42174

http://xmodulo.com/2013/01/how-to-automatically-start-program-on-boot-in-debian.html

新增 /etc/init.d/loadkeys

#!/bin/sh

### BEGIN INIT INFO

# Provides:loadkeys

# Required-Start: 

# Required-Stop: 

# Should-Start: 

# Should-Stop: 

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start and stop loadkeys

# Description: loadkeys

### END INIT INFO

loadkeys us

以 root 身分鍵入以下指令:

chmod 755 /etc/init.d/loadkeys

update-rc.d loadkeys defaults

shutdown -r now

開機就會進入英語鍵盤模式了。

移除自動執行 SCRIPT 的方式: sudo update-rc.d -f loadkeys remove

官網的說明,它說自己是 7 版,但是進入網頁介面的 about 它卻寫 5 版,update 資料庫的方式可用 5 版方式:

http://www.openvas.org/vm.html

Version: 1.0 (up-to-date regarding base system, OpenVAS-7 and Feed as of 2014-05-12)

Download Sites for the OVA Image (3.5 GByte):

HTTP via binarysignals (Germany):

http://mirrord.binarysignals.net/OpenVAS-7-DEMO-1.0.ova (sha1sum)

RSYNC via OpenVAS (Germany):

rsync://rsync.openvas.org/vm/OpenVAS-7-DEMO-1.0.ova (sha1sum)

MD5SUM: 7d7e4d24229a9a518a356801af1b8845

Compatibility: VirtualBox >=4.3, ESXi >=4

Important Notes:

Security (it is highly recommended that you follow these steps immediately after first start):

You should change the default password for system account "root" (login as root and apply command "passwd").

You should change the default password for system account "openvas" (login as openvas and apply command "passwd").

You should change the default password for web account "admin" (login as admin via web interface and go to "Extras/My Settings". Via the Edit button, change the password - remind the checkbox to confirm password change).

You should upgrade the base system immediately to install all security updates published meanwhile. The base system is Debian Wheezy, so you need to run as "root" the command "apt-get dist-upgrade" (or other management tools you might prefer).

A self-signed SSL certificate is used. You need to allow an exception in your browser at first login.

Exchange it if you don't want to share the same ceritificate with other OpenVAS DEMO installations.

Encryption of passwords: The passwords that you enter for Credentials (ssh/smb) and that are boing used for authenticated scans are stored encrypted. A encryption key is pre-installed because the creation can take considerably long (upto 60 minutes).

If you do not exchange this key, you share the same encryption key with other OpenVAS DEMO installations!

This way you delete the key and create a new one (takes upto 60 minutes):

gpg --homedir=/usr/local/etc/openvas/gnupg --delete-secret-keys 94094F5B

gpg --homedir=/usr/local/etc/openvas/gnupg --delete-keys 94094F5B

openvasmd --create-credentials-encryption-key

/etc/init.d/openvas-manager restart

You will find further details and hints about the key management in the file "/root/build/openvas-manager-5.0.1/INSTALL".

Usage:

If you don't know where to log into the web interface, then log in as system user "openvas" and the URL will be printed.

GNU GPL: In compliance with GNU GPL, any sources are already pre-installed on the VM (under /root/source)

Performance: After import it might make sense to increase resources (CPU, RAM), given your host can provide this

Updating OpenVAS: OpenVAS was built unter /root/build. You need to download newest releases as tar.gz files and follow the usual scheme for building OpenVAS from source. The install prefix is "/usr/local".

Web timeout: If you want to increase the web timeout to for example 1 hour, then you should add "--timeout=60" to DAEMON_ARGS in /etc/default/greenbone-security-assistant and then restart.

同步各種弱點資料庫:

            su -

root@debvas:~# openvas-nvt-sync

註:系統會問要不要整合資料庫(migration),按「y」。

root@debvas:~# openvasmd --rebuild

root@debvas:~# openvas-scapdata-sync

root@debvas:~# openvas-certdata-sync

重新開機

root@debvas:~# shutdown -r now

進入網頁 https://ip 然後輸入帳號 admin 及密碼,開始選 job 去掃。下載 report 檔:網頁上的 scan management > reports > 選按 date > 畫面中上有 Report results > PDF 下拉選單選報表格式 > 按綠色「下載」圖示。

註:進入 deep 掃瞄模式掃 freebsd 9 伺服器,出現流量在掃瞄後會仍有每秒十幾 MB 的大流量,將 OPENVAS 虛擬機關掉就沒再出現了。所以在掃瞄過程中可以進入 cacti 看看系統的狀況。建議以 full and fast 設定作掃瞄即可。

2014 年修補缺陷的方法:

freebsd 缺陷1: 

freebsd 缺陷2 (http://httpd.apache.org/docs/current/en/mod/core.html#traceenable): 

dns 缺陷1:

vhd 兩台伺服器的 port 10001 tcp 與 10002 tcp 被認為是木馬:

backup、log、中的 nfs 服務: