🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Install Magento 2 Security Patches (Quick & Easy)

By Sanjay JethvaUpdated on Jun 16, 2025 5 min read

Keeping your Magento 2 store secure is crucial for both your business and customer trust. Installing Magento 2 security patches is a vital step in maintaining your site’s security and improving its performance.

In this article, we’ll cover how to install Magento 2 security patches. These straightforward steps will help keep your site secure and address any vulnerabilities that could affect your store.

What is Magento 2 Security Patch?

Magento security patches are updates released by Magento to fix vulnerabilities and enhance the security of your store. 

Like this is latest security patch APSB25-50 for Magento 2 store owners

These patches address issues that could be exploited by attackers, ensuring that your Magento site remains protected.

When a security flaw is identified, Magento issues a patch to correct the problem and prevent unauthorized access or data breaches. Implementing these security patches is crucial to safeguarding your site against emerging threats and maintaining optimal security.

Why are Magento 2 Security Patches Essential?

Besides your store safety, Magento 2 security patches are essential for several reasons:

  • They protect your site from vulnerabilities and cyber-attacks, ensuring that your customers’ data and your business information remain secure.
  • Keeping your Magento store up-to-date with the latest patches helps you stay compliant with security best practices and regulations.
  • Security patches often include performance improvements and bug fixes that enhance the overall functionality of your store.
  • Applying security patches prevents potential breaches that could lead to site downtime and loss of revenue.

List of Magento 2 Security Patches 

Patches Security Bulletin ID Release Date
2.4.8-p1APSB25-50June 10, 2025
2.4.4-p7APSB24-03February 13, 2024
2.4.4-p8APSB24-18April 9, 2024
2.4.4-p9APSB24-40June 11, 2024
2.4.4-p10APSB24-61August 13, 2024
2.4.4-p11APSB24-73October 8, 2024
2.4.4-p3APSB23-17March 14, 2023
2.4.4-p4APSB23-35June 13, 2023
2.4.4-p5APSB23-42August 8, 2023
2.4.4-p6APSB23-50October 10, 2023
2.4.4-p1APSB22-38August 9, 2022
2.4.4-p2APSB22-48October 12, 2022

Must do Before Applying Magento 2 Security Patches

Before you proceed to install Magento 2 security patches, follow these 3 crucial preparatory steps:

  1. Backup Your Store: Create a full backup of your Magento store, including files and databases, to safeguard against any issues during the Magento security patch installation.
  2. Check System Requirements: Ensure your Magento version is compatible with the security patch you plan to install. Verify compatibility with any custom extensions or themes. If you’re still using an older version, consider upgrading to Magento 2.
  3. Turn On Maintenance Mode: Put your Magento store in maintenance mode while you perform the patch installation. This will notify your customers of ongoing changes and help avoid any order invalidation during the process.

How to Install Magento 2 Security Patches?

We’ve identified three methods for installing security patches easily. Choose the one that best fits your access level and convenience:

1. Using SSH

First, upload the local patch file to your Magento_root on the server. Remember to check and verify that the file is located in the correct directory

Then, in the command-line interface, run this command:

patch < patch_file_name.patch

Head to System > Tools > Cache Management to refresh the cache.

The command ensures that the file that needs to be patched is located in the patch file. 

2. Use a composer 

Test your patch and then follow these steps to apply them. 

Head to the project directory from your command line then add the  cweagans/composer-patches module to the composer.json file.

composer require cweagans/composer-patches

Then, edit your composer.json file with the filling

  • Module – magento/module-payment
  • Title – “MAGETWO-56934: Checkout page freezes when ordering with Authorize. net with invalid credit card”
  • Path to patch – “patches/composer/github-issue-6474.diff”

In case a patch affects your specific modules, then create several patch files depending on the modules. 

Then, apply the patch using this command:

composer -v install 

Now, update the composer.lock file. These files will keep a record of which patches are applied to the Composer package.

composer update --lock 

3. Github

Go to your site’s working directory and create a patch directory to store your Magento 2 security patches. 

Then, copy the required patches to generate the directory and create a patch file using this command:

git diff > ./patches/patchForModule.patch.

Verifying & Reverting the Patch Installation in Magento 2

After applying the Magento security patch, it’s important to verify that the Magento security patches installation was successful:

  • To ensure the patched files have been correctly modified, compare them with the original files and identify the differences.
  • Check server logs for any unusual activity or errors that might indicate a problem with the patch installation.
  • Finally, monitor the site for any unusual errors or issues that may have arisen after the installation of security patches to make further changes.

If you encounter issues after applying a patch, you may need to revert it. Follow these steps:

  • Use the backup you created before applying the patch to restore your site to its previous state.
  • If the issue persists, you can run the following command to revert the patch by navigating to the Magento 2 root directory:
sh patch_file_name.sh -R

Must do After Applying Magento 2 Security Patches

Once the patch is successfully installed, make sure to perform the following checks:

  • Clear Cache: Clear both Magento and server caches to ensure the changes take effect and to avoid any outdated data.
  • Reindex Data: Reindex Magento data to ensure all data is up-to-date and the site operates smoothly.
  • Monitor Site Performance: Keep an eye on your site’s performance and security after applying the patch to ensure everything is functioning correctly.
  • Review Security Settings: Check and update any security settings or configurations that may have been affected by the patch.
  • Record Details: Document the details of the applied patch, including the version and installation date, for future reference.

To further improve your store’s security after installing Magento 2 security patches, consider to rotate the encryption key regularly. That will help you protect sensitive customer and order data from unauthorized access by updating the encryption mechanism.

Get Technical Help Here

These easy-to-follow steps guide you how to install security patches in Magento 2. 

However, if you encounter any difficulties in implementing these patches, you should consider reaching out to a Magento security patch installation service.

Our experts can provide better guidance, ensure the proper application of patches, and help maintain your site’s security and performance. 

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.