2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

クラウドセキュリティ監査ツール「Scout Suite」を使って、Azureのネットワークセキュリティグループをチェックしてみた

Last updated at Posted at 2025-07-02

以前、「クラウドセキュリティ監査ツール「Scout Suite」を使って、ゆるゆる設定のAWS環境をチェックしてみた」という記事を書いているのですが、今回はAzure環境に対して「Scout Suite」を実行してみたので、その記録を残しておきます。


事前準備

AWS場合と同様に「ゆるゆるのネットワークセキュリティグループ」を作成します。

まずは Azureのポータル画面 にログインします。

画面左上のハンバーガーメニューから「すべてのサービス」をクリックして、サービスの一覧画面に移動します。
image.png

画面左側のメニューから「ネットワーキング」をクリックします。
image.png

「ネットワーク セキュリティ」の中から「ネットワーク セキュリティ グループ」をクリックします。

image.png

画面上部の「+作成」をクリックして、ネットワーク セキュリティ グループの作成画面へ移動します。

image.png

以下のように入力して、「確認および作成」ボタンをクリックします。

  • サブスクリプション: 従量課金
  • リソースグループ: ScoutSuite
  • 名前: high_risk
  • リージョン: Japan East

image.png

確認画面が表示されるので、「作成」ボタンをクリックします。

image.png

作成が完了するとこのような画面が表示されるので、「リソースに移動」をクリックします。

Screenshot from 2025-06-23 16-10-18.png

デフォルトでいくつか「受信セキュリティ規則」と「送信セキュリティ規則」が設定されていることが確認できます。

Screenshot from 2025-06-23 16-15-42.png

左側のメニューから「受信セキュリティ規制」をクリックします。

image.png

画面上部の「+作成」をクリックします。

image.png

「受信セキュリティ規則の追加」の画面が表示されるので、以下のように入力します。

image.png

左側のメニューから「送信セキュリティ規制」をクリックします。

image.png

画面上部の「+作成」をクリックします。

image.png

「送信セキュリティ規則の追加」の画面が表示されるので、以下のように入力します。

image.png


Scout Suiteを実行

以前、AWSに対して ScoutSuite を試した際はローカル環境上でコマンドが実行できるように構築したのですが、今回は Docker を利用することにします。

ScoutSuite の「Docker Image」というwikiページを見ると、以下のような説明が記載されています。

image.png

しかし、残念ながら ScoutSuite のリポジトリの docker ディレクトリ内に compose.yamldocker-compose.yml といったファイルが存在しません。

image.png

なので、当然ですが以下のコマンドは失敗します。

$ pwd
/PATH/TO/ScoutSuite/docker
$ docker compose build
no configuration file provided: not found

試しに docker ディレクトリ内に存在する build.sh を実行してみます。

$ ./build.sh 


==============================
BEGINNING BUILD...

BUILD TARGET NOT FOUND!

USAGE:
  ./build.sh [base | aws | gcp | azure | all ]
==============================

Azure環境のDockerイメージをビルドする場合は引数として「azure」を付与して実行します。
すると、「nccgroup/scoutsuite-base:5.13.0-01」が見つからないため失敗していることがわかります。

$ ./build.sh azure


==============================
BEGINNING BUILD...

------------------------------
building azure image...



building image using:
docker build     -f Dockerfile-azure     -t nccgroup/scoutsuite-azure:5.13.0-01     --build-arg BUILD_DATE=2025-07-02T12:41:25Z     --build-arg NAME=scoutsuite     --build-arg VCS_REF=7909f2fc     --build-arg VCS_URL=https://github.com/nccgroup/ScoutSuite     --build-arg VENDOR=nccgroup     --build-arg VERSION=5.13.0-01     --build-arg IMAGE_NAME=nccgroup/scoutsuite-azure:5.13.0-01     .
[+] Building 1.7s (3/3) FINISHED                                                     docker:default
 => [internal] load build definition from Dockerfile-azure                                     0.0s
 => => transferring dockerfile: 983B                                                           0.0s
 => ERROR [internal] load metadata for docker.io/nccgroup/scoutsuite-base:5.13.0-01            1.5s
 => [auth] nccgroup/scoutsuite-base:pull token for registry-1.docker.io                        0.0s
------
 > [internal] load metadata for docker.io/nccgroup/scoutsuite-base:5.13.0-01:
------
Dockerfile-azure:1
--------------------
   1 | >>> FROM nccgroup/scoutsuite-base:5.13.0-01
   2 |     
   3 |     LABEL maintainer="Jason Ross <algorythm@gmail.com>"
--------------------
ERROR: failed to build: failed to solve: nccgroup/scoutsuite-base:5.13.0-01: failed to resolve source metadata for docker.io/nccgroup/scoutsuite-base:5.13.0-01: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

docker/Dockerfile-azure の1行目を確認するとFROMに「nccgroup/scoutsuite-base:5.13.0-01」が指定されており、これが原因のようです。

Docker Hubで「nccgroup」を検索すると確かに該当がないのですが、 ScoutSuite のメンテナである Jason RossさんがアップロードしたAzure用のイメージを見つけることができましたので、今回はこれを利用してみることにします。

docker pull を実行します。

$ docker pull rossja/scoutsuite-azure:5.13.0-01

Azure用のコンテナを起動します。
scout コマンドを実行した際に「/root/scoutsuite-report」ディレクトリ配下にHTMLファイルが出力されるので、ローカルからアクセスできるようにマウントしておきます。

$ docker container run \
--rm \
-v /tmp/scoutsuite-report:/root/scoutsuite-report \
-it rossja/scoutsuite-azure:5.13.0-01

az login を実行。

root@f7e9c09549e4:~# az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.

表示されているURL( https://microsoft.com/devicelogin )にアクセスすると、認可コードが求められますので、画面上の「enter the code XXXXXXXXX」と記載されているコードを入力します。

image.png

Azureのログイン画面が表示されるので、通常どおりログインします。

Screenshot from 2025-07-02 22-03-28.png

「Microsoft Azure CLI にサインインしますか?」と表示されるので「続行」をクリックします。

Screenshot from 2025-07-02 22-05-00.png

このメッセージが表示されたらこの画面は閉じます。

image.png

ログインが完了するとターミナル上に認証したユーザーの情報が表示されます。

root@f7e9c09549e4:~# az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.
[
  {
    "cloudName": "AzureCloud",
    "homeTenantId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "isDefault": true,
    "managedByTenants": [],
    "name": "従量課金",
    "state": "Enabled",
    "tenantId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "user": {
      "name": "akase244@example.com",
      "type": "user"
    }
  }
]

準備が整ったので scout コマンドを実行します。
Azureの場合は認証方法がいくつかあるようですが、今回は az login によるログインを行いましたので、 --cli を付与して実行します。

root@f7e9c09549e4:~# scout azure --cli
2025-07-02 13:14:35 f7e9c09549e4 scout[53] INFO Launching Scout
2025-07-02 13:14:35 f7e9c09549e4 scout[53] INFO Authenticating to cloud provider
2025-07-02 13:14:38 f7e9c09549e4 scout[53] INFO No subscription set, inferring
2025-07-02 13:14:38 f7e9c09549e4 scout[53] INFO Running against subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Gathering data from APIs
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Azure Active Directory service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the RBAC service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Security Center service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the SQL Database service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Storage Accounts service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Key Vault service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Network service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Virtual Machines service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the App Services service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the MySQL Database service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the PostgresSQL Database service
2025-07-02 13:14:39 f7e9c09549e4 scout[53] INFO Fetching resources for the Logging Monitoring service
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Running pre-processing engine
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Running rule engine
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Applying display filters
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Running post-processing engine
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Saving data to scoutsuite-report/scoutsuite-results/scoutsuite_results_azure-tenant-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.js
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Saving data to scoutsuite-report/scoutsuite-results/scoutsuite_exceptions_azure-tenant-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.js
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Creating scoutsuite-report/azure-tenant-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.html
2025-07-02 13:15:04 f7e9c09549e4 scout[53] INFO Opening the HTML report

「scoutsuite-report」ディレクトリ配下にレポートファイルが出力されていることが確認できます。

root@f7e9c09549e4:~# ls -l ~/scoutsuite-report/
total 180
-rw-r--r-- 1 root root 159073 Jul  2 13:15 azure-tenant-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.html
drwxr-xr-x 4 root root   4096 Jul  2 13:15 inc-bootstrap
drwxr-xr-x 5 root root   4096 Jul  2 13:15 inc-fontawesome
drwxr-xr-x 2 root root   4096 Jul  2 13:15 inc-handlebars
drwxr-xr-x 2 root root   4096 Jul  2 13:15 inc-jquery
drwxr-xr-x 3 root root   4096 Oct 16  2023 inc-scoutsuite
drwxr-xr-x 2 root root   4096 Jul  2 13:15 scoutsuite-results

ローカル環境で実行した場合は自動的にブラウザが起動する仕組みになっていますが、今回はDockerコンテナ内で実行したので、マウントしておいたディレクトリ内に出力されているファイルを手動で開きます。

Screenshot from 2025-07-02 22-19-42.png

「Network」の部分をクリックします。

image.png

「Security Group Rules Allowing All Inbound Access」と警告されていることがわかります。

image.png

Screenshot from 2025-07-02 22-28-13.png

まとめ

久しぶりに「Scout Suite」を利用してみましたが、リポジトリの最終コミットが「May 10, 2024」なので、メンテナンスが止まっている状態のアプリケーションでセキュリティ監査を行うこと自体があまり良くないなと感じました。

メンテナンスが止まっているということは、Azureで新しくリリースされている機能の監査には使えないということですし、今回はリポジトリとドキュメントの内容の乖離を何点か見つけたので、使用していてかなり不安でした。
ということなので、あくまで参考程度にしていただけると良いかと思います。

また、今回は az login でログインするパターンを試しましたが、認証に使ったアカウントはAzure内の全権を持つアカウントのため、本来であれば、閲覧者(Reader)、セキュリティ閲覧者(Security Reader)のようなロールを割り当てたアカウントで行うべきかと思いました。このあたりも実際に利用する場合は注意すべき点かと思います。

参考URL

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?