interconnectit / Search-Replace-DB

This script was made to aid the process of migrating PHP and MySQL based websites. Works with most common CMSes.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
GNU General Public License v3.0
4k stars 855 forks source link

General issue about security #275

Closed nylen closed 4 years ago

nylen commented 5 years ago

From https://interconnectit.com/products/search-and-replace-for-wordpress-databases/:

I heard this script is insecure. Is it really?

Yes – it’s a development tool, not something you should be putting on production servers. If you do put it on a production server be really careful. We’re trying to work out ways of protecting users further, because it turns out that this tool is being recommended by webhosts around the world, but too often to quite naive users who don’t really understand the risks.

This is raising red flags for me. "be really careful" is not a solution for making this script accessible via the public web, especially for "naive users who don't really understand the risks".

I know this script is intended for use with more than just WordPress, but since this is probably the most common use case, one idea would be to make the default configuration of this script try to detect the WordPress settings, and if they are found, only allow access via the login of an administrative user on the WP site.

Failing that, what solutions are you working out to protect users further?

sawtoothid commented 5 years ago

You do understand that this is not a WP plugin, yes? It has no access to WP functions; it doesn't even run WP.

nylen commented 5 years ago

It has no access to WP functions

Of course it does, if it detects WP and chooses to use its data for authentication:

if ( file_exists( 'wp-load.php' ) ) {
    require_once 'wp-load.php';
    // now we have access  to WP functions
    // require authentication of an admin user stored in WP database
}

Note, I've edited the original issue to clarify this, I originally mentioned allowing access through wp-admin but this makes more sense.

gianluigi-icit commented 4 years ago

This is a feature we considered, we will work on it probably after v4 is released.