LV1lv1
  • Restoring articles and defensive methods after a WordPress website is attacked and tampered with

    My WordPress website, which was only set up 5 days ago, was hacked by a hacker using Python. Save the posts and reinstall WordPress Use phpMyAdmin to export these five tables from the database: wp_postmeta, wp_posts, wp_terms, wp_terms, and wp_term_taxonomy; Compress and download this folder: /wp-content/uploads; Delete all website files and all tables in the database; Upload the WordPress zip file again, extract it, and reinstall; Upload the compressed file from uploads, and then unzip it; Delete these five tables from the database: wp_postmeta, wp_posts, wp_terms, wp_terms, and wp_term_taxonomy; Upload the five tables exported from the database. This completes the reinstallation of WordPress and restores the previously published articles. Defense Method If you are using an nginx environment, simply add this code to the server{} section of the configuration file: if ($http_user_agent ~* "WinHttp|WebZIP|FetchURL|node-superagent|java|FeedDemon|Jullo|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|Feedly|Apache-HttpAsyncClient|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|BOT/0.1|YandexBot|FlightDeckReports|Linguee Bot|Go-http-client|curl|Wget|okhttp|node-fetch|axios|php|Ruby|PostmanRuntime|RestSharp|sqlmap|nmap|Metasploit|Nikto|zgrab|masscan|wpscan|^$") { return 403; } If you are using Apache, add this code at the top of the .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On # Merges and blocks all crawlers, scanners, scripts, and malicious UAs (with deduplication and complete version) RewriteCond %{HTTP_USER_AGENT} ^$ [OR] RewriteCond %{HTTP_USER_AGENT} (WinHttp|WebZIP|FetchURL|node-superagent|java|FeedDemon|Jullo|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|Feedly|Apache-HttpAsyncClient|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|BOT/0.1|YandexBot|FlightDeckReports|Linguee Bot|Go-http-client|curl|Wget|okhttp|node-fetch|axios|php|Ruby|PostmanRuntime|RestSharp|sqlmap|nmap|Metasploit|Nikto|zgrab|masscan|wpscan|Semrush|meta-webindexer|facebookexternalhit|ExternalFetcher|meta-externalagent|Amazonbot|Amzn-SearchBot|Majestic|Sitechecker|Seoscout|PetalBot|GPTBot|ChatGPT-User|OpenAI-Search|AI2Bot|AmazonBot-Sneek|ClaudeBot|anthropic-ai) [NC] RewriteRule ^ - [F,L] </IfModule> By following these…
    Articles
    • 4
    • 0
Profile
Cart
Coupons
Check-in
Message Message
Search