Detection of System User Discovery via query.exe
Adversaries utilize the Windows utility 'query.exe' to perform system and Active Directory user discovery for situational awareness, facilitating further lateral movement and privilege escalation.
The Windows binary query.exe is frequently leveraged by threat actors to perform system user discovery, a critical stage in the reconnaissance phase of an attack. By executing this utility, adversaries can enumerate currently logged-in users, mapping the environment to identify high-value targets or accounts with elevated privileges. This technique is often associated with Active Directory discovery efforts and has been documented in various campaigns, including activities related to Medusa Ransomware. While query.exe is a standard Windows component, its usage in command-line configurations targeting user information - specifically when not directed at local server contexts - serves as a high-fidelity signal for unauthorized reconnaissance. Defenders should focus on capturing full command-line arguments to distinguish between legitimate administrative troubleshooting and adversary-led discovery operations.
Impact
Successful execution of this discovery technique allows attackers to gain critical situational awareness of the compromised endpoint and the broader network environment. By identifying active users, adversaries can optimize lateral movement paths and identify accounts with the appropriate permissions to escalate privileges or deploy ransomware, ultimately increasing the speed and efficacy of a security incident.
Recommendation
- Deploy the provided Sigma rule to monitor for
query.exeexecutions that include user enumeration parameters. - Establish a baseline for administrative use of
query.exewithin your environment to tune out false positives originating from authorized IT management activities. - Ensure EDR agents are configured to log full command-line strings and parent process information, as this metadata is essential for validating the intent behind
query.exeexecution.
Immediate actions
Deploy Sigma detection rule to SIEM/EDR platform.
Threat Hunt
Search historical EDR logs for execution of query.exe in the past 30 days.
Data: Process creation events
Detection coverage 1
Detect System User Discovery via query.exe
mediumDetects the use of query.exe with command-line arguments intended to enumerate logged-in users, excluding standard local-only server queries.
Detection queries are available on the platform. Get full rules →