Some of the attacks you launch will involve stealing login credentials and using them on other workstations or servers. Your attempts may be unsuccessful because the login credentials could have changed. Youâll need to be particularly vigilant about the companyâs password policy. In fact, if you enter the wrong password, the account could be locked.
The password policy for an Active Directory environment allows for several actions to be taken:
Lock (temporarily or not) an account after a certain number of failed login attempts.
Require a minimum length and complexity for passwords.
Set the password expiration time.
Identifying the password policy will allow you to fly under the radar by avoiding locking accounts inadvertently. When I first started, I used to rely on a tool to retrieve user passwords in a company, but the tool didnât take the password policy into consideration. As a result, I ended up locking dozens of accounts, which stopped several employees from working. Fortunately, I was able to provide the client with a script to instantly unlock those accounts. Sure, mistakes are a learning opportunity, but it would be better to avoid traumatic situations like this!
To retrieve the default password policy, you can run the  Get-ADDefaultDomainPasswordPolicy utility in a PowerShell console.
PS C:\> Get-ADDefaultDomainPasswordPolicy
ComplexityEnabled      : True
DistinguishedName      : DC=medic,DC=ex
LockoutDuration       : 00:10:00
LockoutObservationWindow  : 00:30:00
LockoutThreshold      : 3
MaxPasswordAge       : 90.00:00:00
MinPasswordAge       : 1.00:00:00
MinPasswordLength      : 7
objectClass         : {domainDNS}
objectGuid         : dae14cb7-a84e-4d1d-8490-27399d6fbad5
PasswordHistoryCount    : 24
ReversibleEncryptionEnabled : FalseThis password policy requires a password to have at least seven characters ( Â
MinPasswordLength ) and enforces a minimum complexity with the ÂComplexityEnabled parameter. Within a 30-minute period ( ÂLockoutObservationWindow ), the account will be locked after three failed login attempts ( ÂLockoutThreshold ). It will be automatically unlocked after 10 minutes ( ÂLockoutDuration ). Finally, the password must be changed at least every 90 days ( ÂMaxPasswordAge ).
Itâs important to keep these parameters in mind when attempting to log in with stolen accounts!
For the final step in the reconnaissance phase, you must map the Active Directory environment itself. It groups together a large number of objects (users, computers, groups, containers, GPOs, etc.), and each of them can have specific permissions over the others.
By default, all domain users can read all the information in Active Directory. With an unprivileged account, you can list all domain users, the groups they belong to, the permissions of these users and groups, the attributes of all these entities, and much more. Due to this complexity, there is a lot of potentially sensitive data that is accessible to everyone- and which can be used as hidden attack paths.
Every object has attributes, some of which may be used by administrators who believe they are the only ones to have access to them.
The first important piece of information for you is the object names. Servers are often explicitly named to make it easier for administrators to identify them. Youâll often see names like âSQLSRV,â âFILER01,â or âINTRANET.â With this information, youâll more easily be able to identify key servers and machines to target.
In addition, several attributes may be filled in and may contain sensitive information. This is especially common with the âdescriptionâ and âcommentâ attributes, which can contain more detailed information about certain elements, including temporary or non-temporary passwords.
During pentesting, I frequently find a service account password in the objectâs âdescriptionâ field. When I send the following command from a PowerShell console, it provides me with a quick overview of users and computers with a non-empty description field:
PS C:\> Get-ADObject -LDAPFilter "(|(ObjectClass=user)(ObjectClass=computer))" -SearchBase "DC=MEDIC,DC=EX" -Property * |Â where description -ne $null | Select Name, Description, ObjectClass
Name      Description                     ObjectClass
---- Â Â Â Â Â ----------- Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â -----------
Administrator Administrator user account         user
Guest     Guest user account             user
krbtgt     Service account for the Key Distribution Center user
Lucie Poirier Temporary password: Welcome123         userThe ldapdomaindump tool on Linux also allows you to collect information on the Active Directory, including the list of users and their description in the domain_users.html file.
ldapdomaindump -u âmedic.ex\pixisâ -p P4ssw0rd dc01.medic.exIn an Active Directory environment, there are built-in groups that have elevated privileges. All members of these groups will inherit these privileges. Therefore, it is important to familiarize yourself with these groups so you can identify which users to target in your attacks. The three main groups are the following:
Enterprise Administrators: This is the highest level administration group. In a forest with several domains, it will automatically be added to each domainâs administration group.
Domain Admins: This group exists in each domain and is the local administrator of all the domainâs workstations.
Administrators: This group also exists in each domain. It has elevated privileges over all domain operations, including the domain controllers.
There are other privileged groups as described in Microsoftâs documentation, which I recommend you read for more information.
Are there a lot of privileged groups? Itâs a lot of information to remember, and you mentioned various kinds of objects and specific permissions. How do I know who has permissions to do what? How do I progress with my attack?
To answer these questions, Iâm going to tell you about a tool that has helped to improve security in Active Directory environments. Itâs called BloodHound.

BloodHound is a tool that lets you map an Active Directory environment by displaying it as a graph. This map uses the power of graph theory to reveal attack paths that would otherwise have been difficult, if not impossible, for you to detect.
The purpose of this tool is to analyze an Active Directory environment by enumerating the various objects in the environment (users, computers, groups, etc.) and linking them together with relationships. For example, if a user pdevaux is a member of the helpdesk group, this user will be linked to the group by the MemberOf relationship.

This provides a clear visualization of group membership, but thereâs a lot more that the tool can do. You can also see that the helpdesk group is part of the RDPUsers group, so the pdevaux account is also part of this group through inheritance.

And thatâs not all! If you ask for a list of all the groups that pdevaux belongs to, youâll find that they belong to many others!

There are, of course, many other relationships between objects, including relationships showing that one object is the administrator of another, one object has permission to use RDP, or the fact that a user is logged on to a machine.
I suggest you take a closer look at this tool in the video:
To collect Active Directory information, you need to use SharpHound from an authenticated session. If youâre on a domain machine, you can run the tool without any additional parameters. However, if youâre on your attack machine, youâll first need to assign yourself as a domain user using the  RunAs utility.
runas /netonly /user:medic.ex\pixis cmd.exeOnce youâve opened the console as the user, you can use SharpHound.
.\SharpHound.exeWhen the tool has finished collecting information, it generates a ZIP file that can be imported into BloodHound.
Many other tools can be used to make a first pass on an Active Directory environment in order to identify the elements weâve already covered, and some of them can do much more. PingCastle is a tool created by a French-based developer, that generates comprehensive reports on the condition of your Active Directory environment.Â
Discovering the Active Directory allows you to prepare your attack plan. Several approaches can be considered:
Learning about the companyâs password policy in order to target your attacks to discover passwords
Extracting privileged accounts from all objects to better prepare your attack targets
Identifying potential attack paths
Congratulations, youâve now completed this part on the enumeration phase! Using the information youâve gathered so far, you have all the tools you need to carry out the attacks that youâll learn about in the second part. These attacks will allow you to take control of machines and users, elevate your privileges, move laterally across the network, and retain access once these elements have been compromised. Thatâs quite a lot, isnât it? Letâs go!