You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FLUX – Advanced Host-Based Intrusion Detection System for Linux
DESCRIPTION
FLUX is a comprehensive, advanced Host-based Intrusion Detection System (HIDS) built specifically for Linux environments. It operates in real time, continuously monitoring system activity through 13 parallel threads to detect malicious behavior, unauthorized changes, and signs of compromise — from initial reconnaissance all the way to post-exploitation persistence.
Unlike traditional log scanners or single-purpose security scripts, FLUX employs a dual-engine architecture that combines psutil-based process polling with kernel-level auditd execve hooking. Both engines share a unified deduplication layer ensuring no command generates duplicate alerts regardless of which engine captures it first. This ensures no command escapes detection: psutil catches long-running processes every second, while auditd captures every execve syscall at the kernel level — including commands that complete in milliseconds (sudo -l, id, groups, uname -r, find / -perm -4000). The auditd integration automatically configures 15 kernel-level syscall rules and file watches, covering SUID execution, UID change syscalls, root processes from writable directories, /proc/self/mem writes, copy_file_range abuse, and real-time modification detection on sudoers and cron directories.
FLUX integrates 1,259 GTFOBins exploitation patterns covering 200+ Linux binaries with a sophisticated pattern generalization engine that adapts literal GTFOBins examples to match real-world command variations. The engine automatically handles seven common discrepancies between GTFOBins documentation and actual execve cmdlines: literal placeholder paths replaced with filesystem wildcards, quoted DATA strings generalized to arbitrary content, single quotes around -c and -e arguments made optional (shells strip them before execve), dollar-sign variables preserved as literals rather than regex anchors, /bin/sh expanded to match /bin/bash, /bin/dash, and /bin/zsh, comma-space separators made flexible in function calls, and semicolon separators matched with or without whitespace. Versioned binary aliases (python3, python3.11, php8.1, ruby3.0, node20, lua5.4, gcc-12, java17, and more) are automatically mapped to their base GTFOBins rules.
On top of the GTFOBins engine, 22 behavioral alert types derived from the HiveSecurity Linux Privilege Escalation guide provide complete coverage of all six attack phases: reconnaissance (SUID enumeration, world-writable file discovery, sudo -l, cron inspection, kernel version checking), SUID/SGID abuse (euid mismatch detection via auditd with whitelisted system binaries, -p flag shell spawning, chmod +s backdoors), sudo misconfiguration (shell spawning detection that distinguishes malicious os.system/os.execl calls from benign -c usage, LD_PRELOAD injection with shared library compilation detection), cron job hijacking (file modification watches plus content-aware diff alerts showing exactly what was added), PATH injection (both cmdline-based detection and /proc/*/environ polling that catches shell builtin export commands invisible to execve monitoring), Linux capabilities abuse (getcap/setcap detection plus setuid syscall monitoring), and kernel exploits including DirtyFrag (CVE-2026-46331 — page cache corruption via pagemap), DirtyClone (CVE-2026-43503 — memory mapping file manipulation), DirtyPipe (CVE-2022-0847 — /proc/self/mem overwrite), PwnKit (CVE-2021-4034 — suspicious pkexec execution), and CopyFail (copy.fail URL access, splice/copy_file_range abuse, curl-pipe-to-interpreter-su pattern).
Beyond command-level detection, FLUX provides comprehensive system-wide monitoring across eight additional layers. File integrity monitoring via SHA-256 hashing with 3-second polling covers both system files (/etc/passwd, /etc/shadow, /etc/sudoers, /etc/group, /etc/crontab) and HIDS configuration files, supplemented by kernel-level auditd file watches for real-time sudoers and cron modification alerts independent of the polling cycle. User and group account monitoring polls /etc/passwd and /etc/group every 5 seconds using set-difference comparison, detecting new user creation, sudo group membership changes, wheel group modifications, and /etc/sudoers hash changes with automatic corrupted-baseline recovery. Persistence detection monitors all common autostart locations — system-wide paths (/etc/rc.local, /etc/init.d/, /etc/systemd/system/, all cron directories) plus every user's shell RC files under /home/* and /root — with content-aware diffing that shows the exact lines added or removed, not just which file changed. Kernel and rootkit monitoring provides three detection vectors: loaded module tracking with hash verification and whitelist comparison, hidden process detection by cross-referencing /proc PIDs against psutil's process list, and hidden file discovery by comparing os.listdir() output against ls -A results. USB device enumeration captures vendor ID, product ID, manufacturer, serial number, speed class, and max power draw for BadUSB and malicious HID detection. Network surveillance runs across three threads: new process tracking, sustained upload/download detection with 50KB/s threshold and spike analysis, and internet connectivity monitoring via ICMP probes. System resource monitoring detects CPU spikes above 80% and memory usage over 500MB with automatic browser process whitelisting (Firefox, Chrome, Chromium, Brave). Environment scanning polls /proc/*/environ every 2 seconds for PATH hijacking, catching shell builtin export commands that never appear in execve logs.
All alerts are delivered in real time to Discord via structured webhooks with per-alert-type icons and descriptions, enabling rapid incident response before damage occurs. The entire system runs as a single Python process with graceful Ctrl+C shutdown, automatic auditd rule cleanup on exit, and resilient JSON handling with automatic corrupted-baseline recovery.
PATH hijacking via writable directories (/tmp, /dev/shm)
User & group monitoring
/etc/passwd + /etc/group diffing (5s)
New users, sudo/wheel group changes, sudoers modifications
Key Features
1. Auditd-Based Execve Monitoring
Real-time capture of every command executed on the system via kernel-level auditd hooks. Unlike process polling which misses short-lived commands (id, groups, sudo -l, uname -r, etc.), auditd catches everything at the syscall level before the process even starts.
Tails /var/log/audit/audit.log in real time with log rotation handling
Deduplicates commands and detects SUID abuse (euid=0 + auid!=0)
2. GTFOBins Exploitation Detection
Detects exploitation of 200+ Linux binaries based on 1,259 GTFOBins patterns. Every pattern is automatically generalized to match real-world command variations.
Pattern generalization: Literal placeholders (DATA, /path/to/output-file) converted to regex wildcards — 799/1,259 patterns match real commands
Quote generalization: -c '...' and -e '...' patterns match both quoted and unquoted cmdlines (shells strip quotes before execve)
Dollar sign fix: $i, $p variables in Perl/PHP patterns preserved as literal $ instead of regex anchors
Shell path generalization: /bin/sh also matches /bin/bash, /bin/dash, /bin/zsh
Comma-space generalization: ", " and "," both accepted in function call arguments
Versioned binary support: python3, python3.11, php8.1, ruby3.0, node20, lua5.4, gcc-12, java17 all correctly match base binary rules
Login shell filtering: -zsh, -bash etc. skipped unless containing exploitation patterns (eliminates noise from normal terminal usage)
3. Privilege Escalation Detection
Comprehensive detection coverage based on Linux privilege escalation attacks in 2026.
Alert
MITRE
What it detects
[SUID_ABUSE]
T1548.001
Process running as euid=0 spawned by non-root user (via auditd) — whitelists sudo, su, passwd, kmod, modprobe, modinfo
Additional auditd file watches provide kernel-level real-time detection for sudoers and cron directory modifications independent of the polling cycle.
5. Process & Network Monitoring
Multi-layered network and process surveillance running across three threads:
New process detection (detect_new_processes): Tracks all newly spawned processes via psutil PID comparison
Network traffic monitoring (monitor_network_traffic): Detects sustained uploads/downloads exceeding 50KB/s threshold with spike detection (5x average). Reports suspicious process details
Internet connectivity monitoring (monitor_internet): Pings 8.8.8.8 to detect network drops — useful for spotting intentional disruptions
6. Persistence Detection
Monitors all common persistence mechanisms for new or modified entries every second. Shows the actual changed content in alerts, not just the file path.
sudo ./dedsec-flux setup # Install as systemd service (auto-start on boot)
sudo ./dedsec-flux setup-webhook URL # Set Discord webhook URL
sudo ./dedsec-flux run # Run with live color-coded alert feed without installing
sudo ./dedsec-flux uninstall # Uninstall DEDSEC FLUX
Process scanning, resource monitoring, network traffic
pyusb
USB device enumeration
libnotify-bin
Desktop notifications via notify-send
Root privileges
/proc access, auditd control, log reading
Tested On
Kali Linux
Parrot OS
Ubuntu
Disclaimer
TO BE USED FOR EDUCATIONAL PURPOSES ONLY
The use of FLUX is the COMPLETE RESPONSIBILITY of the END-USER. Developers assume NO liability and are NOT responsible for any misuse or damage caused by this program.
About
FLUX – Advanced Host-Based Intrusion Detection System for Linux