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

switch default conn from smbv1 to smbv3 #534

Merged
merged 5 commits into from
Jan 6, 2025
Merged

switch default conn from smbv1 to smbv3 #534

merged 5 commits into from
Jan 6, 2025

Conversation

mpgn
Copy link
Collaborator

@mpgn mpgn commented Jan 4, 2025

Description

As we all know, making connections with SMBv1 often causes errors like "connection reset by peer" or "broken pipe." This is why the --no-smbv1 flag was added by @XiaoliChan

Currently, the reason SMBv1 is checked in the first place is to determine the host info line smbv1: True/False. This is the only reason. However, if a connection with SMBv1 is successful, it will be used for all subsequent operations on the host (self.conn)

The idea: Why not use SMBv3 by default (and then fall back to SMBv1 if SMBv3 fails, essentially doing the opposite of what is done today) and perform a simple check for smbv1: True/False on the host without relying on self.conn (an independent check)

This approach would make Netexec much more reliable i think 💪

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Against goad lab

Screenshots (if appropriate):

image

Checklist:

  • I have ran Ruff against my changes (via poetry: poetry run python -m ruff check . --preview, use --fix to automatically fix what it can)
  • My code follows the style guidelines of this project (should be covered by Ruff above)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@XiaoliChan
Copy link
Contributor

XiaoliChan commented Jan 5, 2025

This logic is much make sense! When SMBv3 failed, then fallback to SMBv1

Copy link
Contributor

@NeffIsBack NeffIsBack left a comment

Choose a reason for hiding this comment

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

LGTM 👍
image

@NeffIsBack NeffIsBack added the bug-fix This Pull Request fixes a bug label Jan 6, 2025
@XiaoliChan
Copy link
Contributor

Don't forget test with server 2003

@NeffIsBack
Copy link
Contributor

Don't forget test with server 2003

Why? It can communicate over SMBv3 or not?

@mpgn mpgn merged commit 5d680a9 into main Jan 6, 2025
4 checks passed
@mpgn mpgn deleted the nosmbv1 branch January 6, 2025 20:23
@XiaoliChan
Copy link
Contributor

Why? It can communicate over SMBv3 or not?

Server 2003 is not support SMBv3, that is why I ask need to test with server 2003 XD, BTW I will test it TMR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix This Pull Request fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants