The biggest cost in incident response lies not in the recovery itself, but in resolving the state of not knowing what happened. That is why, in preventing recurrence, you build a state that is hard to break into, detects anomalies quickly, and can recover—before pursuing perfect defense.

Even a small team can simply work through the items in order of priority.

Priority 1: Narrow down administrative access routes

優先度1:管理経路を絞るの解説画像
  • Use key-based authentication for SSH and disable password login
  • Prohibit direct root login
  • Do not share administrator accounts
  • Remove unnecessary users, ports, and services
  • Set up multi-factor authentication on admin panels

"Kept around but unused" is the state you most want to avoid. Closing off unused entry points can sometimes be more effective than introducing a new security product.

Priority 2: Separate secrets from servers and code

優先度2:秘密情報をサーバとコードから切り離すの解説画像

Design passwords, API keys, SMTP credentials, JSON keys, and the like so they can be rotated on the assumption that they will leak.

  • Never put secrets into Git repositories
  • Keep them out of public directories and screenshots
  • Separate credentials by purpose
  • Grant only the minimum necessary permissions
  • Keep a ledger of issuance dates, purposes, storage locations, and revocation methods

Service accounts, in particular, linger on independently of people leaving or changing roles. Record not who a key belongs to, but which process it is needed for.

Priority 3: Make updates and backups part of the system

優先度3:更新とバックアップを仕組みにするの解説画像

The longer CMS cores, plugins, themes, OSes, and container images are left unattended, the higher the risk rises. Even if you cannot update everything the same day, decide who is responsible for checking updates and how often they do it.

Backups being merely "there" is not enough.

  • Include databases and uploaded files
  • Store them somewhere other than the server itself
  • Document the restoration procedure
  • Run restoration tests periodically

Backups made from a potentially compromised server are not necessarily safe as they are. You also need generation management for recovery backups.

Priority 4: It is fine to start monitoring small

優先度4:監視は少なく始めてよいの解説画像

Even without a large-scale monitoring infrastructure, just the following notifications greatly improve the initial response.

  • Threshold alerts for CPU, memory, and disk usage
  • Website uptime monitoring
  • Notifications for administrator logins and permission changes
  • Notifications for backup failures
  • Regular checks for unnecessary service starts and suspicious outbound communication

In this incident, too, a resource anomaly was the clue that led to early detection. Monitoring does not completely prevent attacks, but it shortens the duration of the damage.

Finally: Once you build your incident response, the next one goes faster

The biggest lesson from this response was the importance of always knowing who runs which service with which credentials.

What you need in an emergency is not sophisticated techniques. Contact lists, administrative privileges, backups, shutdown decisions, procedures for reissuing credentials. Just putting these five into a short runbook dramatically changes the quality of your response.

Bringing intrusions down to absolute zero is difficult. But you can reduce entry points, detect anomalies early, revoke secrets promptly, and maintain the ability to recover. That is the strongest defense available in small-scale web operations.