Skip to content
Projets

À propos

HIRIS - Linux Host Incident Response & Isolation System. Detects intrusions, freezes attacker processes, blocks malicious IPs, and quarantines threats.

Sécurité et confidentialité

Comment ces chiffres sont mesurés

What you can do

  • Full-System Sweep: Checks every running process on startup and every 60 seconds, not just new ones 🔍.
  • Reverse Shell Detection: Shells with stdin/stdout wired to a TCP socket, and pty-upgraded shells behind nc, socat or python 🐚.
  • Web Shell Detection: Shells spawned by nginx, apache, php-fpm and friends, or running as www-data 🌐.
  • Metasploit Coverage: Meterpreter and msfvenom payloads in /tmp or /dev/shm, ssh_login sessions with no terminal, postgres_login superuser sessions 🎯.

Progression mesurée des étoiles

in 24h
0
in 7 days
Historique en cours
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

🛡️ HIRIS

██╗  ██╗██╗██████╗ ██╗███████╗
██║  ██║██║██╔══██╗██║██╔════╝
███████║██║██████╔╝██║███████╗
██╔══██║██║██╔══██╗██║╚════██║
██║  ██║██║██║  ██║██║███████║
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝╚══════╝

Python 3.10+ Platform License

HIRIS (Host Incident Response & Isolation System) is a Linux incident response tool that hunts attackers on the box and freezes them on the spot. Reverse shells, web shells, Meterpreter, fileless implants, brute-force break-ins: HIRIS catches them, stops the process with SIGSTOP, cuts the attacker's IP, quarantines the binary and journals everything so it can be rolled back.

❗ Note: HIRIS is built to stay out of your way. It never touches its own process tree, your SSH session, your source IP or core services like sshd, systemd and auditd.

📝 Description

Most tools tell you an attacker got in. HIRIS stops them while they are still in.

It sweeps every running process on startup, so a shell that was already there before HIRIS started gets caught too, then keeps watching for new ones. When something matches, the response plan runs in order:

  1. Isolate: the attacker's IP is dropped in a dedicated HIRIS iptables chain and live connections are killed with ss -K.
  2. Freeze: the process is stopped with SIGSTOP (or the cgroup v2 freezer). Nothing gets killed by default, so the evidence stays in memory.
  3. Quarantine: the binary is hashed and copied to the quarantine directory.
  4. Journal: every action is written to a JSONL journal that hiris thaw can reverse.

Freezes thaw themselves after freeze_timeout (1 hour by default) in case a heuristic misfires.

🌟 Features

  • Full-System Sweep: Checks every running process on startup and every 60 seconds, not just new ones 🔍.
  • Reverse Shell Detection: Shells with stdin/stdout wired to a TCP socket, and pty-upgraded shells behind nc, socat or python 🐚.
  • Web Shell Detection: Shells spawned by nginx, apache, php-fpm and friends, or running as www-data 🌐.
  • Metasploit Coverage: Meterpreter and msfvenom payloads in /tmp or /dev/shm, ssh_login sessions with no terminal, postgres_login superuser sessions 🎯.
  • Fileless Implant Detection: Processes running from memfd_create, code mapped from memfds, and large anonymous executable memory with a remote connection 👻.
  • Brute Force Correlation: An IP that brute-forces SSH or PostgreSQL and then holds a session gets frozen and blocked 🔗.
  • Database Shells: Shells spawned by postgres or mysqld (COPY ... FROM PROGRAM, UDF exec) 🗄️.
  • Persistence Watch: inotify on cron, systemd units and /root/.ssh 📌.
  • Network IDS: Snort-style packet inspection with its own readable YAML ruleset, plus support for Snort/Suricata .rules files like ET Open 📡.
  • Scan & Sweep Detection: SYN, UDP, NULL, FIN, XMAS scans, host and ping sweeps, SYN and ICMP floods 🛰️.
  • Attack Payloads: Log4Shell, Shellshock, reverse shell one-liners, Meterpreter stages, SQLi, XSS, path traversal, deserialization and scanner fingerprints on the wire 💉.
  • LAN Attacks: ARP spoofing (gateway included) and rogue DHCP servers 🕸️.
  • Per-Rule Actions: Each rule says alert or drop. Drop blocks the IP with iptables and can freeze the process that owns the connection 🚫.
  • Inline IPS: Freezes processes the moment auditd logs their execve, no polling delay ⚡.
  • Rollback: hiris thaw undoes freezes and iptables rules from the journal ↩️.
  • Self-Protection: Pre-flight guard refuses any plan that would hit HIRIS itself, your session or the services keeping the box alive 🧷.

🛠️ Setup

Requirements

  • Linux with /proc
  • Python 3.10+
  • Root (freezing other users' processes and reading /proc/*/fd needs it)
  • iptables and ss for isolation
  • auditd for hiris ips

Installation

  1. Clone the repository:

    git clone https://github.com/K3ysTr0K3R/HIRIS.git
    cd HIRIS
    
  2. Install it:

    sudo pip install -e .
    

    Or run it straight from the folder without installing:

    sudo python3 -m hiris --help
    
  3. Optional YARA support:

    sudo pip install -e ".[yara]"
    

🚀 Usage

Command-Line Options

Usage: hiris [-h] [--version] [-v] {scan,respond,watch,ips,thaw} ...

Commands:
  scan                  One-shot scan, print findings and the response plan
  respond               Scan and build the plan; --force applies it
  watch                 Continuously monitor and respond
  ips                   Inline IPS on the auditd execve stream
  thaw                  Reverse a response journal

Global:
  -v, --verbose         -v for INFO logs, -vv for DEBUG
  --version             Show version and exit

watch:
  --auto-respond        Execute the response plan automatically (default: alert only)
  --i-understand-the-risk
                        Required with --auto-respond
  --kill                After freezing, kill the process (irreversible)
  --break-glass         Strip unsafe actions instead of refusing the plan
  --interval SECONDS    Seconds between /proc polls (default: 2.0)
  --sweep-interval SECONDS
                        Seconds between full-system sweeps (default: 60, 0 = startup only)
  --network             Also capture and inspect network traffic
  --rules FILE          Suricata-style rules file for --network
  --interface IFACE     Capture interface (default: any)
  --config FILE         Config file (default: /etc/hiris/config.yaml)

scan / respond:
  --force               (respond) Apply the plan: isolate, freeze, quarantine
  --kill                (respond) Kill after freezing (irreversible)
  --json FILE           Write the full report as JSON
  --yara RULES          YARA rules to scan executables with
  --since-days N        Persistence lookback window
  --fail-on SEVERITY    Exit non-zero if a finding is this severe or worse

Watch Mode

Alert only, nothing gets touched:

sudo hiris watch

Freeze attackers automatically:

sudo hiris watch --auto-respond --i-understand-the-risk

HIRIS shows a live status line while it watches and prints an alert box the moment something is caught:

╭─ ◆ CRITICAL ──────────────────────────────────────────── shell_socket_stdio  16:26:11 ─╮
│ Reverse shell: bash (pid 516) has stdio on a network socket                            │
│                                                                                        │
│   bash pid 516 has its standard input/output connected to 10.10.14.7. Interactive      │
│   shells should never read from a TCP socket.                                          │
│                                                                                        │
│   →  10.10.14.7                                                                        │
│   ⊘  pid 516                                                                           │
╰────────────────────────────────────────────────────────────────────────────────────────╯

   ⚡  froze 516 · isolated 10.10.14.7 · journal-1795814771.jsonl

   [*] Monitoring system  ⠹  237 procs · 1 findings · 1 frozen · sweep in 42s · up 00:05:12

One-Shot Scan

sudo hiris scan
sudo hiris respond --force

Example:

sudo hiris scan --json report.json --fail-on high

Network IDS

Snort-style mode. Captures packets on every interface and runs them through the bundled hiris.yml ruleset:

sudo hiris net
sudo hiris net -i wlan0 --auto-respond --i-understand-the-risk
sudo hiris watch --network --auto-respond --i-understand-the-risk

Load extra rules, HIRIS YAML or Snort/Suricata, a file or a whole folder:

sudo hiris net --rules myrules.yml --rules /etc/suricata/rules/emerging-scan.rules
hiris rules --rules ./emerging-exploit.rules --list --errors

Writing a HIRIS rule:

rules:
  - { id: 2000001, name: "Redis CONFIG SET abuse", proto: tcp, dst_port: 6379, content: "CONFIG SET", nocase: true, action: drop, severity: critical }
  - { id: 2000002, name: "Login page brute force", proto: tcp, dst_port: [80, 443], content: "POST /login", threshold: { count: 20, seconds: 60 }, action: drop, severity: high }
  - { id: 2000003, name: "Reverse shell to anything", proto: tcp, regex: 'bash -i >& /dev/tcp/', action: drop, severity: critical, freeze: true }
Field What it does
id / name Unique rule number and the alert title
action alert or drop (drop blocks the remote IP when auto-respond is on)
severity critical, high, medium, low or info
proto tcp, udp, icmp or ip
src / dst IP, CIDR, list or $var, ! to negate
src_port / dst_port Port, list or range like "1000:2000"
direction inbound (default), outbound or any
flags TCP flags, Snort syntax (S, SA, F+, 0)
content String or list of strings that must all appear, |hex| allowed
regex / nocase Regex on the payload, case-insensitive matching
dsize / icmp_type Payload size (">800") and ICMP type
threshold Only fire after count hits in seconds
cooldown Seconds before the same rule alerts again for the same IP (default 60)
freeze On drop, also freeze the local process that owns the connection

Detector thresholds (port scan, floods, ARP, DHCP) live in the detectors: block of the same file. Loopback traffic is skipped unless ignore_loopback: false, and your own IPs plus the default gateway are never blocked. Snort/Suricata rules that depend on keywords HIRIS can't evaluate (flowbits, byte_test, ...) are skipped instead of guessed, so they can't false-positive. Python matching keeps up with a laptop's traffic; load ET Open by category, not emerging-all.rules.

Inline IPS

Freezes processes the moment auditd logs their execve, instead of waiting for the next /proc poll:

sudo hiris ips --auto-respond --i-understand-the-risk

Rollback

Every response writes a journal to /var/lib/hiris/reports/. Preview the rollback, then apply it:

sudo hiris thaw /var/lib/hiris/reports/journal-1795814771.jsonl
sudo hiris thaw /var/lib/hiris/reports/journal-1795814771.jsonl --force

Quarantined binaries are left on disk on purpose: they are evidence.

⚙️ Configuration

HIRIS reads /etc/hiris/config.yaml. Every key is optional:

quarantine_dir: /var/lib/hiris/quarantine
report_dir: /var/lib/hiris/reports
freeze_method: sigstop
freeze_timeout: 3600
ignore_loopback: true
protected_uids: [1000]
protected_ttys: [/dev/pts/0]
watch_auto_respond: false
watch_kill: false
db_auto_respond: false
correlation_window_sec: 3600
memory_allow_comms: [myjitapp]
ssh_brute_threshold: 5
ssh_brute_window_sec: 300
auth_log_path: /var/log/auth.log
auth_log_paths:
  5432: /var/log/postgresql/postgresql-18-main.log
brute_ignore_sources: [127.0.0.1, "::1", "[local]"]
network_auto_respond_sids: [2100498]
Key What it does
freeze_method sigstop, cgroup or both
freeze_timeout Seconds before a freeze thaws itself, 0 to never thaw
ignore_loopback Skip 127.0.0.1 connections. Set false to test against localhost
protected_uids / protected_ttys Never freeze processes owned by these
db_auto_respond Freeze PostgreSQL superuser TCP sessions (alert only by default)
correlation_window_sec How long a brute-forcing IP is remembered
memory_allow_comms Extra JIT runtimes allowed to have anonymous executable memory
auth_log_paths Extra per-port service logs to watch for brute force
brute_ignore_sources Failed logins from these IPs never count as brute force. Loopback by default, so Metasploit's own database login isn't flagged
network_auto_respond_sids Rule SIDs with alert action that should still block, e.g. ET Open rules

🔁 Run as a Service

A systemd unit ships in contrib/:

sudo cp -r . /opt/hiris
sudo cp contrib/hiris.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now hiris

Watch it live:

journalctl -u hiris -f

Run it in alert-only mode for a few days first and check what it would have frozen. Some web apps legitimately run shell commands.

🙏 Credits

Built by:

⚠️ Disclaimer

HIRIS freezes and can kill processes and changes firewall rules on the machine it runs on. A heuristic can misfire and stop something legitimate. Test it in alert-only mode first and use it at your own risk. The author is not responsible for any damage caused by this tool.

Explorer des projets similaires

Chargement…