{"id":189618,"date":"2020-07-14T03:57:14","date_gmt":"2020-07-14T03:57:14","guid":{"rendered":"https:\/\/premium.wpmudev.org\/blog\/?p=189618"},"modified":"2024-05-10T00:08:33","modified_gmt":"2024-05-10T00:08:33","slug":"delete-suspicious-code-defender","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/delete-suspicious-code-defender\/","title":{"rendered":"Been Hacked? Here&#8217;s How To Quickly Find and Delete Suspicious Code with Defender"},"content":{"rendered":"<p>If you&#8217;re not careful, suspicious code within your sites can easily go unnoticed and wreak havoc. Whether you&#8217;ve been hacked and need a resolution ASAP, or you simply want to check your sites for suspicious activity, Defender can help you quickly detect and eliminate malware for good. See how it&#8217;s done in this tutorial.<\/p>\n<p>Looking for a convenient and hassle-free way to locate and delete suspicious code from your sites?<\/p>\n<p>In this tutorial we&#8217;re showing you, step-by-step, how <a href=\"https:\/\/wpmudev.com\/project\/wp-defender\/\" target=\"_blank\" rel=\"noopener\">Defender<\/a>&#8216;s vast suite of security features can help banish and keep suspicious code at bay.<\/p>\n<p>You\u2019ll also learn how to keep your sites protected from these kinds of issues going forward.<\/p>\n<p>Let&#8217;s not delay, the health of your sites is at stake!<\/p>\n<h2>How To Detect and Resolve Suspicious Code and Files With Defender<\/h2>\n<p><strong>First order of business&#8230;<\/strong> Detecting and removing suspicious files and code can only be done with the<strong> Pro version of Defender.<\/strong><\/p>\n<p>You can get <a href=\"https:\/\/wpmudev.com\/project\/wp-defender\/\" target=\"_blank\" rel=\"noopener\">Defender Pro<\/a>, along with our suite of Pro WordPress plugins and site management tools for <strong>a low $3\/month.<\/strong> Which is incredible value, especially if you own or manage critical sites that are particularly susceptible to malware or attacks.<\/p>\n<p>The first step is to enable the <strong>Suspicious Code<\/strong> setting via <strong>Malware Scanning &gt; Settings.<\/strong><\/p>\n<p>You also need to ensure that <strong>File Change Detection<\/strong> is enabled for both &#8216;Scan Core Files&#8217; and &#8216;Scan Plugin Files.&#8217; This will help reduce the occurrence of false positives in your scans.<\/p>\n<figure id=\"attachment_221967\" class=\"wp-caption alignnone\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221967 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/enable-suspicious-code.png\" alt=\"A screen showing Defender's various security settings\" width=\"1498\" height=\"1276\" \/><figcaption class=\"wp-caption-text\">Enable these vital security settings before proceeding any further.<\/figcaption><\/figure>\n<div class=\"image-grid cgrid-row\">\n<p>Once you&#8217;ve enabled these settings, you&#8217;re ready to scan your site for malware.<\/p>\n<p>To do this, go to <strong>Malware Scanning<\/strong> via the WordPress admin sidebar or from the main Defender dashboard.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221970\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221970 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/New-malware-scan.png\" alt=\"A screen showing where you can start a new malware scan\" width=\"1200\" height=\"660\" \/><figcaption class=\"wp-caption-text\">Start a new malware scan with a click and identify threats in seconds.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Once here, you can initiate a new scan with a click.<\/p>\n<p>Then sit back and let Defender work its magic. The scan should only take a few minutes, depending on the size of your site.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-221974 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/scan-in-progress.png\" alt=\"A screen showing a Defender malware scan in progress.\" width=\"1200\" height=\"660\" \/><\/div>\n<\/div>\n<p>Once the scan is completed, you will be alerted to any issues found relating to file change detection, known vulnerabilities, and suspicious code.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221979\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221979 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/scan-complete-issues-found-1.png\" alt=\"A screen showing that vulnerabilities have been detected.\" width=\"1200\" height=\"568\" \/><figcaption class=\"wp-caption-text\">The Issues tab details all of the vulnerabilities or suspicious behavior detected.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Next, simply click on the<strong> Issues<\/strong> tab. Here you will find a list of all the potentially harmful files that have been compromised or changed in some way.<\/p>\n<figure id=\"attachment_221969\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221969 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/issues-detected-screen.png\" alt=\"A screen showing the issues the Defender scan has detected.\" width=\"1200\" height=\"1056\" \/><figcaption class=\"wp-caption-text\">Defender quickly identifies issues for you to address.<\/figcaption><\/figure>\n<p>Click on any of the detected files to get more details about the issue and its exact location.<\/p>\n<p>In the example below, the suspicious code has been detected inside of a WordPress plugin. Defender specifically points out the error and the file in which it was found.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221968\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221968 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/issue-details.png\" alt=\"A screen showing details of an issue that was detected during the malware scan.\" width=\"1200\" height=\"866\" \/><figcaption class=\"wp-caption-text\">Quickly see where the detected issue was found.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<div>\n<p>Along with seeing important details like the plugin URL, location of the issue, date added, and developer, you have three options when it comes to addressing suspicious files or code.<\/p>\n<p>You can either <strong>ignore<\/strong>, <strong>delete<\/strong>, or <strong>Safe Repair<\/strong> the file.<\/p>\n<p><em><strong>Caution:<\/strong> It\u2019s strongly recommended to ensure that something is harmless before choosing to delete and\/or ignore it. If you&#8217;re unsure or need advice, you can <a href=\"https:\/\/wpmudev.com\/get-support\/\" target=\"_blank\" rel=\"noopener\">consult our 24\/7 WordPress experts.<\/a><\/em><\/p>\n<p>It&#8217;s important to note there is a chance that reported issues or vulnerabilities could be false positives, meaning that legitimate code being flagged as suspicious due to its resemblance to malicious code.<\/p>\n<p>This can happen for various reasons, such as a function being modified by a plugin or theme, or if something is directly modified in the file or theme editor.<\/p>\n<p>Fortunately, Defender is designed to minimize the occurrence of false positives. However, malicious code often mimics legitimate code, making it almost impossible to avoid completely.<\/p>\n<p>To help verify suspicious code, you can take a couple of steps:<\/p>\n<ul>\n<li><strong>Verify custom edits:<\/strong> Check with the plugin developer to confirm the questionable code.<\/li>\n<li><strong>Contact our support:<\/strong> If you didn\u2019t add the code, and you&#8217;re certain no one you know did, feel free to <a href=\"https:\/\/wpmudev.com\/get-support\/\" target=\"_blank\" rel=\"noopener\">contact WPMU DEV support for feedback<\/a> and to share what you deem to be malicious code.<\/li>\n<\/ul>\n<p>We highly recommend you reach out to either the plugin developer or our expert support team for advice before deleting any files. You&#8217;ll also need to deactivate the plugin before you can delete the associated file.<\/p>\n<p><strong>Another great and risk-free option is to use Defender&#8217;s Safe Repair feature.<\/strong><\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_222010\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-222010 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/Safe-repair-file-1.png\" alt=\"A screen showing where the user can enable the Safe Repair feature\" width=\"1200\" height=\"866\" \/><figcaption class=\"wp-caption-text\">Using Defender&#8217;s Safe Repair feature is a great way to repair your site without worrying if deleting a file will do even more damage.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p>Click <strong>Safe Repair<\/strong> to automatically quarantine the file for a defined amount of time that you specify (30 days &#8211; one year).<\/p>\n<p>The advantage of this is it allows you to quickly repair your site and fix the issue instantly if it is the cause. The quarantine period also gives you ample time to properly investigate what happened.<\/p>\n<p>Plus, if it turns out to be a false positive, you can easily restore the file. This saves you from <a href=\"https:\/\/wpmudev.com\/blog\/defender-safe-repair\/\" target=\"_blank\" rel=\"noopener\">accidentally deleting a critical file<\/a> and preventing further damage to your site.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221965\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221965 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/delete-quarantined-file.png\" alt=\"A screen showing a potentially malicious file in quarantine, and the options you have to deal with it\" width=\"1200\" height=\"1168\" \/><figcaption class=\"wp-caption-text\">Restore or delete files permanently with one click<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Once you&#8217;re sure that deleting the file is safe and necessary, you can securely do so from within the <strong>Quarantined<\/strong> tab.<\/p>\n<p><strong>And that&#8217;s it!<\/strong><\/p>\n<p>You&#8217;ve seen how easy and fast it is to identify and address suspicious files or code in the event of a hack or malware incident.<\/p>\n<p>However, resolving critical issues promptly once they occur is one thing&#8230;.<\/p>\n<p>Preparing and protecting your sites against future attacks is another!<\/p>\n<p>On that note, here are some &#8216;bonus tips&#8217; to ensure your sites are well-prepared to deal with potential hacks or other issues should they reoccur.<\/p>\n<h2>BONUS TIPS: How To Configure Your Sites For Future Protection<\/h2>\n<h3>Schedule Automated Site Scans<\/h3>\n<p>Another useful Defender Pro feature is the ability to run automated site scans.<\/p>\n<p>This not only saves you from running scans manually, but also ensures your sites are checked more frequently for security issues without any hassle.<\/p>\n<p>Scheduling scans can be set up via <strong>Malware Scanning &gt; Settings.<\/strong> From there, all you need to do is enable scheduled scanning and set the frequency, day of the week, and time of day for the scans to run.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221975\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221975 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/set-scanning-schedule.png\" alt=\"A screen showing where you can schedule and automate your malware scans.\" width=\"1200\" height=\"798\" \/><figcaption class=\"wp-caption-text\">Easily set up automated scans to your preferred frequency.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<h3>Enable Notifications of Suspicious Activity<\/h3>\n<p>After setting up automated scans, you should also set up notifications so that you can be alerted about scan results from wherever you are, saving you from having to manually check in.<\/p>\n<p>Simply navigate to the <strong>Notifications<\/strong> section using the sidebar or from your main Defender dashboard.<\/p>\n<p>Here you&#8217;ll find a number of different notification options to choose from.<\/p>\n<p>In the case of detecting suspicious code, you would enable the <strong>Malware Scanning<\/strong> &#8220;Notification&#8221; and &#8220;Reporting&#8221; options.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221992\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221992 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/Enable-configure-notifications.png\" alt=\"A screen showing where you can enable Defender notifications.\" width=\"1200\" height=\"884\" \/><figcaption class=\"wp-caption-text\">Defender gives you a number of options for the types of notifications you want to receive.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<p>Once selected, you can set up additional settings and configurations for each notification.<\/p>\n<p>You also have the option to either add users directly or invite them via email.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-222029 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/notifications-users.png\" alt=\"A screen showing where Defender users can adjust the recipients of their notifications\" width=\"1200\" height=\"1158\" \/><\/div>\n<\/div>\n<\/div>\n<p>Next, you can further configure notification settings to ensure you only receive notifications at appropriate times.<\/p>\n<p>Additionally, you can set up custom email template messages for your clients to guarantee that the notifications they receive are to your liking and clear for the user.<\/p>\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_221994\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-221994 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2024\/05\/Set-notifications-email-template.png\" alt=\"A screen showing where you can confirm notification settings and set up email message templates\" width=\"1200\" height=\"1332\" \/><figcaption class=\"wp-caption-text\">Enable notifications when you really need them and provide custom message templates for your users.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<h2>Finding and Deleting Suspicious Code Just Got Easier With Defender<\/h2>\n<p>As you can see, suspicious code is no match for <a href=\"https:\/\/wpmudev.com\/project\/wp-defender\/\" target=\"_blank\" rel=\"noopener\">Defender<\/a> and it really just takes no more than a few clicks to remove.<\/p>\n<p>Beyond finding malicious code and the ability to delete it, Defender can stop <a href=\"https:\/\/www.w3schools.com\/sql\/sql_injection.asp\" rel=\"noopener\" target=\"_blank\">SQL injections<\/a>, <a href=\"https:\/\/wpmudev.com\/blog\/stop-hackers-with-defender-wordpress-security-plugin\/\" target=\"_blank\" rel=\"noopener\">prevent hackers from exploiting WordPress vulnerabilities<\/a>, prevent PHP execution, and much more.<\/p>\n<p>To discover more about WordPress security, check out our <a href=\"https:\/\/wpmudev.com\/blog\/ultimate-guide-wordpress-security\/\" target=\"_blank\" rel=\"noopener\">Ultimate Guide to WordPress Security<\/a>. And for more information on how Defender works, be sure to <a href=\"https:\/\/wpmudev.com\/docs\/wpmu-dev-plugins\/defender\/\" target=\"_blank\" rel=\"noopener\">view the plugin\u2019s documentation<\/a>.<\/p>\n<p><strong>Don&#8217;t have the time or resources to address malware or hacks yourself? Try our Expert Services!<\/strong><\/p>\n<p>We know that when a malware attack happens on a client site that you are managing, you may not have the time or resources to fix this yourself.<\/p>\n<p>In this case, our <a href=\"https:\/\/wpmudev.com\/expert-services\/\" target=\"_blank\" rel=\"noopener\">Expert &#8216;done-for-you&#8217; Services<\/a> are another great option.<\/p>\n<p>Because instead of worrying about security or malware attacks yourself, you can hire our experts at an affordable price to handle it for you. You can also easily resell these services to your clients without any additional charges from us.<\/p>\n<p>Plus, we offer a full <strong>7-day money-back guarantee. <\/strong>So, if we help resolve a hacked site and a problem reoccurs within seven days, we&#8217;ll return to fix it absolutely free of charge!<\/p>\n<p><strong><a href=\"https:\/\/wpmudev.com\/blog\/expert-services-wordpress-website-management\/\" target=\"_blank\" rel=\"noopener\">Learn more about our Expert Services here<\/a>.<\/strong><\/p>\n<p><em>[Editor\u2019s note: This post was originally published in July 2020 and updated in May 2024 for accuracy.]<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re not careful, suspicious code within your sites can easily go unnoticed and wreak havoc. Whether you&#8217;ve been hacked and need a resolution ASAP, or you simply want to check your sites for suspicious activity, Defender can help you quickly detect and eliminate malware for good. See how it&#8217;s done in this tutorial. Looking [&hellip;]<\/p>\n","protected":false},"author":811449,"featured_media":222212,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"6","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263,11260,11259],"tags":[],"tutorials_categories":[11231],"class_list":["post-189618","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-wpmu-dev-products","category-wpmudev-tutorials","tutorials_categories-defender-pro"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/189618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/811449"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=189618"}],"version-history":[{"count":54,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/189618\/revisions"}],"predecessor-version":[{"id":222143,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/189618\/revisions\/222143"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/222212"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=189618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=189618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=189618"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=189618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}