ruby_smb 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/ruby_smb/client/authentication.rb +12 -2
- data/lib/ruby_smb/client/negotiation.rb +2 -0
- data/lib/ruby_smb/client.rb +6 -0
- data/lib/ruby_smb/error.rb +4 -0
- data/lib/ruby_smb/gss.rb +1 -0
- data/lib/ruby_smb/smb1/packet/session_setup_request.rb +11 -0
- data/lib/ruby_smb/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587f03eec26c36a6ca67ffde30bb05881a456609dff32873b912e7763d266f25
|
4
|
+
data.tar.gz: 18c3b50b89657fe874d0a13904dad2b36c01c49089f01b5a3821d1733eb07c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd6f94e4b093ecab453e6e7f2056bfb7b52fbf2cfec51a26eceb2761b98c78bfd0fe273f083b1ec7db69f553ac7b8fb594e4d7c31ea8468e02337611b0bd4541
|
7
|
+
data.tar.gz: 4b5d924834a9168458ad50afcf6b27df5ba9ab50632b4b81db1e226235c7ebe80540e05fdc4aa6a6a608a6365e83f937304e0289a9d8e5689480f3021f6dd07e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -146,7 +146,7 @@ module RubySMB
|
|
146
146
|
end
|
147
147
|
|
148
148
|
# Takes the raw binary string and returns a {RubySMB::SMB1::Packet::SessionSetupResponse}
|
149
|
-
def
|
149
|
+
def smb1_session_setup_response(raw_response)
|
150
150
|
packet = RubySMB::SMB1::Packet::SessionSetupResponse.read(raw_response)
|
151
151
|
|
152
152
|
unless packet.valid?
|
@@ -159,6 +159,11 @@ module RubySMB
|
|
159
159
|
packet
|
160
160
|
end
|
161
161
|
|
162
|
+
# Takes the raw binary string and returns a {RubySMB::SMB1::Packet::SessionSetupResponse}
|
163
|
+
def smb1_ntlmssp_final_packet(raw_response)
|
164
|
+
smb1_session_setup_response(raw_response)
|
165
|
+
end
|
166
|
+
|
162
167
|
# Takes the raw binary string and returns a {RubySMB::SMB1::Packet::SessionSetupResponse}
|
163
168
|
def smb1_ntlmssp_challenge_packet(raw_response)
|
164
169
|
packet = RubySMB::SMB1::Packet::SessionSetupResponse.read(raw_response)
|
@@ -235,7 +240,7 @@ module RubySMB
|
|
235
240
|
end
|
236
241
|
|
237
242
|
# Takes the raw binary string and returns a {RubySMB::SMB2::Packet::SessionSetupResponse}
|
238
|
-
def
|
243
|
+
def smb2_session_setup_response(raw_response)
|
239
244
|
packet = RubySMB::SMB2::Packet::SessionSetupResponse.read(raw_response)
|
240
245
|
unless packet.valid?
|
241
246
|
raise RubySMB::Error::InvalidPacket.new(
|
@@ -248,6 +253,11 @@ module RubySMB
|
|
248
253
|
packet
|
249
254
|
end
|
250
255
|
|
256
|
+
# Takes the raw binary string and returns a {RubySMB::SMB2::Packet::SessionSetupResponse}
|
257
|
+
def smb2_ntlmssp_final_packet(raw_response)
|
258
|
+
smb2_session_setup_response(raw_response)
|
259
|
+
end
|
260
|
+
|
251
261
|
# Takes the raw binary string and returns a {RubySMB::SMB2::Packet::SessionSetupResponse}
|
252
262
|
def smb2_ntlmssp_challenge_packet(raw_response)
|
253
263
|
packet = RubySMB::SMB2::Packet::SessionSetupResponse.read(raw_response)
|
@@ -118,6 +118,7 @@ module RubySMB
|
|
118
118
|
self.server_max_buffer_size = packet.parameter_block.max_buffer_size - 260
|
119
119
|
self.negotiated_smb_version = 1
|
120
120
|
self.session_encrypt_data = false
|
121
|
+
self.negotiation_security_buffer = packet.data_block.security_blob
|
121
122
|
'SMB1'
|
122
123
|
when RubySMB::SMB2::Packet::NegotiateResponse
|
123
124
|
self.smb1 = false
|
@@ -137,6 +138,7 @@ module RubySMB
|
|
137
138
|
self.server_start_time = packet.server_start_time.to_time if packet.server_start_time != 0
|
138
139
|
self.server_system_time = packet.system_time.to_time if packet.system_time != 0
|
139
140
|
self.server_supports_multi_credit = self.dialect != '0x0202' && packet&.capabilities&.large_mtu == 1
|
141
|
+
self.negotiation_security_buffer = packet.security_buffer
|
140
142
|
case self.dialect
|
141
143
|
when '0x02ff'
|
142
144
|
when '0x0300', '0x0302'
|
data/lib/ruby_smb/client.rb
CHANGED
@@ -295,6 +295,12 @@ module RubySMB
|
|
295
295
|
# false otherwise
|
296
296
|
attr_accessor :server_supports_multi_credit
|
297
297
|
|
298
|
+
# The negotiated security buffer. This is nil until the negotiation process
|
299
|
+
# has finished.
|
300
|
+
# @!attribute [rw] negotiation_security_buffer
|
301
|
+
# @return [String] The raw security buffer bytes
|
302
|
+
attr_accessor :negotiation_security_buffer
|
303
|
+
|
298
304
|
# @param dispatcher [RubySMB::Dispatcher::Socket] the packet dispatcher to use
|
299
305
|
# @param smb1 [Boolean] whether or not to enable SMB1 support
|
300
306
|
# @param smb2 [Boolean] whether or not to enable SMB2 support
|
data/lib/ruby_smb/error.rb
CHANGED
@@ -99,6 +99,10 @@ module RubySMB
|
|
99
99
|
# unsupported protocol.
|
100
100
|
class NegotiationFailure < RubySMBError; end
|
101
101
|
|
102
|
+
# Raised when Authentication fails, possibly due to an
|
103
|
+
# unsupported GSS mechanism type.
|
104
|
+
class AuthenticationFailure < RubySMBError; end
|
105
|
+
|
102
106
|
# Raised when trying to parse raw binary into a BitField and the data
|
103
107
|
# is invalid.
|
104
108
|
class InvalidBitField < RubySMBError; end
|
data/lib/ruby_smb/gss.rb
CHANGED
@@ -14,6 +14,7 @@ module RubySMB
|
|
14
14
|
# @param asn The ASN object to apply the traversal path on.
|
15
15
|
# @param [Array] path The path to traverse, each element is passed to the
|
16
16
|
# ASN object's #value's #[] operator.
|
17
|
+
# @return [OpenSSL::ASN1::Sequence, nil]
|
17
18
|
def self.asn1dig(asn, *path)
|
18
19
|
path.each do |part|
|
19
20
|
return nil unless asn&.value
|
@@ -40,6 +40,17 @@ module RubySMB
|
|
40
40
|
parameter_block :parameter_block
|
41
41
|
data_block :data_block
|
42
42
|
|
43
|
+
# Takes the specified security buffer string and sets it in the {RubySMB::SMB1::Packet::SessionSetupRequest::DataBlock#security_blob}
|
44
|
+
# field. It also automatically sets the length in
|
45
|
+
# {RubySMB::SMB1::Packet::SessionSetupRequest::ParameterBlock#security_blob_length}
|
46
|
+
#
|
47
|
+
# @param buffer [String] the security buffer
|
48
|
+
# @return [void]
|
49
|
+
def set_security_buffer(buffer)
|
50
|
+
parameter_block.security_blob_length = buffer.length
|
51
|
+
data_block.security_blob = buffer
|
52
|
+
end
|
53
|
+
|
43
54
|
# Takes an NTLM Type 1 Message and creates the GSS Security Blob
|
44
55
|
# for it and sets it in the {RubySMB::SMB1::Packet::SessionSetupRequest::DataBlock#security_blob}
|
45
56
|
# field. It also automatically sets the length in
|
data/lib/ruby_smb/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
@@ -97,7 +97,7 @@ cert_chain:
|
|
97
97
|
EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
|
98
98
|
9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
|
99
99
|
-----END CERTIFICATE-----
|
100
|
-
date: 2022-
|
100
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
101
101
|
dependencies:
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: redcarpet
|
metadata.gz.sig
CHANGED
Binary file
|