Changeset 722992
- Timestamp:
- 06/05/2013 08:42:02 AM (13 years ago)
- Location:
- disable-insecure-features/trunk
- Files:
-
- 2 edited
-
functions.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
disable-insecure-features/trunk/functions.php
r712114 r722992 2 2 /* 3 3 Plugin Name: disable insecure features 4 Plugin URI: http://www.planetzuda.com/news/ 5 Description: This disables pingbacks on previously published posts and pages, disables the xmlrpc, hides the readme.html, license.txt and fixes wp-config.php and .htaccess permissions so hackers can't modify them.6 Version: 0. 34 Plugin URI: http://www.planetzuda.com/news/plugins/ 5 Description: This automatically disables pingbacks on old posts and pages, not new ones. This locks down htaccess, hides readme.html, and other files. Credit to Shivanand Sharma from http://binaryturf.com for SQL statements to disable old post pingbacks. Version 0.1 through 0.3 said xmlrpc was turned off. We discovered with the help from tw2113 that the WordPress code that claims it disables the xmlrpc, doesn't disable it. This means the plugin disable xmlrpc is useless. We are working to see if there is a way to disable the xmlrpc via plugin. 6 Version: 0.4 7 7 Author: Planet Zuda, LLC 8 Author URI: http://www.planetzuda.com/news/ plugins/8 Author URI: http://www.planetzuda.com/news/ 9 9 License: GPLv2 10 10 */ … … 46 46 add_action('admin_menu','swph_setup'); 47 47 48 function no_more_xmlrpc()49 {50 add_filter( 'xmlrpc_enabled', '__return_false' ); //51 }52 function swph_xmlrpc()53 {54 add_filter( 'xmlrpc_enabled', '__return_true' );55 }56 48 57 49 58 50 function swph_auto_disabled_features() 59 51 { 52 53 60 54 // the following turns off pingbacks for already published posts and pages 61 55 global $wpdb; 56 62 57 $wpdb->query("UPDATE $wpdb->posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';"); 63 58 $wpdb->query("UPDATE $wpdb->posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';"); 64 // this will lock down the readme.html so hackers can't see it.65 59 66 // the rest is by us. All chmod files will be moved to the .htaccessin the future.60 //thank you to http://wordpress.stackexchange.com/questions/78780/xmlrpc-enabled-filter-not-called for this answer and tw2113 for helping out in the wordpress IRC. This may be implemented in the future. 67 61 68 $swph_readme = ABSPATH . 'readme.html'; 62 $swph_readme = ABSPATH . 'readme.html'; // you don't want people to see what version of WordPress you're running. 69 63 if(file_exists($swph_readme)) 70 64 { 71 chmod($swph_readme,0600); 65 chmod($swph_readme,0600); // makes it seem like the file doesn't exist for users who look for it. 72 66 } 73 67 … … 84 78 chmod($swph_config,0600); 85 79 } 80 86 81 // lock down the .htaccess so hackers can't write to it via bad permissions. 87 82 $swph_access = ABSPATH . '.htaccess'; … … 90 85 chmod($swph_access,0644); 91 86 } 92 else 93 { 94 ?> 95 you moved your wp-config file, so we can't secure it. Sorry. 96 <?php 97 } 98 /* 99 botme needs a lot more work before it is auto enabled. 100 */ 101 } 102 87 } // closes function 103 88 register_activation_hook(__FILE__,'swph_auto_disabled_features'); 104 function botme()105 {106 $bot = WP_PLUGIN_DIR . '/disable-insecure-features/robots.txt';107 $newbot = ABSPATH . 'robots.txt';108 if(file_exists($newbot))109 {110 copy($bot,$newbot);111 chmod($newbot,0644);112 }113 else114 {115 fopen($newbot,"a+");116 fclose($newbot,"a+");117 copy($bot,$newbot);118 chmod($newbot,0644);119 }120 } // closes botme()121 89 122 90 … … 124 92 { 125 93 // settings page put all variables up here to make it clean then generate the form. 126 $swph_url = get_bloginfo('url'); // straight-forward 127 $swph_on = swph_xmlrpc(); // turns the xmlrpc on. Not a good idea, but a few people need it. 128 if($swph_on) 129 register_activation_hook(__FILE__,'swph_xmlrpc'); 130 ?> 131 <br /> 132 <input type="radio" value="<?php swph_disable_xmlrpc(); echo 'disabled' // make sure this works before releasing it. Test it with a xmlrpc program. ?> turn off xmlrpc"> Turn off XMLRPC 133 <input type="submit" value="Submit"> 134 <?php 135 if(!$swph_on) 136 register_activation_hook(__FILE__,'swph_disable_xmlrpc'); 137 ?> 138 139 <input type="radio" value="<?php $swph_on; echo 'enabled'; // make sure this works before releasing it. Test it with a xmlrpc program. ?> turn on xmlrpc "> Turn on XMLRPC 140 <input type="submit" value="Submit"> 141 <?php 142 143 ?> 144 Please go to <a href="<?php echo $swph_url; ?>/wp-admin/options-discussion.php"> settings->discussion </a> and uncheck the box next to the words that say "Allow link notifications from other blogs (pingbacks and trackbacks)" 145 <br /> then click save changes. This will disable any pingbacks for future posts and pages. This plugin automatically disables pingbacks for posts and pages already published. It also disables the xmlrpc.<br /> 146 This is important since hackers are abusing these features to hack other sites. <br /> 147 A future update will let you turn pingbacks on for old posts and pages and re-enable the xmlrpc, even though we really don't recommend it. 94 95 ?> 96 Disable pingbacks for future posts by going to <a href="<?php $swph_url; ?>/wp-admin/options-discussion.php"> settings->discussion </a> and uncheck the box that say "Allow link notifications from other blogs (pingbacks and trackbacks)" 97 <br /> 148 98 <?php 149 99 } 150 151 function swph_disable_xmlrpc() 152 { 153 add_filter( 'xmlrpc_enabled', 'no_more_xmlrpc' ); 154 } 100 ?> -
disable-insecure-features/trunk/readme.txt
r712114 r722992 3 3 Contributors: Planet Zuda, LLC 4 4 Tags: comments, spam, hacking, security,wordpress security, readme, htaccess, license, remove version, version, wp-config, 5 Requires at least: 3.0 .15 Requires at least: 3.0 6 6 Tested up to: 3.5.1 7 7 Stable tag: 3.5.1 … … 11 11 == Description == 12 12 13 This disables pingbacks on previously published posts and pages, disables the xmlrpc,hides the readme.html, license.txt and fixes wp-config.php and .htaccess permissions so hackers can't modify them.13 This disables pingbacks on previously published posts and pages,hides the readme.html, license.txt and fixes wp-config.php and .htaccess permissions so hackers can't modify them. 14 14 == Installation == 15 16 1. Upload the disable-insecure-features directory to the `/wp-content/plugins/` directory in your WordPress installation 17 2. Activate the plugin through the 'Plugins' menu in WordPress 18 3. Pingbacks for previously published posts and pages are disabled and so is the XML-RPC! 15 1. Go to your WordPress admin dashboard and go to plugins > add new and then type disable insecure features. Our plugin will come up. 16 click install now and then hit activate now. 17 2. You are now more secure. 18 19 19 == Credits == 20 We would like to give credit where credit is due. We would like to thank Shivanand Sharma from http://binaryturf.com for his article on disabling pingbacks from previously published posts and pages. The disabling feature of the xml-rpc is from the disable xml-rpc plugin, so they also deserve credit.20 We would like to give credit where credit is due. We would like to thank Shivanand Sharma from http://binaryturf.com for his article on disabling pingbacks from previously published posts and pages. 21 21 == Frequently Asked Questions == 22 22 … … 34 34 = Will the readme.html, license.txt, wp-config.php, .htaccess or any other file reset to insecure permissions if I delete this plugin? = 35 35 No. 36 = Does this plugin disable the XMLRPC? 37 No. Code has been passed around WordPress claiming that it disables the XMLRPC and there is even a plugin called disable xmlrpc using that code, but it doesn't work 38 = Will you be disabling the xmlrpc in the future? 39 Hopefully. We are looking into how we can turn it off via the plugin. 40 = I don't want pingbacks turned off for future posts. WIll this plugin do that? 41 Whenever you update the core or reactivate the plugin your pingbacks for all published posts and pages will be turned off. 36 42 == Changelog == 43 =0.4= 44 We discovered that the code everyone is using to disable the xmlrpc for 3.5 and up isn't disabling the xmlrpc, so we've removed that feature. We hope to actually disable the xmlrpc if at all possible. 45 = 0.3 = 46 changes permissions for readme.html, license.txt, and .htaccess. It makes it so readme.html and license.txt can't be accessed by visitors. It makes sure .htaccess has the appropiate permissions. 37 47 38 48 = 0.2 =
Note: See TracChangeset
for help on using the changeset viewer.