• Resolved la_ri_za

    (@la_ri_za)


    My customer’s site was hacked two days ago. I found this discussion in stackexchange, and the code matches with the code I found in almost every php file: http://security.stackexchange.com/questions/70579/is-this-a-backdoor
    I have now cleaned the wordpress with this script: https://gist.github.com/owise1/096c2d31c866eee0adce

    I also found this article, though the MailPoet plugin WAS NOT INSTALLED in my customers site, nor it has any neighboring sites:
    https://blog.sucuri.net/2014/10/wordpress-websites-continue-to-get-hacked-via-mailpoet-plugin-vulnerability.html

    Wordfence is on. It didn’t notify me about the changes in files: it seems it halted when it tried to do a scheduled scan. I can see error messages in the log:

    [Oct 11 01:22:57:1444515777.112067:1:error] <b>Deprecated</b>: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in <b>…/wp-content/plugins/wordfence/lib/wfDict.php</b> on line <b>1</b>
    [Oct 11 01:22:57:1444515777.108687:2:error] Scan terminated with error: We received an empty data response from the Wordfence scanning servers when calling the ‘is_safe_file’ function.

    The day before WordFence had completed a full scan with no problems to report.

    Plugins and wp are up to date. Here are the list of plugins:
    Admin Columns
    Advanced Custom Fields
    Akismet
    Antispam Bee
    BackWPup
    Black Studio TinyMCE Widget
    Bunyad Page Builder
    Bunyad Shortcodes
    Bunyad Widgets
    Contact Form 7
    Contextual Related Posts
    Custom Sidebars
    Hello Dolly
    Post Thumbnail Editor
    Search & Filter
    Wordfence Security
    WP-PostRatings
    Yoast SEO
    Theme: Smart-mag (recent security updates done)

    I’m feeling quite insecure since I don’t now what caused this in the first place. So if anyone has any information about the subject, please let me know.

    https://wordpress.org/plugins/wordfence/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author WFMattR

    (@wfmattr)

    Sorry to hear about the hack — I tested the code you linked to, and Wordfence should find it if a scan was able to complete, but since the scan had stopped, that was probably the reason the notices did not come out.

    If you still have it, can you send me a copy of the file mentioned in the error: /wp-content/plugins/wordfence/lib/wfDict.php ? In the current version of Wordfence, there is not a preg_replace, so that file may have been affected as well. My email is mattr (at) wordfence.com

    I will take a look at the “empty data response” warning, as well.

    To help clean up the hack, I would suggest removing and reinstalling Wordfence to make sure you have a clean copy, and then following the guide here:
    How do I clean my hacked site using Wordfence

    I’m not sure what the source of the hack might be if all plugins and WordPress itself are up to date. It could be that one of the plugins has a newly discovered security problem that has not been fixed, or some of the site’s passwords (FTP, hosting account, etc.)

    If you have trouble getting Wordfence running again or other questions on the cleanup, let us know here.

    -Matt R

    Thread Starter la_ri_za

    (@la_ri_za)

    Hi Matt,

    thanks for your quick reply!

    Yes, I’m sure /wp-content/plugins/wordfence/lib/wfDict.php was affected as well, since in our debug.log there’s huge amount of error messages like that, each referring to different php files. So it’s the hacker code which is causing the error message in the first place. I’m sorry I don’t have the affected file anymore, since I cleaned the whole site.

    I forgot to mention one plugin which was also installed: WP Retina 2x. That was not activated though.

    Here’s more detailed timeline if it helps:
    – Sat 10.10. at 12:11: I receive an email from WordFence that someone signed in with the username “backup”. Before that there was no such username. (I didn’t check my email on saturday which I regret…)
    – Sat 10.10. at 15:48: Wordfence reports that the username “backup” signs in for the second time.
    – Sat 10.10. at 16:00: Wordfence completes the scan. Everything’s ok.
    – Sat 10.10. at 17:32: First error in our debug.log (debug happens to be on, accidentally). This is caused by the code which the hacker has added in almost every wordpress php file. It looks like this “Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in …/wp-content/…*filename*.php on line 1”
    – Sun 11.10. at 01:06: Wordfence starts to scan, but stops with the error message “Scan terminated with error: We received an empty data response from the Wordfence scanning servers when calling the ‘is_safe_file’ function”.
    – Sun 11.10. I realize that the site has been hacked and find the code in almost every php file. In addition to this, I find a new folder in wp-content/upgrade/, named “small.jpg”. It’s empty.

    Plugin Author WFMattR

    (@wfmattr)

    Thanks for the additional details. Since the first thing you noticed was the new “backup” user logging in, that might mean that someone was able to get into the database directly to add the user without going through WordPress — if you haven’t changed the database password already, that is definitely recommended.

    -Matt R

    Hey Matt, about 20 of my sites got hit with this a couple days ago, along with the ‘backup’ user being installed in all our WP sites across all the mysql db’s.

    Could this have been the culprit?

    https://blog.sucuri.net/2015/10/security-advisory-stored-xss-in-akismet-wordpress-plugin.html

    Plugin Author WFMattR

    (@wfmattr)

    I haven’t seen that method used to create a user, but it could be possible if you use Akismet and haven’t updated it yet. I would start by making sure all plugins, themes, and WordPress are up to date on all of the sites — if any of the sites are using the same hosting account or database user, it could be any one of them that had been hacked, which could cross-infect the others.

    We have a guide to cleaning hacked sites, here, with a lot of good recommendations:
    How do I clean my hacked site using Wordfence?

    -Matt R

    Thread Starter la_ri_za

    (@la_ri_za)

    Hi,

    I can confirm that on our site commenting and “Convert emoticons like 🙂 and 😛 to graphics on display” was enabled. So theoretically Akismet could have been the culprit.

    EDIT: Sorry, Akismet was disabled. So Akismet WAS NOT the culprit. 🙂

    Plugin Author WFMattR

    (@wfmattr)

    Ok, thanks for the follow-up. Were you able to get the site cleaned up from the initial problem above?

    -Matt R

    Thread Starter la_ri_za

    (@la_ri_za)

    Yes, it looks like it’s clean. I made a “high sensitivity” scanning with Wordfence and the report says everything’s fine. I’m also looking for other ways to make wp more secure. Apparently 2-step verifications (like https://wordpress.org/plugins/miniorange-2-factor-authentication/) are not very widely used, but maybe that could add one more security layer?

    Plugin Author WFMattR

    (@wfmattr)

    Yes, two-factor authentication can help in many cases, but not all.

    Wordfence’s premium version does have two-factor authentication options, and other features that may help. More details are at wordfence.com — if you have questions on the premium version, you can email presales (at) wordfence.com since the forum rules don’t allow us to support premium features here.

    -Matt R

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WordPress hacked, Wordfence didn't notify’ is closed to new replies.