Commit Graph

4 Commits

Author SHA1 Message Date
cschantz 198abeb564 Sync v2 with multi-tier distributed DDoS enhancements 2025-12-24 20:01:27 -05:00
cschantz 7719cfecd1 Add distributed DDoS detection with dynamic thresholds
CRITICAL FIX for botnet-style attacks

USER REPORT:
"512 SYN_RECV connections but live monitor only shows 2 IPs"

ROOT CAUSE:
Threshold was hardcoded at >20 connections per IP. This works for
focused attacks (one IP, many connections) but FAILS for distributed
DDoS where 50+ IPs each send 5-15 connections.

Example from user's attack:
- 512 total SYN_RECV connections
- Spread across 40+ attacker IPs
- Top attacker: 107 packets (likely <20 active connections)
- Result: NONE detected, server getting hammered

SOLUTION - Dynamic Threshold:

1. Total SYN_RECV Detection (line 2226)
   Count total SYN_RECV across all IPs
   If > 100 total → distributed_attack mode activated

2. Adaptive Thresholds (lines 2247-2253)
   NORMAL MODE: threshold = 20 connections
   - Focused attack (1-2 IPs)
   - High bar to avoid false positives

   DISTRIBUTED MODE: threshold = 5 connections
   - Botnet attack (many IPs)
   - Catches participants in coordinated attack
   - Triggers when total > 100

DETECTION EXAMPLES:

Focused Attack (unchanged behavior):
- 1 IP with 150 SYN_RECV
- Total: 150, threshold: 20
- Result: 1 IP detected, blocked

Distributed Botnet (NEW):
- 50 IPs each with 10 SYN_RECV
- Total: 500, threshold: 5 (distributed mode)
- Result: ALL 50 IPs detected, reputation tracked
- Progressive blocking as scores accumulate

User's Attack (512 total):
- distributed_attack = 1 (512 > 100)
- threshold = 5
- All IPs with >5 connections now tracked
- Likely catches 30-40 of the attackers

This allows catching both attack patterns without flooding
the system with false positives during normal traffic.
2025-12-24 19:57:22 -05:00
cschantz aadc3be64a Sync v2 with main: Add all missing auto-blocking and SYN flood enhancements
- Added missing quick_block_ip() function
- Added INSTANT_BLOCK for score 100
- Added AUTO_BLOCK for score >=80
- Added full SYN flood reputation tracking
- Added intelligent threat scoring (persistence, escalation, threat intel)
- v2 was 7 days behind main, now synced
2025-12-24 19:54:57 -05:00
cschantz db187f8f0f Fix menu standards: Add RED 0 back buttons to 3 menus
Fixed php-optimizer.sh:
- Changed 'q) Quit' to '0) Exit' with RED color
- Updated case handler to use '0' instead of 'q|Q'

Fixed live-attack-monitor-v2.sh (2 menus):
1. show_blocking_menu:
   - Changed 'Cancel' to 'Back' with RED 0
2. show_security_hardening_menu:
   - Changed 'q) Return to Monitor' to '0) Back' with RED color
   - Updated case handler to use '0' instead of 'q|Q'

Progress: 3/9 menus fixed
Remaining: bot-analyzer (2), malware-scanner (1), live-attack-monitor (2), acronis-logs (1)
2025-12-17 01:31:06 -05:00