LOGO

Track Firewall Activity: A Guide to Windows Firewall Logging

July 1, 2015
Track Firewall Activity: A Guide to Windows Firewall Logging

Firewall Logging and Traffic Analysis

All firewalls, as part of their function in regulating network traffic, incorporate logging capabilities. This functionality records details regarding how the firewall processes different traffic types.

These logs are a significant resource, offering insights into network activity. They typically include crucial data points such as originating and destination IP addresses, port numbers utilized, and the protocols employed.

Utilizing Windows Firewall Logs

The Windows Firewall log file is particularly useful for observing network connections. It allows administrators to monitor both TCP and UDP connections, as well as packets that have been actively blocked by the firewall.

Analyzing these logs can help identify potential security threats or troubleshoot network connectivity issues. Detailed records of blocked traffic are essential for maintaining a secure network environment.

Information gathered from firewall logs is vital for security audits and compliance reporting. Proper log management is a key component of a robust cybersecurity strategy.

The Value and Timing of Firewall Log Utilization

Firewall logging serves several crucial purposes, extending beyond simple security monitoring. It’s a powerful tool for network administrators and security professionals.

Key Applications of Firewall Logging

Utilizing firewall logs allows for verification of newly implemented firewall rules. This ensures they function as intended and facilitates debugging when unexpected behavior occurs.

Troubleshooting application failures can often be aided by examining Windows Firewall logs. The logging feature enables analysis of blocked ports, both static and dynamic, as well as detailed packet inspection.

Identifying malicious activity is another significant benefit. Firewall logs can reveal suspicious patterns within your network, though they don’t pinpoint the origin of such activity.

Proactive Security Measures

Repeated, unsuccessful connection attempts to your firewall or critical systems originating from a single IP address, or a range of addresses, should raise a red flag. Consider implementing a rule to block all traffic from that IP space.

It’s important to verify the legitimacy of the source IP address to prevent blocking legitimate users due to spoofing.

Detecting Outbound Threats

Unexpected outgoing connections originating from internal servers, such as web servers, may indicate unauthorized use of your system. This could signify an attacker leveraging your infrastructure to launch attacks against external targets.

Monitoring outbound traffic is essential for detecting compromised systems and preventing your network from being used in malicious activities.

Analyzing these connections can help identify the source of the compromise and mitigate the threat.

Enabling the Windows Firewall Log

Initially, logging within the Windows Firewall is deactivated, meaning no activity is recorded. To initiate log file creation, press the “Win key + R” combination to launch the Run dialog. Then, input “wf.msc” and press Enter. This will display the “Windows Firewall with Advanced Security” interface.

On the right-hand side of the window, select “Properties.”

how-to-track-firewall-activity-with-the-windows-firewall-log-1.jpg

A configuration window will appear. Navigate to the “Private Profile” tab and, within the “Logging Section,” choose “Customize.”

how-to-track-firewall-activity-with-the-windows-firewall-log-2.jpg

A new screen will open, allowing you to define the maximum log file size, its storage location, and the types of events to record. You can choose to log only dropped packets, successful connections, or both. A dropped packet represents data blocked by the Windows Firewall.

A successful connection encompasses both incoming connections and outbound connections initiated by the user, though it doesn’t automatically indicate a successful intrusion attempt.

how-to-track-firewall-activity-with-the-windows-firewall-log-3.jpg

By default, Windows Firewall directs log entries to:

%SystemRoot%\System32\LogFiles\Firewall\Pfirewall.log

However, it only retains the most recent 4 MB of data. In active environments, continuous logging can impact system performance. Therefore, enabling logging is best reserved for active troubleshooting, with subsequent deactivation upon completion.

Subsequently, select the “Public Profile” tab and replicate the configuration steps performed for the “Private Profile.” This activates logging for both private and public network connections.

The log file is generated in W3C extended log format (.log), which can be viewed using a text editor or imported into a spreadsheet application. Given the potential for thousands of entries, disabling word wrap in Notepad is recommended to maintain column alignment when viewing the log directly.

Alternatively, spreadsheet software will present the data in a columnar format for simplified analysis.

Returning to the main “Windows Firewall with Advanced Security” screen, scroll down to locate the “Monitoring” link. Within the Details pane, under “Logging Settings,” click the file path displayed next to “File Name” to open the log in Notepad.

how-to-track-firewall-activity-with-the-windows-firewall-log-4.jpg

Understanding the Windows Firewall Log

The Windows Firewall security log is structured into two distinct parts. The header section provides unchanging, descriptive details regarding the log's version and the available data fields. Conversely, the log's body comprises dynamic, compiled data generated by network traffic attempting to traverse the firewall.

This body is continuously updated with new entries appearing at the bottom. Data fields are arranged sequentially from left to right, with a (-) symbol indicating the absence of an entry for a specific field.

Log Header Components

According to Microsoft Technet documentation, the log file header includes the following elements:

  • Version — Indicates the installed version of the Windows Firewall security log.
  • Software — Specifies the software responsible for creating the log.
  • Time — Confirms that all timestamps within the log are recorded in local time.
  • Fields — Lists the available fields for security log entries, contingent on data availability.

Log Body Details

The body of the log file contains the following information for each entry:

  • date — The date of the event, formatted as YYYY-MM-DD.
  • time — The local time of the event, displayed in HH:MM:SS format, utilizing a 24-hour clock.
  • action — The action taken by the firewall, including DROP (connection dropped), OPEN (connection established), CLOSE (connection terminated), OPEN-INBOUND (inbound session initiated), and INFO-EVENTS-LOST (events processed but not logged).
  • protocol — The network protocol used, such as TCP, UDP, or ICMP.
  • src-ip — The source IP address, representing the computer initiating the communication.
  • dst-ip — The destination IP address, indicating the target of the connection attempt.
  • src-port — The source port number on the sending computer.
  • dst-port — The destination port number to which the sending computer attempted to connect.
  • size — The packet size, measured in bytes.
  • tcpflags — Details regarding TCP control flags within the TCP header.
  • tcpsyn — The TCP sequence number contained in the packet.
  • tcpack — The TCP acknowledgement number within the packet.
  • tcpwin — The TCP window size, expressed in bytes, within the packet.
  • icmptype — Information pertaining to ICMP messages.
  • icmpcode — Further details regarding ICMP messages.
  • info — A descriptive entry dependent on the specific action that occurred.
  • path — The communication direction, with options including SEND, RECEIVE, FORWARD, and UNKNOWN.

Each log entry can contain up to seventeen distinct pieces of information. However, for typical analysis, the initial eight data points are generally the most pertinent.

To investigate potential malicious activity, open the log file in a text editor like Notepad and filter for entries where the 'action' field indicates 'DROP'. Then, observe if the destination IP addresses frequently end in a number other than 255. If numerous such entries are found, record the corresponding destination IP addresses.

Enabling native logs is a recommended practice when troubleshooting network issues involving the Windows Firewall. While the Windows Firewall log isn't designed for comprehensive network security analysis, it provides valuable insight into behind-the-scenes activity and can aid in debugging application failures.

#Windows Firewall#firewall log#track firewall activity#Windows security#firewall monitoring#network security