today I woke up surprised that my website was hacked. I found scripts like this in several files of my Drupal instalation


I could find that the script was propagated, from


That footer.php should not be there, so my question is, how a php file could be uploaded in that folder?

I checked all the upload images and files fields and I ensure any of those are allowed of upload .php files.

Can someone help me out?

how to prevent this type of hacking? what are the precautions for this type of hacking?

  • 3
    There's a million different ways this could have happened, and there's no way we can answer it completely. The one thing I will say is that one practice I like, is to have disable_functions=eval in my settings. That would have prevented this from working, though not necessarily prevent the original attack. It will also kill the php module, which I'm sure if a common attack vector on Drupal sites, and using it is utterly foolish.
    – Letharion
    Commented Oct 23, 2014 at 16:46
  • what is your hosting type? Shared, VPS,..?
    – xurshid29
    Commented Oct 23, 2014 at 16:49
  • Mine is a shared hosting
    – svelandiag
    Commented Oct 23, 2014 at 16:50
  • @SsouLlesS If you have the appropriate logging for it, you should search for them for 'n7f2521', which is the payload carrying the executable code. What you do with it depends of course entirely on what you find, but if you want help understanding what's happened, you might wanna add it to the question. And if not the question, you might wanna post it in the chat, I'd be interested in seeing what there is.
    – Letharion
    Commented Oct 23, 2014 at 16:55
  • 2
    Did you address drupal.org/SA-CORE-2014-005 ?
    – mpdonadio
    Commented Oct 23, 2014 at 17:23

2 Answers 2


Your site has indeed been hacked. Many possibilities of a backdoor exist now.

You can start by upgrading to 7.32 or better and downloading the Hacked! module and scanning your system files for changes.

You can also use one of the following commands to find the exploited files.

  • grep -Rl PCT4BA6ODSE . | xargs sed -i 's/<[?]php.*PCT4BA6ODSE_.*[?]>/<\?php \/\/ RECOVERED FILE - more info at AllAboutTodd.com \?>/g'
  • find . -type f -newermt 2014-10-01 ! -newermt 2014-10-31 -name "*.php"

The latter command will find all files that end in .php which were last modified in October. To search instead the files for which the permissions were changed in October, replace -newermt with -newerct.


Start with ensuring that your modules and core are up to date. Also make sure that your submitting user credentials using a secure connection (HTTPS).

You could use a module like Password policy to secure user accounts. For now I'd change all of your admin credentials, clean up any damage, and maybe have users change their passwords.


Also check out the secure login module.

  • 3
    And then pop to /admin/reports/updates/settings and make sure you're getting emailed about security releases
    – Clive
    Commented Oct 23, 2014 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.