• Resolved danlyons

    (@danlyons)


    We have an old WPMU site that has been continually upgraded through the Admin dashboard without issue. Recently, it was attacked and the wp-config.php file was compromised, and all contents were completely deleted.

    I have restored the sample file, and begun working through the changes. Here’s my current wp-config.php:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', '********');
    
    /** MySQL database username */
    define('DB_USER', '********');
    
    /** MySQL database password */
    define('DB_PASSWORD', '********');
    
    /** MySQL hostname */
    define('DB_HOST', '********');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /** Allow Database Repair from WP-ADMIN */
    define('WP_ALLOW_REPAIR', true);
    
    /** Define as WPMU Site */
    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', '********' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.ww.wp.xz.cn/secret-key/1.1/salt/ ww.wp.xz.cn secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define('AUTH_KEY',         '********');
    define('SECURE_AUTH_KEY',  '********');
    define('LOGGED_IN_KEY',    '********');
    define('NONCE_KEY',        '********');
    define('AUTH_SALT',        '********');
    define('SECURE_AUTH_SALT', '********');
    define('LOGGED_IN_SALT',   '********');
    define('NONCE_SALT',       '********');
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     */
    define('WP_DEBUG', false);
    
    /* That's all, stop editing! Happy blogging. */
    
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    When I try to run the repair, I receive the following errors:

    wp_posts: Table '********.wp_posts' doesn't exist
    wp_comments: Table '********.wp_comments' doesn't exist
    wp_links: Table '********.wp_links' doesn't exist
    wp_options: Table '********.wp_options' doesn't exist
    wp_postmeta: Table '********.wp_postmeta' doesn't exist
    wp_terms: Table '********.wp_terms' doesn't exist
    wp_term_taxonomy: Table '********.wp_term_taxonomy' doesn't exist
    wp_term_relationships: Table '********.wp_term_relationships' doesn't exist
    wp_commentmeta: Table '********.wp_commentmeta' doesn't exist
    wp_useronline: Table '********.wp_useronline' doesn't exist

    I’ve gone through a number of the other forum posts, but nothing has quite resolved it for me at this point, although they have influenced the current config.

    Any help would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter danlyons

    (@danlyons)

    Managed to fix it myself with a backup, after finally finding one back far enough that is wasn’t hacked.

    In case it helps anyone else, here’s the version that resolved my issues:

    <?php
    /**
     * The base configurations of the WordPress.
     *
     **************************************************************************
     * Do not try to create this file manually. Read the README.txt and run the
     * web installer.
     **************************************************************************
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH.
     *
     * This file is used by the wp-config.php creation script during the
     * installation.
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', '********');
    
    /** MySQL database username */
    define('DB_USER', '********');
    
    /** MySQL database password */
    define('DB_PASSWORD', '********');
    
    /** MySQL hostname */
    define('DB_HOST', '********');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    define('VHOST', 'no');
    $base = '/';
    define('DOMAIN_CURRENT_SITE', '********' );
    define('PATH_CURRENT_SITE', '/' );
    define('BLOGID_CURRENT_SITE', '1' );
    
    /** Allow Database Repair from WP-ADMIN */
    define('WP_ALLOW_REPAIR', true);
    
    /**#@+
     * Authentication Unique Keys.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link http://api.ww.wp.xz.cn/secret-key/1.1/ ww.wp.xz.cn secret-key service}
     *
     * @since 2.6.0
     */
    define('AUTH_KEY', '********');
    define('SECURE_AUTH_KEY', '********');
    define('LOGGED_IN_KEY', '********');
    define('NONCE_KEY', '********');
    define('AUTH_SALT', '********');
    define('LOGGED_IN_SALT', '********');
    define('SECURE_AUTH_SALT', '********');
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress.  A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
     * language support.
     */
    define ('WPLANG', '');
    
    // double check $base
    if( $base == 'BASE' )
    	die( 'Problem in wp-config.php - $base is set to BASE when it should be the path like "/" or "/blogs/"! Please fix it!' );
    
    // uncomment this to enable wp-content/sunrise.php support
    //define( 'SUNRISE', 'on' );
    
    // uncomment to move wp-content/blogs.dir to another relative path
    // remember to change WP_CONTENT too.
    // define( "UPLOADBLOGSDIR", "fileserver" );
    
    // If VHOST is 'yes' uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled)
    // For example, the browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' );
    // define( 'NOBLOGREDIRECT', '' );
    // On a directory based install you can use the 404 handler.
    
    // Location of mu-plugins
    // define( 'WPMU_PLUGIN_DIR', '' );
    // define( 'WPMU_PLUGIN_URL', '' );
    // define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );
    
    // Uncomment to disable the site admin bar
    //define( 'NOADMINBAR', 1 );
    
    define( "WP_USE_MULTIPLE_DB", false );
    
    define('FORCE_SSL_LOGIN', false);
    define( 'NONCE_SALT', '********' );
    /* That's all, stop editing! Happy blogging. */
    
    /** WordPress absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    ?>

    Thanks anyways and hope this helps someone else in the future!

    Glad to see you have resolved the issue. Unless you are still in the process of repairing your database you should remove the following:

    /** Allow Database Repair from WP-ADMIN */
    define('WP_ALLOW_REPAIR', true);

    Added with Version 2.9, there is automatic database optimization support, which you can enable by adding the following define to your wp-config.php file only when the feature is required.

    https://codex.ww.wp.xz.cn/Editing_wp-config.php#Automatic_Database_Optimizing

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP-Config Hacked – Now Database Tables Reported Missing’ is closed to new replies.