CodeRed,Nimdaの攻撃    (2002/11/17)

 Apacheのアクセスログを見てたら,CodeRedNimdaのアタックが結構あることに気づきました。もちろん,これらはWindowsNTやWindows2000のIISサーバにある脆弱性を突いてくるワームですから,うちのサーバは全然平気なんですが何だか嫌なもんですなあ。

ちなみにこれ↓がCodeRedがアタックしてきたときのログ
3*.2**.220.2 - - [16/Nov/2002:23:57:49 +0900] "GET /default.ida?NNNNNN・・・山のようにNが続いて・・・NNNNNNNNNNNN%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u9090%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u0000%u00=a HTTP/1.0" 400 326 "-" "-"
IPアドレスを晒すのもどうかと思うので一部分伏せ字です。特徴は"GET /default.ida?NNNNNN"で始まる長〜いパラメータです。バッファオーバフローを狙っているのでしょうか。

それから,これ↓がNimdaがアタックしてきたときのログ
210.1**.2**.70 - - [17/Nov/2002:16:32:47 +0900] "GET /scripts/root.exe?/c+dir HTTP/1.0" 404 284 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:49 +0900] "GET /MSADC/root.exe?/c+dir HTTP/1.0" 404 282 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:50 +0900] "GET /c/winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 292 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:51 +0900] "GET /d/winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 292 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:53 +0900] "GET /scripts/..%255c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 304 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:57 +0900] "GET /_vti_bin/..%255c../..%255c../..%255c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 317 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:32:59 +0900] "GET /_mem_bin/..%255c../..%255c../..%255c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 317 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:01 +0900] "GET /msadc/..%255c../..%255c../..%255c/..%c1%1c../..%c1%1c../..%c1%1c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 342 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:03 +0900] "GET /scripts/..%c1%1c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 307 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:07 +0900] "GET /scripts/..%c0%2f../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 298 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:09 +0900] "GET /scripts/..%c0%af../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 309 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:11 +0900] "GET /scripts/..%c1%9c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 305 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:13 +0900] "GET /scripts/..%%35%63../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 304 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:14 +0900] "GET /scripts/..%%35c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 304 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:16 +0900] "GET /scripts/..%25%35%63../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 304 "-" "-"
210.1**.2**.70 - - [17/Nov/2002:16:33:17 +0900] "GET /scripts/..%252f../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 304 "-" "-"
ログの特徴は,上のように root.exe と cmd.exe をチェックしてるところ。 一度に16回のリクエストがあるんですな。
では,この2つのワームが残すログをまともなアクセスとは別に記録してWebalizerで統計をとってみましょう。(ここwebalizer-2.01.10-0vl1.i386.rpmがダウンロードできます)
# rpm -ivh webalizer-2.01.10-0vl1.i386.rpm ダウンロードしたrpmを適当なディレクトリに置いて,インストールします。

httpd.confの真ん中あたりを以下のように編集します。
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a 
# container, they will be logged here.  Contrariwise, if you *do*
# define per- access logfiles, transactions will be
# logged therein and *not* in this file.
#
# CustomLog /var/log/httpd/access_log common
#CustomLog /var/log/httpd/access_log combined

SetEnvIf Request_URI "root\.exe|cmd\.exe|default\.ida" worm
CustomLog /var/log/httpd/worm_log combined env=worm
CustomLog /var/log/httpd/access_log combined env=!worm
これでCodeRedやNimdaのアクセスログをworm_logに分離して記録することができるはず(だったんですけどねえ・・・)。

これがWebalizerが作ったグラフ。
毎日こんなにアタックがあるんですヨ。

時間別のアクセス記録です。

ところがCodeRedのアクセスがworm_logではなく,本体のaccess_logに記録されちゃうんだなあ。
何が悪いんだろ。
というわけで,上のグラフはNimdaのみのアタック記録ってことでよろしく。(^_^;)


でも,どうしてもCodeRedのアタックが調べたいので,httpd.confを以下のように変えて(wormのアタックをaccess_logからはじかないで),ココで手に入るApache Attack AnalysisというCGIで解析してみることにしました。
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a 
# container, they will be logged here.  Contrariwise, if you *do*
# define per- access logfiles, transactions will be
# logged therein and *not* in this file.
#
# CustomLog /var/log/httpd/access_log common
#CustomLog /var/log/httpd/access_log combined

SetEnvIf Request_URI "root\.exe|cmd\.exe|default\.ida" worm
CustomLog /var/log/httpd/worm_log combined env=worm
CustomLog /var/log/httpd/access_log combined
んで,その結果はこのページで見られます。ま,とりあえずこれでよしとするか・・・。




Linuxで自宅サーバ 
\1980のジャンクPCで自宅サーバ  
ノートPCにNFSインストール  
自宅サーバでHPを公開しよう
CGIを使ってみよう
WebDAVを使ってみよう(1)
WebDAVを使ってみよう(2)
kernelの再構築(VineLinux2.5)
自宅サーバでLiveカメラ
自宅サーバでLiveカメラ(2)
Wormの攻撃
ADSLの導入とIPアドレス自動更新
DiCE for Linux
メールサーバ(Postfix)の設定



【Top Page】