Skip to content
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

Recognise broken SMB sessions and close them #19731

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

smashery
Copy link
Contributor

If an SMB session is forcibly closed or inoperative, the session remained in the list of open sessions (until forcibly closed). This recognises certain errors and shuts the SMB sessions down.

Verification

  • Start msfconsole
  • Create several sessions with the smb_login module onto the one host
  • Shut down the server (this won't cause the sessions to terminate yet)
  • Run a module with an SMB session (any of the ones that use SMB optional sessions)
  • Verify that it is terminated, and removed from the list of active sessions

Demo

msf6 auxiliary(scanner/smb/pipe_auditor) > run session=3
[*] Using existing session 3
[*] 192.168.20.99 - SMB session 3 closed.
[*] Error: 192.168.20.99: RubySMB::Error::CommunicationError An error occurred writing to the Socket: Connection reset by peer
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

@msutovsky-r7 msutovsky-r7 self-assigned this Dec 18, 2024
Copy link
Contributor

@msutovsky-r7 msutovsky-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issue with the code. The main code update is SimpleClient update, the rest of the code of modifying existing functionality to fit the new session_lifetime function.

@msutovsky-r7 msutovsky-r7 merged commit 789f7cf into rapid7:master Dec 23, 2024
120 checks passed
msutovsky-r7 added a commit to msutovsky-r7/metasploit-framework that referenced this pull request Dec 23, 2024
…sion and managing them"

This reverts commit 789f7cf, reversing
changes made to 6eb2f61.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants