Skip to content

Commit d52220c

Browse files
committed
Fixes the create session datastore option from appearing for payloads
1 parent 4af5c54 commit d52220c

File tree

20 files changed

+53
-17
lines changed

20 files changed

+53
-17
lines changed

documentation/modules/auxiliary/cloud/aws/enum_ssm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Provided AWS credentials, this module will call the authenticated API of Amazon
44
instances accessible to the account. Once enumerated as SSM-enabled, the instances can be controlled using out-of-band
55
WebSocket sessions provided by the AWS API (nominally, privileged out of the box). This module provides not only the API
66
enumeration identifying EC2 instances accessible via SSM with given credentials, but enables session initiation for all
7-
identified targets (without requiring target-level credentials) using the CreateSession mixin option. The module also
7+
identified targets (without requiring target-level credentials) using the CreateSession datastore option. The module also
88
provides an EC2 ID filter and a limiting throttle to prevent session stampedes or expensive messes.
99

1010
## Verification Steps

lib/msf/base/sessions/command_shell_options.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ module CommandShellOptions
1515
def initialize(info = {})
1616
super(info)
1717

18-
register_options(
19-
[
20-
OptBool.new('CreateSession', [false, 'Create a new session for every successful login', true])
21-
]
22-
)
23-
2418
register_advanced_options(
2519
[
2620
OptString.new('InitialAutoRunScript', "An initial script to run on session creation (before AutoRunScript)"),
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: binary -*-
2+
3+
##
4+
# This file is part of the Metasploit Framework and may be subject to
5+
# redistribution and commercial restrictions. Please see the Metasploit
6+
# Framework web site for more information on licensing and terms of use.
7+
# https://metasploit.com/framework/
8+
##
9+
10+
11+
module Msf
12+
module Sessions
13+
module CreateSessionOptions
14+
def initialize(info = {})
15+
super(info)
16+
17+
register_options(
18+
[
19+
OptBool.new('CreateSession', [false, 'Create a new session for every successful login', true])
20+
]
21+
)
22+
end
23+
end
24+
end
25+
end

modules/auxiliary/cloud/aws/enum_ssm.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class MetasploitModule < Msf::Auxiliary
1010
include Rex::Proto::Http::WebSocket::AmazonSsm
1111
include Msf::Auxiliary::Report
1212
include Msf::Auxiliary::CommandShell
13+
include Msf::Sessions::CreateSessionOptions
14+
1315
def initialize(info = {})
1416
super(
1517
update_info(
@@ -24,7 +26,7 @@ def initialize(info = {})
2426
This module provides not only the API enumeration identifying EC2
2527
instances accessible via SSM with given credentials, but enables
2628
session initiation for all identified targets (without requiring
27-
target-level credentials) using the CreateSession mixin option.
29+
target-level credentials) using the CreateSession datastore option.
2830
The module also provides an EC2 ID filter and a limiting throttle
2931
to prevent session stampedes or expensive messes.
3032
},

modules/auxiliary/scanner/mssql/mssql_login.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class MetasploitModule < Msf::Auxiliary
1414
include Msf::Auxiliary::AuthBrute
1515
include Msf::Auxiliary::CommandShell
1616
include Msf::Auxiliary::Scanner
17+
include Msf::Sessions::CreateSessionOptions
1718

1819
def initialize
1920
super(
@@ -29,13 +30,13 @@ def initialize
2930
'DefaultOptions' =>
3031
{
3132
'USERNAME' => 'sa',
32-
'BLANK_PASSWORDS' => true
33+
'BLANK_PASSWORDS' => true,
34+
'CreateSession' => false
3335
}
3436
)
3537
register_options([
3638
Opt::Proxies,
37-
OptBool.new('TDSENCRYPTION', [ true, 'Use TLS/SSL for TDS data "Force Encryption"', false]),
38-
OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false])
39+
OptBool.new('TDSENCRYPTION', [ true, 'Use TLS/SSL for TDS data "Force Encryption"', false])
3940
])
4041

4142
options_to_deregister = %w[PASSWORD_SPRAY]

modules/auxiliary/scanner/mysql/mysql_login.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class MetasploitModule < Msf::Auxiliary
1111
include Msf::Auxiliary::Report
1212
include Msf::Auxiliary::AuthBrute
1313
include Msf::Auxiliary::Scanner
14+
include Msf::Sessions::CreateSessionOptions
1415
include Msf::Auxiliary::CommandShell
1516

1617
def initialize(info = {})
@@ -27,14 +28,14 @@ def initialize(info = {})
2728
'DefaultOptions' =>
2829
{
2930
'USERNAME' => 'root',
30-
'BLANK_PASSWORDS' => true
31+
'BLANK_PASSWORDS' => true,
32+
'CreateSession' => false
3133
}
3234
))
3335

3436
register_options(
3537
[
3638
Opt::Proxies,
37-
OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false])
3839
])
3940

4041
options_to_deregister = %w[PASSWORD_SPRAY]

modules/auxiliary/scanner/postgres/postgres_login.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class MetasploitModule < Msf::Auxiliary
1313
include Msf::Auxiliary::Scanner
1414
include Msf::Auxiliary::Report
1515
include Msf::Auxiliary::CommandShell
16+
include Msf::Sessions::CreateSessionOptions
1617

1718
# Creates an instance of this module.
1819
def initialize(info = {})
@@ -26,6 +27,7 @@ def initialize(info = {})
2627
},
2728
'Author' => [ 'todb' ],
2829
'License' => MSF_LICENSE,
30+
'DefaultOptions' => { 'CreateSession' => false },
2931
'References' =>
3032
[
3133
[ 'URL', 'https://www.postgresql.org/' ],
@@ -37,7 +39,6 @@ def initialize(info = {})
3739
register_options(
3840
[
3941
Opt::Proxies,
40-
OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false]),
4142
OptPath.new('USERPASS_FILE', [ false, "File containing (space-separated) users and passwords, one pair per line",
4243
File.join(Msf::Config.data_directory, "wordlists", "postgres_default_userpass.txt") ]),
4344
OptPath.new('USER_FILE', [ false, "File containing users, one per line",

modules/auxiliary/scanner/rservices/rexec_login.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class MetasploitModule < Msf::Auxiliary
99
include Msf::Auxiliary::AuthBrute
1010
include Msf::Auxiliary::Scanner
1111
include Msf::Auxiliary::CommandShell
12+
include Msf::Sessions::CreateSessionOptions
1213

1314
def initialize
1415
super(

modules/auxiliary/scanner/rservices/rlogin_login.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class MetasploitModule < Msf::Auxiliary
1111
include Msf::Auxiliary::Scanner
1212
include Msf::Auxiliary::Login
1313
include Msf::Auxiliary::CommandShell
14+
include Msf::Sessions::CreateSessionOptions
1415

1516
def initialize
1617
super(

modules/auxiliary/scanner/rservices/rsh_login.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class MetasploitModule < Msf::Auxiliary
1010
include Msf::Auxiliary::RServices
1111
include Msf::Auxiliary::Scanner
1212
include Msf::Auxiliary::CommandShell
13+
include Msf::Sessions::CreateSessionOptions
1314

1415
def initialize
1516
super(

0 commit comments

Comments
 (0)