VPS Tutorials
VPS Compromise: 24-Hour Response Checklist (2026): Disconnect First or Preserve Evidence First?
When many people suspect their VPS has been compromised, their first instinct is to shut it down, reboot it, or change passwords. But the real danger is often not acting too slowly—it's acting in the wrong order. Centered on the core question of "disconnect first or preserve evidence first," this article provides a first-24-hours response checklist better suited to Linux/VPS scenarios, helping you stop the bleeding first, preserve evidence next, and then decide whether to rebuild or restore.

When many people first suspect their VPS may have been compromised, only two thoughts remain in their heads:
- Shut it down immediately
- Change passwords immediately
Both actions sound reasonable, but when you're actually on the incident scene, getting the order wrong is more dangerous than doing nothing.
Because in the first 24 hours after a compromise, the hardest part isn't "knowing what to do"—it's judging:
- Should I disconnect the network immediately?
- Can I just reboot directly?
- Should I preserve evidence first or restore business first?
- Is changing passwords better the earlier the better?
- Can this machine still be trusted?
This article is dedicated to solving these questions.
I won't give you a one-line answer like "reinstall the system as soon as you notice anything abnormal." Instead, I'll give you a first-24-hours response checklist better suited to VPS / Linux server scenarios: control risk first, preserve evidence next, then decide whether to rebuild or restore.
If you only remember one sentence, remember this:
After suspecting a VPS compromise, prioritize isolating the network rather than rebooting or shutting down right away.
Why?
Because once you directly:
- Shut down
- Reboot
- Roughly kill processes
- Immediately delete files
You may simultaneously lose several of the most critical types of evidence:
- Malicious processes in memory
- Current network connections
- Attacker session state
- Temporary keys, tokens, decryption information
On the other hand, if you do nothing and let the server stay online, the attacker may still be:
- Moving laterally
- Continuously calling back
- Clearing logs
- Stealing more data
So the correct approach is usually not a binary choice of "shut down or not," but:
- Isolate the network first
- Then preserve key evidence
- Then judge whether it's short-term containment, long-term investigation, or direct rebuild
This is the most important question in this entire article.
For most VPS incidents, the safest order is:
- First cut off public network access
- But try to keep the system powered on and not rebooted
This means what you should do is more like:
- Temporarily tighten security groups / firewalls in the cloud provider console
- Block new inbound access
- Cut off suspicious outbound connections as much as possible
- If necessary, detach the instance from the public network
Rather than directly:
rebootshutdown now
If you already see the following signals, isolating the network takes priority over everything:
- Continuously sending outbound packets, suspected of attacking others
- Large-scale data exfiltration in progress
- Scanning the internal network laterally
- Being used as a proxy, phishing, or spam node
- Obvious ongoing intrusion activity in the business
At this point, without isolation, the damage will only continue to expand.
If you're facing:
- A compliance investigation
- Customer data leakage
- A need to trace the attack path
- Suspicion of a persistent backdoor or advanced intrusion
Then you should be even more restrained about the urge to "reboot immediately."
Because once power is cut, a lot of volatile evidence is gone.
- Causing ongoing harm → isolate the network first
- Need to preserve forensic value → don't rush to shut down/reboot
- Both matter → isolate the network first, then preserve the scene
This is the most critical containment phase.
First write down:
- The time of the anomaly
- The source that triggered the alert
- Which service is abnormal
- Which accounts/ports/processes are suspicious
This step looks simple, but it's very important later for review, communication, and judging the timeline.
Prioritize using:
- Cloud provider firewall
- Security groups
- Console network rules
The goal is:
- Block the attacker from continuing to connect in
- Block suspicious outbound traffic
- Avoid damaging the scene as much as possible
You must be restrained at this step.
Don't immediately do these things out of panic:
- One-click antivirus
- Automatic repair scripts
- Clearing
/tmp - Deleting cron
- Directly
apt upgrade
These can all contaminate the scene, making it impossible for you to trace the cause later or confirm the scope of impact.
If this VPS is running production business, you need to make a decision in the first 15 minutes:
- Must this machine go offline immediately?
- Is there a standby node or static degradation page?
- Do you need to switch traffic to a backup machine?
Don't leave "business continuity" until an hour later to remember.
If you already suspect that root, sudo users, deployment accounts, or panel accounts are compromised, pause using these accounts for further operations, to avoid expanding the contamination and to prevent the attacker from using your own operations to cover their tracks.
It's recommended to immediately open a separate incident record:
- Who did what and when
- Which rule was changed
- Which logs were exported
- What anomalies were seen
You'll be very grateful for this step later.
In Linux / VPS scenarios, the most valuable thing in the first hour isn't "fixing quickly"—it's "preserving the key scene first."
- Current process list
- Current network connections
- Login sessions and user activity
- Key system logs
- Scheduled tasks, startup items, SSH keys, sudo configuration changes
- Web service, database, panel, container logs
- Are there abnormal process names
- Are there suspicious parent-child process relationships
- Are there unfamiliar listening ports
- Are there outbound connections to unfamiliar IPs
- Are there newly created accounts / newly added SSH keys
- Are there modified scheduled tasks / systemd services
Because many key attacker behaviors only live in the "current running state":
- Callback connections
- Memory-resident malware / fileless malicious code
- Temporary tokens
- Shell sessions
Once you reboot, these may disappear directly.
When many people discover an intrusion, their first reaction is:
- Change the root password
- Change the database password
- Change the cloud provider password
This isn't wrong, but the order may be wrong.
If the attacker is still in the machine, or there's a persistent backdoor, then the new passwords, tokens, and keys you just changed may soon be obtained by the attacker again.
So the safer order is usually:
- Isolate access first
- Confirm the scope of impact
- Invalidate sessions / tokens / keys first
- Then rotate credentials in bulk
- root / sudo user passwords
- SSH keys
- Panel accounts
- Database accounts
- Deployment machine credentials
- API keys / Access Tokens
- Object storage keys
- CI/CD secrets
If this VPS has:
.env- Deployment scripts
- Automation tools
- GitHub Actions / GitLab Runner / webhook
Then what's leaked is often not just this server itself, but an entire chain of upstream and downstream credentials.
This is another key decision point.
In the following situations, you should usually treat "rebuild" as the main path by default:
- root has been taken over
- The attack entry point and duration are uncertain
- There are obvious persistence traces
- Kernel-level / high-privilege backdoors are suspected
- The business allows recovery via backup
- It's impossible to confirm whether the system is still trustworthy
Why?
Because cleanup does not equal trustworthy recovery.
Deleting one mining program doesn't mean there's no second backdoor; fixing one cron doesn't mean there's no systemd persistence; restoring one file doesn't mean the attacker hasn't modified something else.
Only when the following conditions are relatively clear should you barely consider it:
- The scope of impact is very small
- The intrusion path is clear
- There's no high-privilege persistence
- You're confident enough that cleanup is complete
- The business can't be rebuilt in the short term
Even so, it's more advisable to migrate to a new instance as soon as possible.
Many teams think "getting the website back up" counts as recovery, but in reality that's far from enough.
If the vulnerability is still there, the ports are still open, and permissions haven't been tightened, the attacker only needs a few minutes to come back.
You restored the machine, but the old keys are still valid—that's not much different from not restoring at all.
Malicious files, backdoor scripts, and contaminated backups are sometimes not only on the host.
This is one of the most common persistence locations on Linux VPS.
If you don't strengthen monitoring within an hour after recovery, then you actually don't know whether the attacker has come back.
To make execution easier, you can split the first 24 hours into the following 4 segments.
- Record the source of the anomaly
- Isolate the network at the control panel level
- Decide whether to switch traffic/degrade
- Don't reboot, don't clean the scene
- Export logs
- Check processes, ports, connections
- Record account, task schedule, service changes
- Keep copies of key evidence
- Judge the scope of impact
- Invalidate sessions and tokens
- Rotate high-risk credentials
- Judge whether to rebuild directly
- Restore from trustworthy backups to a new environment
- Harden patches, permissions, MFA, network policies
- Enable high-frequency monitoring
- Record root cause, timeline, and pending actions
For most individual webmasters, small teams, and tool sites, the most realistic path is usually not "building a full forensic lab," but:
- Isolate the network first
- Preserve basic evidence as much as possible
- Export key logs and configurations
- Rotate all key credentials
- Rebuild a new instance with trustworthy backups
- Keep the old machine only as an investigation sample, no longer restored directly to production
This is the most balanced approach between cost and security.
If you already have backups, snapshots, and recovery processes, this will be much easier. If not, you can first read these two articles:
- What's the Difference Between VPS Snapshots, Backups, and Images (2026): Don't Mix Them Up When Restoring
- VPS Automatic Backup Solutions (2025) - Protect Your Data from Disaster-Level Damage
Direct shutdown is usually not recommended. The safer default action is to isolate the network first to avoid further harm, while preserving volatile evidence such as memory, connections, and sessions as much as possible.
In most cases, disconnecting the network / isolating access takes priority. Because if the attacker is still online, the new password may also be leaked again soon.
If high privileges, persistence, or an unclear scope of impact are already involved, it's usually more advisable to rebuild a new instance rather than continue trusting the old system.
Then you should stick even more to the approach of "isolate first, preserve basic evidence, then rebuild." Don't panic-fix while destroying the entire scene.
In the first 24 hours after a VPS compromise, the most dangerous thing isn't "acting too slowly"—it's getting the order wrong.
The truly stable approach is usually:
- Isolate the network first to avoid continued harm
- Preserve evidence as much as possible, don't rush to reboot
- Judge the trust boundary first, then rotate credentials
- Rebuild if you can, don't over-believe "it's been cleaned"
In one sentence:
Contain first, then collect evidence, then recover; don't treat "just try rebooting" as incident response.
If your VPS hasn't been compromised yet, the most valuable part of this article isn't actually "what to do afterward," but reminding you to prepare in advance:
- Backups
- Snapshots
- Logs
- MFA
- Recovery runbook
Because when something really happens, what you lack most is never commands—it's time.