Windows API reference
gethostbyname
Legacy resolver that returns host information for a name.
- Library
- Ws2_32.dll
- Category
- Network / Sockets
- Suspicion
- high
- MITRE ATT&CK
- T1071.004 Application Layer Protocol: DNS
Detection summary
gethostbyname maps to Sysmon Event 22 and Microsoft-Windows-DNS-Client; these events record the OS effect, not the API call.
- Sysmon: Sysmon Event 22
- ETW: Microsoft-Windows-DNS-Client
- Notes: Sysmon Event 22 records the DNS query and returned addresses; cached or hosts-file resolution may not generate it. Microsoft-Windows-DNS-Client records the query; Sysmon Event 22 is the usual consumer.
Sources and documentation
- Microsoft Learn documentation (direct documentation)
Not yet human-reviewed. Page metadata generated .
Legitimate use
Browsers, games, IM clients, IT tooling and updaters.
Related APIs
- getaddrinfo — Ws2_32.dll
- gethostbyaddr — Ws2_32.dll