Overview
The Welcart e-Commerce plugin for WordPress is vulnerable to PHP Object Injection, which allows unauthenticated attackers to store arbitrary 'reserve' key/value pairs as order metadata during a public checkout. This can lead to the deletion of arbitrary files on the server, including wp-config.php, and potentially result in remote code execution when an attacker re-runs the WordPress installer against a database they control.
Understanding the Vulnerability / Threat
Root Cause Analysis
The fundamental flaw in this vulnerability is the deserialization of untrusted input in the Telecom EDY payment callback (usces_action_acting_transaction). This allows an attacker to inject malicious PHP objects, which can lead to a POP (Property-Oriented Programming) chain. The POP chain is present in the TCPDF library bundled with the plugin, making it possible for attackers to delete arbitrary files on the server.
The vulnerability class of this issue is CWE-502, which refers to the deserialization of untrusted data.
Attack Surface & Vector
This vulnerability lives in the Welcart e-Commerce plugin for WordPress, specifically in the Telecom EDY payment callback. An attacker can reach this vulnerability through a public checkout, where they can store arbitrary 'reserve' key/value pairs as order metadata. The attacker can then invoke the callback with an attacker-chosen 'option' parameter to select and unserialize that metadata without any provider signature, source-address, transaction-identity, or ownership check.
The preconditions needed for this vulnerability to be exploited are:
- The attacker must have access to the public checkout functionality of the Welcart e-Commerce plugin.
- The attacker must be able to store arbitrary 'reserve' key/value pairs as order metadata.
- An admin must print an invoice to trigger file deletion.
Exploitation Mechanics — Scenario Walkthrough
Scenario: Compromising a Corporate WordPress Instance with Welcart e-Commerce Plugin
1. Initial Position: An attacker has access to the public checkout functionality of a WordPress instance with the Welcart e-Commerce plugin installed.
2. Triggering the Flaw: The attacker stores arbitrary 'reserve' key/value pairs as order metadata during a public checkout. The attacker then invokes the Telecom EDY payment callback with an attacker-chosen 'option' parameter to select and unserialize that metadata.
3. What Breaks: The deserialization of untrusted input triggers a POP chain in the TCPDF library, allowing the attacker to delete arbitrary files on the server, including wp-config.php.
4. Attacker's Prize: The attacker can delete arbitrary files on the server, including wp-config.php. If the attacker re-runs the WordPress installer against a database they control, they can achieve remote code execution.
Real-World Impact
The impact of this vulnerability is significant, as it allows unauthenticated attackers to delete arbitrary files on the server, potentially leading to remote code execution. This can result in a complete compromise of the WordPress instance and potentially lead to lateral movement within the network.
Detection & Defense
Immediate Mitigations
- Upgrade the Welcart e-Commerce plugin to version 2.12.2 or later.
Detection Strategies
- Monitor for suspicious activity in the Telecom EDY payment callback.
- Check for unusual file deletion activity on the server.
- Implement a Web Application Firewall (WAF) to detect and prevent deserialization attacks.
Long-Term Hardening
- Implement a defense-in-depth approach by using a combination of security controls, such as firewalls, intrusion detection systems, and secure coding practices.
- Regularly update and patch plugins and themes to prevent known vulnerabilities.
- Use a secure protocol for communication between the plugin and the payment gateway.
Key Takeaways
- The Welcart e-Commerce plugin for WordPress is vulnerable to PHP Object Injection, which can lead to arbitrary file deletion and remote code execution.
- The vulnerability is caused by the deserialization of untrusted input in the Telecom EDY payment callback.
- Upgrading the plugin to version 2.12.2 or later can mitigate the vulnerability.
- Implementing a defense-in-depth approach and regularly updating and patching plugins and themes can prevent similar vulnerabilities.
Sources
- National Vulnerability Database (NVD)
- Wordfence