forensicsfreemedium

PersistenceIsFutile

HackTheBox

Task: compromised Linux server with 8 backdoors (remote access + privilege escalation) to find and remove, then run verification script. Solution: systematic enumeration of SSH keys, crontabs, SUID binaries, shell RC files, MOTD scripts, and system users to identify and remediate all 8 persistence mechanisms.

$ ls tags/ techniques/
backdoor_enumeration_and_removalsuid_binary_detection_via_md5cron_persistence_analysisbashrc_alias_backdoor_detectionmotd_script_analysisssh_key_persistence_removaldns_txt_c2_detectionpasswd_shadow_modification_detection

$ cat /etc/rate-limit

Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.

PersistenceIsFutile — HackTheBox

Description

Hackers made it onto one of our production server. We've isolated it from the internet until we can clean the machine up. The IR team reported eight different backdoors on the server, but didn't say what they were and we can't get in touch with them. We need to get this server back into prod ASAP. Please find the eight backdoors (both remote access and privilege escalation) and remove them. Once done, run /root/solveme as root to check.

We are given SSH access to a compromised Linux server (credentials: user / hackthebox with sudo rights). The goal is to find and remove all 8 backdoors — both remote access and privilege escalation — then run /root/solveme as root to verify full remediation.

Analysis

Initial Reconnaissance

Connected via SSH and performed comprehensive enumeration across all common persistence locations:

Area CheckedCommand / PathPurpose
User accounts/etc/passwd, /etc/shadowDetect modified/added users
Running processesps auxfFind active backdoor processes
Listening portsss -tlnpDetect bind shells
SSH keys/root/.ssh/authorized_keysUnauthorized keys
Crontabscrontab -l, /etc/cron.daily/, /etc/cron.d/Scheduled persistence
SUID binariesfind / -perm -4000Privilege escalation
Systemd servicessystemctl list-unitsMalicious services
Shell RC files.bashrc, .profileLogin-triggered backdoors
MOTD scripts/etc/update-motd.d/SSH login triggers
PAM configs/etc/pam.d/Authentication backdoors

This systematic approach revealed all 8 backdoors spanning multiple persistence categories.

Solution

Backdoor 1 — Reverse Shell via MOTD (Remote Access)

Location: /etc/update-motd.d/30-connectivity-check → calls /var/lib/private/connectivity-check

...