Skip to content

[New Rule] Potential ResetNightmare UPN Account Takeover (CVE-2026-27912) - #6679

Open
w0rk3r wants to merge 1 commit into
mainfrom
resetnightmare
Open

[New Rule] Potential ResetNightmare UPN Account Takeover (CVE-2026-27912)#6679
w0rk3r wants to merge 1 commit into
mainfrom
resetnightmare

Conversation

@w0rk3r

@w0rk3r w0rk3r commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Issues

Part of https://github.com/elastic/ia-trade-team/issues/1061

Summary

Identifies a User Principal Name (UPN) being set to another account's sAMAccountName, followed by a password change for that other account. This pattern may indicate ResetNightmare (CVE-2026-27912), which allows an attacker who can write a UPN to reset another account's password and take over that account. Targeting a privileged identity can escalate a standard domain user to Domain Admin or equivalent control of the domain.

Data for the testing can be found on the team stack.

Example Data

Resulting event JSON
{
  "@timestamp": "2026-08-18T06:46:02.978-03:00",
  "event.ingested": "2026-08-18T06:46:11.000-03:00",
  "event.code": "4723",
  "event.outcome": "success",
  "Esql.stage": "password_change",
  "Esql.victim_sid": "S-1-5-21-2038103339-2155116624-3331879844-1117",
  "Esql.assignment_times": "2026-08-18T06:46:02.805-03:00",
  "Esql.computer_name": "meereen.essos.local",
  "Esql.actor_sid": "S-1-5-21-2038103339-2155116624-3331879844-1115",
  "Esql.victim_name": "missandei",
  "Esql.assignment_span_ms": 173,
  "Esql.assignment_time": "2026-08-18T06:46:02.805-03:00",
  "host.id": "78dfb2cd-7fe7-4362-bdda-31953b32e9b3",
  "host.name": "meereen",
  "winlog.computer_name": "meereen.essos.local",
  "winlog.event_data.SubjectUserSid": "S-1-5-21-2038103339-2155116624-3331879844-1115",
  "winlog.event_data.SubjectUserName": "khal.drogo",
  "winlog.event_data.SubjectDomainName": "ESSOS",
  "winlog.event_data.TargetSid": "S-1-5-21-2038103339-2155116624-3331879844-1117",
  "winlog.event_data.TargetUserName": "missandei",
  "winlog.event_data.TargetDomainName": "ESSOS",
  "winlog.record_id": "3117948",
  "_id": "AaAUQxeCu9npfSmgWh68",
  "_index": ".ds-logs-system.security-default-2026.07.22-000024",
  "_version": 1
}
image

@w0rk3r w0rk3r self-assigned this Aug 19, 2026
Copilot AI lite review requested due to automatic review settings August 19, 2026 20:19
@w0rk3r w0rk3r added Rule: New Proposal for new rule OS: Windows windows related rules Domain: Endpoint backport: auto labels Aug 19, 2026
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Aug 19, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ Potential ResetNightmare UPN Account Takeover (CVE-2026-27912) (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Windows/Active Directory detection rule to identify potential ResetNightmare (CVE-2026-27912) abuse by correlating a UPN assignment to another account’s sAMAccountName with a subsequent password change for that account.

Changes:

  • Introduces a new ES|QL rule correlating Security Event IDs 4738 (UPN set) and 4723 (password change) within a short time window.
  • Adds supporting rule metadata (references, ATT&CK mapping, investigation fields, setup guidance) for triage and operational use.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +35 to +45
tags = [
"Domain: Identity",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Persistence",
"Use Case: Active Directory Monitoring",
"Use Case: Vulnerability",
"Data Source: Active Directory",
"Data Source: Windows Security Event Logs",
]
Comment on lines +74 to +78
| WHERE Esql.victim_name IS NOT NULL AND
Esql.actor_sid IS NOT NULL AND
Esql.computer_name IS NOT NULL AND
Esql.actor_sid != Esql.victim_sid
)
standard domain user to Domain Admin or equivalent control of the domain.
"""
from = "now-9m"
interval = "5m"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interval = "5m"

default is 5m

"Use Case: Active Directory Monitoring",
"Use Case: Vulnerability",
"Data Source: Active Directory",
"Data Source: Windows Security Event Logs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Data Source: Windows Security Event Logs",
"Data Source: Windows Security Event Logs",
"Vuln: CVE-2026-27912",

Comment on lines +103 to +121
| KEEP
@timestamp,
event.ingested,
event.code,
event.outcome,
Esql.*,
host.id,
host.name,
winlog.computer_name,
winlog.event_data.SubjectUserSid,
winlog.event_data.SubjectUserName,
winlog.event_data.SubjectDomainName,
winlog.event_data.TargetSid,
winlog.event_data.TargetUserName,
winlog.event_data.TargetDomainName,
winlog.record_id,
_id,
_index,
_version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| KEEP
@timestamp,
event.ingested,
event.code,
event.outcome,
Esql.*,
host.id,
host.name,
winlog.computer_name,
winlog.event_data.SubjectUserSid,
winlog.event_data.SubjectUserName,
winlog.event_data.SubjectDomainName,
winlog.event_data.TargetSid,
winlog.event_data.TargetUserName,
winlog.event_data.TargetDomainName,
winlog.record_id,
_id,
_index,
_version
| KEEP
@timestamp,
event.*
Esql.*,
host.*
winlog.*
_id,
_index,
_version

nit

UPN to reset another account's password and take over that account. Targeting a privileged identity can escalate a
standard domain user to Domain Admin or equivalent control of the domain.
"""
from = "now-9m"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we safely increase the lookback window?
Could wait 10 minutes, then clear the UPN and continue to the password reset which would bypass the rule.

@terrancedejesus terrancedejesus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aegrah Aegrah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks good to me; but we may want a few more eyes on this since it's complicated.

Setup instructions: https://ela.st/audit-user-account-management
"""
severity = "medium"
tags = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required taxonomy tags Platform: Windows and Rule Type: ESQL are missing. Adding both here could keep this rule discoverable and compliant with the rule-tag taxonomy.

/* 4738 TargetSid is the UPN object (actor); UserPrincipalName is the victim SAM. */
| EVAL Esql.stage = "upn_assignment",
Esql.actor_sid = winlog.event_data.TargetSid,
Esql.victim_name = TO_LOWER(winlog.event_data.UserPrincipalName),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we generally used the format Esql.field_name + operation (if relevant); may want to update these to the standardized format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport: auto Domain: Endpoint OS: Windows windows related rules Rule: New Proposal for new rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants