Logging Flashcards
What is Logging
Logs are detailed lists of application information, system performance statistics, or user activities. Logs can be useful for keeping track of computer use, network activity, security issues, and error reports. Every activity in your environment, from emails to logins to firewall updates, is considered a security event. Events are, (or should be,) logged to keep tabs on everything that’s happening in your technology landscape. So how can we use this for security purposes? Let’s cover some examples:
Logging user events in Windows Active Directory domains. This allows us to see when accounts are logged in, incorrect password attempts, administrative account usage, when new accounts are created or deleted, etc. This is a good way to detect activities such as brute-forcing attacks against login credentials or password spraying attacks.
Logging network connections from firewalls can allow us to detect port scanning or vulnerability scanning activity, denial-of-service attacks, and network issues.
It’s important to define exactly what logs are needed. In large organizations, the volume of data passed to a SIEM can be absolutely huge, so we need to work out what logs we actually need, and what devices we need logs from. Scoping this appropriately means there is less noise, and it’s easier to analyze the data we actually need, instead of the data we have access to. SIEMs are not log repositories, they are analysis platforms!
In the next few lessons, we will cover the following important log types we need to consider when performing security event monitoring:
Syslog
Windows Event Logs
Other Logs
Syslog
Actions on many devices generate events that are logged locally for analysis, such as shutdowns, start-ups, processes, and connections. When you have a large number of devices, it becomes impractical to review these locally. System Logging Protocol (Syslog) is a standard protocol used to convey event or system log notification messages to a designated server, known as a Syslog server. The Syslog server centralizes data collection from various devices for analysis, review, and intervention. The Syslog protocol is outlined by RFC 5424.
The protocol can be enabled on most network equipment such as switches, routers and firewalls, and even endpoint devices. Syslog is available on Unix and Linux-based systems and many web servers. Windows systems use their own by default as opposed to Syslog (Windows Event Manager – we’ll cover this in the next lesson), these can also be forwarded to a central server, via third-party utilities or other configurations using the Syslog protocol. Custom applications can also be developed to use Syslog for log transport.
Syslog uses UDP 514 by default; TCP 514 can be used for more reliability; however, certain stricter security standards require that logs are securely transferred, so TCP 6514 is used as a de facto standard, although not official. Take note that Syslog does not offer authentication or encryption built-in, so it may be susceptible to attacks.
Complete network monitoring requires using multiple tools. Syslog is an important pillar in network monitoring because it ensures that events occurring without a dramatic effect do not fall through the cracks. The best practice is to use software that combines all the tools to always have an overview of what is happening in the network.
Syslog Messages
A Syslog message is made of three components; a Priority Value (PRI), a Header, and a Message. We will explain these three parts below.
Priority Value (PRI) The Priority Value is derived from both the Facility Code and the Severity Level. We can use the simple equation to calculate PRI: (facility code * 8) + Severity value = PRI.
Below are the Facility Code and Severity Level tables.
Syslog Messages 2
Header
This contains identifying information, such as; Timestamp, Hostname, Application name, Message ID. This is useful for understanding where the system message has come from.
Message
This could be simple readable text or only machine-readable. The content of the message is not defined by the protocol only the format is. Each message sent to the Syslog server has two labels associated with it that make the message easier to handle. The first label describes the function (facility) of the application that generated it. For example, mail servers typically log using the mail facility. The second label specifies the severity level. After these two labels, the action is specified. The action is usually a filename in the /var/log directory tree, in which the messages will be stored.
Syslog Severity Levels
Windows Event Logs
“Windows Event logs” or “Event Logs” are files in binary format (with .evtx extension) stored locally in the Windows directory of a computer with that operating system:
Windows 2000 to WinXP/Windows Server 2003:
%WinDir%\system32\Config.evt
Windows Server 2008 to 2019, and Windows Vista to Win10:
%WinDir%\system32\WinEVT\Logs.evtx
These logs keep a detailed record of the vast majority of events that have occurred on the system (hardware events, user logins, program execution and installation, etc.), allowing system administrators to keep track of everything that happens within a system during its execution and being able to diagnose and foresee potential issues. Categories of registered events include:
Application: Events logged by an application (Execution, Deployment error, etc.)
System: Events logged by the Operating System (Device loading, startup errors, etc.)
Security: Events that are relevant to the security of the system (Logins and logouts, file deletion, granting of administration permissions, etc.)
Directory Service: This is a record available only to Domain Controllers, it stores Active Directory (AD) events.
DNS Server: It is a record available only to DNS servers; logs of DNS service are stored.
File Replication Service: Is a record available only for Domain Controllers, it stores Domain Controller Replication events.
If you are interested in learning more about these types of records, how they work and how to visualize them, visit the following links:
https: //www.manageengine.eu/network-monitoring/Eventlog_Tutorial_Part_I.html
https: //www.loggly.com/ultimate-guide/windows-logging-basics/#
Security Event Logs
Security Event Logs are events stored by the system that contain information related to the “Windows Security audit policies” (elements of systematic monitoring that helps with the evaluation of system security), which are used to allow precise control over any possible incident present in the system.
Some of these elements are:
Account logon events (valid and invalid sign-ons and sign-offs)
Account management (creation, modification, interaction and deletion of user accounts)
Privilege use.
Account management (creation, modification, interaction and deletion of user accounts)
Resource usage (file creation, modification, interaction and deletion)
If you want to learn more about the Windows Security Audit, it’s settings, and how to apply it, visit the following link: https://eventlogxp.com/essentials/securityauditing.html.
If you want to learn more about security events and get a more detailed list of these items, we recommend you visit the following links:
https: //www.ultimatewindowssecurity.com/securitylog/encyclopedia/default.aspx
https: //www.andreafortuna.org/2019/06/12/windows-security-event-logs-my-own-cheatsheet/
Event Viewer
On Windows 10 we can view Windows Events using the Event Viewer. Search for it in the Windows search bar and run it.
Event Viewer 2
We can use this program to view all different types of logs, and we highly recommend that students check it out to view the logs on their own systems. For this purposes of this walkthrough, we’re going to focus primarily on security-related events. When opening Event Viewer you should see a display similar to the below screenshot.
Event Viewer 3
The Summary of Administrative Events in the middle of the screen displays a high-level overview of all event types in the past 7 days. We can see that we have had 0 critical events in the past 7 days, 260 errors, and 223 warnings. On the left-hand side pane, we’re going to expand the Windows Logs section. We can see this is split into 5 different sections;
Application Security Setup System Forwarded Events
Event Viewer 4
If we click on Security, the middle pane will now show us Security Events. In the below screenshot we can see a lot of events with the Event ID 5379 and the task category User Account Management. If we double click on one of these ID 5379 events, we can get some more information, which we’ll cover below.
Event Viewer 4 contd
Event Viewer 5
Event 5379 is related to users logging in to a Windows system. Let’s explain the information in this event log:
Credential Manager credentials were read – When a user submits credentials when logging into Windows, the system will read the stored credentials in the Credential Manager to ensure that the user-provided credentials exist, and if they’re valid, allowing the users to successfully login.
Security ID – The Security Identification value of the account attempt to sign in.
Account Name – The name of the account.
Account Domain – The domain the account is trying to log in to. As this is just a personal PC on a home network, the default domain is WORKGROUP.
Logon ID – This is a semi-unique (unique between reboots) number that identifies the logon session.
Read Operation – Enumerate credentials is the action taken by the system, as covered under the first bullet-point.
In the bottom section of the window we can also see the time that the event was logged (18/06/2020 14:05:10), the computer that the event was generated on (DESTKOP-V9GVD5Q), and that the audit was successful, based on the Keyword value.
In the first screenshot above showing a list of Security Events, at the top we can see there are some Logon events and Special Logon events, let’s take a deeper look at them.
Event Viewer 6a
In the above screenshot, we can see events with the IDs 4672 Special Logon and 4624 Logon. This pane displays the events with the newest at the top, so the actual sequence is: Logon > Special Logon. But what does this actually mean? The logon event is whenever a user logs into the system, and the Special Logon is when an administrator logs in. We can see these are paired up, because when a user account with administrator privileges logs into Windows it requires the Logon event, then the Special Logon event. Below are screenshots of both of these event types expanded within Event Viewer.
Event Viewer 6b