T1098.007

Additional Local or Domain Groups

An adversary may add additional local or domain groups to an adversary-controlled account to maintain persistent access to a system or domain. On Windows, accounts may use the net localgroup and net group commands to add existing users to local and domain groups. Accounts may be added to the local administrators group, Remote Desktop Users group, or VPN user groups. On Linux, adversaries may use usermod to add accounts to the sudoers group. In Windows environments, machine accounts may also be added to domain groups, allowing the local SYSTEM account to gain privileges on the domain.

Microsoft Sentinel / Defender
kusto
let SensitiveGroups = dynamic([
  "Administrators", "Domain Admins", "Enterprise Admins",
  "Schema Admins", "Group Policy Creator Owners",
  "Remote Desktop Users", "Remote Management Users",
  "Network Configuration Operators", "Backup Operators",
  "Account Operators", "Server Operators",
  "DnsAdmins", "DHCP Administrators",
  "Exchange Windows Permissions", "Exchange Trusted Subsystem",
  "sudoers", "wheel", "admin"
]);
let GroupAddEvents = SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID in (4728, 4732, 4746, 4751, 4756, 4761, 4746)
  // 4728 = member added to global security group
  // 4732 = member added to local security group
  // 4746 = member added to distribution group (local)
  // 4751 = member added to universal distribution group
  // 4756 = member added to universal security group
  // 4761 = member added to local distribution group
| extend AddedAccount = tostring(EventData.MemberName)
| extend GroupName = tostring(EventData.GroupName)
| extend SubjectAccount = strcat(tostring(EventData.SubjectDomainName), "\\", tostring(EventData.SubjectUserName))
| extend TargetSid = tostring(EventData.MemberSid)
| project TimeGenerated, EventID, Computer, GroupName, AddedAccount, SubjectAccount, TargetSid, Activity;
let NetCmdGroupAdd = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("net.exe", "net1.exe")
| where ProcessCommandLine has_any ("localgroup", "group")
  and ProcessCommandLine has "/add"
| extend GroupOperation = extract(@"(localgroup|group)\s+[""']?([^""'/\s]+)[""']?", 2, ProcessCommandLine)
| project
    TimeGenerated = Timestamp,
    DeviceName,
    AccountName,
    ProcessCommandLine,
    InitiatingProcessFileName,
    InitiatingProcessCommandLine,
    GroupOperation;
GroupAddEvents
| union (
    NetCmdGroupAdd
    | project TimeGenerated, Computer = DeviceName, GroupName = GroupOperation,
              AddedAccount = "", SubjectAccount = AccountName,
              ProcessCommandLine, InitiatingProcessFileName
)
| where GroupName has_any (SensitiveGroups)
   or isnotempty(GroupName)
| sort by TimeGenerated desc
high severity high confidence

Data Sources

Windows Security Event Log Process: Process Creation Active Directory: Active Directory Object Modification Microsoft Defender for Endpoint

Required Tables

SecurityEvent DeviceProcessEvents

False Positives

  • IT administrators legitimately adding helpdesk or IT staff to Remote Desktop Users for support purposes
  • Automated onboarding scripts that add new employees to standard role-based groups during provisioning
  • Software deployment or patch management services (SCCM, Intune) adding service accounts to local admin groups on managed endpoints
  • Domain controller domain join operations that add machine accounts to specific groups automatically
  • Third-party backup software installers that add their service accounts to Backup Operators group

Unlock Pro Content

Get the full detection package for T1098.007 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections