Card Not Present Fraud , Fraud Management & Cybercrime , Fraud Risk Management

Researchers Identify Backdoor Methods to Access Magento

Sucuri Offers Advice on Risk Mitigation
Researchers Identify Backdoor Methods to Access Magento

Researchers at website security company Sucuri have discovered five backdoor methods to access Adobe's Magento e-commerce platform, potentially enabling capture of credit card details or administrator login credentials.

See Also: The State of Organizations' Security Posture as of Q1 2018

The backdoors, which the researchers say evade common detection techniques and provide attackers remote code execution privileges, were found during an investigation of a compromised Magento environment.

“The techniques used by the attackers in these backdoors illustrate the ever-changing landscape of website security and highlight some of the tactics used to avoid traditional backdoor detection,” says Liam Smith, security analyst at Sucuri.

The five distinct backdoor methods discovered during the investigation are:

  1. Reflection function - This backdoor is added directly to Magento’s core file /errors/503.php. This malicious code takes user input from the “ID” URL parameter and builds a reflection function, which acts as a disguise and gives the attacker an opportunity to pass malicious input. Below is an example of a payload that can be abused:

    hxxps://example[.]com/errors/503.php?id=system&processor=array(‘cat app/etc/local.xml’)

    “If, during the attack, command execution functions such as system or shell_exec are enabled, the attacker would have unhindered access to your site files, including configuration files,” Smith notes. “This would further lead to lateral movement into the website’s database and allow further injections aimed at capturing credit card details or administrator login credentials."

  2. forward_static_call() - This is nearly identical to the “reflection function” backdoor, but is added in Magento’s processor.php file. “This sample builds a class ‘A’, with a constructor that calls whichever function is named from input 'X', and passes input '_' as an argument,” Smith says.

  3. register_tick_function() - This backdoor is added in Magento’s close.php file. Like the previous two methods, this one provides attackers with remote code execution. “By keeping no one backdoor the same, the attackers can thwart attempts to search for other infections based on any previously discovered samples,” Smith notes.

  4. session_set_save_handler() - In this method, the attacker abuses regular and unsuspicious functions to achieve remote code execution privileges. This function allows developers to specify how a user’s session is to be stored, and attackers abuse it by a backdoor hidden in a file named 1.php. The save handler function is forced to accept the untrusted input from the attacker due to this abuse and instantly executes the malicious payload.

  5. ZipArchive() - This is one of the most unusual methods for backdoor abuse in Magento, because it interacts with the cookies using a POST request. Generally, if access logging is enabled on a web server or a firewall, the GET request initiated by the attackers can be detected.

  6. The attackers ensure that only payloads they send are executed through their backdoor. The first step is to check the value of the “mailto_” cookie. In Magento, the “mailto_” cookie is usually not configured. The value inside the cookie is then named and saved as a zip archive in the /tmp temporary folder. Because it uses the regular function, it avoids detection and deletes itself from the temporary folder immediately post execution, leaving no trails of the backdoor established, according to Sucuri.

    “In the same spirit of remaining discrete, the attacker wrapped the entire backdoor in a try/catch statement to ensure that any errors that might generate through the execution of the code are silently discarded and not logged to a central file,” Smith says.

    Preventive Measures

    Sucuri advises e-commerce sites that use Magento to perform integrity checks on their websites to detect these infections. Systems performing integrity checks will track any modifications to site files and can help find malware that would have otherwise gone undetected, Sucuri says.

    Monitoring access logs can also help detect malicious activities and backdoors, the security firm notes.


About the Author

Mihir Bagwe

Mihir Bagwe

Principal Correspondent, Global News Desk, ISMG

Bagwe previously worked at CISO magazine, reporting the latest cybersecurity news and trends and interviewing cybersecurity subject matter experts.




Around the Network

Our website uses cookies. Cookies enable us to provide the best experience possible and help us understand how visitors use our website. By browsing bankinfosecurity.asia, you agree to our use of cookies.