
Controllo password di Azure AD
In un ambiente Azure AD, è possibile determinare se un utente ha la Multi-Factor Authentication (MFA) disabilitata senza richiedere privilegi speciali. Questo può essere ottenuto analizzando la data di creazione dell'account e la data dell'ultima modifica della password.
Se la data e l'ora di creazione di un account corrispondono alla data e all'ora dell'ultima modifica della password, potrebbe indicare che non c'è stata alcuna interazione umana da quando l'account è stato creato e che l'utente non è stato in grado di abilitare la Multi-Factor Authentication (MFA) o di cambiare la propria password. E ci sono altre 'anomalie', come la data di modifica della password più vecchia della data di creazione. Questo suggerisce anche che la Multi-Factor Authentication (MFA) non ha potuto essere abilitata perché l'utente non era ancora stato creato!
Aggiornamento del 16-10-2023:
Aggiornamento del 18-02-2024:
Queste informazioni possono essere utili per identificare potenziali rischi per la sicurezza, pensate per l'uso sia da parte dei red team che dei blue team.
Il file del database roadrecon o il file JSON estratto con l'aiuto dell'opzione --code-javascript è necessario per questo strumento.
Il tool Roadrecon è sviluppato da dirkjanm e può essere scaricato su github https://github.com/dirkjanm/ROADtools oppure pip install roadrecon.
Come usarlo, vedere:
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 o il file js nella cartella:Segui questi passaggi per recuperare un elenco di utenti insieme alle informazioni sull'account utilizzando lo script fornito.
Accedi al portale Azure
Gestione utenti
Apri gli strumenti di sviluppo
F12 nel tuo browser web per aprire gli strumenti di sviluppo.Esegui lo script
Recupera UsersList e UserInfo
Scarica le informazioni utente unificate
merged_users.json.Esegui con Azure AD Password Checker
azurepwchecker.py --json-input merged_users.jsonVedi esempio:
Vedi intro:
Aggiornamento 16-10-2023:

Come usare l'argomento --code-javascript per generare un elenco di utenti nel portale Azure, che può poi essere importato utilizzando il comando azurepwchecker.py --json-input merged_users.json:
Aggiornamento 13-02-2024:
Ho caricato una versione modificata di GraphRunner da @dafthack e i crediti vanno a lui. In questa versione modificata, ho aggiunto una nuova funzionalità che consente di leggere i file HAR direttamente dal dispositivo della "vittima". Questa nuova funzione aiuta a controllare ed esaminare gli Access Token per accedere a diversi permessi o ambiti. Inoltre, se un Access Token è scaduto, questa versione consente l'uso di un Refresh Token per creare un nuovo Access Token. Questo processo è sensibile al tempo, ma elimina la necessità di nomi utente e password, se hai già effettuato l'accesso all'ambiente Office365, poiché richiede solo i token di sessione trovati nei file HAR.
Tieni presente che il codice potrebbe sembrare un po' disorganizzato. La mia competenza non è principalmente in JavaScript, quindi la mia attenzione principale è stata rivolta all'aggiunta di nuove funzionalità piuttosto che all'organizzazione del codice.
Scarica i file HAR. Puoi utilizzare gli strumenti di sviluppo disponibili nei browser web. Per la maggior parte dei browser, premi semplicemente F12 per aprire gli strumenti di sviluppo, poi vai alla scheda 'Rete' per salvare i file HAR, dopo aver aggiornato la pagina web: video
Carica i tuoi file HAR tramite l'interfaccia fornita. Una volta caricati, puoi navigare tra i vari Access Token per analizzare i dettagli della sessione, inclusi i relativi ambiti e altro. I token visualizzati in rosso indicano che sono scaduti. GraphRunner supporta anche l'uso dei Refresh Token per generare nuovi Access Token validi quando necessario: video
Funzionalità aggiunte per consentire il download dei dati utente completi in un file JSON, rilevare le anomalie MFA negli account e scaricare un elenco di queste anomalie: video