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

start remote registry as unprivileged user in reg.py #1638

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

dadevel
Copy link
Contributor

@dadevel dadevel commented Oct 27, 2023

This PR implements the trick discovered by @antonioCoco in https://twitter.com/splinter_code/status/1715876413474025704 to trigger the start of the RemoteRegistry service as unprivileged user by opening the winreg named pipe over SMB.
Additionally HKEY_USERS can now be accessed trough reg.py.

demo

Trigger the start of the RemoteRegistry service as unprivileged user by opening the winreg named pipe.
# original idea from https://twitter.com/splinter_code/status/1715876413474025704
tid = self.__smbConnection.connectTree('IPC$')
try:
self.__smbConnection.openFile(tid, r'\winreg', 0x12019f, creationOption=0x40, fileAttributes=0x80)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No clue what the hex values do, just copied them over from psexec.py.

@anadrianmanrique anadrianmanrique self-assigned this Oct 31, 2023
@anadrianmanrique anadrianmanrique added the medium Medium priority item label Oct 31, 2023
@anadrianmanrique
Copy link
Contributor

@dadevel thanks for your PR. I'm testing it, so fat it's working as expected. Please apply the suggested changes in the review in order to merge these changes in the main branch. Thanks

@dadevel
Copy link
Contributor Author

dadevel commented Nov 2, 2023

Hi @anadrianmanrique, thanks for reviewing my PR. I updated the help message.

@anadrianmanrique anadrianmanrique merged commit 2d00fc6 into fortra:master Nov 3, 2023
9 checks passed
@dadevel dadevel deleted the patch-1 branch November 3, 2023 15:04
abbra pushed a commit to abbra/impacket that referenced this pull request Nov 27, 2023
* start remote registry as unprivileged user in reg.py

Trigger the start of the RemoteRegistry service as unprivileged user by opening the winreg named pipe.

* enable access to HKEY_USERS trough reg.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Medium priority item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants