Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

Zero-day in Magmi database client for popular e-commerce platform Magento targeted in the wild

We've observed HTTP requests associated with an exploit attempt on the Magento e-commerce platform. The flaw is not within Magento itself but introduced by installing and failing to change the default security configuration of a vulnerable version of an open-source utility for the platform – Magmi. Magmi is a "Magento Mass Importer developed as a Magento DATABASE client." Evidence of the malicious activity was discovered in Trustwave SpiderLabs honeypots. The Trustwave Web Application Firewall (WAF) detected the HTTP requests, and the requests suggest that malicious actors are attempting to exploit this directory traversal vulnerability in the wild. Successful exploitation results in access to Magento site credentials and the encryption key for the database.

Magento's website claims that more than 240,000 merchants use their e-commerce software, but it's difficult to determine how many instances of the platform include the vulnerable Magmi installation. Magmi is available for download from either SourceForge or GitHub. Only versions downloaded from SourceForge are vulnerable. Magmi was downloaded from SourceForge more than 2,800 times in September alone.

After we disclosed the vulnerability to the owner of Magmi (dweeves) and to Magento, Magento responded to us acknowledging the issue and stating that they issued a security notification to their partners and users that opt to receive such notifications. Magento also reported that they assessed all known Magento sites and contacted the owners of 1,700 sites they believe to be vulnerable.

Magento offers two versions of the software: Community Edition and Enterprise Edition (hosted by Magento). Security firm Checkpoint published extensive research on the security of Magento earlier this year, and in-the-wild attacks on the reported vulnerabilities were observed soon after disclosure (Sucuri blog - Impact of Hacks to Magento and Security Week 24 Apr 2015).

Beginning last month, Trustwave SpiderLabs researchers discovered requests such as the following:

GET /…sanitized.../magmi-importer/web/download_file.php?file=../../app/etc/local.xml HTTP/1.1

Trustwave WAF categorized these requests as directory traversal attacks because of the presence of '../..' in the request. This is an attempt to access the Linux password file by backtracking the path.

The Vulnerability

Magmi-importer is commonly used in the path of Magmi installations. Magmi allows users to import content directly into the Magento database. Again, the vulnerable version of Magmi is available on SourceForge.

As described in Magmi Wiki installation Guide, most users will install Magmi in the same directory as Magento. Therefore the path"../../app/etc/local.xml" will point at the local.xml file used by Magento. Magento uses app/etc/local.xml to store the database credentials and encryption key. Securing access to this file is an elementary step in securing Magento as described in their security guide: Magento Security: Check your app/etc/local.xml file. Moreover, Magento Enterprise Edition periodically checks whether this file is externally visible and throws an alert if it is.

The Magmi repository in GitHub is maintained by "dweeves" - Sebastian Beacuemont. The code is also available via SourceForge. While the two repositories are said to remain in sync, that doesn't appear to be the case.

The latest Magmi version 0.7.21 from SourceForge included the following download.php file:

BSL_12781_f8e18fc5-bf61-44e4-bebc-1ae1a87ec428

In lines four and five, you can see that the program opens the file stated in the request parameter without performing any checks required to avoid directory traversal—herein lies the vulnerability. The latest Magmi repository on GitHub does not contain the download_file.php. Therefore, only downloads from SourceForge are vulnerable to this attack. The GitHub repository is up to date with file changes over the last month, while the last change to the SourceForge version occurred at the end of 2014.

What's disturbing is the inconsistency between the two repositories and the popularity of the out-dated, SourceForge repository. The graphic below illustrates more than 500 downloads of Magmi on SourceForge during the first week of October. The prevalence of the outdated version might be because a search for "magmi" at Google.com returns the vulnerable, SourceForge version as the first result with a rating of 4.5 out of 5.

9308_53700737-061d-456e-8a29-c645d4a83428

 

7957_1057f6d7-08cc-4510-a9fc-8586f0c7a6dc

 

Exploitability

The vulnerability can only be exploited if the Magmi installation including the "\web" location is not secured. It's best to protect Magmi wherever it resides using HTTP basic authentication or other methods (see how-to-secure-magmi).

If you installed Magmi without securing it, you're already vulnerable because credentials can be found in the Magmi UI admin pages. However, the directory traversal vulnerability in download_file.php makes the attack much easier to perform using a single GET request.

The site protected by Trustwave WAF that detected the malicious HTTP requests was not hosting Magento, suggesting that the attack was random and not targeted. However, identifying sites that host Magento is easy based on X-Magento and X-Varnish headers. A search in the Shodan search engine will reveal several Magento sites.

Summary

Above we've illustrated how a severe security flaw can be introduced into a Magento based e-commerce system by installing a commonly used, vulnerable version of the open-source Magmi utility and failing to change the default security configuration. Our discovery of probe HTTP requests in Trustwave SpiderLabs honeypots, suggest that bad actors are aware of the vulnerability and how to exploit it.

WAFs provide an essential layer of protection against such attacks for e-commerce and other web sites. Trustwave WAF and ModSecurity use generic rules and learning capabilities to successfully detect and block such attempts out-of-the-box.

ABOUT TRUSTWAVE

Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo