Amazon InspectorでWindowsの脆弱性を検知させてみた

2016.05.14

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは、コカコーラが大好きなカジです。

はじめに

Amazon Inspectorを使ってWindowsサーバへの脆弱性診断をしてみました。また、日本語のマネージメントコンソールに対応していたため、試してみました。 Linuxの方はこのブログを参考にしてください。

Amazon InspectorのWindows対応について

2016/5/13現在、Windowsを検査対象の場合、プレビュー扱いのようです。マニュアルの対応OSに以下のように記載されています。

Windows Server 2008 R2 and Windows Server 2012

Important Support for Windows-based operating systems for the AWS agent is in preview and subject to change.

試したところ、検知していた内容のありましたのでご紹介します。

EC2の構築

Amazon Inspectorの検査対象のリージョンは以下の4つとなります。

  • US West (Oregon)
  • US East (N. Virginia)
  • EU (Ireland)
  • Asia Pacific (Tokyo)

今回は、東京で実施しています。

以下のイメージでLaunchし、Inspectorで検査してみました。 Windows_Server-2012-RTM-Japanese-64Bit-Base-2016.03.09 - ami-7b222c15

kaji-Inspector-Windows-01

タグの設定

AWS Inspectorの検査対象はタグによって判別させます。今回は「Inspector」=「True」というタグを付与しました。

kaji-Inspector-Windows-02

WindowsへのInspector エージェントインストール

エージェントダウンロード

マニュアルに記載のあるURLからダウンロードしますが、ブラウザを利用せずPowershellで実行しました。 Powershellを起動し、以下を実行しています。

PS C:\Users\Administrator > cd .¥Desktop
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> Invoke-WebRequest -Uri "https://d1wk0tztpsntt1.cloudfront.net/windows/installer/latest/AWSAgentInstall.exe" -OutFile "AWSAgentInstall.exe"

ダウンロードした、以下のファイルをクリックして実行しインストールします。

kaji-Inspector-Agent-Installl-00

エージェントインストール

起動すると以下の画面が出るので、同意してInstallをクリックします。

kaji-Inspector-Agent-Installl-01

インストール中の画面

kaji-Inspector-Agent-Installl-02

完了画面

kaji-Inspector-Agent-Installl-03

サービスに登録されて自動起動するようになっていました。EC2側の準備は完了です。

Amazon Inspectorの設定(日本語版)

AWS Inspector管理画面から[今すぐ始める]ボタンをクリックします。 kaji-Inspector-01

ステップ1 前提条件

まずはIAM Roleの設定が必要なので、「ロールの選択または作成をクリック」 kaji-Inspector-02

IAM Roleを新規に作成します。デフォルトのまま特に変更せず、「許可」ボタンをクリックします。 kaji-Inspector-03

そのまま「続行」をクリックします。 kaji-Inspector-04

ステップ2 評価ターゲットの定義

先ほど設定した、名前に適当な名前(今回はWindows2012)を設定し、検査対象となるEC2に設定したタグ「Inspector」=「True」を設定します。 kaji-Inspector-05

ステップ3 評価テンプレートの定義

名前欄に適当な名前を設定(今回はTest Assesment)を入力し、ルールパッケージを選択します。今回は事前定義のすべての項目を選択しています。

  • CIS Operating System Security Configuration Benchmarks-1.0
  • Security Best Practices-1.0
  • Common Vulnerabilities and Exposures-1.1
  • Runtime Behavior Analysis-1.0

所用時間は「1時間(推奨)」を選択し、「続行」をクリックします。

kaji-Inspector-06

ステップ4 確認

以下の画面が表示されますので、「作成」をクリックします。

kaji-Inspector-07

Amazon Inspectorの検査を実行

作成した評価テンプレートの左側のラジオボタンをクリックして選択し、「実行」ボタンをクリックします。 kaji-Inspector-08

先ほど指定した、所用時間かかるためしばらく放置します。実行中の画面は以下となります。 kaji-Inspector-09

分析結果の確認

分析完了になりましたら、「結果」をクリックし内容を確認します。 kaji-Inspector-10

詳細を確認できます。

kaji-Inspector-12

右側のダウンロードボタンを押すとCSVファイルでダウンロードできます。

kaji-Inspector-11

文字コードの問題と思いますが、Mac版のExcelでCSVを開いたところ、1行目が文字化けしましたがテキストエディタでは表示されましたので、変換すると良いと思います。

CVEについては量が多かったので省略してます。

"重要度","結果","ターゲット","テンプレート","ルールパッケージ"
"High","Instance i-bec24821 is vulnerable to CVE-2016-0103","Windows2012","Test Assesment","Common Vulnerabilities and Exposures-1.1"
<省略>
"Low","Instance i-bec24821 used insecure protocol(s) 80/tcp (http) to connect to a remote host. These protocols pass traffic in the clear, increasing the risk of a successful traffic interception attack.","Windows2012","Test Assesment","Runtime Behavior Analysis-1.0"
"Informational","Unsupported Operating System or Version","Windows2012","Test Assesment","Security Best Practices-1.0"
<省略>
"Informational","Instance i-bec24821 is hosting insecure service protocol(s) 137/udp (netbios-ns), 139/tcp (netbios-ssn), 138/udp (netbios-dgm).","Windows2012","Test Assesment","Runtime Behavior Analysis-1.0"
"Medium","Instance i-bec24821 is vulnerable to CVE-2016-0162","Windows2012","Test Assesment","Common Vulnerabilities and Exposures-1.1"
"Informational","Unsupported Operating System or Version","Windows2012","Test Assesment","CIS Operating System Security Configuration Benchmarks-1.0"
<省略>
"Informational","Instance i-bec24821 was listening on TCP port(s) 135, 139, 445, 5985, 47001, 49152, 49153, 49154, 49155, 49156, 49651, but no connections to these port(s) were seen during the assessment run.","Windows2012","Test Assesment","Runtime Behavior Analysis-1.0"
"High","Instance i-bec24821 is vulnerable to CVE-2013-0005","Windows2012","Test Assesment","Common Vulnerabilities and Exposures-1.1"

結果を見て

私は以下の2点に注目しました。

1点目はCommon Vulnerabilities and Exposuresや、Runtime Behavior Analysisで検出されました。 2点目は「Unsupported Operating System or Version」にて以下の2件がありましたので、ルールバージョンがアップデートされ今後Windows対応されると推測しています。

  • Security Best Practices-1.0
  • CIS Operating System Security Configuration Benchmarks-1.0

今後のアップデートされて、すべてのルールパッケージが検査できるようになることを期待しています。

その他

AWS Black Belt Online Seminar資料

先日、AWS Black Belt Online SeminarでInspectorが紹介されておりました。 資料はここにとなります。

Windows版 Inspector Agentのステータス確認

以下を実行するとステータスが表示されます。Powershellから実行して確認しました。 C:\Program Files\Amazon Web Services\AWS Agent\AWSAgentStatus.exe

正常時のエージェントのステータス情報

PS C:\Program Files\Amazon Web Services\AWS Agent> .\AWSAgentStatus.exe
Configuration file path : C:\ProgramData\Amazon Web Services\AWS Agent\agent.cfg
Configuration status :
Agent version : 1.0
System release : Windows Server 2012 x64 - 6.2.9200
Daemon : true
Max queue size : 31457280
Log File :
Msgs log max size : 29360128
CodeModules : true
InstanceMetaData : true
PackageInfo : true
NetworkInterfaces : true
Groups : true
Users : true
Terminals : true
ConfigurationInfo : true
GlobalFile:/etc/bash.bashrc
GlobalFile:/etc/bashrc
GlobalFile:/etc/login.defs
GlobalFile:/etc/pam.conf
GlobalFile:/etc/pam.d/*
GlobalFile:/etc/profile
GlobalFile:/etc/samba/smb.conf
GlobalFile:/etc/ssh/sshd_config
GlobalFile:/etc/sysctl.conf
PerUserFile:.bash_login
PerUserFile:.bash_profile
PerUserFile:.bashrc
Permissions : true
GlobalDir:/bin
GlobalDir:/etc
GlobalDir:/lib
GlobalDir:/lib64
GlobalDir:/root
GlobalDir:/sbin
GlobalDir:/usr/bin
GlobalDir:/usr/lib
GlobalDir:/usr/lib64
GlobalDir:/usr/local/bin
GlobalDir:/usr/local/lib
GlobalDir:/usr/local/lib64
GlobalDir:/usr/local/sbin
GlobalDir:/usr/sbin
KernelModules : true
Oval : true
Dns entries : true
System performance : true
System performance update frequency : 1
System performance send frequency : 30
Process performance : true
Process performance update frequency : 1
Process performance send frequency : 30
Kernel module status : 0
Network connections : true
Listening ports : true
Code modules : true
Processes : true
Publisher type : Service
Registered : true
Endpoint :
Instance-Id : i-bec24821
Region : ap-northeast-1
IpAddress : 10.10.10.174
MacAddress : 06:e3:89:94:db:23
IpAddress : fe80::1dbb:1c56:5894:1c9e
MacAddress : 06:e3:89:94:db:23
IpAddress : fe80::5efe:10.10.10.174
MacAddress : 00:00:00:00:00:00
IpAddress : 127.0.0.1
MacAddress : 00:00:00:00:00:00
IpAddress : ::1
MacAddress : 00:00:00:00:00:00
IpAddress : fe80::100:7f:fffe
MacAddress : 00:00:00:00:00:00
Total events published : 3266
Events published in last call : 13
AgentId : i-bec24821
Collecting : true
Last registration attempt date : Fri 2016-05-13 10:15:50 協定世界時
Last registration date : Fri 2016-05-13 10:15:50 協定世界時
Last config retrieval attempt date : Fri 2016-05-13 10:31:37 協定世界時
Last config retrieval date : Fri 2016-05-13 10:31:38 協定世界時
Last event publishing attempt date : Fri 2016-05-13 10:31:22 協定世界時
Last event publishing date : Fri 2016-05-13 10:31:23 協定世界時

PS C:\Program Files\Amazon Web Services\AWS Agent>