Locking Down the Magento Admin: 12 Security Checks
Card skimmers and hijacked admin accounts are still the most common ways Magento stores get compromised. Patching fixes known bugs. Hardening shrinks everything else an attacker can reach. Work through these twelve checks.
The admin panel
- Move the admin away from
/adminto a custom path. - Keep two-factor authentication on for every admin account.
- Limit admin access to known IP addresses or a VPN.
- Delete unused accounts and give everyone their own login.
- Use roles with only the permissions each person needs.
Two commands help here:
php bin/magento info:adminuri php bin/magento admin:user:unlock USERNAME
The server
- Make code directories read-only for the web server user in production.
- Block PHP execution in
pub/mediaand other upload folders. - Patch the operating system, PHP and database, not only Magento.
- Use SSH keys, and turn off password and root logins.
location ~* ^/media/.*\.php$ {
deny all;
}
The storefront
- Apply a strict Content Security Policy on checkout to stop injected skimmers.
- Place a web application firewall in front of the store.
- Scan for malware daily and alert on any change to core or checkout files.
Warning signs
Admin users nobody recognises, new JavaScript on checkout, or files changed outside a deployment all need immediate attention. Put the store into maintenance mode, keep the logs and bring in experienced help quickly.
Need a second pair of eyes on this? Our team handles Magento development every week. See how we can help.