{"id":39989,"date":"2026-08-01T01:21:19","date_gmt":"2026-07-31T18:21:19","guid":{"rendered":"https:\/\/dps.media\/xu-ly-wordpress-bi-hack-quy-trinh-10-buoc\/"},"modified":"2026-08-01T01:21:19","modified_gmt":"2026-07-31T18:21:19","slug":"processing-wordpress-hacked-10-step-process-2","status":"publish","type":"post","link":"https:\/\/dps.media\/en\/xu-ly-wordpress-bi-hack-quy-trinh-10-buoc\/","title":{"rendered":"Handling a Hacked WordPress Site: A 10-Step Process to Completely Remove Malware and Patch Vulnerabilities"},"content":{"rendered":"<p>One day, your website began showing unusual signs: organic traffic dropped suddenly, customers reported being redirected to unfamiliar gambling websites, or a few unfamiliar administrator accounts appeared in the admin settings page. If you are facing these issues, it is clear that your website has been infected with malware. Quickly finding a way <strong><a href=\"https:\/\/dps.media\/en\/processing-wordpress-hacked-10-step-process-2\/\">handle wordpress hacked<\/a><\/strong> is critically important for protecting customer data, maintaining brand reputation, and avoiding being blacklisted by Google.<\/p><p>Recently, the technical team at DPS.MEDIA successfully helped restore a corporate website system heavily infected with malware (storage path on the server at `\/home\/yourdomain.com\/public_html\/`). Technical analysis from the Wordfence CLI log file shows that this website contains 16,854 files, with a total scanned size of 281.2 MiB. Wordfence took 851 seconds (approximately 14 minutes) to scan and detected exactly 3 suspicious files (files suspected of containing malicious code). This article will share the details of this real case study, provide the specific names of the malicious plugins, the hacker's fake admin accounts, and an A-to-Z cleanup process so you can check your own system.<\/p><h2>Step 1: Scan for Malware Using Wordfence CLI<\/h2><p>Wordfence CLI is an extremely powerful malware scanning tool that runs on your server's command line (VPS\/Server), processing much faster than regular plugins. First, you need to connect your free Wordfence license key using the command:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wordfence configure<\/code><\/pre><p>Then, scan the folder containing the website's source code and export the results to a fixed log file for easy analysis:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wordfence malware-scan --output-path=\/home\/yourdomain.com\/public_html\/wordfence-scan-log.log \/home\/yourdomain.com\/public_html\/<\/code><\/pre><h3>Extremely important note about the number of skipped files (Skipped Files)<\/h3><p>During the scan, the system reports up to <strong>7,903 files skipped<\/strong>. The reason is that Wordfence CLI, by default, only scans source code files (such as PHP). However, hackers today are very sophisticated; they often hide webshells or insert PHP code into static files (such as files with the `.jpg`, `.png`, `.css`, or `.js` extensions).<\/p><p>Therefore, to ensure a thorough cleanup, you must perform a full deep scan by adding the flag <code data-no-translation=\"\">--include-all-files<\/code>:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wordfence malware-scan --include-all-files --output-path=\/home\/yourdomain.com\/public_html\/wordfence-scan-full-\\\\$(date +%Y%m%d-%H%M%S).log \/home\/yourdomain.com\/public_html\/<\/code><\/pre><p>In addition, if the log reports <strong>timeout<\/strong> (the system hit 1 timeout), check the timed-out file right away. Files with unusually large sizes or that take too long to process are usually files containing millions of lines of obfuscated code from hackers.<\/p><p><img decoding=\"async\" src=\"https:\/\/dps.media\/wp-content\/uploads\/2026\/08\/xu_ly_wordpress_bi_hack_quy_trinh_10_buo_img3-1.png\" alt=\"handle wordpress hacked\" style=\"display:block;margin:20px auto;max-width:100%;height:auto\" title=\"\"><\/p><h2>Step 2: Read the log file and precisely identify the malware name<\/h2><p>Because Wordfence only reports the number of suspicious files in the final summary, you need to filter the file paths of these 3 files using a filter command <code data-no-translation=\"\">grep<\/code>:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">grep -i \"suspicious\\|malicious\\|match\" \/home\/yourdomain.com\/public_html\/wordfence-scan-log.log<\/code><\/pre><p>Or you can export the scan results directly to CSV format for easier visual analysis:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wordfence malware-scan --output-format=csv --output-path=\/home\/yourdomain.com\/public_html\/wordfence-scan-results.csv \/home\/yourdomain.com\/public_html\/<\/code><\/pre><p>Based on the actual log, we detected 3 specific malicious files, including:<\/p><ul>\n<li><strong>wp-content-filter\/wp-content-filter.php:<\/strong> The fake plugin contains malicious code that creates an admin account and prints an \"OK\" confirmation line. This is a classic admin-creating backdoor, usually triggered remotely by hackers through a hidden HTTP parameter.<\/li>\n<li><strong>wordpress-cache-optimizer\/wordpress-cache-optimizer.php:<\/strong> A fake plugin disguised as a caching tool. This file contains code that automatically inserts a hidden administrator account with hardcoded login credentials.<\/li>\n<li><strong>wp-fixplugin.php:<\/strong> Located in the directory <code data-no-translation=\"\">wp-content\/mu-plugins\/<\/code> (Must-Use Plugins, automatically loaded without appearing in the regular plugin list). This file automatically inserts a malicious script tag in the form <code data-no-translation=\"\">&lt;script src=\"...\"&gt;<\/code> into the tag <code data-no-translation=\"\">&lt;head&gt;<\/code> of the website to redirect users to betting sites. The subtle part is that this file uses the function <code data-no-translation=\"\">is_user_logged_in()<\/code> to <strong>hide this malicious script from logged-in admins<\/strong> to avoid being detected by administrators when browsing their own website.<\/li>\n<\/ul><p>Once you know exactly what they are, use the following command to completely delete these malicious folders and files:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">rm -rf \/home\/yourdomain.com\/public_html\/wp-content\/plugins\/wp-content-filter\nrm -rf \/home\/yourdomain.com\/public_html\/wp-content\/plugins\/wordpress-cache-optimizer\nrm \/home\/yourdomain.com\/public_html\/wp-content\/mu-plugins\/wp-fixplugin.php<\/code><\/pre><h2>Step 3: Review and Delete Fake Admin Accounts<\/h2><p>List all accounts with the highest privileges on the website using WP-CLI:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp user list --role=administrator --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><p>Cross-checking against the source code and account creation times, we detected 2 fake administrator accounts created by the hacker:<\/p><ul>\n<li><strong>wphiddenbot (ID 4):<\/strong> Created at 2026-07-21 03:54:55, display name \"Cache Worker\", email <code data-no-translation=\"\">wphiddenbot@gmail.com<\/code>. This is an account created by a fake plugin <code data-no-translation=\"\">wordpress-cache-optimizer.php<\/code>.<\/li>\n<li><strong>wpenginebot (ID 3):<\/strong> Created at 2026-07-20 21:41:33 (about 6 hours before wphiddenbot). This is precisely the account created by the backdoor <code data-no-translation=\"\">wp-content-filter.php<\/code> created. The creation time coincides with the moment the malware was deployed to the server.<\/li>\n<\/ul><p>Delete these 2 fake accounts and reassign their posts to the real admin account (ID 1):<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp user delete 3 --reassign=1 --allow-root --path=\/home\/yourdomain.com\/public_html\nwp user delete 4 --reassign=1 --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h2>Step 4: Clean Up Malicious Configurations Deeply Hidden in the Database<\/h2><p>Malicious code does not only reside in files but also stores harmful configurations in the database (table <code data-no-translation=\"\">wp_options<\/code>). In many cases, administrators delete PHP files but do not clean up the database, so the website continues to be hacked again.<\/p><p>To search for these malicious options in the database, use WP-CLI to run the following check commands (note: change the actual domain path to <code data-no-translation=\"\">yourdomain.com<\/code>):<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp option list --search=\"*fixplugin*\" --allow-root --path=\/home\/yourdomain.com\/public_html\nwp option list --search=\"*cache_optimizer*\" --allow-root --path=\/home\/yourdomain.com\/public_html\nwp option list --search=\"*content_filter*\" --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><p>The terminal output will help you immediately identify any abnormal configurations:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">+-------------------------+--------------------------------------------------+\n| option_name             | option_value                                     |\n+-------------------------+--------------------------------------------------+\n| wp_fixplugin_script_url | https:\/\/mamglaqwek.com\/googletagmanager.js?v=2.0 |\n| wp_fixplugin_script_ver | 1785515873                                       |\n+-------------------------+--------------------------------------------------+\n+-------------+--------------+\n| option_name | option_value |\n+-------------+--------------+\n+-------------+--------------+\n| option_name | option_value |\n+-------------+--------------+\n+-------------+--------------+\n| option_name | option_value |\n+-------------+--------------+<\/code><\/pre><p>Specifically, mu-plugin <code data-no-translation=\"\">wp-fixplugin.php<\/code> call function <code data-no-translation=\"\">get_option()<\/code> from the configuration constants. During actual testing, we found two malicious options added to the table <code data-no-translation=\"\">wp_options<\/code>:<\/p><ul>\n<li><strong>wp_fixplugin_script_url:<\/strong> Save the malicious script link value <code data-no-translation=\"\">https:\/\/mamglaqwek.com\/googletagmanager.js?v=2.0<\/code>. This link impersonates Google Tag Manager to blend in with your legitimate tracking code (for example <code data-no-translation=\"\">GTM-WPTSRZZJ<\/code>).<\/li>\n<li><strong>wp_fixplugin_script_ver:<\/strong> Save timestamp <code data-no-translation=\"\">1785511188<\/code> (or other timestamp variants such as <code data-no-translation=\"\">1785515873<\/code>).<\/li>\n<\/ul><p>These two options have <code data-no-translation=\"\">option_id<\/code> very large (up to 100,136), indicating they were recently injected during the attack chain on 20-21\/07. Proceed to delete these options entirely using WP-CLI:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp option delete wp_fixplugin_script_url --allow-root --path=\/home\/yourdomain.com\/public_html\nwp option delete wp_fixplugin_script_ver --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h3>Trace and Search Deeper:<\/h3><p>Hackers often have backup mechanisms, inserting malicious links <code data-no-translation=\"\">mamglaqwek.com<\/code> in many other places, such as post content, widgets or themes. You need to scan the entire system to search for traces of this domain:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\"># Qu\u00e9t t\u00ecm trong to\u00e0n b\u1ed9 file c\u1ee7a wp-content\ngrep -rl \"mamglaqwek.com\" \/home\/yourdomain.com\/public_html\/ 2>\/dev\/null\n\n# Qu\u00e9t t\u00ecm trong to\u00e0n b\u1ed9 c\u00e1c b\u1ea3ng d\u1eef li\u1ec7u database\nwp db search \"mamglaqwek.com\" --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h2>Step 5: Check Configuration Files and Patch Critical Vulnerabilities<\/h2><p>Read the file carefully <code data-no-translation=\"\">.htaccess<\/code> and <code data-no-translation=\"\">wp-config.php<\/code>:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">cat \/home\/yourdomain.com\/public_html\/.htaccess\ncat \/home\/yourdomain.com\/public_html\/wp-config.php | grep -v \"^\\s*\/\/\" | grep -v \"^\\s*\\$\"<\/code><\/pre><p>Carefully check whether there are any unusual redirect rules in the `.htaccess` file. At the same time, during a review of the `wp-config.php` file, we identified 2 serious security vulnerabilities that require immediate action:<\/p><h3>1. Security keys (Salts keys) have not been set up<\/h3><p>The keys used to encrypt login cookies are still set to WordPress's default values:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">define( 'AUTH_KEY',         'put your unique phrase here' );\ndefine( 'SECURE_AUTH_KEY',  'put your unique phrase here' );\n...<\/code><\/pre><p>Get a new set of random keys from WordPress.org by running the command:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">curl -s https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/<\/code><\/pre><p>Or automatically rotate the Salts keys using WP-CLI (this will force all logged-in accounts, including hackers, to log out immediately):<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp config shuffle-salts --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h3>2. Database Password Leaked or Too Weak<\/h3><p>If your database connection password was exposed in logs or is too simple, change it immediately in the MySQL console:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\"># Truy c\u1eadp MySQL Console\nmysql -u root -p\n\n# Thay \u0111\u1ed5i m\u1eadt kh\u1ea9u cho user k\u1ebft n\u1ed1i database\nALTER USER 'yourdomain_wp_user'@'localhost' IDENTIFIED BY 'mat_khau_moi_sieu_manh';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre><p>Then, update this new password in the line <code data-no-translation=\"\">DB_PASSWORD<\/code> in the file <code data-no-translation=\"\">wp-config.php<\/code>.<\/p><h2>Step 6: Replace the entire Core source code with a clean copy<\/h2><p>To make sure no system files have been quietly altered by hackers, overwrite the core with a clean copy from WordPress's official source (skip the wp-content folder):<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">cd \/tmp\nwget https:\/\/downloads.wordpress.org\/release\/wordpress-7.0.2-no-content.zip\nunzip wordpress-7.0.2-no-content.zip\n\n# Sao l\u01b0u wp-admin v\u00e0 wp-includes c\u0169 \u0111\u1ec3 d\u1ef1 ph\u00f2ng\ncp -r \/home\/yourdomain.com\/public_html\/wp-admin \/home\/yourdomain.com\/wp-admin-backup-\\\\$(date +%Y%m%d)\ncp -r \/home\/yourdomain.com\/public_html\/wp-includes \/home\/yourdomain.com\/wp-includes-backup-\\\\$(date +%Y%m%d)\n\n# S\u1eed d\u1ee5ng rsync ghi \u0111\u00e8 core s\u1ea1ch\nrsync -av --exclude='wp-content' \/tmp\/wordpress\/ \/home\/yourdomain.com\/public_html\/<\/code><\/pre><h2>Step 7: Reset the password of the genuine Admin account<\/h2><p>Change the passwords for all actual admin accounts in the system (such as the account <code data-no-translation=\"\">admindps<\/code> and other admins) via WP-CLI:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp user update admindps --user_pass=\"MatKhauMoiSieuCapBaoMat@2026\" --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h2>Step 8: Block PHP File Execution in the Uploads Folder<\/h2><p>This is a mandatory security hardening action. Hackers frequently exploit upload vulnerabilities to upload webshells disguised with extensions such as `.png.php` or similar into the uploads folder. Create a file <code data-no-translation=\"\">.htaccess<\/code> located in the folder <code data-no-translation=\"\">wp-content\/uploads\/<\/code> with content that blocks PHP execution:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">&lt;Files *.php&gt;\n    deny from all\n&lt;\/Files&gt;<\/code><\/pre><h2>Step 9: Scan the System One More Time to Confirm It Is Clean<\/h2><p>Rerun the comprehensive scan to make sure no remaining threats are left behind:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wordfence malware-scan --include-all-files --output-path=\/home\/yourdomain.com\/public_html\/wordfence-scan-final.log \/home\/yourdomain.com\/public_html\/<\/code><\/pre><p>When the results come back completely clean, turn off maintenance mode:<\/p><pre data-no-translation=\"\"><code data-no-translation=\"\">wp maintenance-mode deactivate --allow-root --path=\/home\/yourdomain.com\/public_html<\/code><\/pre><h2>Step 10: File Permissions and Continuous Monitoring<\/h2><p>Set the directory permissions to <code data-no-translation=\"\">755<\/code>, the file is <code data-no-translation=\"\">644<\/code>, and file <code data-no-translation=\"\">wp-config.php<\/code> is <code data-no-translation=\"\">400<\/code> or <code data-no-translation=\"\">600<\/code> to prevent unauthorized changes to the configuration file.<\/p><h2>Website Security Optimization with DPS.MEDIA Professional Services<\/h2><p>Removing malware only addresses the symptoms. The core issue is that you must identify the original security vulnerability by analyzing the Web Server Access Log at the time the backdoor file was created, in order to close that gap and prevent hackers from returning next time.<\/p><p>You should review the official security standards through <a href=\"https:\/\/wordpress.org\/support\/article\/hardening-wordpress\/\" rel=\"nofollow noopener\" target=\"_blank\">the official WordPress Hardening documentation<\/a> to enhance the security of the system.<\/p><p>If you are struggling to clean up malicious code or want to strengthen comprehensive security for your website, contact DPS.MEDIA right away via Hotline\/Zalo: <strong>0961545445<\/strong> or visit our office at number <strong>56 Nguyen Dinh Chieu, Tan Dinh Ward, District 1, Ho Chi Minh City<\/strong>. We offer <a href=\"https:\/\/dps.media\/en\/\">professional WordPress website design service<\/a> SEO-compliant, with integrated multi-layer automatic security and daily secure backup mode, helping you operate your business with confidence and grow sustainably.<\/p>","protected":false},"excerpt":{"rendered":"<p>Detailed guide to the process of handling a hacked WordPress website, removing fake plugins wordpress-cache-optimizer.php, wp-content-filter.php, mu-plugin wp-fixplugin.php, and patching the Salts key vulnerability.<\/p>","protected":false},"author":0,"featured_media":39996,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"rs_blank_template":"","rs_page_bg_color":"","slide_template_v7":"","footnotes":""},"categories":[2037,2288,1204],"tags":[],"class_list":["post-39989","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bao-mat-website","category-thu-thuat-wordpress","category-wordpress-marketing"],"acf":[],"rankmath_keywords":{"primary":"x\u1eed l\u00fd wordpress b\u1ecb hack, wordpress b\u1ecb hack, c\u00e1ch x\u1eed l\u00fd wordpress b\u1ecb hack","secondary":["wordpress b\u1ecb hack","c\u00e1ch x\u1eed l\u00fd wordpress b\u1ecb hack"]},"yoast_keywords":{"primary":"","secondary":[]},"yoast_focuskw":"","rankmath_focuskw":"x\u1eed l\u00fd wordpress b\u1ecb hack, wordpress b\u1ecb hack, c\u00e1ch x\u1eed l\u00fd wordpress b\u1ecb hack","seo_keywords":{"primary":"x\u1eed l\u00fd wordpress b\u1ecb hack, wordpress b\u1ecb hack, c\u00e1ch x\u1eed l\u00fd wordpress b\u1ecb hack","secondary":["wordpress b\u1ecb hack","c\u00e1ch x\u1eed l\u00fd wordpress b\u1ecb hack"]},"_links":{"self":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/comments?post=39989"}],"version-history":[{"count":0,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/39989\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media\/39996"}],"wp:attachment":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media?parent=39989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/categories?post=39989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/tags?post=39989"}],"curies":[{"name":"Agency collaboration cost optimization strategy","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}