ruby_smb 3.3.16 → 3.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5f3e7d4b38a0c2cbae5b04d401f988e0eb90585374877983c5d0f249935379b
4
- data.tar.gz: dc98770e931bf9c6ee4edd80a0a1bba2a2ac6ff75aef12b96f5c00efa1612074
3
+ metadata.gz: 3a184f6972edec8968cd3c69c2c4adb46f62f1ebd652c5b0013ba87d074f3cc8
4
+ data.tar.gz: e48dc3bf1a1a1771672ac7fbce126da175a596ce3fe4951f8b83e4aec2dcca50
5
5
  SHA512:
6
- metadata.gz: bb9b0288dc73c844c6707aa1bbd5e7db38a8f1a92240695e4fda6ecbe94bddcb049270a4b6ad96038cabda1a871ebb026ad1ef868c366fe17f804f9c107ba3ee
7
- data.tar.gz: 3fc829b270e287d4e87de00b08c17ed9fa9bf325191582f88cb252a0b64f9b0ec4c1b8d2ffae6ef7200ad42ea3daa7192f54edd8c829540783a980ae920b92e3
6
+ metadata.gz: bb45e333f0167db6b3a8d9cacb398d10cc2f5f611d4696c98b76f4daa8b2b1ed9ab03c3e1de83d78114d92f25c6803774fd0204a91e509ad755d4ea891986620
7
+ data.tar.gz: 81e33299c43682283cd663128ac1a765fdc460e04d57468004965662439d4193f2c422de6f20754b4e77f99461ef317b0b373ffd6c4851b014d4504927d3e05f
@@ -31,6 +31,7 @@ module RubySMB
31
31
  #
32
32
  # @return [WindowsError::ErrorCode] the status code the server returned
33
33
  def smb1_anonymous_auth
34
+ @mech_type = :anonymous
34
35
  request = smb1_anonymous_auth_request
35
36
  raw_response = send_recv(request)
36
37
  response = smb1_anonymous_auth_response(raw_response)
@@ -73,6 +74,7 @@ module RubySMB
73
74
  # Handles the SMB1 NTLMSSP 4-way handshake for Authentication and store
74
75
  # information about the peer/server.
75
76
  def smb1_authenticate
77
+ @mech_type = :ntlm
76
78
  response = smb1_ntlmssp_negotiate
77
79
  challenge_packet = smb1_ntlmssp_challenge_packet(response)
78
80
 
@@ -205,6 +207,7 @@ module RubySMB
205
207
  # Handles the SMB2 NTLMSSP 4-way handshake for Authentication and store
206
208
  # information about the peer/server.
207
209
  def smb2_authenticate
210
+ @mech_type = :ntlm
208
211
  response = smb2_ntlmssp_negotiate
209
212
  challenge_packet = smb2_ntlmssp_challenge_packet(response)
210
213
  if @dialect == '0x0311'
@@ -517,6 +517,18 @@ module RubySMB
517
517
  break
518
518
  end unless version == 'SMB1'
519
519
 
520
+ # Handle STATUS_NETWORK_SESSION_EXPIRED. The 'net use' client upon receiving this error will automatically attempt
521
+ # to re-authenticate, which makes relaying ntlm authentication to multiple targets possible. This block ensures
522
+ # ruby_smb behaves in the same manner as 'net use'.
523
+ if smb2_header && smb2_header.nt_status == WindowsError::NTStatus::STATUS_NETWORK_SESSION_EXPIRED && !@mech_type.nil?
524
+ if @mech_type == :ntlm || @mech_type == :anonymous
525
+ session_setup(self.username, self.password, self.domain, local_workstation: self.local_workstation, ntlm_flags: NTLM::DEFAULT_CLIENT_FLAGS)
526
+ raw_response = send_recv(packet, encrypt: encrypt) # Retry the request after re-authentication
527
+ elsif @mech_type == :kerberos
528
+ raise RubySMB::Error::RubySMBError, 'WindowsError::NTStatus::STATUS_NETWORK_SESSION_EXPIRED received, but kerberos authentication is being used, so automatic re-authentication cannot be attempted.'
529
+ end
530
+ end
531
+
520
532
  self.sequence_counter += 1 if signing_required && !session_key.empty?
521
533
  # update the SMB2 message ID according to the received Credit Charged
522
534
  self.smb2_message_id += smb2_header.credit_charge - 1 if smb2_header && self.server_supports_multi_credit
@@ -1,3 +1,3 @@
1
1
  module RubySMB
2
- VERSION = '3.3.16'.freeze
2
+ VERSION = '3.3.17'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.16
4
+ version: 3.3.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2025-05-06 00:00:00.000000000 Z
16
+ date: 2026-03-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: redcarpet