Created
February 12, 2018 00:42
-
-
Save bongbongco/21682f0f08800d807872b3d131fa151b to your computer and use it in GitHub Desktop.
patch for DoS vulenrability (CVE-2018-6389)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -f wp-login.php && -f wp-admin/load-scripts.php && -f wp-admin/includes/noop.php ]] | |
then | |
sed -i "1 s/^.*$/<?php\ndefine('CONCATENATE_SCRIPTS', false);/" wp-login.php | |
sed -i -e "s/^require( ABSPATH . WPINC . '\/script-loader.php' );$/require( ABSPATH . 'wp-admin\/admin.php' );/g" wp-admin/load-scripts.php | |
sed -i -e "s/^require( ABSPATH . WPINC . '\/script-loader.php' );$/require( ABSPATH . 'wp-admin\/admin.php' );/g" wp-admin/load-styles.php | |
echo """<?php | |
/** | |
* Noop functions for load-scripts.php and load-styles.php. | |
* | |
* @package WordPress | |
* @subpackage Administration | |
* @since 4.4.0 | |
*/ | |
function get_file( \$path ) { | |
if ( function_exists('realpath') ) { | |
\$path = realpath( \$path ); | |
} | |
if ( ! \$path || ! @is_file( \$path ) ) { | |
return ''; | |
} | |
return @file_get_contents( \$path ); | |
}""" > wp-admin/includes/noop.php | |
echo 'Successfuly patched.' | |
else | |
echo 'Please run this file from WordPress root directory.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment