
Azure AD Password Checker
Azure AD環境では、特別な権限を必要とせずに、ユーザーが多要素認証(MFA)を無効にしているかどうかを判断できます。これは、アカウントの作成日時と最終パスワード変更日時を分析することで達成できます。
アカウントの作成日時が最終パスワード変更日時と一致する場合、アカウント作成以降に人による操作が行われていない可能性があり、ユーザーが多要素認証(MFA)を有効にしたりパスワードを変更したりできなかったことを示している可能性があります。また、パスワード変更日が作成日より古いなど、他の「異常」もあります。これは、ユーザーがまだ作成されていなかったため、多要素認証(MFA)を有効にできなかったことも示唆しています!
2023年10月16日更新:
2024年2月18日更新:
この情報は、潜在的なセキュリティリスクの特定に役立ち、レッドチームとブルーチームの両方が使用できるように設計されています。
このツールには、--code-javascriptオプションを使用して抽出されたroadreconデータベースファイルまたはJSONファイルが必要です。Roadreconツールはdirkjanmによって開発されており、GitHub https://github.com/dirkjanm/ROADtools または pip install roadrecon でダウンロードできます。
使用方法は以下を参照:
python3 azurepwchecker.py
usage: azurepwchecker.py [-h] [--roadrecon-dump] [--roadrecon-dump-mfa] [-d DB] [-m] [-l] [-ll] [-lll] [-la] [-lo]
[-ji JSON_INPUT] [-c]
Azure AD Password Checker - This is a parser for generated JSON file or the roadrecon database file designed for use by both red and blue teams.
Database can be created when using --code-javascript option to extract 'merged_users.json' file with be created to later input this file with --json-input argument.
And roadrecon generated roadrecon.db file can be used! roadrecon is developed by https://github.com/dirkjanm credits to him!
options:
-h, --help show this help message and exit
-d DB, --db DB Specify the path to the 'roadrecon.db' database file, default is this location
-m, --mfa-list User Accounts without MFA (No privileged user required)! This argument helps identify user
accounts that have not enabled Multi-Factor Authentication (MFA). If an account's creation
date and time match its last password change date and time, it may indicate that no human
interaction has occurred since the account was created, and the user has not been able to
enable MFA or change their password. And there are other 'anomalies' such as the password
change date being older than the creation date. This suggests also that Multi-Factor
Authentication (MFA) couldn't be enabled because the User wasn't created yet! :-]
-mo OUTFILE, --outfile OUTFILE
Output users with MFA anomalies to file
-l, --pw-month User accounts that had their passwords changed last month
-ll, --pw-year User accounts that had their passwords changed last year
-lll, --pw-older User accounts that haven't changed their passwords in a long time, oldest first
-la, --admin User accounts that are members of 'Admin' named groups, including 'Global Reader'
-lo, --out-of-hours User password change that occurred outside of office hours, specifically between 5:00 PM
(17:00) and 8:00 AM (08:00) on weekdays, as well as on Saturdays and Sundays
-ji JSON_INPUT, --json-input JSON_INPUT
Provide the JSON file imported from your web browser's console using JavaScript. For
'createdDateTime' and 'lastPasswordChange' details, ensure you download the JSON output using
the '--code-javascript' option.
-c, --code-javascript
Perform extraction even if 'azurepwchecker.py' or 'roadrecon' is unavailable. This script
enables extraction through the JavaScript console of a web browser. To proceed, ensure you
have a valid account to log in at https://portal.azure.com/#view/Microsoft_AAD_UsersAndTenants
/UserManagementMenuBlade/~/AllUsers or an active session on a computer. Copy and paste the
provided JavaScript code into the browser's console. Once the session is validated and you
have the necessary permissions, a JSON file named 'merged_users.json' will be generated. You
can then import it using the following command as example: 'azurepwchecker.py --json-input
merged_users.json -m'
-v, --version show program's version number and exit
run roadrecon first:
(Run the following command to install the tool "pip install roadrecon)"
--roadrecon-dump "roadrecon dump" command or do it with roadrecon
--roadrecon-dump-mfa "roadrecon dump --mfa" command (requires privileged access) or do it with roadrecon
azurepwchecker.py --code-javascript を生成してコピーするか、フォルダ内のjsファイルを使用:以下の手順に従って、提供されたスクリプトを使用してユーザー一覧とそのアカウント情報を取得します。
Azure Portalにログイン
ユーザー管理にアクセス
開発者ツールを開く
F12キーを押して開発者ツールを開きます。スクリプトを実行
UsersListとUserInfoを取得
統合ユーザー情報をダウンロード
merged_users.jsonという名前のファイルが生成されます。Azure AD Password Checkerで実行
azurepwchecker.py --json-input merged_users.json例を参照:
イントロを参照:
2023年10月16日更新:

--code-javascript 引数を使用してAzure Portalでユーザー一覧を生成し、その後 azurepwchecker.py --json-input merged_users.json コマンドでインポートする方法:
2024年2月13日更新:
@dafthack氏によるGraphRunnerの編集版をアップロードしました。クレジットは彼にあります。この修正版では、「被害者」のデバイスからHARファイルを直接読み取ることができる新機能を追加しました。この新機能は、さまざまな権限やスコープにアクセスするためのAccess Tokenの確認と調査に役立ちます。さらに、Access Tokenが期限切れの場合、このバージョンではRefresh Tokenを使用して新しいAccess Tokenを作成できます。このプロセスは時間に敏感ですが、Office365環境にすでにログインしている場合、ユーザー名とパスワードの必要性がなくなり、HARファイルにあるセッショントークンのみが必要になります。
コードがやや整理されていないように見えるかもしれませんが、ご了承ください。私の専門知識は主にJavaScriptにあるわけではないため、コードの整理よりも新機能の追加に重点を置きました。
Webブラウザで利用可能な開発者ツールを使用してHARファイルをダウンロードします。ほとんどのブラウザでは、F12キーを押して開発者ツールを開き、[Network]タブに移動して、Webページを更新した後にHARファイルを保存します: video
提供されたインターフェースを介してHARファイルをアップロードします。アップロードすると、さまざまなAccess Tokenを移動して、スコープなどを含むセッションの詳細を分析できます。赤色で表示されたトークンは期限切れであることを示します。GraphRunnerは、必要に応じてRefresh Tokenを使用して新しい有効なAccess Tokenを生成することもサポートしています: video
完全なユーザーデータをJSONファイルでダウンロードできる機能、アカウントのMFA異常を検出する機能、およびこれらの異常の一覧をダウンロードする機能を追加しました: video