VPSサーバーでWebサイト公開 備忘録 ~Linux、MySQLからAJAXまで

NessusでVPSサーバーの脆弱性診断 ApacheのTraceメソッド

NessusでVPSサーバー(CentOS6.2)の脆弱性診断を行った際、ApacheのTraceメソッドが重要度”Medium”として診断レポート報告されました。
 
Apacheで”Trace”メソッドが有効になっていて、外部から情報を搾取されるリスクがあるようです。
 
※Nessusについては以下の記事参照。
NessusでVPSサーバーの脆弱性診断

Nessusのレポートでは、対策方法も記載されています。
 
Apacheの設定ファイルに下記記述を追加して、Apacheを再起動します。
“TraceEnable Off”
 
せっかくなので、HTTPのTraceメソッドについて実際にリクエストを送って確認してみました。
 

Telnetを使ってTraceメソッドを確認


 
①Apache設定ファイルに”TraceEnable Off”が無い状態
 
青字が入力した部分で、それ以外はサーバーからの応答部分です。
“HOST:”の部分にリクエストを送るサイトのドメイン名を入力します。”HOST”部分の入力したらリターンを2回押下します。
 
“HTTP/1.1 200 OK”から続く通常のサーバーからのレスポンスとクライアント側から入力したTraceメソッドのリクエストが表示されます。
# telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
TRACE /index.html HTTP/1.1
 HOST: wp.example.com
 
HTTP/1.1 200 OK
Date: Tue, 12 Nov 2013 00:10:44 GMT
Server: Apache
Connection: close
Transfer-Encoding: chunked
Content-Type: message/http
 
3e
TRACE /index.html HTTP/1.1
HOST: wp.example.com
 
0
 
Connection closed by foreign host.

 
②Apache設定ファイルに”TraceEnable Off”を設定した状態
 
同様にTraceメソッドを送ると、今度は”HTTP/1.1 405 Method Not Allowed”と応答され、Traceメソッドが使えなくなっていることが確認できます。

# telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
TRACE /index.php HTTP/1.1
 HOST: wp.example.com
 
HTTP/1.1 405 Method Not Allowed
Date: Tue, 12 Nov 2013 00:08:32 GMT
Server: Apache
Allow:
Content-Length: 306
Connection: close
Content-Type: text/html; charset=iso-8859-1
 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method TRACE is not allowed for the URL /index.php.</p>
<hr>
<address>Apache Server at wp.example.com Port 80</address>
</body></html>
Connection closed by foreign host.
モバイルバージョンを終了