Part 6 / 6

Network Log Analysis

🕑 90-120 minutes 📖 Advanced Level 📋 Module 3

Introduction

Network logs are vital evidence in cyber crime investigation. They record all network activities and help in reconstructing events, identifying attackers, and understanding the scope of an incident. This section will teach you how to analyze different types of network logs.

📚 Learning Objectives

After this part, you will be able to analyze firewall logs, server logs, and router logs, and identify anomalies that indicate malicious activity.

Types of Network Logs

Various devices on a network generate logs that can be valuable for investigation.

🛡

Firewall Logs

Record allowed and blocked connections, source/destination IPs, ports, and protocols.

💻

Server Logs

Web server access logs, authentication logs, application logs, and error logs.

🔄

Router Logs

Routing information, interface status, access control lists, and traffic flow data.

🔌

Switch Logs

Port status, MAC address tables, VLAN information, and spanning tree events.

Firewall Logs

Firewall logs are one of the most important sources of evidence in network investigations. They show all traffic that was allowed or blocked at the network perimeter.

Common Firewall Log Fields

FieldDescription
TimestampDate and time of the event
Source IPIP address initiating the connection
Destination IPIP address receiving the connection
Source PortPort used by the source
Destination PortPort being accessed
ProtocolTCP, UDP, ICMP, etc.
ActionAllow, Deny, Drop, Reject
Rule IDWhich firewall rule was triggered
BytesAmount of data transferred
InterfaceNetwork interface involved

Sample Firewall Log (iptables)

Jan 15 10:30:45 firewall kernel: [UFW BLOCK] IN=eth0 OUT= MAC=00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd SRC=192.168.1.100 DST=10.0.0.5 LEN=40 TOS=0x00 PREC=0x00 TTL=64 ID=54321 PROTO=TCP SPT=52345 DPT=22 WINDOW=1024 SYN URGP=0 Jan 15 10:30:46 firewall kernel: [UFW ALLOW] IN=eth0 OUT=eth1 SRC=192.168.1.50 DST=8.8.8.8 LEN=60 TOS=0x00 TTL=64 ID=12345 PROTO=UDP SPT=45678 DPT=53

What to Look For in Firewall Logs

  • Repeated blocked connections: May indicate scanning or brute force attempts
  • Unusual ports: Connections to uncommon ports (e.g., 4444, 31337)
  • High volume traffic: Possible data exfiltration or DDoS
  • Internal to external on unusual ports: Possible C2 communication
  • After-hours traffic: Activity during non-business hours
  • Geo-location anomalies: Connections from unexpected countries
Port Analysis

Key ports to watch:
- 22 (SSH), 23 (Telnet): Remote access attempts
- 445, 139 (SMB): Ransomware, lateral movement
- 3389 (RDP): Remote desktop attacks
- 4444: Common Metasploit default
- High ports (>49152): May be C2 channels

Server Logs

Server logs contain detailed information about all requests and activities on a server. Web server logs are particularly important for investigating website attacks.

Apache/Nginx Access Log Format

192.168.1.100 - - [15/Jan/2024:10:30:45 +0530] "GET /admin/login.php HTTP/1.1" 200 1234 "https://example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" 103.45.67.89 - - [15/Jan/2024:10:30:50 +0530] "POST /admin/login.php HTTP/1.1" 401 567 "-" "python-requests/2.25.1" 103.45.67.89 - - [15/Jan/2024:10:30:51 +0530] "GET /../../etc/passwd HTTP/1.1" 400 0 "-" "curl/7.68.0"

Understanding HTTP Status Codes

Code RangeMeaningInvestigation Note
200-299SuccessNormal requests; check for unauthorized access
301, 302RedirectMay indicate URL manipulation
400Bad RequestMalformed requests, possible attack
401, 403Unauthorized/ForbiddenFailed access attempts
404Not FoundDirectory scanning if many from same IP
500-599Server ErrorMay indicate successful exploitation

Windows Event Logs

Windows systems generate detailed event logs that are crucial for investigation:

Important Event IDs

Event IDDescriptionLog
4624Successful logonSecurity
4625Failed logonSecurity
4648Explicit credential logonSecurity
4720User account createdSecurity
4732User added to groupSecurity
4688Process createdSecurity
7045Service installedSystem
1102Audit log clearedSecurity
💡 Attack Pattern Example

A brute force attack pattern in logs:
1. Multiple 4625 (failed logon) events from same IP
2. Eventually a 4624 (successful logon) if attack succeeded
3. Followed by 4720/4732 (account/privilege changes)
4. Then 4688 events showing malicious processes

Router Logs

Router logs provide visibility into network traffic flow and routing decisions. They are useful for understanding how traffic traversed the network.

Types of Router Logs

  • Syslog Messages: General system events and errors
  • ACL Logs: Access Control List matches (allowed/denied traffic)
  • NetFlow/IPFIX: Detailed traffic flow information
  • SNMP Traps: Alert messages for specific conditions
  • Authentication Logs: Login attempts to the router

Sample Cisco Router Log

*Jan 15 10:30:45.123: %SEC-6-IPACCESSLOGP: list OUTSIDE_IN denied tcp 192.168.1.100(52345) -> 10.0.0.5(22), 1 packet *Jan 15 10:30:50.456: %SYS-5-CONFIG_I: Configured from console by admin on vty0 (192.168.1.50) *Jan 15 10:31:00.789: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down *Jan 15 10:31:05.012: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

NetFlow Analysis

NetFlow provides detailed traffic statistics that are valuable for:

  • Traffic Analysis: Understanding communication patterns
  • Anomaly Detection: Identifying unusual traffic volumes
  • Bandwidth Usage: Finding top talkers and listeners
  • Security Monitoring: Detecting scanning and attacks

NetFlow Record Fields

Source IP, Destination IP, Source Port, Destination Port Protocol, Packets, Bytes, Start Time, End Time TCP Flags, Type of Service, Input Interface, Output Interface

Anomaly Detection

Anomaly detection is the process of identifying patterns in logs that deviate from normal behavior. This helps in detecting attacks and suspicious activities.

Common Anomaly Patterns

📈

Traffic Spikes

Sudden increase in traffic volume may indicate DDoS attack or data exfiltration.

🔒

Failed Login Bursts

Multiple failed authentication attempts indicate brute force or credential stuffing.

🕑

Off-Hours Activity

System access during non-business hours may indicate compromise.

🌍

Geographic Anomalies

Access from unexpected locations or countries.

Indicators of Compromise (IoCs) in Logs

IoC TypeWhat to Look For
Malware C2Periodic connections to same IP/domain, unusual DNS queries
Data ExfiltrationLarge outbound transfers, especially to cloud storage
Lateral MovementInternal scanning, SMB traffic between workstations
Privilege EscalationNew admin accounts, group membership changes
PersistenceNew services, scheduled tasks, registry changes
Defense EvasionLog clearing, disabled security tools
Log Analysis Best Practices

1. Normalize timestamps to a single timezone
2. Correlate logs from multiple sources
3. Create baselines of normal activity
4. Use automated tools for large log volumes
5. Document all findings with evidence

Log Analysis Tools

SIEM Solutions

  • Splunk: Industry-leading log management and analysis
  • ELK Stack: Elasticsearch, Logstash, Kibana - Open source
  • IBM QRadar: Enterprise SIEM with built-in analytics
  • Microsoft Sentinel: Cloud-native SIEM
  • Graylog: Open source log management

Free Tools for Log Analysis

  • Log Parser: Microsoft tool for parsing various log formats
  • GoAccess: Real-time web log analyzer
  • Chainsaw: Windows event log analysis
  • Loki: Log aggregation system by Grafana
  • grep/awk/sed: Command-line tools for text processing

Basic Log Analysis Commands

# Count unique IPs in Apache log awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20 # Find all 404 errors grep " 404 " access.log # Count requests per hour awk '{print $4}' access.log | cut -d: -f1,2 | sort | uniq -c # Find failed SSH logins grep "Failed password" /var/log/auth.log # Windows Event Log query (PowerShell) Get-EventLog -LogName Security -InstanceId 4625 -Newest 100
📚 Key Points
  • Network logs (firewall, server, router) are critical evidence in cyber crime investigation
  • Firewall logs show allowed and blocked connections with source/destination details
  • Web server logs record all HTTP requests including methods, URLs, and response codes
  • Windows Event IDs like 4624 (logon), 4625 (failed logon), 4688 (process) are key for investigation
  • Router logs and NetFlow provide network traffic flow information
  • Anomaly detection involves identifying deviations from normal patterns
  • Common IoCs include unusual traffic patterns, failed logins, and geographic anomalies
  • SIEM tools like Splunk and ELK Stack help analyze large volumes of logs