A Magento community sourced security pre-flight checklist.

Overview

Magento Security Checklist

This is a community sourced checklist of security measures to take before launching your store. Think of it as a pre-flight checklist so you don't forget something important because you've been in a headlong rush for the last few months to get all the features of your eCommerce site built.

This checklist will apply to only Magento 2.x versions.

Custom code

  • Are all inputs validated on the server side?
    • (TODO: Link to validation tutorial)
  • Are you sanitizing all inputs also? (eg: casting to integers if a number is expected?)
  • Are you correctly protecting your code against PHP string comparison vulnerabilities? (eg. == vs ===)
  • Are you using Magento built in form_key validation on all custom forms?
    • (TODO: Link for more info on CSRF Anti-forgery tokens)
  • Are you properly escaping all output to screen using escapeHtml(), escapeJs() and similar functions?
  • Are you setting HttpOnly and Secure flag on any custom cookies?
  • Are you using the Magento\Config\Model\Config\Backend\Encrypted backend model for sensitive API data to be stored in the DB? eg: payment gateway keys.
  • Are you using any dynamic code execution functions like eval, shell_exec or backticks (``)?
  • Are you building MySQL queries properly and not using direct queries?
  • Are all sensitive or system specific settings treated as sensitive configuration?
  • Are you adhering to the Magento Technical Guidelines when developing custom code?
  • Are you sanitizing/ filtering user inputs and dynamic data against malicious code to prevent cross-site scripting (XSS)?

Extension security checklist

  • Do you have the latest version of all the extensions being used on the site?
  • Are all your extensions using Magento ACL properly to limit the scope of users?
    • (TODO: ACL tutorial)
  • Did you perform a security audit on 3rd party extensions used on the store?
    • At the very least execute Extension Code Review against Magento Coding Standards
    • Use a tool that reports the usage of dependencies with known security vulnerabilities
    • Review if Passwords/API Credentials or other Sensitive Data stored by 3rd Party Extension are not save in Database using plaintext!
    • (TODO: Link to more sample tools to help perform security audit on extensions)
  • Review the need of using Magento_Swagger & Magento_Version Modules in Production Environment (consider to Disable those CORE Modules or at the very least restrict access to hostname/magento_version and hostname/swagger)
  • Are you updating the 3rd party extensions on a regular basis?

Magento Admin settings

  • Are you using a custom Magento Admin URL?
  • Is the secret key added to admin URLs?
  • Is access to your Admin URL IP whitelisted or protected via VPN?
  • If you can't make the Admin URL private, are you using CAPTCHA/ reCAPTCHA for admin login form?
  • Is the admin session lifetime set to a reasonable configuration (1-2hrs)?
  • Are you reinforcing admin password renewal at least every 3 months?
  • Are you disabling the admin account sharing?
  • Are you limiting the failed admin login attempts to a reasonable number of times (eg 3)?
  • Confirm that Web -> Default Cookie Settings -> Use HTTP Only is not disabled?
  • Are you using 2FA for your admin login?
  • Are there any old/unused admin users which were created for testing or development that should be removed?
  • Are you using CAPTCHA/ reCAPTCHA for customer facing web forms?

Server settings

  • Is your site logging information in a format that is easily reviewed by your team?
  • Is your site logging any potentially sensitive information?
  • Is you TLS certificate properly installed and your OpenSSL configuration set to high standards?
  • Do you have notifications turned on for filesystem integrity?
  • Disable Server Signature:
  • Set secure PHP settings in php.ini
    • Minimize the number of PHP modules you have installed. Remove any not needed by Magento.
    • Disable PHP version exposure: expose_php = Off
    • Disable Script Name exposure for mail() function: mail.add_x_header = Off
    • Disable errors: display_errors = Off
    • Set httponly flag as default for cookies: session.cookie_httpsonly = On
    • Set secure flag as default for cookies: session.cookie_secure = On
    • Disable remote file inclusion: allow_url_fopen = Off and allow_url_include = Off
    • Set open_basedir and upload_tmp_dir to appropriate directories for you distro/installation
  • Are there any (development) files or database dumps lying around in the production document root that are not intended for public usage (for example info.php, phpinfo.php, dbdump.sql.gz)?
  • Does an unnecessary .git folder or .gitignore file exist in your production filesystem?
  • Are any required files for server operation readable publicly? eg: php.ini or .user.ini
  • Do all your folders in your docroot have the appropriate permissions set? (for example var/logs, /var/report, install)?
  • Have you analyzed your HTTP response headers for problems?
  • Unless you have specific requirements for them have you limited all requests to GET and PUT?
  • Are you disabling the directory paths indexing/ listing?
  • Can you set your Magento php files installation as read-only?
    • Do you have a process for matching the production server files with a known good state?
  • TODO: need to add mod_security information
  • Is the webserver & Magento’s app/etc/env.php configured to use /pub as document root?
  • Is /media/ accesible?
  • Are there any executable files inside /media/?
  • Are you using up-to-date services (where compatibility allows it)?
  • Are you disabling or returning 404 the requests to pages with unused forms?

SSH access

  • Are you granting server access only by SSH connection and usage of individual users with individual keys?
  • Are you providing access only to the people who actually need it, and only to the resources they need?
  • Are you documenting all SSH keys and update them as team members change the keys or are added/ removed to/ from the team?
  • Are you reviewing all access by project team members and staff periodically (at least every 3 months)?
  • Are you disabling SSH access for root user?
  • Is the default SSH port changed from 22 to something else (eg 2233)?
  • Is SSH password authentication disabled?

Regular Maintenance

  • Do you have an Incident Response Plan implemented and tested (mock scenario)?
  • Do you have a person with regular scheduled time to review log messages for suspicious behaviour?
    • What is your process for dealing with IP address that are attempted to directory bruteforcing?
  • Do you have automated offsite backups for your site enabled?
    • Are these backups encrypted and on a non-public location?
    • Are these backups treated with the same level of security as your existing code?

Secure Development processes

  • Do you have a process for sanitizing production data for developers?
  • Do you have a list of developers/support staff with full access to your production systems and a process for accessing them?

Testing environments

  • Are you blocking access to testing machines and use a whitelist for IPs that really need to access these resources?
  • Are you keeping a catalog of all IPs - who and why they have access over HTTP to these machines and periodically check if they still need the access?
  • Are you using environment variables to overwrite any production URL for payment processors, 3rd party API integrations or other sensitive configurations which you might overlook when updating the testing machine database with a backup from production?

Magento Core

  • Does your site contain the latest security patches and updates?
  • Are you applying the security patches' new standards/ changes to the custom code developed so far? Without this, the patch can be useless (the system is as strong as its weakest link).
  • Do you have a person with a subscription to security notices from Magento security blog for urgent patches/updates?
  • Do you have a recurring reminder to execute regularly review validity of existing Admin accounts (including the allocated resources)?
    • Recommended monthly
  • Are you reviewing on a regular basis (at least every 3 months) the existing API integrations and the allocated resources?

External security concerns

  • If you are using a Web Application Firewall (WAF) does it provide virtual patching and how do you keep it up to date?

Additional resources

You might also like...
A dockerized magento 2 community environment ready for development or production.

Painless Magento 2 & 1 A dockerized magento 2 community environment ready for development or production. It supports magento 1.9.x for development Ins

List of Magento extensions with known security issues.
List of Magento extensions with known security issues.

Magento Vulnerability Database List of Magento 1 and 2 integrations with known security issues. Objective: easily identify insecure 3rd party software

A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

Camdram is an open source project developed by a team of volunteers for the benefit of the Cambridge student theatre community

Camdram is an open source project developed by a team of volunteers for the benefit of the Cambridge student theatre community. We use this repository to host the code that runs Camdram and to co-ordinate our work, however we welcome anyone to contribute bugs and suggest new features.

Spotweb is a decentralized usenet community based on the Spotnet protocol.

Spotweb is a decentralized usenet community based on the Spotnet protocol. Spotweb requires an operational webserver with PHP5.6 installed, it

This is a community-based project designed in the view of R.V.R & J.C College of Engineering hostel mess maintenance.

Hostel-Maintenance-System Introduction This is a community-based project designed in the view of R.V.R & J.C College of Engineering hostel mess mainte

Spotweb is a decentralized usenet community based on the Spotnet protocol.
Spotweb is a decentralized usenet community based on the Spotnet protocol.

Spotweb Spotweb is a decentralized usenet community based on the Spotnet protocol. Spotweb requires an operational webserver with PHP5.6 installed, it

The Laravel.io Community Portal.

Laravel.io This is the repository for the Laravel.io community portal. The code is entirely open source and licensed under the MIT license. We welcome

Community-created, unofficial PHP SDK for the Skynet Decentralized Internet Network. siasky.net

Skynet PHP SDK This SDK is a community-created, unofficial SDK in PHP for the Skynet Decentralized Internet Network. It is taken as primarily a port f

Comments
  • publicly accessible .user.ini

    publicly accessible .user.ini

    Server settings do you have publicly accessible '.user.ini' over HTTP / HTTPS. are you able to download https://www.yoursite.com/pub/.user.ini ?

    if yes that needs to be protected

    opened by jigneshthummar 1
  • Added question about sensitive configuration

    Added question about sensitive configuration

    Sensitive or system specific configuration should be treated as such in M2.

    There is a dedicated page on the DevDocs on how to to so: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/configuration/sensitive-and-environment-settings.html

    opened by renttek 0
  • Notes from JD from community slack to integrate

    Notes from JD from community slack to integrate

    `Nothing about content security policy on there. I think that’s a big one. Most important place to have your CSP locked down is on the checkout page.

    Recommendation - use a read only filesystem. Use Docker and checksum your images. Firewall your entire site and make sure it’s not doing any outbound connections (unless you know what those are). Secure your backups! You don’t need access to the database if you take your backups and put them in a public S3 bucket. Your backups should have the same security as root access to your database. They should also be encrypted so they can’t just be transferred around. Be careful with any PII. Don’t be lazy and make a copy of your production database for devs to put on insecure machines (their laptops) that they take on the train, airports, etc. Make a development database. Use mocks. Use test data. That brings me to the next point - your whole system is completely insecure if the person with all of the keys is running on an insecure computer. Mandate that anyone with production access has an up-to-date anti-virus program, they are trained in how to detect phishing attacks, they have secure passwords/keys, their browsers are up-to-date and all of the plugins on that are up-to-date.`

    opened by talesh 2
  • Scripts to add to JIRA, Trello, Pivotal Tracker Asana etc

    Scripts to add to JIRA, Trello, Pivotal Tracker Asana etc

    This list would only be useful if it is actually implemented. The best way to get developers to do a thing is to put it into the bug tracker. They already have a pattern of picking up things from that tool and completing them.

    We should build a simple to use script to inject all these tasks from the main list into a project in each popular task/bug tracker software used by Magento agencies.

    I am not sure how this will be implemented yet, or if it will require modifying the main list in a manner that is easier to read from a script or not. Those are details that still need to be hashed out.

    help wanted 
    opened by talesh 3
Owner
Talesh Seeparsan
All about securing ecommerce stores.
Talesh Seeparsan
Magento - Magento Community Editions

Magento Community Edition /// THIS REPOSITORY IS DEPREACTED /// 1.9.4.1 will be the last version update. Please switch over to OpenMage! Either to the

FireGento e. V. 107 Oct 17, 2022
Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

Aristi_Papastavrou 11 Apr 23, 2022
Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files

Quality Hook Installer Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files Install

Kay W. 2 Dec 15, 2022
A Bayesian average is a method of estimating the mean of a population using outside information, especially a pre-existing belief, which is factored into the calculation

A Bayesian average is a method of estimating the mean of a population using outside information, especially a pre-existing belief, which is factored into the calculation.

Assisted Mindfulness 3 Oct 19, 2022
Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.

OpenMage 782 Jan 3, 2023
A Magento 1.x module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.

Magento Cachebuster Cachebuster is a Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN,

Gordon Knoppe 129 Apr 1, 2022
Magento React Native Community

Magento React Native Community New version of the https://github.com/troublediehard/magento-react-native based on GraphQL api. Which will be covered w

Dima Portenko 52 Dec 21, 2022
Deutsches Sprachpaket für Magento 2 Community Edition

Magento 2 German LocalePack de_DE Deutsches Sprachpaket für Magento 2 Community Edition (Version 2.4.2) Die Übersetzung wurde von deutschen Mutterspra

Splendid Internet GmbH 87 Sep 25, 2022