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

SMB: Add SMBOptions to SMBPlugin #3089

Merged
merged 5 commits into from
Mar 13, 2023

Conversation

ilija-lazoroski
Copy link
Contributor

Issue: #2952

What does this PR do?

Fixes part of #2952

Add any further explanations here.

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • Was the CHANGELOG.md updated to reflect the changes?
  • Was the documentation framework updated to reflect the changes?
  • Have you checked that you haven't introduced any duplicate code?

Testing Checklist

  • Added relevant unit tests?
  • Have you successfully tested your changes locally? Elaborate:

    Tested by unit tests

  • If applicable, add screenshots or log transcripts of the feature working

@mssalvatore
Copy link
Collaborator

@ybasford Option descriptions could use your expert opinion.

Copy link
Collaborator

@mssalvatore mssalvatore left a comment

Choose a reason for hiding this comment

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

Vulture fails

agent_binary_upload_timeout: float = Field(
default=30.0,
gt=0.0,
le=100.0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

These maximums seem somewhat arbitrary. Are they based on anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we get rid of the maximums altogether?

Copy link
Collaborator

@mssalvatore mssalvatore Mar 13, 2023

Choose a reason for hiding this comment

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

Only if we add a note to the description that this could cause the agent to hang on manual shutdown if it's set too high. Realistically, we shutdown after I think 120 seconds if things are hung.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we should also change things in Hadoop

@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.05 🎉

Comparison is base (c254126) 67.58% compared to head (04b6cb0) 67.63%.

❗ Current head 04b6cb0 differs from pull request most recent head 899673c. Consider uploading reports for the commit 899673c to get more accurate results

Additional details and impacted files
@@                      Coverage Diff                      @@
##           2952-smb-exploiter-plugin    #3089      +/-   ##
=============================================================
+ Coverage                      67.58%   67.63%   +0.05%     
=============================================================
  Files                            444      446       +2     
  Lines                          12730    12755      +25     
=============================================================
+ Hits                            8603     8627      +24     
- Misses                          4127     4128       +1     

see 11 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@cakekoa cakekoa mentioned this pull request Mar 10, 2023
8 tasks
@shreyamalviya shreyamalviya force-pushed the 2952-smb-options branch 2 times, most recently from 4bfe266 to 04b6cb0 Compare March 13, 2023 07:10
Copy link
Contributor

@shreyamalviya shreyamalviya left a comment

Choose a reason for hiding this comment

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

We should consider adding the option of choosing both or one of port 445 and port 139 instead of hard-coding it to be both. Probably checkboxes.

Comment on lines +14 to +16
use_kerberos: bool = Field(
default=False, description="Use Kerberos authentication for RPC transport."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't need this. We don't have any exploiter logic for when Kerberos auth is set to true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we don't but RPC transport has that option which we were hard-coding to False.

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly, we don't specifically handle cases where Kerberos is used. Do we need anything else for it to work or is our existing logic enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probablyyyy. We need to check that.

Comment on lines 17 to 28
rpc_connect_timeout: float = Field(
default=15.0,
gt=0.0,
le=100.0,
description="The maximum time (in seconds) to wait for a response on an RPC connection.",
)
smb_connect_timeout: float = Field(
default=15.0,
gt=0.0,
le=100.0,
description="The maximum time (in seconds) to wait for a response on an SMB connection.",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also wondering if this should just be one option (smb_connect_timeout) which is used in both places. The user doesn't know about the internal workings of the exploiter i.e. where/when/why RPC is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That probably make sense.

@shreyamalviya shreyamalviya changed the base branch from develop to 2952-smb-exploiter-plugin March 13, 2023 11:29
@mssalvatore
Copy link
Collaborator

We should consider adding the option of choosing both or one of port 445 and port 139 instead of hard-coding it to be both. Probably checkboxes.

@shreyamalviya We discussed it on Friday. The issue is that 445 and 139 aren't really the right configuration options. The right set of configuration options are checkboxes regarding whether or not we should use the protocol over NetBIOS (see https://www.upguard.com/blog/smb-port). After some discussion, we decided this requires the user to have more knowledge of SMB and its history than they probably want. We decided that, since it's so easy to modify and release new versions of the plugin, we could add this option at a later date if a user requests it. For now, we decided to just hard code both.

Comment on lines 17 to 28
rpc_connect_timeout: float = Field(
default=15.0,
gt=0.0,
le=100.0,
description="The maximum time (in seconds) to wait for a response on an RPC connection.",
)
smb_connect_timeout: float = Field(
default=15.0,
gt=0.0,
le=100.0,
description="The maximum time (in seconds) to wait for a response on an SMB connection.",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these just be the same option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rpc protocol is part of smb so we can use the same timeout
@shreyamalviya shreyamalviya merged commit 327a563 into 2952-smb-exploiter-plugin Mar 13, 2023
@shreyamalviya shreyamalviya deleted the 2952-smb-options branch March 13, 2023 12:28
cakekoa pushed a commit that referenced this pull request Mar 13, 2023
ilija-lazoroski added a commit that referenced this pull request Mar 13, 2023
ilija-lazoroski added a commit that referenced this pull request Mar 14, 2023
default=30.0,
gt=0.0,
le=100.0,
description="The timeout (in seconds) for uploading the Agent binary"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change description text: "Timeout (in seconds) for uploading the Agent binary."

cakekoa pushed a commit that referenced this pull request Mar 20, 2023
mssalvatore pushed a commit that referenced this pull request Mar 23, 2023
mssalvatore pushed a commit that referenced this pull request Mar 23, 2023
mssalvatore pushed a commit that referenced this pull request Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants