Saturday, January 18, 2020

Event ID 4624 - An account was successfully logged on

Event ID 4624 - An account was successfully logged on

Json log sample:

{
"EventTime": "2017-10-09 05:00:00",
"Hostname": "LPWXDC.ChangeMe.local",
"Keywords": -9214364837600034816,
"EventType": "AUDIT_SUCCESS",
"SeverityValue": 2,
"Severity": "INFO",
"EventID": 4624,
"SourceName": "Microsoft-Windows-Security-Auditing",
"ProviderGuid": "{54849625-5478-4994-A5BA-3E3B0328C30D}",
"Version": 1,
"Task": 12544,
"OpcodeValue": 0,
"RecordNumber": 409583434,
"ProcessID": 824,
"ThreadID": 19048,
"Channel": "Security",
"Message": "An account was successfully logged on.",
"Category": "Logon",
"Opcode": "Info",
"SubjectUserSid": "S-1-0-0",
"SubjectUserName": "-",
"SubjectDomainName": "-",
"SubjectLogonId": "0x0",
"TargetUserSid": "S-1-5-18",
"TargetUserName": "LPW",
"TargetDomainName": "LP",
"TargetLogonId": "0x1828eb397",
"LogonType": "3",
"LogonProcessName": "Kerberos",
"AuthenticationPackageName": "Kerberos",
"LogonGuid": "{FD1B49BA-A5E9-5D7D-D3F4-D925B43807F2}",
"TransmittedServices": "-",
"LmPackageName": "-",
"KeyLength": "0",
"ProcessName": "-",
"WorkstationName": "LPLONSERVDBVM",
"IpAddress": "10.0.2.10",
"IpPort": "60208",
"ImpersonationLevel": "%%1833",
"EventReceivedTime": "2017-10-09 05:00:00",
"SourceModuleName": "wineventlog_in",
"SourceModuleType": "im_msvistalog"
}

This event is very important and highly valuable. It documents all successful attempt to logon to the local computer regardless of logon type, location of the user or type of account.

Subject User Information:
"SubjectUserSid"
"SubjectUserName"
"SubjectDomainName"
"SubjectLogonId"
This provides an information of account that request logon but not the actual user who logged on. This information are in general not that important from audit perspective but still there could be some cases where you would want to look into this. To find information regarding user who logged on we need to refer to Target User Information as below.

Target User Information:
"TargetUserSid" -> SID of an account
"TargetUserName" -> user who logged in
"TargetDomainName" -> domain name of user
"TargetLogonId" -> This is unique number between each reboot and it identifies each logon  session. This can be used to correlate with logoff events 4634, 4647.
This provides an information about the user who just logged. To determine whether the account is local or domain compare TargetDomainName to the computer name.  If they match, the account is a local account on that system, otherwise a domain account.

Type of logon:
"LogonType" -> This defines the type of logon. Possible values are as follows


logon_typedescription
2Interactive
3Network
4Batch
5Service
7Unlock
8NetworkCleartext
9NewCredentials
10RemoteInteractive
11CachedInteractive

Impersonation Level:


impersonation leveldescription
%%1832Identification
%%1833Impersonation
%%1840Delegation
%%1841Denied by Process Trust Label ACE
%%1842Yes
%%1843No
%%1844System
%%1845Not Available
%%1846Default
%%1847DisallowMmConfig
%%1848Off
%%1849Auto

Network Information:
"IpAddress" -> IP address of the computer where the user is physically present
"IpPort" -> source TCP port of the logon request
"WorkstationName" -> the computer name of the computer where the user is physically present.  Workstation may be blank in some Kerberos logons.

The launchpad to a career in IT. This program is designed to take beginner learners to job readiness in about eight months.

The Working of NTLM Authentication

Why NTLM:
Microsoft adopted Kerberos as the preferred authentication protocol for Windows 2000 and subsequent Active Directory domains. Kerberos is typically used when a server belongs to a Windows Server domain, or if a trust relationship with a Windows Server Domain is established in some other way (such as Linux to Windows AD authentication). But NTLM can be used in either case(if you have a active directory or not).
NTLM is still used in the following situations:
  • The client is authenticating to a server using an IP address
  • The client is authenticating to a server that belongs to a different Active Directory forest that has a legacy NTLM trust instead of a transitive inter-forest trust
  • The client is authenticating to a server that doesn't belong to a domain
  • No Active Directory domain exists (commonly referred to as "workgroup" or "peer-to-peer")
  • Where a firewall would otherwise restrict the ports required by Kerberos (typically TCP 88)
Working of NTLM:
The following steps present an outline of NTLM non-interactive authentication. The first step provides the user's NTLM credentials and occurs only as part of the interactive authentication (logon) process.
1. (Interactive authentication only) A user accesses a client computer and provides a domain name, user name, and password. The client computes a cryptographic hash of the password and discards the actual password.
2. The client sends the user name to the server (in plaintext).
3. The server generates a 16-byte random number, called a challenge or nonce, and sends it to the client.
4. The client encrypts this challenge with the hash of the user's password and returns the result to the server. This is called the response.
5. The server sends the following three items to the domain controller:

  • User name
  • Challenge sent to the client
  • Response received from the client
6. The domain controller uses the user name to retrieve the hash of the user's password from the Security Account Manager database. It uses this password hash to encrypt the challenge.
7. The domain controller compares the encrypted challenge it computed (in step 6) to the response computed by the client (in step 4). If they are identical, authentication is successful.
Your application should not access the NTLM security package directly; instead, it should use the Negotiate security package. Negotiate allows your application to take advantage of more advanced security protocols if they are supported by the systems involved in the authentication. Currently, the Negotiate security package selects between Kerberos and NTLM. Negotiate selects Kerberos unless it cannot be used by one of the systems involved in the authentication.
NTLM working in terms of status codes:
Windows NT Challenge/Response protocol
Windows NT Challenge/Response (NTCR) protocol differs from Kerberos in that the server presents the HTTP client with a "challenge" and the client responds with its response. This way, the client's password is never sent over the network. Authentication with the NTCR protocol occurs as follows:
1. Typically, the client issues an initial anonymous request. When the anonymous request is rejected, IIS returns a 401.2 error and the WWW-Authenticate headers.
2. If the client fails or does not support Kerberos, the Negotiate and NTLM header values initiate an NTCR authentication exchange. The client closes the TCP connection, opens a new one, and sends a request that includes an Authorization: NTLM header. This header also includes encoded text that represents the users UserName, ComputerName, and Domain. This text is used by the Windows Security Support Provider Interface (SSPI) to generate the challenge. If the user account is not a local Windows account on the IIS server, the data is passed on to an appropriate domain controller, which then generates the challenge.
3. The challenge is sent to the client and IIS returns another 401.1 error.
4. The client uses its password and the challenge to create a mathematical hash. The client sends the hash back to the server in another Authorization: NTLM header.
5. The server accepts the response, and the local security provider or the appropriate domain controller recreates the same hash and compares the two. If they match, the user is successfully authenticated.
The launchpad to a career in IT. This program is designed to take beginner learners to job readiness in about eight months.

Friday, January 17, 2020

Event ID 4625 - An account failed to logon

Event ID 4625 - An account failed to logon

Json log sample:

{
"EventTime": "2017/08/25 14:09:12"
"Hostname": "CIVDCS-ADC1.changeme.com"
"Keywords": -9218868437227405312
"EventType": "AUDIT_FAILURE"
"SeverityValue": 4
"Severity": "ERROR"
"EventID": 4625
"SourceName": "Microsoft-Windows-Security-Auditing"
"ProviderGuid": "{54849625-5478-4994-A5BA-3E3B0328C30D}"
"Version": 0
"Task": 12544
"OpcodeValue": 0
"RecordNumber": 56611365
"ProcessID": 528
"ThreadID": 4672
"Channel": "Security"
"Message": "An account failed to log on."
"Category": "Logon"
"Opcode": "Info"
"SubjectUserSid": "S-1-0-0"
"SubjectUserName": "-"
"SubjectDomainName": "-"
"SubjectLogonId": "0x0"
"TargetUserSid": "S-1-0-0"
"TargetUserName": "MININT-UP26I95$"
"TargetDomainName": "changeme"
"Status": "0xc000006d"
"FailureReason": "%%2313"
"SubStatus": "0xc000006a"
"LogonType": "3"
"LogonProcessName": "NtLmSsp "
"AuthenticationPackageName": "NTLM"
"WorkstationName": "MININT-UP26I95"
"TransmittedServices": "-"
"LmPackageName": "-"
"KeyLength": "0"
"ProcessName": "-"
"IpAddress": "172.23.130.64"
"IpPort": "65284"
"EventReceivedTime": "2017/08/25 14:09:12"
"SourceModuleName": "wineventlog_in"
"SourceModuleType": "im_msvistalog"
}

This event is very important and highly valuable. It documents all failed attempt to logon to the local computer regardless of logon type, location of the user or type of account.

Subject User Information:
"SubjectUserSid"
"SubjectUserName"
"SubjectDomainName"
"SubjectLogonId"
This provides an information of account that request logon but not the actual user who logged on. This information are in general not that important from audit perspective but still there could be some cases where you would want to look into this. To find information regarding user who logged on we need to refer to Target User Information as below.

Target User Information:
"TargetUserSid" -> SID of an account
"TargetUserName" -> user who logged in
"TargetDomainName" -> domain name of user
"TargetLogonId" -> This is unique number between each reboot and it identifies each logon  session.
This provides an information about the user who just logged. To determine whether the account is local or domain compare TargetDomainName to the computer name.  If they match, the account is a local account on that system, otherwise a domain account.

Type of logon:
"LogonType" -> This defines the type of logon. Possible values are as follows


logon_typedescription
2Interactive
3Network
4Batch
5Service
7Unlock
8NetworkCleartext
9NewCredentials
10RemoteInteractive
11CachedInteractive

Status and Sub Status Code:



status and sub_status_codedescription
0XC000005EThere are currently no logon servers available to service the logon request.
0xC0000064user name does not exist
0xC000006Auser name is correct but the password is wrong
0XC000006DThis is either due to a bad username or authentication information
0XC000006EUnknown user name or bad password.
0xC000006Fuser tried to logon outside his day of week or time of day restrictions
0xC0000070workstation restriction or Authentication Policy Silo violation (look for event ID 4820 on domain controller)
0xC0000071expired password
0xC0000072account is currently disabled
0XC00000DCIndicates the Sam Server was in the wrong state to perform the desired operation.
0xC0000133clocks between DC and other computer too far out of sync
0xc000015bThe user has not been granted the requested logon type (aka logon right) at this machine
0XC000018CThe logon request failed because the trust relationship between the primary domain and the trusted domain failed.
0XC0000192An attempt was made to logon but the netlogon service was not started.
0XC0000193account expiration
0XC0000224user is required to change password at next logon
0xC0000225evidently a bug in Windows and not a risk
0xC0000234user is currently locked out
0XC0000413Logon Failure: The machine you are logging onto is protected by an authentication firewall. The specified   account is not allowed to authenticate to the machine.

Failure Reason:

Failure reasoninformation
%%2305The specified user account has expired. 
%%2309The specified account's password has expired. 
%%2310Account currently disabled. 
%%2311Account logon time restriction violation. 
%%2312User not allowed to logon at this computer. 
%%2313Unknown user name or bad password. 

Network Information:
"IpAddress" -> IP address of the computer where the user is physically present
"IpPort" -> source TCP port of the logon request
"WorkstationName" -> the computer name of the computer where the user is physically present.  Workstation may be blank in some Kerberos logons.

Why should you monitor this event?

  • To detect brute-force, dictionary, and other password guess attacks. Monitor sudden spike in failed logons.
  • To detect abnormal and possible malicious internal activity. Monitor a logon attempt from a disabled account or unauthorized workstation, users logging on outside of normal working hours, etc.
  • To benchmark Account lockout threshold policy setting. Determine number of failed login attempts before a user account gets locked.
  • To comply with regulatory mandates precise information surrounding failed logons is necessary.

The launchpad to a career in IT. This program is designed to take beginner learners to job readiness in about eight months.

Windows - List of Audit Events

Audit Event IDs list

Audit account logon events

Event IDDescription
4776The domain controller attempted to validate the credentials for an account
4777The domain controller failed to validate the credentials for an account
4768A Kerberos authentication ticket (TGT) was requested
4769A Kerberos service ticket was requested
4770A Kerberos service ticket was renewed

Audit account management

Event IDDescription
4741A computer account was created.
4742A computer account was changed.
4743A computer account was deleted.
4739Domain Policy was changed.
4782The password hash an account was accessed.
4727A security enabled global group was created.
4728A member was added to a security enabled global group.
4729A member was removed from a security enabled global group.
4730A security enabled global group was deleted.
4731A security enabled local group was created.
4732A member was added to a security enabled local group.
4733A member was removed from a security enabled local group.
4734A security enabled local group was deleted.
4735A security enabled local group was changed.
4737A security enabled global group was changed.
4754A security enabled universal group was created.
4755A security enabled universal group was changed.
4756A member was added to a security enabled universal group.
4757A member was removed from a security enabled universal group.
4758A security enabled universal group was deleted.
4720A user account was created.
4722A user account was enabled.
4723An attempt was made to change an account's password.
4724An attempt was made to reset an account's password.
4725A user account was disabled.
4726A user account was deleted.
4738A user account was changed.
4740A user account was locked out.
4765SID History was added to an account.
4766An attempt to add SID History to an account failed.
4767A user account was unlocked.
4780The ACL was set on accounts which are members of administrators groups.
4781The name of an account was changed:

Audit directory service access

Event IDDescription
4934Attributes of an Active Directory object were replicated.
4935Replication failure begins.
4936Replication failure ends.
5136A directory service object was modified.
5137A directory service object was created.
5138A directory service object was undeleted.
5139A directory service object was moved.
5141A directory service object was deleted.
4932Synchronization of a replica of an Active Directory naming context has begun.
4933Synchronization of a replica of an Active Directory naming context has ended.

Audit logon events

Event IDDescription
4634An account was logged off.
4647User initiated logoff.
4624An account was successfully logged on.
4625An account failed to log on.
4648A logon was attempted using explicit credentials.
4675SIDs were filtered.
4649A replay attack was detected.
4778A session was reconnected to a Window Station.
4779A session was disconnected from a Window Station.
4800The workstation was locked.
4801The workstation was unlocked.
4802The screen saver was invoked.
4803The screen saver was dismissed.
5378The requested credentials delegation was disallowed by policy.
5632A request was made to authenticate to a wireless network.
5633A request was made to authenticate to a wired network.

Audit object access

Event IDDescription
5140A network share object was accessed.
4664An attempt was made to create a hard link.
4985The state of a transaction has changed.
5051A file was virtualized.
5031The Windows Firewall Service blocked an application from accepting incoming connections on the network.
4698A scheduled task was created.
4699A scheduled task was deleted.
4700A scheduled task was enabled.
4701A scheduled task was disabled.
4702A scheduled task was updated.
4657A registry value was modified.
5039A registry key was virtualized.
4660An object was deleted.
4663An attempt was made to access an object.

Audit policy change

Event IDDescription
4715The audit policy (SACL) on an object was changed.
4719System audit policy was changed.
4902The Per user audit policy table was created.
4906The CrashOnAuditFail value has changed.
4907Auditing settings on object were changed.
4706A new trust was created to a domain.
4707A trust to a domain was removed.
4713Kerberos policy was changed.
4716Trusted domain information was modified.
4717System security access was granted to an account.
4718System security access was removed from an account.
4864A namespace collision was detected.
4865A trusted forest information entry was added.
4866A trusted forest information entry was removed.
4867A trusted forest information entry was modified.
4704A user right was assigned.
4705A user right was removed.
4714Encrypted data recovery policy was changed.
4944The following policy was active when the Windows Firewall started.
4945A rule was listed when the Windows Firewall started.
4946A change has been made to Windows Firewall exception list. A rule was added.
4947A change has been made to Windows Firewall exception list. A rule was modified.
4948A change has been made to Windows Firewall exception list. A rule was deleted.
4949Windows Firewall settings were restored to the default values.
4950A Windows Firewall setting has changed.
4951A rule has been ignored because its major version number was not recognized by Windows Firewall.
4952Parts of a rule have been ignored because its minor version number was not recognized by Windows Firewall. The other parts of the rule will be enforced.
4953A rule has been ignored by Windows Firewall because it could not parse the rule.
4954Windows Firewall Group Policy settings have changed. The new settings have been applied.
4956Windows Firewall has changed the active profile.
4957Windows Firewall did not apply the following rule:
4958Windows Firewall did not apply the following rule because the rule referred to items not configured on this computer:
6144Security policy in the group policy objects has been applied successfully.
6145One or more errors occurred while processing security policy in the group policy objects.
4670Permissions on an object were changed.

Audit privilege use

Event IDDescription
4672Special privileges assigned to new logon.
4673A privileged service was called.
4674An operation was attempted on a privileged object.

Audit system events

Event IDDescription
5024The Windows Firewall Service has started successfully.
5025The Windows Firewall Service has been stopped.
5027The Windows Firewall Service was unable to retrieve the security policy from the local storage. The service will continue enforcing the current policy.
5028The Windows Firewall Service was unable to parse the new security policy. The service will continue with currently enforced policy.
5029The Windows Firewall Service failed to initialize the driver. The service will continue to enforce the current policy.
5030The Windows Firewall Service failed to start.
5032Windows Firewall was unable to notify the user that it blocked an application from accepting incoming connections on the network.
5033The Windows Firewall Driver has started successfully.
5034The Windows Firewall Driver has been stopped.
5035The Windows Firewall Driver failed to start.
5037The Windows Firewall Driver detected critical runtime error. Terminating.
4608Windows is starting up.
4609Windows is shutting down.
4616The system time was changed.
4621Administrator recovered system from CrashOnAuditFail. Users who are not administrators will now be allowed to log on. Some auditable activity might not have been recorded.
4697A service was installed in the system.
4618A monitored security event pattern has occurred.