ActiveDirectory replication metadata
Windows DFIR notes are no longer maintained on InfoSec-Notes. Updated versions can be found on: artefacts.help. This note is however not presently integrated to artefacts.help
.
Overview
The Active Directory replication metadata hold information about change made on an Active Directory object. Every object within Active Directory stores replication metadata, in their msDS-ReplAttributeMetaData
and msDS-ReplValueMetaData
attributes.
The replication metadata is used by the Domain Controllers to replicate modifications and, as so, only attributes that are replicated will be logged in the replication metadata. As stated in the Microsoft documentation: "every attribute in [the Active Directory] Schema
has a flag called FLAG_ATTR_NOT_REPLICATED
. If this flag value is True (1)
, that attribute is not included in AD Replication. If the attribute value is False (0)
, then that attribute is replicated". Upon creation of an object, all replicated attributes that are automatically populated will be logged in the replication metadata.
The msDS-ReplAttributeMetaData
attribute stores replication metadata for regular replicated attributes, while the msDS-ReplValueMetaData
attribute stores replication metadata for linked attributes
.
The replication metadata is stored in the msDS-ReplAttributeMetaData
attribute as a XML with the following notable fields:
pszAttributeName
: the name of the attribute replicated.dwVersion
: a replication counter, incremented upon each modification of the associated attribute.ftimeLastOriginatingChange
: last change timestamp.pszLastOriginatingDsaDN
: Domain Controller from which originated the last change. More precisely, the distinguished name of theNTDS Settings
(typeDomain Controller Settings
) of the Domain Controller.uuidLastOriginatingDsaInvocationID
:invocationId
of the Domain Controller (stored in the Domain Controller 'sNTDS Settings
).
As stated, the msDS-ReplValueMetaData
attribute hold replication metadata for the linked attributes
, which were introduced in Windows Server 2003 functional level to reduce replication data. Linked attributes
are pairs of two attributes, with the values of one attribute, denominated the back link
, being based on the values set on the other attribute, denominated the forward link
. Only the forward link
attributes are replicated, which allow to reduce replication metadata.
For instance, the groups's member
attribute is the forward link for the user and computer accounts' memberOf
attribute. The member
attribute of group objects holds, in addition to the fields introduced above, information on when the principal was added (ftimeCreated
field) or deleted (ftimeDeleted
field) from the group.
Replication metadata enumeration and timelining
The attributes that are / are not replicated can be listed using the following PowerShell queries (that make use of the Remote Server Administration Tools (RSAT)
's PowerShell ActiveDirectory
module):
The repadmin
utility and the Get-ADReplicationAttributeMetadata
PowerShell cmdlet (introduced in Windows Server 2012
) can be used to enumerate the replication metadata of a specified object:
The ADTimeline PowerShell script can be used to automate the enumeration of the replication metadata and consolidates the modifications in a timeline. Only the objects "considered of interest" are listed (more details on the project GitHub repository).
In order to access the objects in the tombstone, the account used to execute the script must be able to read the object placed the Deleted Objects Container
. It is thus advised to execute the script with Domain Admins
privileges. Otherwise, only the replication metadata of existing objects will be enumerated.
Replication metadata of interest
The following replicated attribute (in a default configuration) could be of interest for digital forensics and incident response purposes.
Attribute | Object(s) | Description |
---|---|---|
| User accounts or groups. | If |
| Security principals. | Refer to |
| Groups. | Information on when a given principal was added or removed from the group.
While the list of present principals is exhaustive, the replication metadata of removed principal will only persist for the |
| User or computer accounts. | Setting or modification of Kerberos |
| Any securable objects:
user or computer accounts, groups, | Modification of the security descriptor of a securable object, linked to a potential change of ownership or |
| User or computer accounts. | Modification of an account |
| User accounts. | Modification of an user's logon script. |
| User or computer accounts. | Setting or modification of an user or computer account's |
| Security principals. | Setting or modification of a security principal |
| User or computer accounts. | Setting or modification of an user or computer account's |
... | ... | ... |
lastLogon v. lastLogonTimestamp
Every account in Active Directory, be it an user or computer account, has both a lastLogon
and a lastLogonTimestamp
attributes.
The lastLogon
attribute of an account is immediately updated upon a successful authentication of the account. The lastLogon
attribute is however (by default) not replicated, and is thus only updated on the Domain Controller that provided the authentication.
On the other hand, the lastLogonTimestamp
attribute of an account is replicated by default but will only be updated if the difference between the previous value and new value is greater than the default naming context's ms-DS-Logon-Time-Sync-Interval
attribute. By default the value for this attribute is not set, and takes default to 14 days.
Knowing precisely when the account last connected thus requires to enumerate the account's lastLogon
attribute on all the Domain Controllers of the forest.
Both the lastLogon
and a lastLogonTimestamp
attributes are stored as UNIX time
: 32-bit value containing the number of seconds elapsed since 1/1/1970. Both attributes store time values in Greenwich Mean Time (GMT)
. Refer to the [DFIR] Windows - Timestamps
note for information on how to convert these timestamps to an human readable format.
References
https://social.technet.microsoft.com/wiki/contents/articles/22461.understanding-the-ad-account-attributes-lastlogon-lastlogontimestamp-and-lastlogondate.aspx
Last updated