{"id":150,"date":"2020-03-24T21:41:03","date_gmt":"2020-03-24T21:41:03","guid":{"rendered":"http:\/\/ictbank.ir\/blog\/?p=150"},"modified":"2020-03-30T09:05:48","modified_gmt":"2020-03-30T09:05:48","slug":"one-way-to-prevent-ddos-attacks-in-wordpress","status":"publish","type":"post","link":"https:\/\/ictbank.ir\/blog\/one-way-to-prevent-ddos-attacks-in-wordpress\/","title":{"rendered":"One way to Prevent DDOS attacks in WordPress"},"content":{"rendered":"\n<p>If you scan your WordPress site with wpscan tool, you would see a message like this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;+] http:\/\/ictbank.ir\/blog\/wp-cron.php\n | Found By: Direct Access (Aggressive Detection)\n | Confidence: 60%\n | References:\n |  - https:\/\/www.iplocation.net\/defend-wordpress-from-ddos\n |  - https:\/\/github.com\/wpscanteam\/wpscan\/issues\/1299\n<\/pre><\/div>\n\n\n<p>It means that a hacker can generate a DDOS attack on your host using this URL, cause this URL return a blank page and a 200 HTML Response Code.<\/p>\n\n\n\n<p>Also, this script will use a considerable amount of RAM and CPU, due to its heavy database queries.<\/p>\n\n\n\n<p>So you have to do some workarounds to prevent these problems:<\/p>\n\n\n\n<p>1. edit wp-config.php file and add below line to disable running the above script for every visits:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndefine(&#039;DISABLE_WP_CRON&#039;, true);\n<\/pre><\/div>\n\n\n<p>2. create a crontab record for running this script periodically:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n*\/10    *       *       *       *       \/usr\/bin\/php \/path_of_script\/wp-cron.php &gt;\/dev\/null 2&gt;&amp;amp;\n<\/pre><\/div>\n\n\n<p>3. secure the script and return a 403 error code. to do so, you have to edit your webservice config file (\/etc\/httpd\/conf\/httpd.conf) and add the follow: (123.123.123.123 is your web server ip address)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Directory &quot;\/path_to_your_weblog&quot;&gt;\n\tOrder allow,deny\n\tAllow from all\n\t&amp;lt;Files &quot;wp-cron.php&quot;&gt;\n\t\tRequire ip 123.123.123\n\t\tRequire ip 127.0.0.1\n\t&amp;lt;\/Files&gt;\n&amp;lt;\/Directory&gt;\n<\/pre><\/div> ","protected":false},"excerpt":{"rendered":"<p>If you scan your WordPress site with wpscan tool, you would see a message like this: It means that a hacker can generate a DDOS attack on your host using this URL, cause this URL return a blank page and a 200 HTML Response Code. Also, this script will use a considerable amount of RAM [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/template-full-width.php","format":"standard","meta":{"footnotes":""},"categories":[71,73],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-security","category-wordpress-web-security"],"_links":{"self":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":2,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":188,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions\/188"}],"wp:attachment":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}