AI as Your Security Analyst — by anuj.com
In our last edition, we looked at a surprisingly simple way to use AI to identify potentially malicious processes running on your desktop. All it took was a PowerShell command, an exported list of running processes and a carefully constructed AI prompt.
This time, we turn our attention to another fundamental pillar of endpoint security — authentication monitoring.
Has someone been trying to log into your computer? Have there been repeated unsuccessful login attempts? Has someone successfully logged in at a time when you weren’t even using your computer?
The interesting thing is that Windows already collects much of the information we need to investigate these questions. Most of us simply never look at it.
AI can help change that.
Q. Does Windows keep a record of every login attempt?
Windows has a built-in security auditing mechanism that records successful and unsuccessful authentication events, provided the relevant audit policies are enabled.
These events are stored in the Windows Security Event Log.
To access them manually:
- Press Windows + R.
- Type
eventvwr.msc. - Navigate to Windows Logs → Security.
Depending on your audit configuration and log retention settings, you may find thousands of security events.
The problem isn’t the lack of security information. It is knowing what to look for.
This is where AI becomes particularly useful.
Q. What security events should we be looking for?
Every Windows security event has an associated Event ID. Some of the most interesting ones from an authentication and identity security perspective are:
| Event ID | Description |
|---|---|
| 4624 | Successful logon |
| 4625 | Failed logon |
| 4648 | Logon attempted using explicit credentials |
| 4672 | Special privileges assigned to a new logon |
| 4740 | User account locked out |
| 4720 | New user account created |
| 4732 | Member added to a security-enabled local group |
| 1102 | Security audit log cleared |
A single failed login is rarely a cause for concern. However, dozens of failed login attempts followed by a successful login involving the same account and source may warrant further investigation.
Similarly, the creation of an unfamiliar user account, followed by its addition to the local Administrators group, deserves attention.
Security intelligence often lies not in individual events, but in the relationship between events.
Q. How do I export this information from my computer?
As with our previous exercise, we will use PowerShell.
Open PowerShell as Administrator and run the following script. It extracts selected security events from the past seven days and exports relevant authentication details to a CSV file.
$events = Get-WinEvent -FilterHashtable @{
LogName = 'Security'
Id = 4624,4625,4648,4672,4740,4720,4732,1102
StartTime = (Get-Date).AddDays(-7)
}
$events | ForEach-Object {
$event = $_
$xml = [xml]$event.ToXml()
$data = @{}
foreach ($field in $xml.Event.EventData.Data) {
if ($field.Name) {
$data[$field.Name] = $field.'#text'
}
}
[PSCustomObject]@{
TimeCreated = $event.TimeCreated
EventID = $event.Id
RecordID = $event.RecordId
Computer = $event.MachineName
TargetUser = $data['TargetUserName']
SubjectUser = $data['SubjectUserName']
LogonType = $data['LogonType']
SourceIP = $data['IpAddress']
Workstation = $data['WorkstationName']
ProcessName = $data['ProcessName']
LogonID = $data['TargetLogonId']
SubjectLogonID = $data['SubjectLogonId']
Status = $data['Status']
SubStatus = $data['SubStatus']
MemberName = $data['MemberName']
MemberSID = $data['MemberSid']
Details = $event.Message
}
} | Export-Csv "$env:USERPROFILE\SecurityEvents.csv" `
-NoTypeInformation -Encoding UTF8
This will create a file called SecurityEvents.csv in your Windows user profile folder.
The script is read-only. It does not modify your security settings, disable any services or change your computer’s configuration.
Some fields will be empty because different security events record different types of information.
Before uploading the file to an AI service, review and redact sensitive information, including usernames, computer names, internal IP addresses and organizational details. Use consistent pseudonyms so that AI can still correlate related events.
For corporate devices, use only an organization-approved AI service.
Q. Can Windows distinguish between different types of logins?
Yes. This is one of the more interesting aspects of Windows authentication auditing.
Windows records a Logon Type alongside many authentication events.
| Logon Type | Meaning |
|---|---|
| 2 | Interactive login at the computer |
| 3 | Network login |
| 4 | Batch or scheduled task login |
| 5 | Windows service login |
| 7 | Workstation unlock |
| 8 | Network cleartext authentication |
| 9 | New credentials |
| 10 | Remote interactive login, such as RDP |
| 11 | Cached interactive login |
Why does this matter?
A Windows service logging in at 3 AM may be perfectly normal.
An unexpected Remote Desktop login at 3 AM, on the other hand, may deserve immediate investigation.
A network login could be associated with accessing a shared folder, a remote administration tool or another legitimate Windows operation. It does not necessarily indicate that someone has gained interactive access to your desktop.
Understanding these distinctions helps prevent false alarms.
Q. What do I ask AI to look for?
Upload your reviewed and redacted CSV file to your AI assistant and use the following prompt.
Act as an endpoint security analyst specializing in Windows authentication and identity security.
Analyze the attached Windows Security Event Log export.
Investigate:
- Repeated failed authentication attempts.
- Potential brute-force or password-spraying activity.
- Failed login attempts followed by successful logins involving related accounts and sources.
- Unexpected Remote Desktop sessions.
- Interactive logins outside normal usage hours.
- Unfamiliar accounts and source addresses.
- Unexpected assignment of administrative privileges.
- Creation of new user accounts.
- Additions to privileged local security groups.
- Evidence of security audit log clearing.
Correlate events using timestamps, usernames, source addresses, logon types and logon IDs wherever available.
Classify findings as Normal, Low Risk, Requires Investigation or High Priority.
For each finding, provide the supporting Event IDs, timestamps, evidence, possible legitimate explanations, confidence level and recommended verification steps.
Distinguish observed facts from inferred conclusions. Do not invent missing information or assume that an unfamiliar account or IP address is malicious.
Q. What might AI discover?
Consider the following hypothetical security events:
| Time | Event ID | Account | Source IP |
|---|---|---|---|
| 02:14 AM | 4625 | Administrator | 192.0.2.45 |
| 02:15 AM | 4625 | Administrator | 192.0.2.45 |
| 02:16 AM | 4625 | Administrator | 192.0.2.45 |
| 02:17 AM | 4625 | Administrator | 192.0.2.45 |
| 02:18 AM | 4624 | Administrator | 192.0.2.45 |
| 02:18 AM | 4672 | Administrator | Not recorded |
Individually, these events may not tell us much.
Collectively, they suggest a potentially interesting sequence:
- Multiple unsuccessful authentication attempts.
- A subsequent successful authentication involving the same account and source address.
- A possible assignment of elevated privileges.
If the successful authentication was a Type 10 logon, indicating a remote interactive session, this would be an additional reason to investigate.
We would still need to correlate the successful logon’s ID with the privilege assignment event and establish whether the activity was authorized.
This is not proof of a compromise. It could be an administrator who repeatedly mistyped a password.
But it is precisely the kind of pattern that a security analyst would want to investigate.
Q. What else could AI identify?
Password spraying
Instead of repeatedly attempting to access a single account, an attacker may attempt authentication against multiple accounts.
A pattern of failed logins across several usernames originating from a common source could be consistent with password spraying.
Unexpected privilege assignments
A successful login followed by Event ID 4672 indicates that certain sensitive privileges were assigned to the new logon.
This is routine for many administrative and system accounts. However, an unexpected privileged logon involving an unfamiliar account could warrant investigation.
Unauthorized account creation
An attacker who has gained sufficient access may create an additional user account to maintain access to the endpoint.
Event ID 4720 records user account creation. Event ID 4732 can help identify subsequent additions to local security groups, including the Administrators group.
Correlating these events may reveal potential persistence mechanisms.
Security log tampering
Event ID 1102 indicates that the Windows Security audit log was cleared.
There are legitimate administrative reasons to clear logs. Nevertheless, unexpected log clearing following suspicious authentication activity deserves particular attention.
The absence of evidence is not always evidence of absence.
Q. What if my computer has no failed login events?
That does not necessarily mean that nobody has attempted to access your computer.
It could also mean:
- Failed logon auditing is not enabled.
- Older events have been overwritten.
- The relevant authentication occurred on another system.
- The authentication mechanism does not produce the expected local security events.
- The attempted access was blocked before reaching Windows authentication.
You can inspect your current Windows logon auditing configuration using:
auditpol /get /subcategory:"Logon"
Ideally, both successful and failed logon auditing should be enabled for this exercise.
On enterprise-managed computers, these settings may be controlled through organizational security policies.
Q. What should I do if AI identifies something suspicious?
Start by independently verifying the finding.
Check whether the account belongs to a legitimate user, whether the source address is associated with a known device, whether Remote Desktop is intentionally enabled and whether the activity corresponds to scheduled maintenance or authorized software.
If there is credible evidence of unauthorized access, preserve the security logs, disconnect the affected computer from the network if appropriate, and change affected credentials from a separate trusted device.
For enterprise-managed endpoints, contact your security team and follow the organization’s incident response procedures.
AI can help prioritize an investigation. It should not be given the authority to disable accounts, delete files or modify security configurations based solely on its interpretation of an event log.
Q. Isn’t this essentially what enterprise security software does?
At a conceptual level, yes.
Enterprise security platforms such as Microsoft Sentinel, Microsoft Defender for Endpoint and Splunk collect security telemetry, correlate events, identify suspicious behavioral patterns and help security analysts prioritize investigations.
What we have performed here is a simplified, manual version of one component of that process.
The fundamental workflow is the same:
Collect telemetry → Correlate events → Identify anomalies → Verify findings → Respond.
Enterprise platforms perform these operations continuously, across thousands of endpoints, using threat intelligence, behavioral baselines, detection rules and automated response capabilities.
A CSV file and a general-purpose AI assistant are not a replacement for those capabilities. However, they offer an accessible way to understand and apply some of the underlying principles.
The Bigger Picture: AI and Endpoint Security
Endpoint security is often thought of as antivirus software, malware detection and device protection.
But endpoint security is also about answering a series of fundamental questions:
- What is running on my computer?
- Who is trying to access it?
- What privileges have they been granted?
- Who is my computer communicating with?
- What changes have been made to its security configuration?
- Can I trust the applications and identities operating on it?
In our previous edition, we examined the first question. Today, we examined the second.
In both cases, the security telemetry was already available on our computers. We simply used AI to help make sense of it.
One of the most immediate applications of AI in cybersecurity is not necessarily discovering new threats. It is extracting actionable intelligence from security information we already possess.
Now imagine extending this exercise across an entire enterprise — thousands of endpoints, cloud workloads, SaaS applications, service accounts and autonomous AI agents.
That is where AI-powered security analysis becomes an enterprise-wide architectural capability.
AI as Your Security Analyst is a series from anuj.com exploring practical applications of artificial intelligence in cybersecurity, using the tools and technologies already available to us.
Beyond the desktop — Enterprise AI Security
At anuj.com, our signature AI Security Audit™ and AI SecureCheck™ engagements help organizations identify security gaps across enterprise AI systems, cloud infrastructure, identities, APIs and emerging agentic AI architectures.
Learn more: Enterprise AI Security Audit
anuj.com — The voice of experience in AI and security.
ANUJ.COM
The voice of experience in AI and security.
AI & Security Newsletter — Traditional Security