🏁Cheatsheet - Fast Commands (ENUMERATION)

Invisible Shells + Addons

Herramienta
Para qué sirve
Ejemplos de comandos

Invisi-Shell

PowerShell stealth (AMSI + logging bypass)

C:\AD\Tools\InviShell\RunWithRegistryNonAdmin.bat

or

C:\AD\Tools\InviShell\RunWithPathAsAdmin.bat

PowerView

Enumeración ofensiva de Active Directory

. C:\AD\Tools\PowerView.ps1

Example Commands:

powershell Get-DomainUser powershell Get-DomainGroup

powershell Find-InterestingDomainAcl

powershell Get-DomainObjectAcl -Identity administrador -ResolveGUIDs

ADModule

Módulo oficial de Microsoft para administrar AD

Import-Module C:\AD\Tools\ADModulemaster\Microsoft.ActiveDirectory.Management.dll

and

Import-Module C:\AD\Tools\ADModule-master\ActiveDirectory\ActiveDirectory.psd1

Example Commands:

powershell Get-ADUser -Filter * powershell Get-ADGroup -Filter *

Using Invisi-Shell

• With admin privileges: RunWithPathAsAdmin.bat • With non-admin privileges: RunWithRegistryNonAdmin.bat • Type exit from the new PowerShell session to complete the clean-up.

cd \AD\Tools
C:\AD\Tools\InviShell\RunWithRegistryNonAdmin.bat
. C:\AD\Tools\PowerView.ps1

All Enumeration - PowerView

  • Domain Info

  • Users

    • Member Computers

  • Computers

  • Domain Administrators

    • Members of the Domain Admins group

  • Enterprise Administrators

    • Members of the Enterprise Administrators

Commands
Function
Example

Get-Domain

General Info by Domain

Get-DomainUser | select -ExpandProperty samaccountname

List All Current Domain Users

Get-DomainComputer | select -ExpandProperty dnshostname

List Names of Machines: DCs, Servers, PCs, WorkStations, etc...

Get-DomainGroup -Identity "Domain Admins"

List Domain Admins: members, SID, descriptions, DN, etc..

Get-DomainGroupMember

-Identity "Domain Admins"

List Doamin Admins into the forest

Get-DomainGroupMember

List members of the Enterprise Administrators


All Enumeration - ADModule

  • Domain Users

    • List Properties

  • All Computers

  • Enumerate Domain Administrators

  • Enumerate the Enterprise Administrators

Commands
Function
Example

Get-ADUser -Filter *

List all users in the current domain

Get-ADUser -Filter * -Properties *| select Samaccountname,Description

List specific properties: Samaccountname,Description

Get-ADComputer -Filter *

List All Computers

Get-ADGroupMember

-Identity 'Domain Admins'

List Domain Admins: members, SID, descriptions, DN, etc..

Get-ADGroupMember -Identity 'Enterprise Admins' -Server moneycorp.local

List Doamin Admins into the forest


Bloodhound

We need to install the neo4j service. Unzip the archive C:\AD\Tools\neo4j-community-4.1.1-windows.zip

Instalation

Install and start the neo4j service as follows, into:

For it, we need a admin user to continue with the installation

Once the service is started, browse to http://localhost:7474arrow-up-right

Enter the username: neo4j and password: neo4j. You need to enter a new password. Let's use BloodHound as the new password.

Now, open BloodHound from C:\AD\Tools\BloodHound-win32-x64\BloodHound-win32-x64 and provide the following details:

bolt://localhost:7687

Username: neo4j Password: BloodHound

Ingestores

Run BloodHound ingestores to gather data and information about the current domain. Run the following commands to run Collector:

Once all the data is uploaded to BloodHound, search for shortest path to Domain Admins in dollarcorp domain. (press Ctrl to toggle labels).


PowerHuntShares

Run the following commands from a PowerShell session started using Invisi-Shellarrow-up-right:

After this, we need save into a file txt in C:\AD\Tools, all Domain Computer, extract its using:

It generate us a .htlm in the same folder

You need to copy the summary report to your host machine because the report needs interent access, which is not available on the student VM.

Go to ShareGraph -> search dcorp-ci -> Right click on dcorp-ci node -> Click expand. Tt turns out that 'Everyone' has privileges on the 'AI' folder.


ACLs Enumeration - Domain Admins Group

Remember to continúe using the PowerShell session started using Invisi-Shell

Commands
Function
Example

Get-DomainObjectAcl -Identity "Domain Admins" -ResolveGUIDs

List all users in the current domain

Excesive Permissions - On us account

Finally, to check for modify rights/permissions for the studentx, we can use Find-InterestingDomainACL from PowerView:

Member of the RDPUsers group

Note that the output in your lab for the below command will be different and will depend on your lab instance:

Commands
Function
Example

Find-InterestingDomainAcl -ResolveGUIDs | ?{$_.IdentityReferenceName -match "RDPUsers"}

List all users in the current domain with RDP permissions


Analyze the permissions - BloodHound UI (local machine)

DO IT with ADMIN LOCAL PRIVILEGES!

Install Bloodhound - Neo4j

Once the service is started, browse to http://localhost:7474arrow-up-right

Username: neo4j Password: neo4j

After do login, we need change the passwd, set BloodHound or neo4j!

Install/Start BloodHound

Now, open BloodHound from C:\AD\Tools\BloodHound-win32-x64\BloodHound-win32-x64 and provide the following details:

Set the same user and password that before

BloofHound Ingestor

Once we have do all of this, execute the ingestor and upload it -->

It save into C:\AD\Tools\neo4j-community-4.4.5-windows\neo4j-community-4.4.5\bin

IMPORT!: Upload all zip file, not stract it


Enumerate OUs

Commands
Function
Example

Get-DomainOU

Enumerate folders and his complete info of AD

Get-DomainOU | select

-ExpandProperty name

Enumerate only the names of the folder of AD

(Get-DomainOU -Identity DevOps).distinguishedname | %{Get-DomainComputer -SearchBase $_} | select name

List all the computers in the DevOps OU


Enumerate GPOs

Commands
Function
Example

Get-DomainGPO

List info GPOs of AD

(Get-DomainOU

-Identity DevOps).gplink

Get GUID of specific police

Get-DomainGPO

-Identity '{GUID}'

List all datails of specific GPO


Enumerate ACLs of GPOs

To enumerate the ACLs for the Applocked and DevOps GPO, let's use the BloodHound CE UI.

Search for Applocker in the UI -> Click on the node -> Click on Inboud Object Control

It turns out that the RDPUsers group has GenericAll over the policy.

Similary, search for DevOps and look at its 'Inbound Object Control':

A user named 'devopsadmin' has 'WriteDACL' on DevOps Policy.


Enumerate all domains in the current Forest

Note: Remenber use a silent powershell


Enumerate all Trust of "dollarcorp" Domain

Note: Remenber use a silent powershell

List external trusts & Extact Infromation

Commands
Function
Example

Get-ForestDomain

| %{Get-DomainTrust

-Domain $_.Name} | ?{$_.TrustAttributes -eq

"FILTER_SIDS"}

List only the external trusts in the "moneycorp.local" forest

Get-DomainTrust | ?{$_.TrustAttributes -eq "FILTER_SIDS"}

Enumerate external trusts of the "dollarcorp" domain

Since the above is a Bi-Directional trust, we can extract information from the eurocorp.local forest.

We either need bi-directional trust or one-way trust from eurocorp.local to dollarcorp to be able to use the below command

Get-ForestDomain -Forest eurocorp.local | %{Get-DomainTrust -Domain $_.Name}

Extract information from the eurocorp.local forest

Notice the error above. It occurred because PowerView attempted to list trusts even for eu.eurocorp.local. Because external trust is non-transitive it was not possible!


Using AD Module in a PowerShell - Invisi-Shell

Import the AD Module in a PowerShell session started using Invisi-Shell:

Commands
Function
Example

(Get-ADForest).Domains

Enumerate all the domains

Get-ADTrust -Filter *

Enumerate all the Trusts in the current domain

Get-ADForest | %{Get-ADTrust

-Filter *}

Enumerate all the trusts in the moneycorp.local forest

(Get-ADForest).Domains | %{Get-ADTrust -Filter '(intraForest -ne $True) -and (ForestTransitive -ne $True)' -Server $_}

Enumerate external trusts in moneycorp.local domain


Enumeate File shares with Write permissions

Invisi-Shell & PowerHuntShares exec

Remenber use C:\AD\Tools\InviShell\RunWithRegistryNonAdmin.bat

After this, we need save into a file txt in C:\AD\Tools, all Domain Computer, extract its using:

You need to copy the summary report to your host machine because the report needs interent access, which is not available on the student VM.

Connect via RDP to download it, for example

Last updated