#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct EventIdEntry {
pub event_id: u32,
pub channel: &'static str,
pub description: &'static str,
pub mitre_techniques: &'static [&'static str],
pub artifact_ids: &'static [&'static str],
pub high_value: bool,
}
pub static EVENT_ID_TABLE: &[EventIdEntry] = &[
EventIdEntry {
event_id: 104,
channel: "System",
description: "System log cleared",
mitre_techniques: &["T1070.001"],
artifact_ids: &["evtx_system"],
high_value: true,
},
EventIdEntry {
event_id: 1102,
channel: "Security",
description: "Audit log cleared",
mitre_techniques: &["T1070.001"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4624,
channel: "Security",
description: "Successful logon",
mitre_techniques: &["T1078"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4625,
channel: "Security",
description: "Failed logon — brute force indicator",
mitre_techniques: &["T1110"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4648,
channel: "Security",
description: "Logon with explicit credentials",
mitre_techniques: &["T1550.002"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4663,
channel: "Security",
description: "Object access attempt",
mitre_techniques: &["T1005"],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4688,
channel: "Security",
description: "Process creation",
mitre_techniques: &["T1059"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4698,
channel: "Security",
description: "Scheduled task created",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_security", "scheduled_tasks_dir"],
high_value: true,
},
EventIdEntry {
event_id: 4702,
channel: "Security",
description: "Scheduled task updated",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4720,
channel: "Security",
description: "User account created",
mitre_techniques: &["T1136.001"],
artifact_ids: &["evtx_security", "sam_users"],
high_value: true,
},
EventIdEntry {
event_id: 4732,
channel: "Security",
description: "Member added to security-enabled local group",
mitre_techniques: &["T1098"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4768,
channel: "Security",
description: "Kerberos TGT requested",
mitre_techniques: &["T1558.003"],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4769,
channel: "Security",
description: "Kerberos service ticket requested",
mitre_techniques: &["T1558.003"],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4771,
channel: "Security",
description: "Kerberos pre-authentication failed",
mitre_techniques: &["T1110"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4776,
channel: "Security",
description: "NTLM authentication",
mitre_techniques: &["T1550.002"],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 7045,
channel: "System",
description: "Service installed",
mitre_techniques: &["T1543.003"],
artifact_ids: &["evtx_system"],
high_value: true,
},
EventIdEntry {
event_id: 4634,
channel: "Security",
description: "Logoff (system-generated)",
mitre_techniques: &[],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4647,
channel: "Security",
description: "User-initiated logoff",
mitre_techniques: &[],
artifact_ids: &["evtx_security"],
high_value: false,
},
EventIdEntry {
event_id: 4672,
channel: "Security",
description: "Special privileges assigned to new logon (admin-equivalent)",
mitre_techniques: &["T1078"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 4722,
channel: "Security",
description: "User account enabled",
mitre_techniques: &["T1098"],
artifact_ids: &["evtx_security"],
high_value: true,
},
EventIdEntry {
event_id: 21,
channel: "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational",
description: "RDP session logon succeeded",
mitre_techniques: &["T1021.001"],
artifact_ids: &["evtx_rdp_session", "evtx_terminal_services"],
high_value: true,
},
EventIdEntry {
event_id: 22,
channel: "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational",
description: "RDP shell (session) start",
mitre_techniques: &["T1021.001"],
artifact_ids: &["evtx_rdp_session", "evtx_terminal_services"],
high_value: false,
},
EventIdEntry {
event_id: 1149,
channel: "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational",
description: "RDP network connection established (label 'auth succeeded' is misleading — \
precedes credential validation; corroborate with 21/22 or 4624 Type 10)",
mitre_techniques: &["T1021.001"],
artifact_ids: &["evtx_rdp_inbound", "evtx_terminal_services"],
high_value: true,
},
EventIdEntry {
event_id: 1029,
channel: "Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational",
description: "RDP Core: SHA1 hash of the connecting username (correlation aid)",
mitre_techniques: &["T1021.001"],
artifact_ids: &["evtx_rdp_client", "evtx_terminal_services"],
high_value: false,
},
EventIdEntry {
event_id: 106,
channel: "Microsoft-Windows-TaskScheduler/Operational",
description: "Scheduled task registered (created)",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_task_scheduler", "scheduled_tasks_dir"],
high_value: true,
},
EventIdEntry {
event_id: 140,
channel: "Microsoft-Windows-TaskScheduler/Operational",
description: "Scheduled task updated",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_task_scheduler"],
high_value: false,
},
EventIdEntry {
event_id: 141,
channel: "Microsoft-Windows-TaskScheduler/Operational",
description: "Scheduled task deleted",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_task_scheduler"],
high_value: false,
},
EventIdEntry {
event_id: 200,
channel: "Microsoft-Windows-TaskScheduler/Operational",
description: "Scheduled task action started",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_task_scheduler"],
high_value: false,
},
EventIdEntry {
event_id: 201,
channel: "Microsoft-Windows-TaskScheduler/Operational",
description: "Scheduled task action completed",
mitre_techniques: &["T1053.005"],
artifact_ids: &["evtx_task_scheduler"],
high_value: false,
},
EventIdEntry {
event_id: 4103,
channel: "Microsoft-Windows-PowerShell/Operational",
description: "PowerShell module logging",
mitre_techniques: &["T1059.001"],
artifact_ids: &["evtx_powershell"],
high_value: false,
},
EventIdEntry {
event_id: 4104,
channel: "Microsoft-Windows-PowerShell/Operational",
description: "PowerShell script block logging — captures full (decoded) script content",
mitre_techniques: &["T1059.001"],
artifact_ids: &["evtx_powershell"],
high_value: true,
},
EventIdEntry {
event_id: 400,
channel: "Windows PowerShell",
description: "PowerShell engine/session start (classic log)",
mitre_techniques: &["T1059.001"],
artifact_ids: &["evtx_powershell_classic"],
high_value: false,
},
EventIdEntry {
event_id: 600,
channel: "Windows PowerShell",
description: "PowerShell provider start/stop (classic log)",
mitre_techniques: &["T1059.001"],
artifact_ids: &["evtx_powershell_classic"],
high_value: false,
},
EventIdEntry {
event_id: 7034,
channel: "System",
description: "Service crashed unexpectedly",
mitre_techniques: &["T1543.003"],
artifact_ids: &["evtx_system"],
high_value: false,
},
EventIdEntry {
event_id: 7036,
channel: "System",
description: "Service started/stopped",
mitre_techniques: &["T1543.003"],
artifact_ids: &["evtx_system"],
high_value: false,
},
EventIdEntry {
event_id: 1116,
channel: "Microsoft-Windows-Windows Defender/Operational",
description: "Microsoft Defender detected malware",
mitre_techniques: &["T1059"],
artifact_ids: &["evtx_defender"],
high_value: true,
},
EventIdEntry {
event_id: 1117,
channel: "Microsoft-Windows-Windows Defender/Operational",
description: "Microsoft Defender took action (remediation)",
mitre_techniques: &[],
artifact_ids: &["evtx_defender"],
high_value: false,
},
EventIdEntry {
event_id: 216,
channel: "Application",
description: "ESENT: database location change detected (NTDS.dit move ⇒ red flag)",
mitre_techniques: &["T1003.003"],
artifact_ids: &["evtx_application"],
high_value: true,
},
EventIdEntry {
event_id: 325,
channel: "Application",
description: "ESENT: database engine created a new database (NTDS.dit in unexpected \
location ⇒ red flag)",
mitre_techniques: &["T1003.003"],
artifact_ids: &["evtx_application"],
high_value: true,
},
EventIdEntry {
event_id: 326,
channel: "Application",
description: "ESENT: database attached",
mitre_techniques: &["T1003.003"],
artifact_ids: &["evtx_application"],
high_value: false,
},
EventIdEntry {
event_id: 327,
channel: "Application",
description: "ESENT: database detached",
mitre_techniques: &["T1003.003"],
artifact_ids: &["evtx_application"],
high_value: false,
},
];
pub fn event_entry(event_id: u32) -> Option<&'static EventIdEntry> {
EVENT_ID_TABLE.iter().find(|e| e.event_id == event_id)
}
pub fn events_for_artifact(artifact_id: &str) -> Vec<&'static EventIdEntry> {
EVENT_ID_TABLE
.iter()
.filter(|e| e.artifact_ids.contains(&artifact_id))
.collect()
}
pub fn high_value_events() -> Vec<&'static EventIdEntry> {
EVENT_ID_TABLE.iter().filter(|e| e.high_value).collect()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn table_nonempty() {
assert!(!EVENT_ID_TABLE.is_empty());
}
#[test]
fn logon_event_4624_exists() {
let e = event_entry(4624).expect("Event 4624 (logon) should exist");
assert_eq!(e.channel, "Security");
assert!(e.high_value);
}
#[test]
fn process_creation_4688_exists() {
let e = event_entry(4688).expect("Event 4688 (process creation) should exist");
assert!(!e.mitre_techniques.is_empty());
}
#[test]
fn unknown_event_returns_none() {
assert!(event_entry(99999).is_none());
}
#[test]
fn evtx_security_has_events() {
let events = events_for_artifact("evtx_security");
assert!(
!events.is_empty(),
"evtx_security should have event associations"
);
}
#[test]
fn high_value_events_nonempty() {
let hv = high_value_events();
assert!(hv.len() >= 5);
assert!(hv.iter().all(|e| e.high_value));
}
const IWE_REQUIRED: &[(u32, &str)] = &[
(4634, "Security"),
(4647, "Security"),
(4672, "Security"),
(4722, "Security"),
(
21,
"Microsoft-Windows-TerminalServices-LocalSessionManager/Operational",
),
(
22,
"Microsoft-Windows-TerminalServices-LocalSessionManager/Operational",
),
(
1149,
"Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational",
),
(
1029,
"Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational",
),
(106, "Microsoft-Windows-TaskScheduler/Operational"),
(140, "Microsoft-Windows-TaskScheduler/Operational"),
(141, "Microsoft-Windows-TaskScheduler/Operational"),
(200, "Microsoft-Windows-TaskScheduler/Operational"),
(201, "Microsoft-Windows-TaskScheduler/Operational"),
(4103, "Microsoft-Windows-PowerShell/Operational"),
(4104, "Microsoft-Windows-PowerShell/Operational"),
(400, "Windows PowerShell"),
(600, "Windows PowerShell"),
(7034, "System"),
(7036, "System"),
(1116, "Microsoft-Windows-Windows Defender/Operational"),
(1117, "Microsoft-Windows-Windows Defender/Operational"),
(216, "Application"),
(325, "Application"),
(326, "Application"),
(327, "Application"),
];
#[test]
fn iwe_course_event_ids_present() {
for &(id, channel) in IWE_REQUIRED {
let e = event_entry(id)
.unwrap_or_else(|| panic!("IWE Event ID {id} missing from EVENT_ID_TABLE"));
assert_eq!(
e.channel, channel,
"Event {id} channel mismatch: got {:?}, want {channel:?}",
e.channel
);
assert!(
!e.description.is_empty(),
"Event {id} must carry a description"
);
}
}
#[test]
fn powershell_scriptblock_4104_is_high_value() {
let e = event_entry(4104).expect("Event 4104 (script block logging) should exist");
assert!(e.high_value, "4104 (decoded script content) is high-value");
assert!(e.mitre_techniques.contains(&"T1059.001"));
}
#[test]
fn all_artifact_ids_valid() {
use crate::catalog::CATALOG;
let ids: std::collections::HashSet<&str> = CATALOG.list().iter().map(|d| d.id).collect();
for entry in EVENT_ID_TABLE {
for aid in entry.artifact_ids {
assert!(
ids.contains(aid),
"Unknown artifact_id {} in event {}",
aid,
entry.event_id
);
}
}
}
}