LoginSignup
0
0

More than 1 year has passed since last update.

Microsoft Sentinel分析ルールの紐解き(User Assigned Privileged Role)

Last updated at Posted at 2022-12-24

Microsoft Sentinelにおいてもともと準備されている分析ルールについてクエリの中身や注意点等を紐解いていく。

警告
なお、このルールは利用環境によっては過検知が多発するためチューニングが必要である。
例えば

  • PIM(Privileged Identity Management)による権限付与は検知除外する
  • 条件付きアクセスで許可されたロケーションからの操作は検知除外する
  • 特定の作業者(情報システム部門の担当者 等)による権限付与は検知除外する

である

1. ルール概要

項目 説明
重大度
ルール名 User Assigned Privileged Role
ルールの種類 Scheduled
ルールの頻度 2時間ごとにクエリを実行
ルールの期間 過去2時間のデータ
バージョン 1.0.3
説明 新しい特権ロールがユーザーに割り当てられたときに識別されます。ロールの対象となるアカウントには、特権的なアクセス権が与えられています。割り当てが予期しないものであったり、アカウント所有者の責任ではないロールに割り当てられたりした場合は、調査してください。(by DeepL)
Ref https://learn.microsoft.com/ja-jp/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1

2. 活用するテーブル

テーブル名 概要 参考URL
AuditLogs Azure ADの監査ログ https://learn.microsoft.com/ja-jp/azure/azure-monitor/reference/tables/auditlogs

3. クエリ解説

User Assigned Privileged Role / version1.0.3
// AzureADの監査ログを対象とする
AuditLogs
// 大文字小文字区別せずに CategoryフィールドがRoleManagementのものに絞り込む
| where Category =~ "RoleManagement"
// 操作の種類が付与のものに絞り込む
// https://cloudsteady.jp/post/33813/
| where AADOperationType in ("Assign", "AssignEligibleRole")
// アクティビティもしくは操作の名称がPIMもしくはアクティブによる権限追加によるものに絞り込む
// ※ユーザー、グループ問わずに権限付与された際は上記文字列になることに注意
| where ActivityDisplayName has_any ("Add eligible member to role", "Add member to role")
// TargetResourcesフィールドの配列データを展開する
| mv-expand TargetResources
// TargetResources.modifiedPropertiesフィールドの配列データを展開する
| mv-expand TargetResources.modifiedProperties
// displayName_ というフィールドにstring型で変更内容の表示名を格納
| extend displayName_ = tostring(TargetResources_modifiedProperties.displayName)
// 大文字小文字区別せずに displayName_フィールドがRole.DisplayNameのものに絞り込む
| where displayName_ =~ "Role.DisplayName"
// RoleName というフィールドにstring型で付与された権限名を格納
| extend RoleName = tostring(parse_json(tostring(TargetResources_modifiedProperties.newValue)))
// 大文字小文字区別せずに付与された権限名にAdminのものに絞り込む
| where RoleName contains "Admin"
// InitiatingApp というフィールドにstring型で権限が付与された際のアプリケーションの表示名を格納
| extend InitiatingApp = tostring(parse_json(tostring(InitiatedBy.app)).displayName)
// Initiator フィールドに権限付与のきっかけとなった情報を格納する
// アプリケーションの場合(InitiatingAppフィールドが何かしら文字列が入っていれば)そのアプリケーション名を
// 文字列が入ってない場合は権限付与したユーザーのUPNを格納する
| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName))
// Uncomment below to not alert for PIM activations
// Privileged Identity Managementによる権限付与の場合を除く
//| where Initiator != "MS-PIM"
// Target というフィールドにstring型で付与されたユーザーのUPNを格納する
| extend Target = tostring(TargetResources.userPrincipalName)
// 発生時間を1時間単位に丸め、操作名、権限名、権限付与された対象ユーザーのUPN、権限付与したアプリもしくは人、付与結果にサマライズする
| summarize by bin(TimeGenerated, 1h), OperationName,  RoleName, Target, Initiator, Result
// AccountCustomEntityフィールドに権限付与された対象ユーザーの情報を格納する
| extend AccountCustomEntity = Target
0
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
0
0