Detection Playbook: Identify Roles (T1591.004)

T1591.004 · 2026-11-24

Identify Roles

Reconnaissance
PRE
MITRE ATT&CK →
Technique Identify Roles (T1591.004)
Tactic Reconnaissance
Platforms PRE

Overview

T1591.004 (Identify Roles) is a pre-compromise reconnaissance technique where adversaries map out organizational hierarchies, job titles, and business functions to identify high-value targets. By understanding who holds privileged access, who approves financial transactions, or who manages IT infrastructure, attackers can precisely tailor phishing lures, pretexting calls, and social engineering campaigns rather than relying on spray-and-pray approaches.

Because this technique occurs almost entirely outside your perimeter — against public websites, LinkedIn, job boards, and data broker sources — it generates no direct endpoint or network telemetry in most environments. Every security team still needs visibility into the downstream signals it triggers: inbound phishing attempts targeting named executives, suspicious OSINT-style queries against your public web presence, and anomalous access patterns on identity platforms that may indicate an attacker validating harvested role data.

Attacker Perspective

Attackers use role identification to collapse a large, anonymous organization into a short list of named, targeted individuals whose access level justifies the effort of a sophisticated attack.

  • LinkedIn scraping via automation: Tools like linkedin2username or ScrapedIn are used to enumerate employee names, titles, and departments at scale, often producing formatted username lists (firstname.lastname) for password spraying or spear-phishing campaigns.
  • Corporate website harvesting: Tools like theHarvester or recon-ng with modules such as recon/companies-contacts/bing_linkedin_cache scrape "About Us," "Leadership," and "Contact" pages to extract names, roles, and email formats.
  • Phishing for information (T1598): Adversaries send pretexting emails impersonating HR, IT helpdesk, or recruiters, using role-specific lures (e.g., "Your benefits enrollment as a [Director-level] employee is expiring") to confirm and enrich harvested role data.
  • Leaked dataset mining: Threat actors search breach databases (via dehashed.com API queries or dark web marketplaces) for records tied to your organization's email domain, cross-referencing emails against role data harvested from public sources to identify accounts worth targeting.

This technique is attractive because it is entirely passive from the attacker's perspective — it requires no malware, generates no alerts in victim environments, and dramatically improves the return on investment for every downstream attack phase.

Detection Strategy

Required Telemetry

  • Web server and CDN access logs: Enable full-request logging on your public-facing web servers (Apache/Nginx access logs, AWS CloudFront logs, Azure Front Door logs, Cloudflare Firewall logs). Capture client_ip, user_agent, uri_path, http_method, response_code, bytes_sent, and referer. Without these, you cannot detect automated scraping of your "About Us" or "Leadership" pages.
  • Email gateway logs (inbound): Enable header-level logging on your SEG (Proofpoint, Mimecast, Microsoft Defender for Office 365, Cisco ESA). Capture sender_domain, sender_ip, recipient, subject, attachment_hashes, and url_clicks. Phishing for information campaigns targeting named roles will appear here first.
  • Microsoft Entra ID / Azure AD Sign-in Logs: Enable Entra ID Diagnostic Settings and stream SignInLogs and NonInteractiveUserSignInLogs to your SIEM. Capture userPrincipalName, ipAddress, appDisplayName, resultType, conditionalAccessStatus, and riskLevelDuringSignIn. Attackers validating harvested accounts generate failed sign-in spikes.
  • Active Directory Event Logs (Windows): Enable the following via Group Policy (Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy):
    • Account Logon → Audit Credential Validation: Event ID 4776 (NTLM credential validation — detects password spray attempts against harvested usernames)
    • Account Management → Audit User Account Management: Event ID 4720, 4722, 4725, 4738 (account changes that may indicate post-recon access)
    • DS Access → Audit Directory Service Access: Event ID 4661, 4662 (LDAP queries against AD that enumerate user objects and group memberships — requires SACL on the domain object)
    • Logon/Logoff → Audit Logon: Event ID 4624, 4625, 4648
    • Enable LDAP interface events via registry: HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics → 15 Field Engineering = 5 generates Event ID 1644 for expensive or unusual LDAP queries
  • DNS query logs: Enable DNS debug logging on Windows DNS servers (dnscmd /config /logLevel 0x8100 or DNS Server diagnostic events Event ID 3008) or deploy a DNS sinkhole/resolver with query logging. Capture outbound queries to known OSINT infrastructure (Hunter.io, Clearbit, LinkedIn) from internal hosts — this can reveal insider threat or compromised host activity.
  • Microsoft 365 Unified Audit Log (UAL): Ensure audit logging is enabled in the Microsoft Purview compliance portal. Stream UserLoggedIn, SearchQueryInitiatedSharePoint, FileAccessed, and MailItemsAccessed operations. These reveal whether a compromised account is being used to enumerate the directory.
  • Microsoft Graph API / Entra ID Audit Logs: Stream AuditLogs from Entra ID, specifically operations like Get member objects, List members, Get user at high volume from a single service principal or user — indicating programmatic directory enumeration.
  • Firewall and Proxy logs: Log outbound connections from internal hosts to social media APIs, data broker sites (hunter.io, clearbit.com, rocketreach.co), and LinkedIn. Capture src_ip, dst_domain, dst_ip, bytes_out, url, and user_agent.

Key Indicators

  • High-velocity scraping of organizational web pages: In web server access logs, look for uri_path matching /about, /team, /leadership, /contact, /staff, or /directory with more than 20 requests in 60 seconds from a single client_ip. Flag user_agent values matching known scraper signatures: python-requests, curl, Go-http-client, scrapy, Wget.
  • Username enumeration via failed authentications: In Entra ID SignInLogs, look for resultType = 50126 (invalid credentials — user exists) or resultType = 50034 (user does not exist) in bulk from a single ipAddress. A spray pattern shows many different userPrincipalName values failing with the same password from one IP over a short window.
  • Anomalous LDAP enumeration queries: In Windows Event ID 1644, look for LDAP filters such as (objectClass=user), (memberOf=*), or (title=*) returning large result sets (more than 500 objects) from a non-administrative client_ip. Also watch Event ID 4662 with ObjectType = %{bf967aba-0de6-11d0-a285-00aa003049e2} (User objects) accessed in bulk.
  • Phishing emails targeting named executives or specific roles: In email gateway logs, correlate recipient against your HR-sourced list of privileged roles (CFO, CISO, IT Admin, Payroll). Flag emails where subject contains role-specific keywords like invoice, wire transfer, IT helpdesk, benefits, or urgent combined with a first-time sender_domain.
  • Internal host querying external OSINT infrastructure: In proxy/firewall logs, flag dst_domain matching hunter.io, clearbit.com, fullcontact.com, rocketreach.co, api.linkedin.com, or pipl.com from internal src_ip addresses — especially from non-marketing/non-sales systems.
  • Microsoft Graph API bulk user enumeration: In Entra Audit Logs, look for operationName = "Get user" or operationName = "List members" performed more than 100 times within a 10-minute window by a single initiatedBy.user.userPrincipalName or initiatedBy.app.displayName that is not a known provisioning service account.
  • Credential stuffing using harvested role-based usernames: In AD Event ID 4625, look for SubStatus = 0xC000006A (wrong password, account exists) across more than 10 unique TargetUserName values from a single IpAddress within 5 minutes, where LogonType = 3 (network logon).

Detection Logic

Rule 1 — Web Scraping of Organizational Pages (Broad/High Sensitivity):
IF web_log.uri_path MATCHES ("/about|/team|/leadership|/staff|/directory|/contact") AND COUNT(DISTINCT web_log.uri_path) BY web_log.client_ip WITHIN 60s > 15 AND web_log.user_agent MATCHES ("python-requests|curl|Go-http-client|scrapy|Wget|libwww") THEN alert("Possible role page scraping from {client_ip}")

This catches automated tools enumerating your public organizational pages. Expect moderate alert volume — tune down by whitelisting known monitoring vendors, SEO crawlers (Googlebot, Bingbot by verified user_agent and reverse DNS), and your own uptime monitoring IPs. This is your earliest possible signal that a pre-attack recon phase is underway.

Rule 2 — Entra ID Password Spray Against Harvested Usernames (Medium Precision):
IF SignInLogs.resultType IN ("50126", "50055", "50079") AND COUNT(DISTINCT SignInLogs.userPrincipalName) BY SignInLogs.ipAddress WITHIN 10m > 10 AND NOT SignInLogs.ipAddress IN [known_vpn_ranges, known_office_egress_ips] THEN alert("Password spray — possible harvested username list validation from {ipAddress}")

This targets attackers who have harvested a username list via role identification and are now validating it against your IdP. Alert volume should be low to medium; most spikes from legitimate users will not span more than 2–3 unique UPNs from one IP.

Rule 3 — Bulk AD/Graph Directory Enumeration (High Precision):
IF (AuditLogs.operationName IN ("Get user", "List members", "Get member objects") AND COUNT(AuditLogs.operationName) BY AuditLogs.initiatedBy WITHIN 10m > 100 AND NOT AuditLogs.initiatedBy IN [approved_provisioning_apps, hr_sync_accounts]) OR (EventID = 1644 AND LDAP_filter CONTAINS ("objectClass=user" OR "title=" OR "memberOf=") AND result_entries > 200 AND source_ip NOT IN [dc_ip_list, siem_collector_ips]) THEN alert("Bulk directory enumeration — possible role mapping")

This is your highest-confidence rule and should produce very few false positives when exclusions are properly set. It directly catches attackers who have gained initial access and are now enumerating the directory to understand organizational roles and privileges before lateral movement.

Rule 4 — Targeted Phishing Email Cluster Against Executive/Privileged Roles (High Precision):
IF email_gateway.recipient IN [executive_role_list] AND email_gateway.sender_domain NOT IN [known_good_domains] AND email_gateway.sender_domain_age_days < 30 AND (email_gateway.subject MATCHES ("invoice|wire|urgent|IT support|helpdesk|benefits|payroll|credentials") OR email_gateway.url_domain IN [threat_intel_phishing_feed]) THEN alert("Spear phishing targeting privileged role — {recipient}")

This requires you to maintain a executive_role_list (CFO, CEO, CISO, CTO, Payroll Manager, IT Admin, etc.) sourced from your HR system and kept current. Alert volume will be low and each hit warrants immediate investigation, as it strongly suggests the attacker has completed role identification and moved to initial access.

Tuning Guidance

  • Legitimate search engine crawlers: Googlebot, Bingbot, and similar will trigger the web scraping rule. Exclude by verifying reverse DNS of client_ip resolves to *.googlebot.com or *.search.msn.com AND forward DNS confirms the IP. Do not exclude based on user_agent alone — these are trivially spoofed.
  • HR and Identity governance sync tools (Workday, SAP SuccessFactors, SailPoint): These will trigger bulk Graph/LDAP enumeration rules. Identify their dedicated service account names and service principal IDs and add them to an approved_provisioning_apps exclusion list. Audit this list quarterly — attackers may attempt to impersonate these accounts.
  • Internal IT admin LDAP queries: Sysadmins using tools like ADExplorer, RSAT Active Directory Users and Computers, or ldapsearch will trigger Event ID 1644 rules. Exclude based on source_ip IN [admin_workstation_subnets] AND initiating_user IN [tier1_admin_accounts] — but always log and retain these queries for forensic reference.
  • Marketing and sales tooling: Teams using Hunter.io, Clearbit, or LinkedIn Sales Navigator legitimately will trigger the proxy rule for OSINT infrastructure. Build an exclusion based on src_ip IN [sales_workstation_subnet] OR authenticated_user IN [sales_team_ad_group] and validate against your sanctioned software inventory.
  • Legitimate bulk email campaigns: Mass email from approved marketing platforms (HubSpot, Marketo, Salesforce) may appear as spray-like patterns in reverse. Exclude known sender_ip ranges published by these vendors in their SPF records, and ensure your email gateway is DMARC-enforcing to reduce spoofing noise.
  • Multi-factor authentication prompts causing benign failed sign-ins: Users traveling or on new devices frequently generate resultType = 50074 or 50079 (MFA required/interrupted). Tune your spray rule to require a minimum of 10 distinct UPNs from the same IP before alerting, and cross-reference against conditionalAccessStatus = "notApplied" to flag attempts that bypass CA policies entirely.

When the Alert Fires: Investigation Steps

  1. Verify the alert is real and not a data pipeline artifact. Pull the raw event directly from the source log (web server log, Entra SignInLogs table, AD event log) and confirm the fields match what the SIEM rule evaluated — check that timestamps, IPs, and user identifiers are not artifacts of log parsing or index delay.
  2. Identify the external IP or actor and assess the targeted users. Run the external client_ip or sender_ip through threat intel (VirusTotal, Shodan, AbuseIPDB, your SIEM's threat intel feed) and determine whether the targeted users hold privileged roles — flag immediately if targets include executives, IT admins, finance, or HR personnel.
  3. Reconstruct the full scope of web or directory access. For web scraping alerts, pull all requests from the offending client_ip over the past 48 hours in your web server logs and identify every URI path accessed, paying attention to any attempts against /admin, /login, or authentication endpoints; for AD/Graph alerts, pull the complete list of objects queried using Event ID 1644 or Entra Audit Logs filtered by the offending principal.
  4. Check whether any harvested credentials have been used successfully. Query Entra ID SignInLogs for resultType = 0 (successful sign-in) from the same ipAddress or IP subnet that generated the spray or enumeration alert — a successful logon following failed attempts is a critical escalation indicator requiring immediate containment.
  5. Correlate with inbound email to identify whether targeting has already begun. Search your email gateway logs (Proofpoint SIEM connector, Microsoft Defender Advanced Hunting EmailEvents table, or Mimecast SIEM integration) for messages sent to the roles or users identified in step 2 within the past 14 days, filtering for new sender domains, lookalike domains, or subjects matching social engineering themes.
  6. Determine whether any internal host initiated the OSINT activity. Query proxy and DNS logs for outbound connections from internal src_ip addresses to known OSINT platforms (hunter.io, clearbit.com, rocketreach.co, linkedin.com/api) — if found, identify the host and authenticated user using your EDR (CrowdStrike, Defender for Endpoint, SentinelOne) and check for signs of compromise or insider threat activity.
  7. Make the escalation decision based on evidence of downstream action. Treat the finding as a confirmed incident requiring immediate response if any of these are true: a successful authentication followed scraping or spray activity from the same IP; a phishing email was clicked or credentials entered (visible via Microsoft Defender UrlClickEvents or Proofpoint TRAP); or bulk directory enumeration occurred from a non-approved account inside your environment — otherwise, document as confirmed reconnaissance with heightened monitoring and brief the targeted individuals' management.

Response Playbook

Containment

  • Block the offending external IP at the perimeter firewall and web application firewall (WAF): Add the client_ip or IP range to your WAF block list (AWS WAF, Cloudflare, Azure Front Door, Akamai) and confirm the block is applied at the CDN edge layer, not just the origin server. For Cloudflare, use the IP Access Rules or WAF Custom Rules interface. Verify the block is active by checking WAF logs for subsequent 403 responses.
  • If a successful sign-in was detected, immediately disable the compromised account: In Entra ID, use Disable-AzureADUser or the Entra admin portal to block sign-in. In Active Directory, disable the account using ADUC or Disable-ADAccount -Identity [username]. Leave the account intact (do not delete) for forensic investigation.
  • Revoke all active sessions and tokens for the affected account: In Microsoft Entra ID, run Revoke-AzureADUserAllRefreshToken or use the "Revoke sessions" button in the user's Entra profile to invalidate all existing OAuth tokens and session cookies — this removes any active access the attacker may already have.
  • Implement geo-blocking or rate limiting on organizational web pages if scraping is confirmed: Configure your WAF or CDN to rate-limit requests to paths like /about, /leadership, and /team to no more than 30 requests per minute per IP, and enforce CAPTCHA challenges for automated user-agent patterns.
  • Alert and brief targeted personnel: Notify identified high-risk targets (executives, IT admins, finance staff) through a verified out-of-band channel (phone or in-person) that they are being targeted; instruct them not to respond to unexpected credential requests and to report any suspicious contact immediately to the SOC.

Eradication

  • If an internal host was involved in OSINT activity, isolate and investigate it: Use your EDR to network-isolate the host (CrowdStrike: Real Time Response → contain host; Defender for Endpoint: Device actions → Isolate device) while leaving it powered on. Run a full memory and disk collection using your DFIR toolset (Velociraptor, KAPE, or EDR live response) before reimaging.
  • Audit and tighten LDAP/Graph API permissions: Review all service principals and service accounts with User.Read.All, Directory.Read.All, or Group.Read.All Graph API permissions in Entra ID. Revoke unnecessary permissions and enforce least privilege; rotate client secrets and certificates for any service principals that were active during the enumeration window.
  • Reset credentials for any accounts that appeared in the harvested or sprayed username list: Force a password reset for all accounts targeted in a spray attempt, even those that did not successfully authenticate — the attacker now knows these accounts exist. Enforce reset via Entra ID's "Require re-register MFA" policy if SSPR is in scope.
  • Remove any attacker-added persistence if a successful breach is confirmed: Search for new Entra ID application registrations, OAuth consent grants, inbox rules, and conditional access policy modifications created during or after the enumeration window using the Unified Audit Log (New-InboxRule, Add app role assignment to service principal, Update conditional access policy operations).
  • Rotate API keys and secrets exposed to the enumerated scope: If the attacker queried service accounts or application registrations, rotate all client secrets, certificates, and API keys associated with those principals — treat them as compromised even if no successful authentication is confirmed.

Recovery

  • Re-enable affected user accounts only after confirming no persistence remains: Before re-enabling, verify via Entra Audit Logs and the UAL that no new OAuth grants, inbox rules, or MFA device registrations were added under the account during the compromise window; require the user to re-register MFA on a trusted device before restoring access.
  • Reconnect any isolated hosts only after a clean bill of health from your DFIR review: If confidence in the host's integrity is below 100%, reimage from a known-good baseline rather than attempting to clean in place — the risk of a missed implant outweighs the operational cost of reimaging for a targeted attack.
  • Monitor the affected accounts, hosts, and targeted roles for a minimum of 72 hours post-remediation: Create a temporary watchlist in your SIEM containing all affected userPrincipalName values and host identifiers, and trigger high-priority alerts on any authentication, file access, or outbound connection from these entities during the monitoring window.
  • Update your threat intel blocklists with all IOCs discovered during the investigation: Add identified scraper IPs, phishing sender domains, lookalike domains, and malicious URLs to your firewall, DNS RPZ, and email gateway block lists, and share them with your ISAC or threat intel sharing community (FS-ISAC, MS-ISAC) if appropriate.
  • Document the full timeline and conduct a lessons-learned review: Record the initial indicator, investigation timeline, affected scope, containment actions, and time-to-contain in your incident management platform (ServiceNow, Jira, PagerDuty). Use the review to assess whether your executive and privileged-role personnel need targeted security awareness training focused on social engineering and phishing for information tactics.

Stay Ahead

Get daily threat intelligence and weekly detection playbooks.

Free. No account. No email. Follow in Feedly, Inoreader, or any RSS reader.