Hacking - I think I have been hacked

From Online Manual

Revision as of 06:13, 4 May 2014 by Illori (talk | contribs)
Jump to: navigation, search

I think I have been hacked, I'm not sure, how do I check?

This is a difficult question, since it depends on the type of the hack. As an indication, you can open up a few of the Source files (the files located in ./Sources) and see if there is any trace of base64_decode. If there is, there are chances that your forum has been hacked, and there are a few utilities and steps that help users to recover their SMF installation. This code is usually put on the first line of code. So, if the first line isn't "<?php" and absolutely nothing else, you've almost certainly been hacked.

Another way of checking, although it's far less thorough, is to look at the datestamps on your files. If you haven't installed any mods/themes, recently, yet some of your files show as being edited, recently, chances are that they've been modified by someone who shouldn't be able to.

I am sure I have been hacked...what do I do now?

First of all, keep calm. When the forum has been hacked, there are a few simple steps the administrator can perform.

  • Backup your database.

One of the most critical steps is to make backups of the whole SMF system, including the database. If the user has not yet made a backup of the database, he/she should do right now. If something goes wrong, you always have a backup at hand.

  • File a security report with SMF.

If your forum was breached via a security weakness within SMF, or an SMF mod and not via a weakness in a non-SMF script, please report it to the SMF developers, so that the issue can be investigated and, if confirmed, patched. Please report Security issues here. For security reports to be more useful and to help in discovering what the problem really is, please provide your webserver logs, and/or FTP logs. Usually, you can find these logs in your host's control panel, or in a directory called /logs in your account.

You may want to remove the affected files and directories, first, then clean up your installation, to be sure there isn't any trace left of the malicious files.

  • Re-upload SMF files.
    • If you do not have a recent backup of your files, or you want to make sure that you have a clean set of files, you can re-upload the standard SMF package files. Before you do that, it's better to clean up your installation as completely as possible, removing almost all SMF files from your installation directory.
    • You may want however to keep the attachments directory, the Settings.php files, and any custom directories you may have, if any (i.e. if you have a gallery installed, you may want to keep the directory where the gallery pictures are).
    • Check the Settings.php file, to make sure there isn't any leftover hack line. If there is, you'll need to remove the malicious code.
    • Download a Large Upgrade Pack (Go to the download site) for the version of SMF that you're using.
    • Upload every file in the package, except the files required for upgrading (usually just upgrade.php and a few SQL files), using FTP (How do I use FTP?, note that uploading may take a while). Once done, you'll have fresh files and can use your forum safely, again.

I have cleared my hacked SMF installation, how can I prevent this from happening again?

One measure that you can take, is to apply some or all of these security tips. These tips help you to protect your forum from any further attacks.

Notify your host so that they can make sure no other servers have been affected. When you report the hack to your host, ask them to check their logs to see who might have had access to your server and, also, get them to check your file permissions. With some hosts, incorrect file permissions can leave files open for easier hacking.