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

1741 add smb to puppet #1792

Merged
merged 21 commits into from
Mar 21, 2022
Merged

1741 add smb to puppet #1792

merged 21 commits into from
Mar 21, 2022

Conversation

mssalvatore
Copy link
Collaborator

What does this PR do?

Adds SMBExploiter to puppet

Resolves #1741

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?

Testing Checklist

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

    Tested by running unit test
    Tested by building and running agent binaries with 6 SMB targets
    Tested by running agent binaries with WMI exploiter to ensure regressions were not introduced

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

Screenshots

image

self._config.hash_sensitive_data(lm_hash),
self._config.hash_sensitive_data(ntlm_hash),
logger.info(
f'Successfully logged in to {self.host.ip_addr} using user "{user}"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to know which type of credentials were used. use infection_monkey.utils.brute_force.get_credential_string

self._config.hash_sensitive_data(ntlm_hash),
exc,
"Error when trying to copy file using SMB to {self.host.ip_addr} with user "
f'"{user}":{exc}'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as previous comment, would be good to know which credential type is used for reproduction of the error

Configuration.hash_sensitive_data(ntlm_hash),
exc,
)
logger.debug(f'Error while logging into {host} using user "{username}": {exc}')
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be at least info or even error, since we already brute-forced and know the credentials. We should log credential type to ease debugging

@@ -38,7 +38,6 @@
],
"ping_scan_timeout": 10000,
"smb_download_timeout": 300,
"smb_service_name": "InfectionMonkey",
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps it's time for this whole file to go?

"title": "SMB service",
"type": "object",
"properties": {
"smb_download_timeout": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not move it to a const in smbexec.py? Other exploiters don't have timeouts in config

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I considered it. For the moment, it's the only thing exercising our ability to send custom options to exploiters. I think it's worth keeping just as a reminder that we can do that for now.

Copy link
Contributor

@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

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

Superb work, mergeable but left some comments for consideration

@@ -159,7 +159,7 @@ def _exploit_host(self):
except Exception:
status = ScanStatus.SCANNED
pass
T1035Telem(status, UsageEnum.SMB).send()
self.telemetry_messenger.send_telemetry(T1035Telem(status, UsageEnum.SMB))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe now is the time to check on #1571 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably not now. I wan't to keep focused on the agent refactor project.

Comment on lines 74 to 76
if not self.exploit_result.exploitation_success:
logger.debug("Exploiter SmbExec is giving up...")
return False
return self.exploit_result
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets add error_message to the ExploitResultData.

@mssalvatore mssalvatore merged commit 61344f9 into agent-refactor Mar 21, 2022
@mssalvatore mssalvatore deleted the 1741-add-smb-to-puppet branch March 21, 2022 12:16
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.

3 participants