Threat Detection
Category: Engineering
Domain: Security Operations
Overview
The Threat Detection skill provides automated analysis of log files for suspicious patterns including brute force attacks, injection attempts, unusual access patterns, and privilege escalation indicators. It helps security teams triage log data and identify threats before they escalate.
Clarify First
Before analyzing logs, confirm these inputs. If any is unknown or vague, ASK — do not assume:
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
Quick Start
# Analyze a log file for threat signals
python scripts/threat_signal_analyzer.py --file /var/log/auth.log
# Analyze with specific threat category
python scripts/threat_signal_analyzer.py --file access.log --category injection
# JSON output for SIEM integration
python scripts/threat_signal_analyzer.py --file auth.log --format json
# Set minimum severity
python scripts/threat_signal_analyzer.py --file access.log --min-severity high
Tools Overview
threat_signal_analyzer.py
Analyzes log files for suspicious activity patterns across multiple threat categories.
| Feature |
Description |
| Brute force detection |
Identifies repeated failed login attempts from same source |
| Injection scanning |
Detects SQL injection, XSS, command injection in requests |
| Access anomalies |
Flags unusual access times, forbidden paths, admin probes |
| Privilege escalation |
Detects sudo abuse, role changes, permission modifications |
| Rate analysis |
Identifies request flooding and denial-of-service patterns |
| IP reputation |
Flags known-bad patterns (scanners, bots, TOR indicators) |
Workflows
Log Analysis Workflow
- Collect - Gather logs from auth, access, application sources
- Analyze - Run threat_signal_analyzer.py across log files
- Triage - Review critical and high severity findings first
- Correlate - Cross-reference findings across log sources
- Respond - Block IPs, reset credentials, escalate as needed
Incident Investigation Workflow
- Scope - Identify time window and affected systems
- Scan - Run analyzer on all relevant log files
- Timeline - Build timeline from threat signals
- Impact - Assess what was accessed or modified
- Contain - Block threat actors and patch vulnerabilities
Continuous Monitoring
# Cron job: analyze auth logs every hour
python scripts/threat_signal_analyzer.py --file /var/log/auth.log --format json --min-severity high > /tmp/threat_report.json
# CI/CD: scan application logs on deployment
python scripts/threat_signal_analyzer.py --file app.log --category injection --format json
Reference Documentation
- Threat Indicators - Common attack patterns, indicators of compromise, response playbooks
Common Patterns Quick Reference
Threat Categories
| Category |
Signals |
Severity |
| Brute force |
5+ failed logins from same IP in 5 min |
High |
| SQL injection |
UNION SELECT, OR 1=1, DROP TABLE in requests |
Critical |
| XSS |
script tags, javascript: URIs, event handlers in input |
High |
| Path traversal |
../ sequences, /etc/passwd access attempts |
High |
| Command injection |
; cat /etc/passwd, |
nc, backtick usage |
| Admin probing |
/admin, /wp-admin, /phpmyadmin access attempts |
Medium |
| Rate flooding |
100+ requests/minute from single IP |
High |
Severity Levels
- CRITICAL - Active exploitation attempt (injection, RCE)
- HIGH - Likely attack in progress (brute force, privilege escalation)
- MEDIUM - Suspicious activity requiring investigation
- LOW - Informational, possible false positive
Response Actions
| Severity |
Immediate Action |
Follow-Up |
| Critical |
Block IP, alert SOC |
Incident report, forensics |
| High |
Rate limit, monitor |
Review access, check damage |
| Medium |
Log and monitor |
Weekly review |
| Low |
Log only |
Monthly trend analysis |
1---2name: threat-detection3description: This skill should be used when the user asks to "analyze logs for threats", "detect suspicious activity", "scan for brute force attempts", "identify injection attacks", or "audit access patterns for anomalies".4license: MIT + Commons Clause5---6# Threat Detection
7
8> **Category:** Engineering
9> **Domain:** Security Operations
10
11## Overview
12
13The **Threat Detection** skill provides automated analysis of log files for suspicious patterns including brute force attacks, injection attempts, unusual access patterns, and privilege escalation indicators. It helps security teams triage log data and identify threats before they escalate.
14
15## Clarify First
16
17Before analyzing logs, confirm these inputs. If any is unknown or vague, ASK — do not assume:
18
19- [ ] **Log file & source type** — auth / access / application logs to analyze (`--file`; the subject of detection)
20- [ ] **Threat category** — brute force / injection / access anomaly / privilege escalation (`--category`; focuses the scan)
21- [ ] **Minimum severity** — the reporting/alert threshold (`--min-severity`; changes which signals surface and any SIEM/CI gate)
22
23Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
24
25## Quick Start
26
27```bash
28# Analyze a log file for threat signals
29python scripts/threat_signal_analyzer.py --file /var/log/auth.log
30
31# Analyze with specific threat category
32python scripts/threat_signal_analyzer.py --file access.log --category injection
33
34# JSON output for SIEM integration
35python scripts/threat_signal_analyzer.py --file auth.log --format json
36
37# Set minimum severity
38python scripts/threat_signal_analyzer.py --file access.log --min-severity high
39```
40
41## Tools Overview
42
43### threat_signal_analyzer.py
44
45Analyzes log files for suspicious activity patterns across multiple threat categories.
46
47| Feature | Description |
48|---------|-------------|
49| Brute force detection | Identifies repeated failed login attempts from same source |
50| Injection scanning | Detects SQL injection, XSS, command injection in requests |
51| Access anomalies | Flags unusual access times, forbidden paths, admin probes |
52| Privilege escalation | Detects sudo abuse, role changes, permission modifications |
53| Rate analysis | Identifies request flooding and denial-of-service patterns |
54| IP reputation | Flags known-bad patterns (scanners, bots, TOR indicators) |
55
56## Workflows
57
58### Log Analysis Workflow
59
601. **Collect** - Gather logs from auth, access, application sources
612. **Analyze** - Run threat_signal_analyzer.py across log files
623. **Triage** - Review critical and high severity findings first
634. **Correlate** - Cross-reference findings across log sources
645. **Respond** - Block IPs, reset credentials, escalate as needed
65
66### Incident Investigation Workflow
67
681. **Scope** - Identify time window and affected systems
692. **Scan** - Run analyzer on all relevant log files
703. **Timeline** - Build timeline from threat signals
714. **Impact** - Assess what was accessed or modified
725. **Contain** - Block threat actors and patch vulnerabilities
73
74### Continuous Monitoring
75
76```bash
77# Cron job: analyze auth logs every hour
78python scripts/threat_signal_analyzer.py --file /var/log/auth.log --format json --min-severity high > /tmp/threat_report.json
79
80# CI/CD: scan application logs on deployment
81python scripts/threat_signal_analyzer.py --file app.log --category injection --format json
82```
83
84## Reference Documentation
85
86- [Threat Indicators](references/threat-indicators.md) - Common attack patterns, indicators of compromise, response playbooks
87
88## Common Patterns Quick Reference
89
90### Threat Categories
91| Category | Signals | Severity |
92|----------|---------|----------|
93| Brute force | 5+ failed logins from same IP in 5 min | High |
94| SQL injection | UNION SELECT, OR 1=1, DROP TABLE in requests | Critical |
95| XSS | script tags, javascript: URIs, event handlers in input | High |
96| Path traversal | ../ sequences, /etc/passwd access attempts | High |
97| Command injection | ; cat /etc/passwd, | nc, backtick usage | Critical |
98| Admin probing | /admin, /wp-admin, /phpmyadmin access attempts | Medium |
99| Rate flooding | 100+ requests/minute from single IP | High |
100
101### Severity Levels
102- **CRITICAL** - Active exploitation attempt (injection, RCE)
103- **HIGH** - Likely attack in progress (brute force, privilege escalation)
104- **MEDIUM** - Suspicious activity requiring investigation
105- **LOW** - Informational, possible false positive
106
107### Response Actions
108| Severity | Immediate Action | Follow-Up |
109|----------|-----------------|-----------|
110| Critical | Block IP, alert SOC | Incident report, forensics |
111| High | Rate limit, monitor | Review access, check damage |
112| Medium | Log and monitor | Weekly review |
113| Low | Log only | Monthly trend analysis |