Commit Graph

11 Commits

Author SHA1 Message Date
56d45fe7c2 feat(waf): Add sensitivity-based auto-ban system with CrowdSec integration
WAF Auto-ban Features:
- Three sensitivity levels: aggressive, moderate, permissive
- Aggressive: Immediate ban on first critical threat
- Moderate: Ban after 3 attempts in 5 minutes (default)
- Permissive: Ban after 5 attempts in 1 hour
- Attempt tracking with configurable thresholds

Critical threats (immediate in aggressive/moderate):
- CVE exploits, SQL injection, Command injection
- XXE, Log4Shell, SSTI attacks

CrowdSec Integration:
- Auto-ban requests written to /srv/mitmproxy/autoban-requests.log
- Cron job processes bans every minute via mitmproxyctl
- Bans sent to CrowdSec for network-wide enforcement

New Commands:
- mitmproxyctl process-autoban: Process pending bans
- mitmproxyctl reload-autoban: Reload config after UCI changes

CrowdSec Dashboard:
- Added ban button to alerts page
- Modal confirmation with 24h ban duration
- Real-time banned IP tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:40:52 +01:00
94c02c9224 feat(waf): Add comprehensive CVE detection patterns
Added 60+ CVE patterns for WAF filtering:

2021 CVEs:
- CVE-2021-44228 (Log4Shell)
- CVE-2021-41773 (Apache path traversal)
- CVE-2021-26084 (Confluence OGNL)
- CVE-2021-34473 (ProxyShell)
- CVE-2021-21972 (VMware vCenter)
- CVE-2021-22986 (F5 BIG-IP)

2022 CVEs:
- CVE-2022-22963 (Spring Cloud Function)
- CVE-2022-22965 (Spring4Shell)
- CVE-2022-1388 (F5 Auth Bypass)
- CVE-2022-26134 (Confluence OGNL)
- CVE-2022-41040 (ProxyNotShell)
- CVE-2022-42889 (Apache Commons Text)

2023 CVEs:
- CVE-2023-34362 (MOVEit Transfer)
- CVE-2023-22515/22518 (Confluence)
- CVE-2023-46747 (F5 BIG-IP)
- CVE-2023-27997 (Fortinet SSL VPN)
- CVE-2023-20198 (Cisco IOS XE)
- CVE-2023-4966 (Citrix Bleed)

2024 CVEs:
- CVE-2024-3400 (PAN-OS)
- CVE-2024-21887 (Ivanti)
- CVE-2024-1709 (ScreenConnect)
- CVE-2024-27198 (TeamCity)
- CVE-2024-23897 (Jenkins)
- CVE-2024-4577 (PHP-CGI)
- CVE-2024-6387 (OpenSSH)
- CVE-2024-55591 (FortiOS)

2025 CVEs:
- CVE-2025-15467 (OpenSSL CMS)
- CVE-2025-0282 (Ivanti)
- CVE-2025-23006 (SonicWall)

Plus CMS, Framework, Database, CI/CD, and Cloud patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:27:31 +01:00
2ce7c5da3a fix(security): Move CVE-2025-15467 detection before SSRF check
Content-Type based CVE detection must happen before SSRF patterns
to avoid false positives when routing through localhost.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:44:23 +01:00
77e572a787 feat(security): Add CVE-2025-15467 detection and mitmproxy threat integration
- Add CVE-2025-15467 (OpenSSL CMS stack overflow) detection patterns
- Detect S/MIME/CMS content types that may be exploited
- Integrate mitmproxy threats into security-threats dashboard
- Security threats page now shows real-time WAF detections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:34:20 +01:00
f4b9c910c5 feat(mitmproxy): Add WAN protection mode for incoming traffic inspection
Add WAF-like functionality to mitmproxy for protecting services exposed
to the internet. Incoming WAN traffic is redirected through mitmproxy
for threat detection before reaching backend services.

Features:
- WAN protection mode with nftables rules for incoming traffic
- Enhanced bot scanner detection with 50+ scanner signatures
- Behavioral detection for config/admin/backup/shell hunting
- CrowdSec integration with new scenarios for bot scanners
- LuCI interface for WAN protection configuration
- DPI mirror mode support (secondary feature)

New CrowdSec scenarios:
- secubox/mitmproxy-botscan: Detect automated reconnaissance
- secubox/mitmproxy-shell-hunter: Detect shell/backdoor hunting
- secubox/mitmproxy-config-hunter: Detect credential file hunting
- secubox/mitmproxy-suspicious-ua: Detect suspicious user agents

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:07:40 +01:00
29f55ec6bc feat(mitmproxy): Add enhanced threat patterns and README
Add modern attack detection patterns:
- SSTI (Jinja2, Twig, FreeMarker, ERB, Thymeleaf)
- Prototype Pollution (__proto__, constructor[])
- GraphQL abuse (introspection, deep nesting)
- JWT attacks (alg:none bypass, exposed tokens)
- CVE-2024-21887 (Ivanti Connect Secure)
- CVE-2024-1709 (ScreenConnect auth bypass)
- CVE-2024-27198 (TeamCity auth bypass)

Add comprehensive README documenting:
- Threat detection patterns and categories
- CrowdSec integration and scenarios
- GeoIP database setup
- File paths and dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 05:45:25 +01:00
7236449223 fix(mitmproxy): Use container-relative path for GeoIP database
The mitmproxy container mounts /srv/mitmproxy as /data, so the GeoIP
database path must use /data/GeoLite2-Country.mmdb for the addon to
find it. This enables proper country detection for external IPs in
threat logs, allowing CrowdSec SSRF scenarios to correctly identify
and ban foreign attackers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 05:30:46 +01:00
7b67b0329a feat(mitmproxy): Integrate threat detection with CrowdSec for auto-banning
- Change analytics addon to write threats to /data/threats.log (bind-mounted to host)
- Add CrowdSec acquisition config to read from /srv/mitmproxy/threats.log
- Add parser for mitmproxy JSON threat logs with source_ip in Meta
- Add scenarios for web attacks, scanners, SSRF, and CVE exploits
- Update RPCD to read alerts from host-visible path without lxc-attach

This enables automatic IP banning when mitmproxy detects:
- SQL injection, XSS, command injection (capacity: 3, ban: 15m)
- Path traversal, XXE, LDAP injection, Log4Shell
- Aggressive web scanning (capacity: 10, ban: 10m)
- SSRF attempts from external IPs (capacity: 5, ban: 10m)
- Known CVE exploits (immediate trigger, ban: 30m)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:49:14 +01:00
92f73fc3d2 feat(mitmproxy): Add HAProxy backend inspection and token auth
- Add HAProxy → mitmproxy → Backend inspection chain for filtering
  all vhost traffic through mitmproxy with threat detection
- Add haproxy_router.py addon for Host-based request routing
- Add mitmproxyctl commands: sync-routes, haproxy-enable, haproxy-disable
- Add auth token to status response for Web UI auto-authentication
- Add HAProxy Backend Inspection section to LuCI status page with
  enable/disable/sync controls
- Add HAProxy Router settings section to LuCI settings page
- LXC container now supports dual-port mode (8888 + 8889 for HAProxy)
- Token displayed with copy button in dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:49:05 +01:00
a6d2b75db8 feat(mitmproxy): Enhanced threat detection analytics v2.0
Analytics addon enhancements:
- SQL injection detection (25+ patterns)
- XSS detection (30+ patterns)
- Command injection detection (20+ patterns)
- Path traversal detection (12+ patterns)
- SSRF detection (10+ patterns)
- XXE/LDAP injection detection
- Log4Shell (CVE-2021-44228) detection
- Known CVE patterns (Spring4Shell, MOVEit, etc.)
- Rate limiting and bot detection
- CrowdSec integration with severity levels

LuCI interface rewrite (KISS):
- Simplified status view with threat monitor
- Security alerts table with severity badges
- Service controls (start/stop/restart)
- RPCD backend with alerts/threat_stats endpoints
- Clean settings form

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:39:36 +01:00
9acab29c34 feat(v0.17): P2P Mesh Recovery, MITM Analytics, Swiss Army Knife
Major features:
- P2P Mesh distributed recovery infrastructure with blockchain catalog
- MITM analytics proxy for external access monitoring (IP, country, scans)
- SecuBox Swiss unified CLI tool for management & recovery
- Python remote management console (secubox-console)
- Multi-theme landing page generator (mirrorbox, cyberpunk, minimal, terminal, light)
- Service Registry enhancements with health check and network diagnostics
- Services page modernization with Service Registry API integration

New components:
- secubox-swiss: Swiss Army Knife unified management tool
- secubox-mesh: P2P mesh networking and sync
- secubox-recover: Snapshot, profiles, rollback, reborn scripts
- secubox-console: Python remote management app
- secubox_analytics.py: MITM traffic analysis addon

Fixes:
- Service Registry ACL permissions for secubox services page
- Port status display (firewall_open detection)
- RPC response handling for list_services

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00