Security Investigation and Incident Response¶
This tutorial teaches you how to effectively investigate security incidents using Peakhour's comprehensive logging and analytics capabilities. You'll learn to identify threats, analyze attack patterns, and respond to security events.
Duration: 45 minutes
Prerequisites: Understanding of firewall rules and log analysis
Learning Goals: Master security event investigation, threat pattern analysis, incident response workflows, and proactive threat hunting
What You'll Build: A complete security investigation methodology that enables rapid threat detection, detailed attack analysis, and effective incident response using Peakhour's security event data.
Understanding Security Event Types¶
Peakhour captures comprehensive security events across multiple protection layers, providing rich data for investigation and analysis.
Security Event Categories¶
WAF (Web Application Firewall) Events:
- SQL injection attempts
- Cross-site scripting (XSS) attacks
- Remote code execution attempts
- Path traversal attacks
- Protocol violations
Access Control Events:
- IP-based blocking (reputation, geographic)
- Rate limiting violations
- Custom firewall rule triggers
- Bot detection and challenges
Authentication Events (Edge Access):
- Login attempts and failures
- Multi-factor authentication events
- Policy evaluation results
- Session management events
Network-Level Events:
- DDoS mitigation
- Protocol-level attacks
- TLS/SSL anomalies
- Fingerprint-based detection
Set Up Your Investigation Dashboard¶
Access Security Analytics¶
- Navigate to Analytics > Security Events
- Select appropriate time range for investigation
- Review the Security Posture Overview:
- Total security events
- Threat distribution by type
- Geographic threat patterns
- Action distribution (blocked, challenged, allowed)
Configure Investigation Views¶
Set up your analytics workspace:
Time Range Selection:
- Recent Activity: Last 24 hours for current threats
- Weekly Trends: 7 days for pattern analysis
- Monthly Overview: 30 days for baseline understanding
- Custom Range: Specific incident timeframes
Event Grouping Options:
- By IP Address: Individual attacker analysis
- By IP Class C: Network-based threat grouping
- By Country: Geographic threat analysis
- By ASN: Network provider analysis
- By WAF Rule: Attack type classification
- By URL: Target analysis
Initial Threat Assessment¶
Review the Threat Funnel for high-level security posture:
- Country-Level Filtering: Geographic threat distribution
- Threat Type Analysis: Attack category breakdown
- Action Effectiveness: How threats were handled
- Risk Score Calculation: Overall security risk assessment (0-100 scale)
Investigate High-Priority Threats¶
Identify Critical Security Events¶
Look for high-severity indicators:
Critical WAF Events:
- Severity: CRITICAL - Immediate investigation required
- Attack Tags:
sql
,rce
,lfi
,xss
with high confidence - Multiple Rule Matches: Coordinated attack attempts
- Successful Bypasses: Events that weren't blocked
Volume-Based Threats:
- High Request Rates: Potential DDoS or brute force
- Geographic Clustering: Coordinated attacks from specific regions
- ASN Concentration: Attacks from hosting providers or compromised networks
Drill Down into Specific Events¶
SQL Injection Attack Investigation
Example Investigation - SQL Injection Attack:
-
Identify the Threat:
-
Analyze Event Details:
{ "unique_id": "waf_20240808_143025_abc123", "time": "2024-08-08T14:30:25.123Z", "client": "203.0.113.45", "host": "yoursite.com", "method": "POST", "path": "/wp-admin/admin-ajax.php", "query": "action=test&id=1' UNION SELECT * FROM users--", "geoip_country_code": "CN", "geoip_as_organization": "China Telecom", "waf": { "matched_rule": { "id": "942100", "data": "union select", "formatted_msg": "SQL Injection Attack Detected", "tags": ["sql", "injection", "attack"], "severity": "CRITICAL" } } }
-
Request Context Analysis:
- Target: WordPress admin functionality
- Payload: Classic UNION-based SQL injection
- Geographic: High-risk country origin
- Network: Residential ISP (potential compromised host)
Investigate Attack Patterns¶
Look for Related Activity:
- Same IP Analysis:
- Filter events by
client: 203.0.113.45
- Review attack timeline and escalation
-
Check for reconnaissance attempts
-
Similar Attack Vectors:
- Search for
waf.matched_rule.tags: sql
- Group by source IP to identify campaign scale
-
Analyze target URL patterns
-
Geographic Correlation:
- Filter by
geoip_country_code: CN
- Look for coordinated attacks from same region
- Check ASN distribution for botnet indicators
Analyze Attack Campaigns¶
Campaign Attribution¶
Identify Coordinated Attacks:
-
Time-Based Clustering:
-
Attack Vector Analysis:
Threat Intelligence Integration¶
Leverage Built-in Reputation Data:
- Check IP Reputation:
- Review if IPs appear in
$webattacks
list - Cross-reference with
$malware
sources -
Check
$tor
exit node involvement -
ASN Analysis:
-
Geographic Threat Distribution:
Attack Timeline Reconstruction¶
Build Attack Chronology:
-
Reconnaissance Phase:
-
Attack Escalation:
-
Lateral Movement Attempts:
Advanced Log Analysis Techniques¶
Use Advanced Query Language¶
Advanced KQL Security Queries
KQL (Kibana Query Language) Queries: Use the query bar for advanced filtering. For aggregations like counting and grouping, use the Chart Builder in the UI after applying your filters.
-
Find Attack Campaigns:
# Filter for SQL injection attempts from specific countries block.by:waf AND waf.matched_rule.tags:sql AND geoip_country_code:("CN" OR "RU" OR "BR")
After filtering, use the Chart Builder to group by
client
andgeoip_as_organization
to find the top attackers. -
Analyze Failed Authentication:
To find IPs with excessive failures, use the Chart Builder to group by
client_ip
and count the events. -
Detect Reconnaissance Activity:
To identify clients with high request counts, use the Chart Builder to group by
client
and count events.
Custom Field Analysis¶
Deep Dive into Request Components:
-
User Agent Analysis:
-
Header Analysis:
Red Flags: Missing common headers, sqlmap signature, unusual content types -
Payload Analysis:
Fingerprint-Based Detection¶
Advanced Threat Detection:
-
TLS Fingerprinting:
-
HTTP/2 Fingerprinting:
Real-Time Threat Hunting¶
Set Up Continuous Monitoring¶
Configure Real-Time Alerts:
-
Critical Event Monitoring:
-
Geographic Anomaly Detection:
Proactive Threat Hunting¶
Hunt for Advanced Threats:
-
Low-and-Slow Attacks: To detect attacks that stay below rate limits, you can filter out rate-limited events and then use the UI to look for suspicious patterns.
Use the Chart Builder to group by
client
over various time windows to spot persistent, low-volume activity. -
Living-off-the-Land Techniques:
-
Session Hijacking Attempts: Detecting session anomalies often requires stateful analysis. A good starting point is to use the UI to find sessions (
session_id
) that are associated with multiple IP addresses (client_ip
).Filter for
event_type:AccessGranted
, then use the Chart Builder to group bysession_id
and find the distinct count ofclient_ip
. A count greater than 1 is suspicious.
Incident Response Workflows¶
Immediate Response Actions¶
Critical Threat Response:
-
Block Malicious IPs:
-
Geographic Blocking:
Evidence Collection¶
Preserve Investigation Data:
-
Export Relevant Events:
-
Document Attack Patterns:
Long-Term Threat Intelligence¶
Build Organizational Knowledge:
-
Create Custom Lists:
-
Update Detection Rules:
Incident Analysis and Reporting¶
Impact Assessment¶
Quantify Attack Impact:
-
Volume Analysis:
-
Resource Impact:
Create Investigation Report¶
Security Incident Report Template
Structured Incident Documentation:
## Security Incident Report - SQL Injection Campaign
### Executive Summary
- **Incident Type**: Coordinated SQL injection attack campaign
- **Duration**: 2024-08-08 14:25 - 15:30 UTC (65 minutes)
- **Source**: China-based infrastructure (primarily AS4134)
- **Impact**: All attacks successfully blocked by WAF
- **Status**: Contained, monitoring continues
### Attack Details
- **Primary Vector**: SQL injection via WordPress admin endpoints
- **Secondary Vectors**: XSS, command injection attempts
- **Tools Used**: Custom scripts, sqlmap signatures detected
- **Geographic Origin**: 78% China, 15% Russia, 7% other
### Response Actions
1. Real-time blocking via WAF rules
2. Enhanced monitoring of source networks
3. Temporary geographic rate limiting
4. IOC sharing with threat intelligence feeds
### Recommendations
1. Review WordPress plugin security posture
2. Implement additional admin endpoint protection
3. Consider geographic access restrictions
4. Enhance monitoring for similar campaigns
Optimize Security Posture¶
Learn from Attacks¶
Improve Detection Capabilities:
-
Enhance WAF Rules:
-
Improve Rate Limiting:
Threat Intelligence Integration¶
Leverage Investigation Insights:
- Update IP Reputation Lists:
- Add confirmed attack IPs to blocklists
- Share IOCs with security community
-
Monitor for infrastructure reuse
-
Behavioral Analysis:
- Create profiles for common attack patterns
- Implement machine learning for anomaly detection
- Develop predictive threat models
Troubleshooting Investigation Issues¶
Missing Event Data¶
Problem¶
Expected security events not appearing
Solutions¶
- Verify time range settings and timezone
- Check if events were rate limited or sampled
- Review firewall rule priorities and matching
- Confirm logging configuration is complete
Performance During Investigation¶
Problem¶
Slow query performance on large datasets
Solutions¶
- Use more specific time ranges for initial analysis
- Leverage indexed fields (IP, time, event type) in filters
- Use sampling for pattern analysis on very large datasets
- Export data for offline analysis if needed
False Positive Analysis¶
Problem¶
Legitimate traffic marked as threats
Solutions¶
- Review user agent patterns for false positives
- Analyze geographic patterns vs. user base
- Check for overly aggressive WAF rules
- Implement allow lists for known legitimate sources
Best Practices for Security Investigation¶
Investigation Methodology¶
- Start with high-level analytics, then drill down to specifics
- Document all findings and actions taken
- Preserve evidence before taking remediation actions
- Collaborate with development teams for context on application behavior
Continuous Improvement¶
- Regular review of security event patterns
- Update detection rules based on new threat intelligence
- Training on emerging attack techniques and tools
- Integration with broader security operations workflows
You now have comprehensive security investigation capabilities that enable rapid threat detection, detailed analysis, and effective incident response using Peakhour's rich security event data and analytics platform.