2003-11-02 [長年日記]

mod_security

mod_securityって楽しいかもと思いいじってみたりしてるところ。以下はApache 2.0.48、mod_security 1.7.2、Windows 2000 Serverという具合。

Audit logging; full details of every request (including POST) can be logged for later analysis.
HTTPリクエストヘッダやPOSTデータもログれるようだけど、受け取ったそのままではないみたい。例えば、

HEAD / HTTP/1.1
HOST: 127.0.0.1
aaaaa
User-Agent: TEST

だとしたら、ログに記録されている内容は、

========================================
Request: 127.0.0.1 - - [[01/Nov/2003:00:00:00 +0900]] "HEAD / HTTP/1.1" 400 0
Handler: (null)
Error: Request header field is missing ':' separator.
<pre> aaaaa</pre>    ---------------------------------------- HEAD / HTTP/1.1 HOST: 127.0.0.1   HTTP/1.1 400 Bad Request Connection: close Content-Type: text/html; charset=iso-8859-1

という具合。何にしても 400 Bad Request だけど。

次に次のようなを試してみた。

GET /a HTTP/1.1
HOST: 127.0.0.1
HOST: 127.0.0.1
HOST: 127.0.0.1

こんな具合で記録されるのですた。

========================================
Request: 127.0.0.1 - - [[02/Nov/2003:11:01:09 +0900]] "GET /a HTTP/1.1" 404 282
Handler: (null)
----------------------------------------
GET /a HTTP/1.1
HOST: 127.0.0.1, 127.0.0.1, 127.0.0.1
 
HTTP/1.1 404 Not Found
Content-Length: 282
Content-Type: text/html; charset=iso-8859-1

で、ちなみに実際の応答は、

HTTP/1.1 404 Not Found
Date: Sun, 01 Nov 2003 00:00:00 GMT
Server: Apache
Content-Length: 282
Content-Type: text/html; charset=iso-8859-1
 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /a was not found on this server.</p>
<hr />
<address>Apache Server at 127.0.0.1, 127.0.0.1, 127.0.0.1 Port 80</address>
</body></html>

どちらかというと、Apache2の問題カナァ?

そいえば、超お手軽にHTTPレスポンスヘッダを書き換えられるんですね。

SecServerSignature "Microsoft-IIS/5.0"

これだけで可能(笑 ちゃんと誤魔化すときはこれだけじゃダメだけどー(笑