This month will have a serious security focus in scanning your AD to determine all kinds of account configurations, see relations between those configurations and mitigate any security risks due to combined configurations. A simple example can be an account with unconstrained delegation configured while it has a weak/compromised password, etc, etc.
To scan the accounts within an Active Directory forest, I will be releasing 5 PowerShell scripts.
–
[Script 1] .\Scan-And-Check-All-Accounts-In-AD-Forest_01_Basic-Info.ps1
Features:
With the PoSH script made available through this blog post you can scan and check ALL accounts in the AD forest to get “basic” account information that is related to security.
Through LDAP queries, this PoSH script retrieves the following information for every account in the AD forest that is able to authenticate:
- Domain FQDN (e.g. ‘IAMTEC.NET’)
- Domain NBT (e.g. ‘IAMTEC’)
- Domain DN (e.g. ‘DC=IAMTEC,DC=NET’)
- Sam Account Name (e.g. ‘jorge’)
- Account Name (e.g. ‘IAMTEC\jorge’)
- Account Type (computer, inetOrgPerson, msDS-GroupManagedServiceAccount, trust (user), user)
- User Principal Name (e.g. ‘jorge@iamtec.nl’)
- Display Name (e.g. Jorge de Almeida Pinto)
- Enabled (e.g. TRUE or FALSE)
- Locked (e.g. TRUE – At:<date/time> or FALSE – Never Locked or FALSE – Has Been Locked Before)
- Account Expires On (e.g. <date/time> or NEVER)
- Pwd Last Set On (e.g. <date/time> or "Must Chng At Next Logon")
- Pwd Never Expires (e.g. TRUE or FALSE)
- Last Logon Timestamp (e.g. <date/time> or NEVER)
- Last Logon (RWDC) (e.g. <date/time> or NEVER Or NOT AVAILABLE (On ‘<FQDN RWDC>’))
–
[Script 2] .\Scan-And-Check-All-Accounts-In-AD-Forest_02_Delegation-Info.ps1
Features:
With the PoSH script made available through this blog post you can scan and check ALL accounts in the AD forest to get “Kerberos Delegation” related account information.
Through LDAP queries, this PoSH script retrieves the following information for every account in the AD forest that is able to authenticate:
- Domain FQDN (e.g. ‘IAMTEC.NET’)
- Domain NBT (e.g. ‘IAMTEC’)
- Domain DN (e.g. ‘DC=IAMTEC,DC=NET’)
- Sam Account Name (e.g. ‘jorge’)
- Account Name (e.g. ‘IAMTEC\jorge’)
- Account Type (computer, inetOrgPerson, msDS-GroupManagedServiceAccount, trust (user), user)
- Service Principal Name(s) (e.g. <comma separated list of SPNs> or "No SPNs")
- Acc Based Deleg Type (e.g. "No-Acc-Deleg" or "Acc-Unc-Deleg" or "Acc-Con-Deleg-AnyAuthN" or "Acc-Con-Deleg-KerbAuthN"
- Acc Based Deleg To (e.g. <comma separated list of SPNs> or "No Delegated SPNs")
- Res Based Deleg For (e.g. <comma separated list of user account names with type and domain listed> or "No-Res-Deleg"
–
[Script 3] .\Scan-And-Check-All-Accounts-In-AD-Forest_03_NC-Level-Permissions-Info.ps1
Features:
With the PoSH script made available through this blog post you can scan and check ALL accounts in the AD forest to get “Permissions At NC Level” related account information.
Through LDAP queries, this PoSH script retrieves the following information for every account in the AD forest that is able to authenticate:
- Domain FQDN (e.g. ‘IAMTEC.NET’)
- Domain NBT (e.g. ‘IAMTEC’)
- Domain DN (e.g. ‘DC=IAMTEC,DC=NET’)
- Sam Account Name (e.g. ‘jorge’)
- Account Name (e.g. ‘IAMTEC\jorge’)
- Account Type (computer, inetOrgPerson, msDS-GroupManagedServiceAccount, trust (user), user)
- DS Repl Chng Perms (e.g. "<comma separated list of domain DNs> (<Assigned Security Principal>)" or "No Perms")
- DS Repl Chng All Perms (e.g. "<comma separated list of domain DNs> (<Assigned Security Principal>)" or "No Perms")
- Migr SID History Perms (e.g. "<comma separated list of domain DNs> (<Assigned Security Principal>)" or "No Perms")
–
[Script 4] .\Scan-And-Check-All-Accounts-In-AD-Forest_04_Object-Level-Permissions-Info.ps1
Features:
With the PoSH script made available through this blog post you can scan and check ALL accounts in the AD forest to get “Permissions At Object Level” related account information.
Through LDAP queries, this PoSH script retrieves the following information for every account in the AD forest that is able to authenticate:
- Domain FQDN (e.g. ‘IAMTEC.NET’)
- Domain NBT (e.g. ‘IAMTEC’)
- Domain DN (e.g. ‘DC=IAMTEC,DC=NET’)
- Sam Account Name (e.g. ‘jorge’)
- Account Name (e.g. ‘IAMTEC\jorge’)
- Account Type (computer, inetOrgPerson, msDS-GroupManagedServiceAccount, trust (user), user)
- Protected Group Membership (e.g. <comma separated list of group account names> or "No Memberships")
REMARK: With protected groups, the focus is ONLY on default AD Protected Groups (e.g. BUILTIN\Administrators", "<DOMAIN>\Domain Admins", etc.)
REMARK: if protected groups are listed then any ACEs for those protected groups are NOT listed to prevent an overload of ACEs
- ACE On AdminSDHolder (e.g. <comma separated list of objects with configured permissions> or "No ACEs")
REMARK: If protected groups are listed then any ACEs for those protected groups are NOT listed to prevent an overload of ACEs
REMARK: It will only look at explicit defined ACEs. Inherited ACEs are NOT listed to prevent an overload of ACEs
- Powerful ACEs On Objects (e.g. <comma separated list of objects with configured permissions> or "No ACEs")
REMARK: If protected groups are listed then any ACEs for those protected groups are NOT listed to prevent an overload of ACEs
REMARK: It will only look at explicit defined ACEs. Inherited ACEs are NOT listed to prevent an overload of ACEs
–
[Script 5] \Scan-And-Check-All-Accounts-In-AD-Forest_05_Account-And-Password-Hygiene-Info.ps1
Features:
With the PoSH script made available through this blog post you can scan and check ALL accounts in the AD forest to get “Account And Password Hygiene” related information.
Through LDAP queries, this PoSH script retrieves the following information for every account in the AD forest that is able to authenticate:
- Domain FQDN (e.g. ‘IAMTEC.NET’)
- Domain NBT (e.g. ‘IAMTEC’)
- Domain DN (e.g. ‘DC=IAMTEC,DC=NET’)
- Sam Account Name (e.g. ‘jorge’)
- Account Name (e.g. ‘IAMTEC\jorge’)
- Account Type (computer, inetOrgPerson, msDS-GroupManagedServiceAccount, trust (user), user)
- Enabled (e.g. TRUE or FALSE)
- Pwd Last Set On (e.g. <date/time> or "Must Chng At Next Logon")
- Has Adm Count Stamp (e.g. TRUE or FALSE)
- Delegatable Adm (e.g. TRUE or FALSE)
- Does Not Req Pre-AuthN (e.g. TRUE or FALSE)
- Has Sid History (e.g. TRUE or FALSE)
- Has LM Hash (e.g. TRUE or FALSE)
- Has Default Pwd (e.g. TRUE or FALSE)
- Has Blank Pwd (e.g. TRUE or FALSE)
- Uses DES Keys Only (e.g. TRUE or FALSE)
- Has Missing AES Keys (e.g. TRUE or FALSE)
- Pwd Rev Encrypt (e.g. TRUE or FALSE)
- Pwd Not Req (e.g. TRUE or FALSE)
- Pwd Never Expires (e.g. TRUE or FALSE)
- Has Shared Pwd (e.g. TRUE – Domain Shrd Pwd Grp x Of y or FALSE)
- Compromised Pwd (e.g. TRUE or FALSE)
- Most Used Hash (e.g. <hash> (<count>) or N.A.)
–
Interested in this? Stay tuned!
Thanks!
–
Cheers,
Jorge
————————————————————————————————————————————————————-
This posting is provided "AS IS" with no warranties and confers no rights!
Always evaluate/test everything yourself first before using/implementing this in production!
This is today’s opinion/technology, it might be different tomorrow and will definitely be different in 10 years!
DISCLAIMER: https://jorgequestforknowledge.wordpress.com/disclaimer/
————————————————————————————————————————————————————-
########################### Jorge’s Quest For Knowledge ##########################
#################### http://JorgeQuestForKnowledge.wordpress.com/ ###################
————————————————————————————————————————————————————-
Like this:
Like Loading...