Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Add the Impersonate module #601

Merged
merged 8 commits into from
Nov 7, 2022
Merged

Add the Impersonate module #601

merged 8 commits into from
Nov 7, 2022

Conversation

Dfte
Copy link
Contributor

@Dfte Dfte commented Jul 4, 2022

Module usage

List available tokens

cme smb -u USERNAME -p PASSWOD -M impersonate

Impersonate user token

  • To list tokens: cme smb -u USERNAME -p PASSWORD -M impersonate -o MODULE=list
  • To run comand as user: cme smb -u USERNAME -p PASSWORD -M impersonate -o MODULE=exec TOKEN=<TOKEN_ID> CMD=whoami
  • To escalate dom admin: cme smb -u USERNAME -p PASSWORD -M impersonate -o MODULE=adduser TOKEN=<TOKEN_ID> CMD="username password 'group admin du dom' \domaincontroller"

@mpgn mpgn added the module label Jul 8, 2022
@mpgn mpgn added the in review label Oct 27, 2022
@mpgn
Copy link
Contributor

mpgn commented Oct 27, 2022

I did test it but while I'm connected as administrator on my DC, the impersonate binary didn't find any session.
On my other server, only the command 'whoami' or dir is working, I have the feeling whoami /all is failing because of the space.

image

@mpgn mpgn added the bug label Oct 27, 2022
Adding double quotes for spaced cmd
@Dfte
Copy link
Contributor Author

Dfte commented Oct 27, 2022

I have added double quotes to make sure that commands with spaces are run correctly. Also I have change the binary a bit to evade EDR's. !)

@mpgn mpgn removed the bug label Oct 27, 2022
@mpgn
Copy link
Contributor

mpgn commented Oct 27, 2022

I've rework the options :)
Very stable on my side !!

I will not merge until the code of impersonate is public so I can build it myself.

image

@mpgn mpgn added delayed and removed in review labels Oct 27, 2022
@Dfte
Copy link
Contributor Author

Dfte commented Oct 27, 2022

I'm thinking about adding an optional FILE option to specify a recompiled version just in case the embedded gets flagged.
Anyway, I'll release the code of the original binary with the blog post (about a week I'd say) :)!

@mpgn
Copy link
Contributor

mpgn commented Oct 27, 2022

Yes, an option with a file will be perfect, check the module procdump for example :)

Guess this will be the final one :P
I'll add technical links to the blog post explaining token manipulation internals as well as the source code of the original binary when the blog post will be released (should be on monday)
@Dfte
Copy link
Contributor Author

Dfte commented Oct 31, 2022

Here is the code of the embedded binary https://github.com/sensepost/impersonate/tree/main/CME_module :)

@mpgn mpgn added awesome sauce! all good tested in my lab and removed delayed labels Nov 2, 2022
@mpgn mpgn merged commit 60e3dda into byt3bl33d3r:master Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants