-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared SMB Service #18680
Shared SMB Service #18680
Conversation
I'm working through why the unit tests are failing right now. |
30e7da5
to
024bdae
Compare
It was an issue with my ruby_smb PR branch not including the latest changes. |
Drop keys whose values are empty to shorten the string
I just want to double-check the behavior I'm seeing. When I run through this, it removes the jobs as expected, but if there is an established smb session, the thread appears to remain to the established connection. I can still query and download the files even when no service exists if I use the established session before I killed the service: Edit: Yes, this is currently expected behavior. |
This pulls in the changes from rapid7/ruby_smb#260 which adds the #remove_share method that is needed for cleanup.
Release NotesThis adds a service compatible with |
This adds a service compatible with
Rex::ServiceManager
for SMB that can be shared among modules. There are currently 15 modules using theMsf::Exploit::Remote::SMB::Server::Share
and this change will allow them all to be run concurrently. Once #18664 is landed, it also also allow multiple instances of that payload handler to be run as well. The only two modules that can not share the service are theauxiliary/server/capture/smb
andexploit/windows/smb/smb_relay
modules because they alter the authentication process. Because that authentication process is altered, shares can not actually be opened by clients for files to be read. Within the code, the limitation is implemented in the new service classes.hardcore_alias
method by uniquely keying on the GSS provider.For the remaining modules that are able to share the instance, it's assumed that they should register their own unique share and create whatever files within it that they need to. The
Msf::Exploit::Remote::SMB::Server::Share
will now raise an exception via#fail_with
if the share that is to be added already exists because the module would be interfering with another. In this case, the user needs to set theSHARE
datastore option to a new, unique value.Something will need to be rebased depending on if this or #18664 is landed first. I'm happy to handle that in which ever order is easiest.
This requires the changes from rapid7/ruby_smb#260 to be implemented for cleaning up the service.
Verification
msfconsole
features set manager_commands true
and restarting msfconsoleexploit/windows/smb/smb_delivery
module twice, taking care to set theLPORT
(if necessary) andSHARE
datastore options to unique values between runs_servicemanager
command to see an instance starting withRex::Proto::SMB::Server
smbclient
or something else to verify that both shares were created (e.g.smbclient //192.168.159.128/Share1 -U smcintyre -N -c "dir *"
assuming thatShare1
was one of the share names)jobs -k #
, leaving the other runningsmbclient
again to make sure that one share is still online while the other is gonesmbclient
again, but this time see that it fails with a connection error because the server was stopped due to the last reference being closedExample