Skip to main content

Summary

Enumerates members of a specified local group using NetLocalGroupGetMembers Win32 API. Retrieves member names, SIDs, and distinguishes between user and group members.
  • Needs Admin: False
  • Version: 2
  • Author: @djhohnstein

Arguments

  • computer (Optional String) - Target computer name (defaults to localhost)
  • group (String) - Local group name to enumerate members

Usage

Raw Output:
Formatted Output: net_localgroup_member command

Detailed Summary

Agent Execution Flow

1. API Function Resolution

  • Resolves NetLocalGroupGetMembers from SAMCLI library
  • Resolves ConvertSidToStringSid from ADVAPI32 library
  • Resolves NetApiBufferFree from NETUTILS library

2. Parameter Processing

  • Deserializes computer and group parameters
  • Defaults to local computer name if not specified

3. Group Member Enumeration

  • Calls NetLocalGroupGetMembers with level 2 for detailed member information
  • Uses preferred maximum length (-1) for optimal buffer allocation
  • Returns buffer containing member structures and counts

4. Member Structure Processing

  • Creates array to hold member structures
  • Iterates through buffer using pointer arithmetic
  • Marshals each structure from unmanaged memory

5. SID Conversion and Member Processing

  • Converts binary SID to string representation
  • Determines if member is a group or user based on SidNameUse
  • Extracts domain and name from Unicode string pointer
  • Skips members where SID conversion fails

6. Memory Management

  • Frees allocated buffer using NetApiBufferFree
  • Prevents memory leaks from unmanaged allocations

Data Structures

LocalGroupMembersInfo (Unmanaged)

NetLocalGroupMember (Managed)

SidNameUse Enumeration

Win32 API Integration

NetLocalGroupGetMembers Function

  • servername: Target computer name
  • localgroupname: Local group to enumerate
  • level: Information level (2 for detailed member info)
  • bufptr: Receives buffer pointer
  • prefmaxlen: Preferred maximum buffer length
  • entriesread: Number of entries returned
  • totalentries: Total entries available
  • resume_handle: Continuation handle

Browser Interface Integration

The JavaScript processes the JSON response into an interactive table with:
  • Group Type Column: Distinguishes between “User” and “Group” members
  • Copy Icons: Allows copying member names and SIDs
  • Dynamic Title: Shows group name in table title
  • Member Details: Computer, group, member name, SID, and type

APIs Used

MITRE ATT&CK Mapping

  • T1590 - Gather Victim Network Information
  • T1069 - Permission Groups Discovery
    • T1069.001 - Local Groups

Security Considerations

  • Privilege Enumeration: Reveals members of privileged groups
  • User Discovery: Exposes user accounts with local privileges
  • Attack Planning: Enables targeting of specific privileged users
  • Detection Vectors: Group membership enumeration may be monitored

Limitations

  1. Requires access to target computer for remote enumeration
  2. May need administrative privileges for some groups/systems
  3. Only shows local group membership (not domain groups)
  4. SID conversion failures skip affected members
  5. Subject to Windows security policies and access controls

Error Conditions

  • Access Denied: Insufficient privileges to enumerate group
  • Group Not Found: Specified group doesn’t exist
  • Network Path Not Found: Target computer unreachable
  • Invalid Parameter: Malformed group or computer name
  • SID Conversion Failure: Unable to convert binary SID to string