隱藏敏感訊息

  1. 當網頁失敗或使用特定工具查詢時,系統會回傳 apache 版本、作業系統/版本等訊息,甚至安裝的模組等。攻擊者可利用這些訊息,比較快找到攻擊的方式。
    [root@kvm6 www]# curl -s http://kvm6.deyu.wang/abc | sed -e 's/<[^>]*>//g' -e '/^$/d'
    301 Moved Permanently
    Moved Permanently
    The document has moved here.
    Apache/2.2.15 (Red Hat) Server at kvm6.deyu.wang Port 80
    
  2. 在 httpd.conf 中設定,ServerTokens 的參數有 Min[imal], OS, Prod[uctOnly], Full 四種,讀者可試著使用這四種參數,看網站回應。ServerSignature off 關閉系統生成的頁面的頁腳訊息。
    [root@kvm6 www]# grep '^Server[TS]' /etc/httpd/conf/httpd.conf 
    ServerTokens Prod
    ServerSignature Off
    
  3. 重新載入 httpd.conf 設定
    [root@kvm6 www]# /etc/init.d/httpd reload
    Reloading httpd:
    
  4. 再次連上不存在的網頁時,已不出現作業系統及 Apache 版本。
    [root@kvm6 www]# curl -s http://kvm6.deyu.wang/abc | sed -e 's/<[^>]*>//g' -e '/^$/d'
    301 Moved Permanently
    Moved Permanently
    The document has moved here.