Identifying Suspicious Network Activities
Common Indicators of Suspicious Network Activities
When analyzing network traffic for security purposes, certain patterns and behaviors may indicate suspicious or malicious activities:
- Unusual Port Usage: Traffic on uncommon ports or well-known malware ports
- Excessive DNS Queries: May indicate DNS tunneling or data exfiltration
- Unencrypted Credentials: Passwords sent in clear text
- Port Scanning: Multiple connection attempts to different ports
- Unusual Data Patterns: Base64-encoded payloads or encrypted traffic where not expected
- Connection Attempts to Known Malicious IPs: Traffic to/from blacklisted addresses
Simulating Suspicious Activities
For learning purposes, let's simulate some suspicious network activities that we can detect with Wireshark:
## Create a directory for our security analysis
mkdir -p ~/wireshark_lab/security_analysis
## Simulate a port scan (limited to a few ports for demonstration)
nmap -p 80,443,22,21,25 scanme.nmap.org > ~/wireshark_lab/security_analysis/scan_results.txt 2>&1
Note: The nmap
command above performs a scan on common ports of the scanme.nmap.org server, which is specifically set up for testing nmap.
Capturing and Analyzing Suspicious Traffic
- Start a new Wireshark capture on your main network interface:
wireshark &
-
In Wireshark, double-click on your primary network interface to start capturing.
-
In a separate terminal, run the simulation command:
## Simulate another port scan while capturing
nmap -p 80,443,22,21,25 scanme.nmap.org > /dev/null 2>&1
-
After the command completes, stop the Wireshark capture by clicking the red square button.
-
Save this capture as suspicious_traffic.pcapng
in the ~/wireshark_lab/security_analysis/
directory.
Detecting Port Scanning
Port scanning is a common reconnaissance technique used by attackers to discover services running on a system. Let's identify the port scanning activity in our capture:
- Apply a filter to see the connection attempts to different ports:
tcp.flags.syn == 1 && tcp.flags.ack == 0
This filter shows TCP SYN packets, which are used to initiate connections. A large number of these packets to different ports on the same host is indicative of port scanning.
- To focus on traffic related to our nmap scan, you can add a filter for the target domain:
tcp.flags.syn == 1 && tcp.flags.ack == 0 && ip.addr contains scanme.nmap.org
Creating a Security Analysis Report
Let's document our findings in a simple security analysis report:
## Create a report file
nano ~/wireshark_lab/security_analysis/security_report.txt
Add the following content to the file:
Security Analysis Report
=======================
Date: [Current Date]
Findings:
1. Port Scanning Activity Detected
- Source: [Your IP address]
- Target: scanme.nmap.org
- Targeted Ports: 80, 443, 22, 21, 25
- Evidence: TCP SYN packets to multiple ports
2. Analysis Method:
- Used Wireshark to capture network traffic
- Applied filter: tcp.flags.syn == 1 && tcp.flags.ack == 0
- Identified pattern of systematic connection attempts
3. Recommended Actions:
- Monitor for unauthorized scanning activities
- Implement firewall rules to limit outbound scanning
- Consider implementing network intrusion detection systems
Save the file by pressing Ctrl+O
, then Enter
, and exit nano with Ctrl+X
.
Creating a Custom Filter for Suspicious Activities
Let's create a custom filter for detecting potential security issues:
- In Wireshark, type the following filter:
(tcp.flags.syn == 1 && tcp.flags.ack == 0) || (dns.qry.type == 1 && dns.qry.name contains "suspicious") || (http.request && ip.addr == 192.168.0.1)
This complex filter looks for:
- Port scanning activity (SYN packets without ACK)
- DNS queries for domains containing "suspicious"
- HTTP requests to/from IP 192.168.0.1
-
Save this filter:
- Click the "+" button at the right end of the filter bar
- Name:
Security Monitoring
- Filter string: (paste the filter above)
- Click "Save"
-
Export this filter configuration for future use:
## First, open your Wireshark profile directory to find the saved filters
ls -la ~/.config/wireshark/
Summarizing Your Security Analysis
Let's verify our security analysis artifacts:
## List all the files we've created
ls -la ~/wireshark_lab/security_analysis/
You should see:
scan_results.txt
- Output from our nmap scan
suspicious_traffic.pcapng
- Wireshark capture of suspicious activities
security_report.txt
- Our analysis report
These files represent a basic cybersecurity analysis workflow:
- Capture suspicious traffic
- Analyze the traffic using appropriate filters
- Document findings and recommendations
In a real security environment, you would continue to refine your detection techniques, create more sophisticated filters, and integrate Wireshark analysis with other security tools for comprehensive threat detection and response.