GitHub Sign-in from Unrecognized Device

Identifies a GitHub sign-in from an unrecognized device. GitHub emits "user.sign_in_from_unrecognized_device", "user.sign_in_from_unrecognized_device_and_location", and "user.new_device_used" when an account authenticates from a device or location it has not seen before. For Enterprise Managed User (EMU) enterprises these user security-log actions stream into the enterprise audit log, where a sign-in from an unfamiliar device can indicate that stolen credentials or a hijacked session are being used from attacker infrastructure. Personal-account enterprises typically retain these events only in the per-user security log, which does not stream to Elastic, so this rule is targeted at EMU audit data.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/09/22"
  3integration = ["github"]
  4maturity = "production"
  5updated_date = "2026/09/22"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies a GitHub sign-in from an unrecognized device. GitHub emits "user.sign_in_from_unrecognized_device",
 11"user.sign_in_from_unrecognized_device_and_location", and "user.new_device_used" when an account authenticates from a
 12device or location it has not seen before. For Enterprise Managed User (EMU) enterprises these user security-log actions
 13stream into the enterprise audit log, where a sign-in from an unfamiliar device can indicate that stolen credentials or a
 14hijacked session are being used from attacker infrastructure. Personal-account enterprises typically retain these events
 15only in the per-user security log, which does not stream to Elastic, so this rule is targeted at EMU audit data.
 16"""
 17false_positives = [
 18    "A developer signing in from a new laptop or phone. Confirm with the user and that MFA succeeded.",
 19]
 20from = "now-9m"
 21language = "esql"
 22license = "Elastic License v2"
 23name = "GitHub Sign-in from Unrecognized Device"
 24note = """## Triage and analysis
 25
 26> **Disclaimer**:
 27> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
 28
 29### Investigating GitHub Sign-in from Unrecognized Device
 30
 31This rule fires on GitHub's `user.sign_in_from_unrecognized_device`, `user.sign_in_from_unrecognized_device_and_location`, and `user.new_device_used` audit actions, which record authentication from a device or location the account has not used before. In Enterprise Managed User (EMU) enterprises these actions reach `logs-github.audit-*`; on non-EMU GHEC they are generally kept only in the per-user security log and will not appear here. A sign-in from an unrecognized device is a common early indicator of account takeover, so review the user and source (`user.name`, `github.actor_ip`, `github.actor_location.country_name`), the device and client (`github.device`, `github.user_agent`), and correlate with any credential or configuration changes that followed to determine whether the legitimate user signed in.
 32
 33### Possible investigation steps
 34
 35- Confirm with the user whether they recently signed in from a new device, phone, or location, and whether `github.device` and `github.user_agent` match equipment they use.
 36- Geolocate `github.actor_ip` and review `github.actor_location.country_name` and the ASN, checking whether the sign-in originates from a location or network consistent with the user's normal activity.
 37- Review `event.action` to distinguish a new device (`user.new_device_used`) from a new device and location (`user.sign_in_from_unrecognized_device_and_location`), the latter being higher risk.
 38- Correlate the same `user.name` and `github.actor_ip` with subsequent credential changes, such as new personal access tokens, OAuth grants, or SSH keys, that indicate the session is being used to establish persistence.
 39- Review the user's recent authentication and security activity for related events, such as MFA changes, recovery-code usage, or additional unrecognized-device sign-ins.
 40
 41### False positive analysis
 42
 43- A developer signing in from a replacement workstation, a new phone, or a travel or home network after completing device verification and MFA. Confirm with the user and that MFA succeeded before dismissing.
 44- Expected changes such as a new corporate laptop rollout or VPN egress change that presents as a new device or location. Validate against IT records and scope exceptions where appropriate.
 45
 46### Response and remediation
 47
 48- If the sign-in was not performed by the legitimate user, reset the user's password and revoke active sessions immediately.
 49- Revoke any personal access tokens, OAuth authorizations, and SSH keys created or used around the time of the sign-in.
 50- Re-enroll or verify MFA for the account, and require the user to re-authenticate from a known device.
 51- Review the account's recent audit activity for repository access, clones, archive downloads, or membership changes performed from the unrecognized device.
 52- Engage incident response per your organization's playbooks and, if the IP or device is confirmed malicious, block or monitor it across the environment.
 53"""
 54references = [
 55    "https://securitylabs.datadoghq.com/articles/mapping-out-your-unknown-threat-hunters-guide-to-github/",
 56    "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/reviewing-your-security-log",
 57]
 58risk_score = 47
 59rule_id = "cbbfd58a-fdb4-4618-9975-27f66165c127"
 60setup = """## Setup
 61
 62This rule is intended for GitHub Enterprise Managed User (EMU) enterprises where user security-log actions stream into the enterprise audit log. Personal-account GHEC trials generally will not emit these events to `logs-github.audit-*`.
 63"""
 64severity = "medium"
 65tags = [
 66    "Domain: Cloud",
 67    "Domain: SaaS",
 68    "Platform: GitHub",
 69    "Use Case: Threat Detection",
 70    "Tactic: Initial Access",
 71    "Data Source: Github",
 72    "Data Source: GitHub Audit Logs",
 73    "Rule Type: ES|QL",
 74    "Resources: Investigation Guide",
 75]
 76timestamp_override = "event.ingested"
 77type = "esql"
 78
 79query = '''
 80from logs-github.audit-* metadata _id, _index, _version
 81| where
 82  event.module == "github" and data_stream.dataset == "github.audit"
 83    and event.action in (
 84      "user.sign_in_from_unrecognized_device",
 85      "user.sign_in_from_unrecognized_device_and_location",
 86      "user.new_device_used"
 87    )
 88| keep
 89    _id,
 90    _index,
 91    _version,
 92    @timestamp,
 93    event.action,
 94    user.name,
 95    github.org,
 96    github.repo,
 97    github.actor_ip,
 98    github.hashed_token,
 99    github.programmatic_access_type,
100    github.user_agent,
101    github.device,
102    github.actor_location.country_name
103'''
104
105
106[[rule.threat]]
107framework = "MITRE ATT&CK"
108[[rule.threat.technique]]
109id = "T1078"
110name = "Valid Accounts"
111reference = "https://attack.mitre.org/techniques/T1078/"
112[[rule.threat.technique.subtechnique]]
113id = "T1078.004"
114name = "Cloud Accounts"
115reference = "https://attack.mitre.org/techniques/T1078/004/"
116
117
118
119[rule.threat.tactic]
120id = "TA0001"
121name = "Initial Access"
122reference = "https://attack.mitre.org/tactics/TA0001/"
123
124[rule.investigation_fields]
125field_names = [
126    "@timestamp",
127    "event.action",
128    "user.name",
129    "github.org",
130    "github.repo",
131    "github.actor_ip",
132    "github.hashed_token",
133    "github.programmatic_access_type",
134    "github.user_agent",
135    "github.device",
136    "github.actor_location.country_name",
137]

Triage and analysis

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Investigating GitHub Sign-in from Unrecognized Device

This rule fires on GitHub's user.sign_in_from_unrecognized_device, user.sign_in_from_unrecognized_device_and_location, and user.new_device_used audit actions, which record authentication from a device or location the account has not used before. In Enterprise Managed User (EMU) enterprises these actions reach logs-github.audit-*; on non-EMU GHEC they are generally kept only in the per-user security log and will not appear here. A sign-in from an unrecognized device is a common early indicator of account takeover, so review the user and source (user.name, github.actor_ip, github.actor_location.country_name), the device and client (github.device, github.user_agent), and correlate with any credential or configuration changes that followed to determine whether the legitimate user signed in.

Possible investigation steps

  • Confirm with the user whether they recently signed in from a new device, phone, or location, and whether github.device and github.user_agent match equipment they use.
  • Geolocate github.actor_ip and review github.actor_location.country_name and the ASN, checking whether the sign-in originates from a location or network consistent with the user's normal activity.
  • Review event.action to distinguish a new device (user.new_device_used) from a new device and location (user.sign_in_from_unrecognized_device_and_location), the latter being higher risk.
  • Correlate the same user.name and github.actor_ip with subsequent credential changes, such as new personal access tokens, OAuth grants, or SSH keys, that indicate the session is being used to establish persistence.
  • Review the user's recent authentication and security activity for related events, such as MFA changes, recovery-code usage, or additional unrecognized-device sign-ins.

False positive analysis

  • A developer signing in from a replacement workstation, a new phone, or a travel or home network after completing device verification and MFA. Confirm with the user and that MFA succeeded before dismissing.
  • Expected changes such as a new corporate laptop rollout or VPN egress change that presents as a new device or location. Validate against IT records and scope exceptions where appropriate.

Response and remediation

  • If the sign-in was not performed by the legitimate user, reset the user's password and revoke active sessions immediately.
  • Revoke any personal access tokens, OAuth authorizations, and SSH keys created or used around the time of the sign-in.
  • Re-enroll or verify MFA for the account, and require the user to re-authenticate from a known device.
  • Review the account's recent audit activity for repository access, clones, archive downloads, or membership changes performed from the unrecognized device.
  • Engage incident response per your organization's playbooks and, if the IP or device is confirmed malicious, block or monitor it across the environment.

References

Related rules

to-top