Skip to content
STAGE33R

Guides · Server software · 7 steps · reviewed

PrestaShop: update safely, remove unused modules and protect the back office

Most PrestaShop compromises come through an outdated module or an exposed admin folder, not through the core. Updating, removing what you do not use and restricting the back office closes most of them.

  1. Back up files and database

    Back up the whole shop folder and the database before any change, and keep the copies off the server.

    mysqldump --single-transaction DB_NAME | gzip > ~/ps-db-$(date +%F).sql.gz
    tar czf ~/ps-files-$(date +%F).tgz /var/www/shop
  2. List modules and versions

    In the back office open Module Manager and note anything with a pending update, anything you no longer use and anything that is no longer maintained by its author.

  3. Uninstall and delete unused modules

    A disabled module is still code on disk and can still be reached by URL. Uninstall it in the back office, then delete its folder.

    ls /var/www/shop/modules | head -n 80
  4. Update the core and the modules on a copy first

    Use the official update path for your version, in a copy of the shop, and test the front office, checkout and the back office before doing it live.

  5. Restrict the admin folder

    Do not leave the admin folder at a guessable name. Restrict it by IP or add HTTP authentication at the web server, and enable two-factor if your version supports it.

    # nginx example
    location ^~ /ADMIN_FOLDER/ {
        allow YOUR_IP;
        deny all;
    }
  6. Remove install leftovers and lock down permissions

    The install folder must not exist, and the web server should not be able to write the code folders.

    ls /var/www/shop/install* 2>/dev/null
    find /var/www/shop -type f -perm -o+w | head
  7. Test an order end to end

    Place a real test order with each payment method and check the confirmation email.

Common mistakes

  • Updating the live shop first: a module that breaks checkout costs sales.
  • Keeping old modules disabled instead of deleting them.
  • Using the same password for the admin and the hosting panel.
  • Skipping the test of payment modules, which are the most sensitive part.

How to undo it

Restore the file archive and the database dump you made, clear the cache and check the front office. Keep the backup until the new version has run for a few days.

Sources

Commands are for Debian and Ubuntu unless noted. Test on a copy first and keep a backup: you are responsible for changes on your own systems.