Skip to content

Security Operations / Incident response · Step 5 of 6

Lesson: RecoverySwitch
← Security Operations

Security investigations

Recovery

Return systems to service from a trusted state and watch for the problem coming back.

Recovery brings services back safely. Rushing it can restore the very weakness or backdoor that caused the incident.

Remove the cause first

Find how access was gained: a missing update, a reused password, an exposed service, a leaked key. Fix that before reconnecting. This step is often called eradication.

After a compromise with root access, you usually cannot trust the system. Rebuilding from a known good image or fresh install, then restoring data, is safer than deleting the files you happened to notice.

Choose a clean backup

Use your timeline. A backup made after the first sign of intrusion may contain the attacker's changes. Even earlier ones need checking, because the true start may be earlier than you think.

$ sha256sum -c backup.tar.gz.sha256
backup.tar.gz: OK
$ mkdir /tmp/restore-test
$ tar -xzf backup.tar.gz -C /tmp/restore-test

The checksum shows the archive matches the one recorded. It does not show the contents are clean. Restore into an isolated place and test that the application really works. A backup you have never restored is only a hope.

Rotate secrets and patch

Replace passwords, keys and tokens that the affected system could read. Apply security updates. Apply the configuration that closes the entry point. Change secrets after the attacker's access is removed, or they may capture the new ones.

Return in stages

Bring back the most important service first, after its dependencies. Agree on checks that show it is healthy:

$ systemctl is-active nginx
active
$ curl -sS -o /dev/null -w "%{http_code}\n" https://example.com/
200

"Active" means the process is running, not that the application is correct, so test a real user action too.

Then monitor more closely for a while: logins, outbound connections, new accounts, new scheduled jobs. Decide in advance what would make you pull the service offline again, and who decides.

Try it

Pick a small folder, archive it with tar -czf backup.tar.gz foldername, save its checksum with sha256sum backup.tar.gz > backup.tar.gz.sha256, and restore it into an empty directory. Compare the two with diff -r. The archives lab covers tar.

Check your understanding

Recovery

All 3 sections · no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.