DEV Community

Owen Ross
Owen Ross

Posted on

You NEED to secure your server

In this day and age, the average time from a domain being pointed to the first automated probe is 9 min.

Avoiding basic credentials

Exposing your server is especially dangerous if you are using default or weak credentials as they can easily be detected and exploited by bot accounts.

Strictly avoid passwords like:

  • admin123
  • admin
  • root
  • your
  • webmaster123
  • webmaster
  • password123

If you have one of the above or similar consider using the following password format:

[Random word][Random Symbol][Random 6 digit number][Random country]
Enter fullscreen mode Exit fullscreen mode

For example:

Truck&289472France
Enter fullscreen mode Exit fullscreen mode

Reused passwords

If you use the same passwords for multiple accounts, services or encryption methods, the attacker can access all the data with the same password, witch can be problematic especially if your running SSH or a remote desktop service because the attacker can establish persistent access.

Storing passwords in plaintext

If you store your passwords in a non encrypted file or database you are basically giving the attacker all your passwords especially if the name of the file is:

  • mypasswords
  • passwords
  • password And any file extension of the above.

Use a password management tool!

Checking for incidents

Webshells

find /var/www -iname "*shell*"
Enter fullscreen mode Exit fullscreen mode

This command looks for all files that contain "shell" in the name and is inclusive of all file extensions, this means that you will be able to find all file extensions in one command

SSH Attempts

journalctl -u ssh -u sshd | grep "admin|root|administrator|webmaster"
Enter fullscreen mode Exit fullscreen mode

This looks for all SSH attempts for the following usernames:

  • admin
  • root
  • administrator
  • webmaster

Priv escalation

Attackers commonly run sudi -l to find out the structure of the permissions

You can check for this with:

journalctl _COMM=sudo | grep "COMMAND=list"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)