- 追加された行はこの色です。
- 削除された行はこの色です。
*TRACEメソッドの無効化 [#c58e0b3d]
#CONTENTS
**概要 [#g4ab78e8]
TRACEメソッドが有効な環境ではクロスサイトトレーシングの手法を用いることでBasic 認証のパスワードを盗むことができます。~
この攻撃を防ぐため、TRACEメソッド自体を使用不可能にする設定の手順を説明します。~
-クロスサイトトレーシングとは
http://bakera.jp/glossary/00430072006f0073007300200053006900740065002000540072006100630069006e0067
http://bakera.jp/glossary/00430072006f0073007300200053006900740065002000540072006100630069006e0067
**Apacheの場合(TraceEnable対応バージョン) [#w2be194f]
Apacheでは1.3.34以降、2.0.55以降、2.2以降ではTRACEメソッドをON/OFF設定できるTraceEnable機能をサポートしているため、以下の設定でTRACEメソッドを無効化できます。~
***設定 [#g5282c05]
httpd.confにTraceEnableを追加し、apacheを再起動することで反映されます。
TraceEnable Off
***TRACEメソッドの確認 [#j590be37]
TRACEメソッドの有効/無効はOPTIONSメソッドを使用することで確認できます。
-手順~
telnetにて80番ポートへ接続し、OPTIONSメソッドにて有効なメソッドを確認
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
OPTIONS / HTTP/1.0
-TRACEメソッドが有効な場合(Allow行の内容を確認)
HTTP/1.1 200 OK
Date: Thu, 01 May 2008 09:06:06 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 0
Connection: close
Content-Type: text/html
Connection closed by foreign host.
-TRACEメソッドが無効な場合(Allow行の内容を確認)
HTTP/1.1 200 OK
Date: Thu, 01 May 2008 09:04:37 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 0
Connection: close
Content-Type: text/html
Connection closed by foreign host.
**Apacheの場合(TraceEnable非対応バージョン) [#me9674ca]
apache 1.3.33、2.0.54以前のバージョンを使用しており、かつバージョンアップが不可能な場合はmod_rewriteを使用してTRACEメソッドを内部的に無効化できます。~
***設定 [#cbcb68f3]
httpd.confに以下のmod_rewriteの設定を行い、apacheを再起動することで反映されます。
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
***確認 [#cf11c4d2]
telnetにて80番ポートへ接続し、TRACEメソッドの結果を確認します。
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
TRACE / HTTP/1.0
Host: www.test.com
-設定前
HTTP/1.1 200 OK
Date: Thu, 01 May 2008 10:27:15 GMT
Server: Apache
Connection: close
Content-Type: message/http
TRACE / HTTP/1.0
Host: www.test.com
Connection closed by foreign host.
-設定後
HTTP/1.1 403 Forbidden
Date: Thu, 01 May 2008 10:30:32 GMT
Server: Apache
Content-Length: 202
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /
on this server.</p>
</body></html>
Connection closed by foreign host.
**IISの場合 [#s5b150ef]
Microsoftが提供している IIS Lockdown tool に含まれる URL Scan によりTRACEメソッドをブロックすることが可能です。
-IIS Lockdown toolの解説~
http://support.microsoft.com/kb/325864/ja