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

net.py can't create a new user when utilizing it through a session from ntlmrelayx #1679

Open
enj5oy opened this issue Jan 10, 2024 · 5 comments
Assignees
Labels
in review This issue or pull request is being analyzed

Comments

@enj5oy
Copy link

enj5oy commented Jan 10, 2024

Configuration

impacket version: v0.12.0.dev1+20230817.32422.a769683f
Python version: 3.10
Target OS: Windows Server 2016
2024-01-10_21-26

After this command user created with hash 31d6cfe0d16ae931b73c59d7e0c089c0 and user is disabled

@NtAlexio2
Copy link
Contributor

Please paste debug output as explained in issue template.

@enj5oy
Copy link
Author

enj5oy commented Jan 13, 2024

@NtAlexio2
issue

@NtAlexio2
Copy link
Contributor

unfortunately I couldn't simulate your situation but the bug is about session_key in (line 2973 in samr.py). By default this key is set while authenticating. I'm not sure how did you get session from ntlmrelayx. could you explain more about your session? I just tested with -k in combination with getTGT.py and it worked without any problem:

┌──(kali㉿kali)-[~/Downloads/impacket-master]
└─$ proxychains python examples/net.py -dc-ip 192.168.8.1 -k -no-pass contoso.local/administrator@victimhost.contoso.local user -create newAdmin -newPasswd Passw0rd
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
Impacket v0.12.0.dev1 - Copyright 2023 Fortra

[proxychains] Strict chain  ...  192.168.8.12:1080  ...  contoso.local:445   ...  OK
[proxychains] Strict chain  ...  192.168.8.12:1080  ...  192.168.8.1:88      ...  OK
[*] Creating user account 'newAdmin'
[+] user account created succesfully: newAdmin:Passw0rd

@enj5oy
Copy link
Author

enj5oy commented Jan 16, 2024

@NtAlexio2 I start ntlmrelayx
2024-01-16_07-32
Then i coerce authentication from domain admin to attacker host
2024-01-16_07-29
Then i run net.py through proxychains

@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Feb 15, 2024
@gabrielg5
Copy link
Collaborator

Hey,

I was able to replay the issue in my environment. Haven't made much progress yet finding a solution but writing down what I've been checking

Test 1
Trying user account creation with net.py both "using Kerberos authentication" and "directly passing credentials as a command parameter". Both worked fine, user is created ok and no exceptions are shown

Test 2
Triggered ntlmrelayx with -socks. Coerced connection to relay from a workstation
Launch net.py with proxychains to create a user. Boom!

Error is in session_key as stated by @NtAlexio2 in a previous comment. When creating a user, that property is used (and needs to not be empty as it's being manipulated - splitted - in the process)

When launching net.py with a relayed connection, session_key is empty.
When launching net.py with other auth methods, it is not empty. This is why Test 1 is working fine.

Checked other examples and are performing the same as net.py
session_key is empty when relayed and not-empty when not relayed. But they are not doing anything with it, that's why those examples do not fail.

Still have not found why it's not the same or if that property is being manipulated in any of those scenarios and causing this misbehavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review This issue or pull request is being analyzed
Projects
None yet
Development

No branches or pull requests

4 participants