CyberLearn
← Back to beginner
Beginner

Systemd Persistence Scanner

Hunt Linux persistence mechanisms

Log in to track progress
2–3hGo

What you'll learn

  • Persistence techniques
  • Systemd internals
  • Cron analysis
  • Threat hunting
███████╗███████╗███╗   ██╗████████╗
██╔════╝██╔════╝████╗  ██║╚══██╔══╝
███████╗█████╗  ██╔██╗ ██║   ██║
╚════██║██╔══╝  ██║╚██╗██║   ██║
███████║███████╗██║ ╚████║   ██║
╚══════╝╚══════╝╚═╝  ╚═══╝   ╚═╝

Cybersecurity Projects Go License: AGPLv3 MITRE ATT&CK

Linux persistence mechanism scanner. Drop a single binary, find every backdoor.

This is a quick overview. Security theory, architecture, and full walkthroughs are in the learn modules.

What It Does

  • Scans 12+ persistence mechanism categories: systemd, cron, shell profiles, SSH, LD_PRELOAD, kernel modules, udev rules, init.d, XDG autostart, at jobs, MOTD scripts, and PAM modules
  • Applies heuristic detection for reverse shells, download-and-execute chains, encoded payloads, alias hijacking, and temp directory abuse
  • Severity scoring from info to critical with MITRE ATT&CK technique mapping on every finding
  • Baseline mode saves a clean-system snapshot, then highlights only new findings on subsequent runs
  • Compiles to a single static binary with zero dependencies for portable deployment

Quick Start

go install github.com/CarterPerez-dev/sentinel/cmd/sentinel@latest
sentinel scan

[!TIP] This project uses just as a command runner. Type just to see all available commands.

Install: curl -sSf https://just.systems/install.sh | bash -s -- --to ~/.local/bin

Commands

CommandDescription
sentinel scanScan for all persistence mechanisms
sentinel scan --jsonOutput results as structured JSON
sentinel scan --min-severity highOnly show high and critical findings
sentinel scan --root /mnt/targetScan a mounted filesystem or chroot
sentinel baseline saveSave current state as a clean baseline
sentinel baseline diffShow only new findings since baseline

Example Output

  [CRITICAL] Library in ld.so.preload
         Path: /etc/ld.so.preload
         Evidence: /dev/shm/.evil.so
         MITRE: T1574.006

  [HIGH] Suspicious cron entry: download-and-execute chain
         Path: /etc/cron.d/updater
         Evidence: */5 * * * * root curl http://... | bash
         MITRE: T1053.003

  [MEDIUM] Recently modified unit file
         Path: /etc/systemd/system/backdoor.service
         Evidence: Modified within the last 24 hours
         MITRE: T1543.002

  Summary: 1 critical 1 high 1 medium 0 low 4 info

Scanners

ScannerMITRE TechniqueWhat It Checks
systemdT1543.002, T1053.006Service/timer units, ExecStart directives, drop-in overrides
cronT1053.003System/user crontabs, cron.d, periodic directories, anacron
profileT1546.004Shell RC files, /etc/profile.d, bashrc/zshrc injections
sshT1098.004authorized_keys options, sshd_config, SSH rc scripts
ld_preloadT1574.006/etc/ld.so.preload, ld.so.conf.d, /etc/environment
kernelT1547.006modules-load.d, modprobe.d install hooks
udevT1546Udev rules with RUN+= directives
initdT1037.004Init.d scripts, rc.local content
xdgT1547.013XDG autostart .desktop files
atjobT1053.001Pending at job spool
motdT1546update-motd.d login scripts
pamT1556.003PAM configs, pam_exec.so, pam_permit.so in auth

Learn

This project includes step-by-step learning materials covering persistence techniques, detection engineering, and implementation details.

ModuleTopic
00 - OverviewPrerequisites and quick start
01 - ConceptsLinux persistence and MITRE ATT&CK
02 - ArchitectureSystem design and data flow
03 - ImplementationCode walkthrough
04 - ChallengesExtension ideas and exercises

License

AGPL 3.0