メニューを閉じる

テクノデジタルグループ

メニューを開く

2014.07.02

インフラ

”Your Amazon EC2 Abuse Report” の顛末

こんにちは、JTです。

AWSのEC2インスタンスについて、マルウェアが仕込まれている可能性があるため、インスタンスを再構築した方が良いとの通知がAWSから届いた。

以下に示す通り、実際にはメールのバウンス時のDNSlookupをC&Cサーバへのアクセスと誤判定されたもので、問題はなかったが、本警告に関する情報がWeb上に殆ど見られなかったため、環境の再構築など余分な工数が発生しました。後世何らかの役に立てばと思い、記録を残しておきます。

1)Amazon EC2 Abuse(ec2-abuse@amazon.com)から不正使用レポートが届いた

Your Amazon EC2 Abuse Report
——————–
We’ve received report(s) that one or more of your instances may be infected with malware.
Malware can be used by people to manipulate your instances into carrying out attacks against Internet computers with or without your permission.
Facilitation of internet attacks are specifically forbidden in the AWS Acceptable Use Policy (http://aws.amazon.com/aup).
If you believe this report to be inaccurate, please reply to this email with an explanation of why the traffic is legitimate.
If you require more context around this report please reply to this report as well.

Instance Id: <My EC2>

We’ve attached the information provided by the reporter at the bottom of this email.
Please review the information as well as the link included below to determine whether your instances are infected with malware.
To permanently remediate the problem, AWS recommends that you move your data to a new instance and terminate the implicated instance.
Taking future precautionary steps by hardening your instance is also recommended.
A list of tips for securing your EC2 instances are available for your review at: http://aws.amazon.com/articles/1233

Once you have investigated this matter, please reply to this email to report your findings and actions.
This information will be relayed to the original reporter of this issue.

Regards,
Amazon EC2 Abuse Team

===== Details ======

1.AWS Acceptable Use Policy: http://aws.amazon.com/agreement/.

2.Additional abuse report information provided by original abuse reporter(s):
* Destination IPs:
* Destination Ports:
* Destination URLs:
* Abuse Time: Fri Mar 03 03:33:33 UTC 2013
* Log Extract:
<<<
Your host has been contacting the following domains that are known to be C&C servers.
This suggests your host is running a botnet client. The following is a list of instances, timestamps of the contact, and domains, subdivided by ec2 region:

Region ap-northeast-1:
i-<My EC2>, 2013-03-03T03:33:33Z, hogehoge.com
i-<My EC2>, 2013-03-03T03:33:33Z, hogehoge.com
i-<My EC2>, 2013-03-03T03:33:33Z, hogehoge.com
(後略)
——————–

2)Abuseの根拠を確認

届いた不正使用レポートには、

Your host has been contacting the following domains that are known to be C&C servers.

とあるものの、”contacting”だけでは具体的にはどのような通信を検知したのかわからない。機械語翻訳のメールで聞いてみるも、反応がない。

英文がまずいのかと思い、AWS有償サポートに($100)切り替え、日本語でのサポートを期待したが本件に関する問い合わせは英文で直接やり取りせよとのこと。追加で問い合わせをかける。

返信が来るのを待っている間に、ClamAVやchkrootkitでサーバを確認、プロセスの確認・ログイン履歴・改ざんチェックも行ってみたが、特に問題は見つからない。

数日たっても回答がないため、あきらめてAWSのおすすめ
(AWS recommends that you move your data to a new instance and terminate the implicated instance.)
通り、クリーンな環境の再構築と膨大なデータの移行(結構大変……)を進めていたところ、漸くAWSから返信あり。曰く

These alerts show that your instance was doing DNS lookups for a known C&C server,hogehoge.com.

とのこと。検知したのは該当ドメインへのDNSlookupだけで、マルウェア特有の通信を検知した、とかではなかったらしい。DNSlookupはメール送信でも普通に発生する。該当インスタンスのqmailのsend履歴に該当ドメインへのバウンスのログがあった。
→.qmail-defaultを変更して、不正アカウントに対するバウンス処理を止める様に変更。
(参照:http://www.softel.co.jp/blogs/tech/archives/2170)

3)修正後連絡

qmailのsendログを貼り付けて状況を説明、マルウェアではなくqmailによるバウンスのリトライが該当サーバへの複数回のDNSlookupの原因だった、対策したのでよろしく、とメール(英文)。

4)Close連絡

Thanks for the response and for disabling bounced mail notifications. These notifications are sent as an advisory to customers to let them know that their instances are reaching out to known botnet-related domains. If the instances don’t go on to get implicated in further abuse cases, then there’s no action required for these specific Botnet-related abuse cases.

■まとめ

・C&CサーバへのDNSlookupを頻繁に行っているとマルウェア入りサーバの可能性ありと判断される。
・AWS Abuse Reportに含まれる情報は非常に限られているので、どのような問題を検知したので警告してきたのか、を確認してから動かないと余分な工数が必要になる。
・AWS Abuse Reportに関しては、有償サポートを結んだとしても優先的に回答が得られるわけではない(有償サポートを結んでも効果が期待できない)。
・英文メールに自信が無くてもしつこく問い合わせすると回答がもらえるかも。あきらめない。


【記事への感想募集中!】

記事への感想・ご意見がありましたら、ぜひフォームからご投稿ください!
  • こんな記事が読んでみたい、こんなことが知りたい、調べてほしい!という意見も募集中!
  • いただいた感想は今後の記事に活かしたいと思います!

感想フォームはこちら


【テクノデジタルではエンジニア/デザイナーを積極採用中です!】

下記項目に1つでも当てはまる方は是非、詳細ページへ!
  • 自分でアプリを作ってみたい
  • ITで世の中にワクワクを生み出したい
  • 使いやすさ、デザインにこだわったWebサイトを開発したい

採用情報の詳細はこちら


Qangaroo(カンガルー)

  • 徹底した見やすさと優れた操作性で、テストの「見える化」を実現。
  • テストの進捗が見える。開発がスマートに進む。
  • クラウド型テスト管理ツール『Qangaroo(カンガルー)』

【テクノデジタルのインフラサービス】

当社では、多数のサービスの開発実績を活かし、
アプリケーションのパフォーマンスを最大限に引き出すインフラ設計・構築を行います。
AWSなどへのクラウド移行、既存インフラの監視・運用保守も承りますので、ぜひご相談ください。
詳細は下記ページをご覧ください。

https://www.tcdigital.jp/infrastructure/

最近の記事