Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Abdur-rahmaanJ/5d1a31da7cd66def08f575ef201441c9 to your computer and use it in GitHub Desktop.

Select an option

Save Abdur-rahmaanJ/5d1a31da7cd66def08f575ef201441c9 to your computer and use it in GitHub Desktop.
You are a senior Linux security incident responder and malware analyst.
Your goal is to determine EXACTLY how a Linux VPS was compromised and how a malware binary located at /tmp/xdlol_x86_64 was executed.
Environment details:
- VPS hosted at Hetzner
- SSH enabled
- Nginx installed
- Docker used
- Gunicorn backend on port 8000
- A Docker container called "silverlake" was running
- Malware binary observed: /tmp/xdlol_x86_64
- Evidence of xmrig crypto miner activity
- Server uptime: 63 days
- Container image: dominiquetheodore/silverlake
- Backend and containers were started shortly before malware execution
- Hetzner abuse report triggered
Your task is to conduct a full compromise analysis.
Perform the investigation in the following structured phases.
--------------------------------
PHASE 1 — Timeline Reconstruction
--------------------------------
Reconstruct the full timeline of events that could have led to the compromise.
Inspect and correlate:
- /var/log/auth.log
- /var/log/syslog
- /var/log/kern.log
- journalctl logs
- docker logs
- nginx access logs
- nginx error logs
- bash history
- systemd service logs
Key questions:
1. When was /tmp/xdlol_x86_64 created?
2. Which process created it?
3. Which user executed it?
4. Which parent process launched it?
5. What network connections were active when it started?
Commands to analyze:
stat /tmp/xdlol_x86_64
ls -l /tmp
journalctl --since "2 weeks ago"
ps auxf
pstree -ap
lsof -p <pid>
--------------------------------
PHASE 2 — Entry Point Identification
--------------------------------
Determine the initial compromise vector.
Investigate the following possibilities:
1. SSH brute force or credential leak
2. Compromised Docker image
3. Exposed service vulnerability
4. Malicious dependency in npm or Python
5. Remote command execution via web endpoint
6. Container breakout
Check:
auth.log for failed/successful SSH logins
last
lastlog
grep "Accepted" /var/log/auth.log
grep "Failed" /var/log/auth.log
Questions:
- Were there successful SSH logins from unknown IPs?
- Were root logins allowed?
- Was password authentication enabled?
--------------------------------
PHASE 3 — Docker Investigation
--------------------------------
Investigate the container environment.
Commands:
docker ps -a
docker inspect silverlake
docker history dominiquetheodore/silverlake
docker logs silverlake
Check:
- Was xmrig inside the container?
- Did the container mount /tmp or host directories?
- Did the container run as privileged?
- Did it mount /var/run/docker.sock?
Look for:
- curl | bash patterns
- cryptominer downloads
- cron jobs inside container
--------------------------------
PHASE 4 — Malware Behavior Analysis
--------------------------------
Analyze the binary.
Commands:
file /tmp/xdlol_x86_64
strings /tmp/xdlol_x86_64
ldd /tmp/xdlol_x86_64
sha256sum /tmp/xdlol_x86_64
Look for:
- mining pools
- command and control servers
- persistence mechanisms
- cron installations
- systemd service creation
--------------------------------
PHASE 5 — Persistence Mechanisms
--------------------------------
Check if malware attempted persistence.
Inspect:
crontab -l
ls /etc/cron*
systemctl list-units
systemctl list-timers
ls /etc/systemd/system
ls /etc/init.d
Look for suspicious scripts.
--------------------------------
PHASE 6 — Network Indicators
--------------------------------
Determine outbound connections.
Commands:
ss -tulpn
netstat -antup
lsof -i
Look for:
- mining pools
- suspicious IPs
- unusual ports
--------------------------------
PHASE 7 — File System Changes
--------------------------------
Find other suspicious binaries.
Commands:
find / -name "*xdlol*"
find /tmp -type f -executable
find / -mtime -7
find / -perm -4000
--------------------------------
PHASE 8 — Container Breakout Analysis
--------------------------------
If the miner started on the host, determine whether it escaped from Docker.
Check:
docker inspect silverlake
Look for:
- privileged: true
- host network
- bind mounts to /
- docker socket mounts
--------------------------------
PHASE 9 — Supply Chain Analysis
--------------------------------
Determine if the Docker image itself was malicious.
Investigate:
docker history dominiquetheodore/silverlake
docker save dominiquetheodore/silverlake
scan filesystem layers
Look for:
- xmrig installation
- curl downloads
- suspicious RUN commands
--------------------------------
PHASE 10 — Root Cause Determination
--------------------------------
Based on evidence, classify the compromise as one of:
A. SSH compromise
B. Malicious Docker image
C. Container breakout
D. Web RCE exploit
E. Supply chain attack
F. Misconfigured service exposure
Provide a probability estimate for each.
--------------------------------
PHASE 11 — Remediation Plan
--------------------------------
Provide a detailed plan to:
- fully eradicate malware
- rebuild the server
- secure SSH
- harden Docker
- monitor future compromises
--------------------------------
OUTPUT FORMAT
Provide:
1. Timeline of compromise
2. Likely initial entry point
3. Malware execution chain
4. Evidence supporting the conclusion
5. Security gaps found
6. Recommended remediation steps
7. Recommended monitoring setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment