# Injecting Magecart into Magento Global Config **[trustwave.com/en-us/resources/blogs/spiderlabs-blog/injecting-magecart-into-magento-global-config/](https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/injecting-magecart-into-magento-global-config/)** At the beginning of June 2020, we were contacted about a breach of a website using the Magento framework that caused a leak of credit card numbers. A thorough analysis of the website identified the webpage’s footer had malicious code added to it. Figure 1. Malicious Script Injected in the Footer Section of the Compromised Magento Webpage We found that the Magento's cached CONFIG_GLOBAL_STORES_DEFAULT file also contains the same malicious code. ----- Figure 2. Magento configuration located at /var/cache within Magento installation directory was also infected On the compromised web server, we also found an Adminer PHP file – a readily available tool used to remotely manage SQL databases such as MySQL. We will get back to this later on why the attacker used this tool. ## Malicious Code Analysis Before we proceed on how the malicious code got into the compromised webpage’s footer, let us first see what the malicious code does. The malicious JavaScript code is a very long string, encapsulated inside a