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