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 exploiter only works with SMBv1 #3577

Closed
5 tasks done
mssalvatore opened this issue Aug 9, 2023 · 3 comments
Closed
5 tasks done

SMB exploiter only works with SMBv1 #3577

mssalvatore opened this issue Aug 9, 2023 · 3 comments
Assignees
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Exploit Impact: High Reported by user
Milestone

Comments

@mssalvatore
Copy link
Collaborator

mssalvatore commented Aug 9, 2023

Describe the bug

A user has reported that the SMB exploiter only works if SMBv1 is enabled. If SMBv1 is disabled, propagation fails with the following event:

ExploitationEvent(
    source=UUID('35b9a0c6-4b32-47da-9f05-90e81c9dc4af'),
    target=IPv4Address(REDACTED),
    timestamp=1691594367.2392383,
    tags=frozenset({'smb-exploiter', 'attack-t1021', 'attack-t1110', 'attack-t1210'}),
    success=False,
    exploiter_name='SMB',
    error_message="Failed to authenticate over SMB with identity=Username(username='hacker') secret=Password(password=SecretStr('**********')): Error occurs while reading from remote(10054)"
)

Tasks

  • Disable SMBv1 on at least one of the SMB test machines. (0d) @ilija-lazoroski
    • Reproduce the issue
    • Update the packer/terraform scripts as necessary
  • Fix it! (0d) @ilija-lazoroski
    • Copy the fix to WMI and test

Hints

I haven't investigated this much, but my money is on the preferred_dialect parameter being the cause of the issue.

https://github.com/guardicore/monkey/blob/e587368339a9c23a9045f0ff9eeece15e7f03a7b/monkey/agent_plugins/exploiters/smb/src/smb_client.py#L77C5-L83C13

@mssalvatore mssalvatore added Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Impact: High Complexity: Medium Reported by user Exploit labels Aug 9, 2023
@mssalvatore mssalvatore added this to the v2.3.0 milestone Aug 9, 2023
@ilija-lazoroski
Copy link
Contributor

It seems that the preferred dialect is SMBv1: https://github.com/fortra/impacket/blob/master/impacket/smb.py#L69

@ilija-lazoroski
Copy link
Contributor

Initial test:

Enabled SMBv1:
image

Disabled SMBv1:
I was able to reproduce the issue with the same message:
error_message="Failed to authenticate over SMB with identity=Username(username='m0nk3y') secret=Password(password=SecretStr('**********')): Error occurs while reading from remote(104)")]

This was referenced Aug 10, 2023
ilija-lazoroski added a commit that referenced this issue Aug 11, 2023
@ilija-lazoroski
Copy link
Contributor

ilija-lazoroski commented Aug 11, 2023

Configured a machine to only use SMBv1 and a machine to use SMBv2/v3.
Based on the fix in which I have added log statement to check the SMB dialect in use, we can see that one of the machines is using NT LM 0.12 which is SMBv1 and the other uses 768 which is SMBv2 or 0x300 in hexdecimal.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Exploit Impact: High Reported by user
Projects
None yet
Development

No branches or pull requests

2 participants