Dev.to AI 🤖 Ai 👁 0 📖 4 min read

The First Hour After a Cyberattack: A Developer's Incident Response Runbook

It's 2 a.m., and your monitoring alert says a production server is making outbound connections to an IP you don't recognise. Or a teammate pings you: "The shared drive is encrypted, and there's a ransom note." What you

It's 2 a.m., and your monitoring alert says a production server is making outbound connections to an IP you don't recognise. Or a teammate pings you: "The shared drive is encrypted, and there's a ransom note."

What you do in the first hour after a cyberattack shapes everything that follows. At ZIA Networks, we've seen good engineers make a bad situation worse by "fixing" things too fast. This runbook gives you an order of operations you can follow when adrenaline is high.

Tip: Don't read this for the first time during an incident. Fork it, adapt it, and keep a copy offline.

The order of operations

  1. Contain
  2. Preserve evidence
  3. Call the right people.
  4. Rotate credentials and secrets
  5. Check backups
  6. Communicate

Notice that "fix it" isn't on the list yet. That comes after you understand what happened.

1. Contain (minutes 0 to 10)

Isolate the affected machine from the network, but do not power it off. Shutting down wipes volatile memory, which can hold running processes, network connections, and sometimes encryption keys.

Linux:

# Take the network interface down (replace eth0 with your interface)
sudo ip link set eth0 down

Windows (PowerShell, run as administrator):

# Disable the network adapter
Disable-NetAdapter -Name "Ethernet" -Confirm:$false

Cloud instances: Don't terminate the instance. Move it to an isolated security group that blocks all inbound and outbound traffic, and take a snapshot of the disc before you change anything else.

If you aren't sure which machines are affected, isolate the whole network segment rather than guessing.

2. Preserve evidence (minutes 10 to 20)

Before touching anything, capture the state of the system. Write output to external storage or another machine, not the compromised disc.

# Run on the affected Linux host and save the output elsewhere
date -u                 # record the time in UTC
whoami; hostname
ps auxf                 # running processes
ss -tulpn               # open ports and connections
last -a | head -50      # recent logins
sudo journalctl --since "24 hours ago" > /mnt/external/journal.txt

Also:

  • Take screenshots of ransom notes, error messages, and strange emails
  • Don't delete suspicious files or clean up logs.
  • Keep a timestamped incident log of every action, who did it, and when.

A simple log template:

[2026-11-23 02:14 UTC] Alert received for host app-01 (A. Sharma)
[2026-11-23 02:18 UTC] Network interface disabled, host left running (A. Sharma)
[2026-11-23 02:25 UTC] Security partner contacted by phone (R. Das)

3. Call the right people (minutes 20 to 30)

Use the phone if your email or chat could be compromised.

  • Your security or IT provider (if you work with ZIA Networks, your response team)
  • Your internal decision-maker
  • Your cyber insurance provider, since many policies require fast notice
  • Legal counsel, if personal or customer data may be involved

Many countries and industries set breach-reporting deadlines, so ask legal early.

4. Rotate credentials and secrets (minutes 30 to 45)

Assume at least one credential is compromised. Work from a clean machine.

  • Reset passwords for admin, email, cloud, and CI/CD accounts
  • Revoke and reissue API keys, tokens, and SSH keys
  • Enforce MFA on every important account
  • Remove access for unknown users, old vendors, and former staff.

Check whether secrets leaked into your repositories:

# Search the repo history for likely secrets (example using gitleaks)
gitleaks detect --source . --verbose

If a secret ever touched a public or shared repo, treat it as exposed even if you deleted the commit. Rotate it.

5. Check backups (minutes 45 to 55)

Attackers often target backups first. Ask:

  • Are backups stored separately from the main network?
  • Are they immutable or offline?
  • Do they predate the attack?
  • Have you actually tested a restore?
# A quick restore test: verify a backup file and restore one file to a scratch location
sha256sum backup-2026-11-22.tar.gz
tar -xzf backup-2026-11-22.tar.gz -C /tmp/restore-test path/to/one/file

A backup you've never restored is a hope, not a backup.

6. Communicate (minutes 55 to 60)

Send one clear message to your team: which devices to avoid, which emails not to open, and who the single point of contact is. Hold off on public statements until the facts are confirmed. A short, accurate update beats a fast, wrong one.

What not to do

  • Don't power off the machine.
  • Don't delete files, logs, or ransom notes.
  • Don't pay a ransom on impulse; there's no guarantee you'll get your data back.
  • Don't reply to the attacker without expert guidance.
  • Don't blame the person who clicked. Blame makes people hide mistakes, and hidden mistakes become big incidents.

Prepare before it happens

A quick checklist you can finish this week:

  • [ ] One-page incident response plan, printed and stored offline
  • [ ] Phone numbers (not only emails) for your security partner, insurer, and lawyer
  • [ ] Tested offline or immutable backups
  • [ ] MFA on all critical accounts
  • [ ] Secrets stored in a vault, not in code
  • [ ] Centralised logs with sensible retention
  • [ ] A tabletop exercise with your team at least once a year

Wrapping up

You can't prevent every attack, but you can control how you respond. Contain, preserve, call for help, rotate secrets, protect backups, and communicate carefully. The first hour goes much better when you've already practiced it.

ZIA Networks helps teams build response plans, set up monitoring, and get hands-on help when something goes wrong.

Your turn: What's the one step you'd add to this runbook? Share it in the comments and help the next developer who reads this.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.