🦦
Otter's Notes
  • Introduction
  • Articles
    • Dumping data from the Microsoft Recall folder
    • Gaining persistence on Windows with Time Providers
    • Reverse engineering LSASS to decrypt DPAPI keys
    • Intro to Hypervisor Implants
    • In-depth Windows Telemetry
  • Notes
    • Active Directory
      • Active Directory Structure
      • Active Directory Terminology
      • Active Directory Objects
      • Active Directory Groups
      • Active Directory Functionality
      • Active Directory Protocols
      • Active Directory Rights and Privileges
      • Security in Active Directory
      • Users and Machine Accounts
      • NTLM
      • LDAP
      • Making a Target User List
      • Enumerating & Retrieving Password Policies
      • Enumerating Security Controls
      • Examining Group Policy
      • GPOs
      • LAPS
      • LLMNR & NBT-NS Poisoning
      • LOLBIN Enumeration
    • AAD
      • Useful Links
      • Overview of Azure & M365
      • Enumerate Users and Domains
      • Post-exploitation Reconnaissance
      • OAuth 2.0 Abuse
      • Abusing Device Code Authentication
      • Abusing Cloud Administrator Role
      • Abusing User Administrator Role
      • AAD Federated Backdoor
      • Service Principal Abuse
      • Compromising Azure Blobs and Storage Accounts
      • Malicious Device Join
      • Disabling Auditing (Unified Audit Logs)
      • Spoofing Azure Sign-In Logs
      • Registering Fake Agents for Log Spoofing
      • Pass the PRT
      • Pass the Cookie
      • Abusing Managed Identities
      • Virtual Machine Abuse
      • Attacking Key Vaults
    • Forest Trust Abuse
      • Parent-Child Trust Abuse
      • One-Way Inbound Trust Abuse
      • Foreign Group Membership
      • Foreign ACL Principals
      • SID History
      • SID Filter Bypass
      • Intra-Forest Attacks
        • Configuration Naming Context Replication
        • ADCS NC Replication Attack
        • GPO On-Site Attack
        • GoldenGMSA Attack
        • DNS Trust Attack
      • Cross-Forest Attacks
        • Trust Account Attack
        • Abusing SQL Linked Servers
        • Abusing PAM Trusts
    • Kerberos
      • Overview of Kerberos Authentication
      • Silver Tickets
      • Golden Tickets
      • Diamond Tickets
      • Kerberoasting
      • AS-REPRoasting
      • Resource-Based Constrained Delegation
      • Constrained Delegation
      • Unconstrained Delegation
      • S4U2Self & S4U2Proxy
      • Golden Certificates
    • DACL Abuse
      • DACL Overview
      • DACLs Enumeration
      • AddMembers
      • GPO Attacks
      • Granting Rights and Ownership
      • Logon Scripts
      • NoPAC
      • Password Abuse
      • SPN Jacking
      • Shadow Credentials
      • Targeted Kerberoasting
    • ADCS
      • Introduction to ADCS
      • ESC1
      • ESC2
      • ESC3
      • ESC4
      • ESC5
      • ESC6
      • ESC7
      • ESC8
      • ESC9
      • ESC10
      • ESC11
      • Certificate Mapping
    • PowerShell
      • PowerShell Basics
      • PowerShell Remoting
      • Alternate PowerShell Hosts
      • PowerShell Pipeline Runners
      • PowerShell Code Signing
      • Scriptblock Logging
      • PowerShell CLM
      • AMSI
      • PowerShell Reflection
      • WMI - Windows Management Instrumentation
      • Interfacing with AD
      • PowerShell Snippets
        • Bypass application whitelisting and CLM with runscripthelper and WMI
        • Create fake PowerShell logs
        • Enumerate AD ACLs
        • Enumerate WMI events
        • Enumerate Domain Trusts
        • Enumerate change metadata
        • Enumerate non-signed service binaries
        • Enumerate with GPOs
        • Find signed alternate PowerShell hosts
        • Get AMSI module
        • Group processes by user with WMI
        • Hide processes from Get-Process
        • Malware re-purposing with PowerShell reflection
        • Monitor PowerShell hosts with WMI
        • PowerShell reflection offensive use-case
        • Query PowerShell alternative hosts with WMI
        • Retrieve file certificate
        • Search LDAP for misconfigurations
        • Sign custom code with PowerShell
        • WMI service creation
        • Weak folder permission enumeration
    • AWS
      • AWS Organizations
      • AWS Principals
    • Binary Exploitation
      • Environment setup for Browser Exploitation
      • Browser Overview and Components
    • Kernel Development
      • Windows
        • Configuring a VM for driver development
Powered by GitBook
On this page
  • Enumerating subscriptions
  • Enumerating service principals
  • Enumerating Conditional Access Policies
  • Enumerating Users
  • Enumerating Administrators
  • Enumerating Synchronization Server
  1. Notes
  2. AAD

Post-exploitation Reconnaissance

Enumerate

  1. AD tenant information

  2. admin roles and identify high-value targets in the network

  3. ADFS

  4. Resources

  5. Conditional access policies

  6. UAL (Unified Access Log) settings

  7. Service principal accounts (for single-factor logon)

  8. Storage accounts / key vaults

To perform these steps we can mainly use AADInternals and the Azure CLI.

Enumerating subscriptions

Get-AADIntAzureSubscriptions

Enumerating service principals

Get-AADIntAccessTokenForAADGraph -SaveToCache
Get-AADIntServicePrincipals

These commands will return a list of service principals with the following attributes

Account enabled
Addresses
AppPrincipalId
DisplayName
ObjectId
ServicePrincipalNames
TrustedForDelegation

With the AppPrincipalId we can gather even more information about a service principal

Get-AADIntServicePrincipals -ClientIDs <id>

Enumerating Conditional Access Policies

Conditional Access Policies are defined as a series of signals and determine how access is controlled when a user tries to access a resource; the "signals" are the following:

  • User: policies can be applied to users or groups of users

  • IP location: the login method can be modified based on the IP the user logs in from

  • Device: devices of specific platforms can be treated differently upon login

  • Applications: users attempting to access specific applications can trigger further conditional policies

Enumerating Users

To list all users we can use

Get-AADIntUsers | Select UserPrincipalName,ObjecdId,ImmutableId

If we want to know more information about a specific user we can use a more precise query

Get-AADIntUser -UserPrincipalName "someone"

A good thing to note about user enumeration and conditional access policies is that, if there is a policy that restricts access to IP addresses coming from a specific geographical area, it's not hard to get more information about a user and find out where they are based.

Enumerating Administrators

There are several administrators we should take note of in AAD but the most important ones are

  • Global Administrator

  • Cloud Administrator

  • Application Administrator

To easily get a list of admin roles and names for their members we can use

$result = Invoke-AADIntReconAsInsider
$result.roleInformation | Where Members -ne $null | select Name,Members

or for a full list of Global Administrators

Get-AADIntGlobalAdmins

Enumerating Synchronization Server

The Synchronization Server is a high-value target for hybrid environments, especially for credential dumping and lateral movement. To get more information about the servers and the service account related to it (identified by the DirSyncServiceAccount field) we use

Get-AADIntSyncConfiguration
.\azurehound.exe -u "someone@domain.onmicrosoft.com" -p "securepassword" list --tenant "domain.onmicrosoft.com" -o "output.json"
PreviousEnumerate Users and DomainsNextOAuth 2.0 Abuse

Last updated 1 year ago

is a tool that allows to identify login mechanisms that allow to bypass MFA or conditional access policies.

The majority of the described enumeration process can be automated with . Another extremely useful tool is , from the BloodHound family, which produces JSON files that can be imported and queried in the BloodHound client.

A good addition to the stock BloodHound client are the we can add to the ~/.config/bloodhound/customqueries.json file.

MFASweep
o365recon
Azurehound
Azure-related queries