Skip to content

Instantly share code, notes, and snippets.

@0xffhh
Created October 6, 2020 08:01
Show Gist options
  • Save 0xffhh/e3d2a607a2eb6140c171b0403b479aec to your computer and use it in GitHub Desktop.
Save 0xffhh/e3d2a607a2eb6140c171b0403b479aec to your computer and use it in GitHub Desktop.
let allLAPSAdminHashes = DeviceProcessEvents
| where FileName =~ "admpwd.ui.exe"
| summarize by SHA1
| invoke FileProfile(SHA1, 100)
| where IsRootSignerMicrosoft and IsCertificateValid
| project SHA1;
DeviceEvents
| where ActionType == "LdapSearch"
| where AdditionalFields has "ms-MCS-AdmPwd"
| where InitiatingProcessSHA1 !in (allLAPSAdminHashes)
| extend LDAP = parse_json(AdditionalFields)
| extend AttributeList = LDAP.AttributeList
| extend ScopeOfSearch = LDAP.ScopeOfSearch
| extend SearchFilter = LDAP.SearchFilter
| extend DistinguishName = LDAP.DistinguishedName
//| project Timestamp, DeviceName, InitiatingProcessAccountName, InitiatingProcessFileName, AttributeList, ScopeOfSearch, SearchFilter, DistinguishName, DeviceId, ReportId
| sort by Timestamp desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment