Skip to content

WordPress security mistakes that are everywhere

A WordPress audit across twenty inherited sites finds the same configuration mistakes on most of them. The ten patterns that show up everywhere and the quick fix for each one.

After auditing enough WordPress sites — twenty inherited from previous agencies, fifty from internal teams that have moved on — the patterns get predictable. The same configuration mistakes show up over and over, on sites built by different people in different years. This is not because WordPress operators are careless; it is because the defaults are forgiving, the documentation is fragmented, and the warnings only appear when something is on fire. The ten mistakes below are the ones that show up almost everywhere, with the quick fix for each.

What’s happening

A WordPress site that has been running for two years and has never been audited accumulates configuration debt. Each layer (server, web server, database, WordPress core, plugins, theme) has settings that should be set differently for production than for development. The defaults are designed to make WordPress work for someone learning, not for a site under attack. The mistakes accumulate because nobody is checking — until an incident, an audit, or a takeover forces a review.

The ten patterns below are the ones found in the majority of WordPress audits, in order of how frequently they appear (most common first).

How to verify

The audit script that finds all ten in five minutes:

#!/bin/bash
echo "=== 1. file editor enabled? ==="
grep "DISALLOW_FILE_EDIT" wp-config.php || echo "MISSING - file editor enabled"

echo "=== 2. table prefix is wp_? ==="
grep "table_prefix" wp-config.php

echo "=== 3. admin user named 'admin'? ==="
wp user list --fields=user_login --role=administrator | grep -E "^admin$"

echo "=== 4. WP_DEBUG enabled in production? ==="
grep -E "WP_DEBUG.*true" wp-config.php

echo "=== 5. xmlrpc.php accessible? ==="
curl -sI https://example.com/xmlrpc.php | head -1

echo "=== 6. REST API user enumeration? ==="
curl -s https://example.com/wp-json/wp/v2/users | head -c 200

echo "=== 7. author archive enumeration? ==="
curl -sI https://example.com/?author=1 | head -1

echo "=== 8. PHP files in uploads? ==="
find wp-content/uploads -name "*.php" -ls

echo "=== 9. debug.log accessible? ==="
curl -sI https://example.com/wp-content/debug.log | head -1

echo "=== 10. backup files in doc root? ==="
ls -la *.sql *.sql.gz *.zip *.tar.gz 2>/dev/null

Each one returns the relevant data. The interpretation is in the fix section.

The fix

The ten mistakes, in order of frequency, with the immediate fix for each.

  1. File editor enabled in the admin. The Plugin → Editor and Appearance → Theme Editor screens allow administrators to modify PHP files from the WordPress admin. A compromised admin account can use these to plant a backdoor without any other access. Fix:

    wp config set DISALLOW_FILE_EDIT true --raw

    The fix takes 30 seconds and breaks nothing for sites with a real deployment workflow (which is most of them).

  2. Default wp_ table prefix. This is a weaker finding than the others — changing the prefix does not stop SQL injection (it just changes the table name) — but the default prefix is also a fingerprint that the install was never customized. Fix:

    # On a new install, before populating
    wp config set table_prefix custom_  
    # On an existing install, requires database migration; consider scope

    For existing sites this is more work than it is worth unless you are doing a full migration anyway.

  3. An admin user literally named admin. Brute-force bots try admin first. Removing or renaming this account eliminates 50% of the credential-guess attempts. Fix:

    # Create a new admin user, login as new user, then delete admin
    wp user create newadmin admin@example.com --role=administrator --user_pass=$(openssl rand -base64 32)
    wp user delete admin --reassign=$(wp user get newadmin --field=ID)
  4. WP_DEBUG enabled in production. Debug mode leaks PHP errors with file paths and database queries into the page output and wp-content/debug.log (which is often web-accessible). Fix:

    wp config set WP_DEBUG false --raw
    wp config set WP_DEBUG_LOG false --raw
    wp config set WP_DEBUG_DISPLAY false --raw
  5. XML-RPC accessible. Covered in detail in a separate KB. The default state allows credential-stuffing via system.multicall. Fix:

    # In .htaccess
    <Files "xmlrpc.php">
        Require all denied
    </Files>
  6. REST API leaks usernames. Covered in detail in a separate KB. https://example.com/wp-json/wp/v2/users returns user information to anyone. Fix is the mu-plugin filter that requires authentication on the users endpoint.

  7. Author archive enumeration. https://example.com/?author=1 redirects to /author/admin/, leaking the username. Fix:

    # In .htaccess
    RewriteCond %{QUERY_STRING} ^author=([0-9]*)
    RewriteRule .* - [F]
  8. PHP files in wp-content/uploads/. The uploads directory is web-accessible. PHP files in it are a sign of either a successful upload exploit or a poorly-designed plugin. Fix:

    # Find them
    find wp-content/uploads -name "*.php" -ls
    
    # Block execution at web server level

    In .htaccess inside the uploads directory:

    <FilesMatch "\.(php|phtml|phar|php5|php7)$">
        Require all denied
    </FilesMatch>

    In nginx:

    location ~* /wp-content/uploads/.*\.(?:php|phtml|phar)$ {
        deny all;
    }
  9. debug.log web-accessible. When WP_DEBUG_LOG is enabled, WordPress writes errors to wp-content/debug.log. This file is in the document root and is served as plaintext by default. It often contains database table names, file paths, and occasionally credentials in error messages. Fix: disable WP_DEBUG_LOG in production (per item 4) and block direct access:

    <Files "debug.log">
        Require all denied
    </Files>
  10. Backup files in the document root. Names like backup.sql, wp-content.zip, site-2024.tar.gz, database-export.sql.gz left at the document root after a maintenance task are publicly downloadable. Attackers run wordlist scans for exactly these names. Fix:

    # Find and move them
    cd /var/www/html
    ls -la *.sql *.sql.gz *.zip *.tar.gz 2>/dev/null
    mv *.sql *.sql.gz *.zip *.tar.gz /tmp/  # then secure-delete

    Configure backups to write to a location outside the document root in the first place.

These ten fixes, applied across a fleet, eliminate the most common findings in a WordPress audit. None of them is difficult; what makes the difference is having a checklist and running it consistently. Stack Harbor applies this list as part of enterprise WordPress support onboarding, then re-audits quarterly to catch drift. If you would like to know how many of these ten apply to your WordPress site or fleet right now, book a free audit pass.