Skip to content

Instantly share code, notes, and snippets.

@bongbongco
Created February 12, 2018 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bongbongco/21682f0f08800d807872b3d131fa151b to your computer and use it in GitHub Desktop.
Save bongbongco/21682f0f08800d807872b3d131fa151b to your computer and use it in GitHub Desktop.
patch for DoS vulenrability (CVE-2018-6389)
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