-
Notifications
You must be signed in to change notification settings - Fork 778
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
[Issue] Shell commands don't use impersonated tokens #45
Comments
Hi @attl4s! I'm not really sure what's going on, I'm not able to reproduce either of those issues. Can you re-test and verify you are still seeing these behaviors? If so, can you provide your OS version? |
Hi again Ryan! Microsoft Windows 10 Enterprise (Evaluation)
I'm gonna keep digging to see if I can get something straight because this doesn't really make sense hahaha. It would be nice if a third person could test and post these things here. Thank you |
That's so strange. Which version of Windows 10 are you using? (i.e. build number) |
|
Ok, finally looked into this a little bit, and think I have confirmed that I'll have to do some thinking about how to handle this. Thanks again for the heads up @attl4s |
@attl4s This is more of a workaround than a solution. But I've added This is a built-in feature of the |
Ok, sorry it's taken so long, but I have now added a I think Let me know if this solution is sufficient @attl4s! |
AWESOME! I'll take a look tomorrow and let you know. Thank you Ryan!! |
Hi again! I've been trying the new CreateProcessWithToken and these are the results: Working like a charm in high integrity contexts:Failing in medium integrity contexts:AFAIK this is the intended behaviour of CreateProcessWithTokenW:
So considering the situation, I think this is indeed the best solution. Sum up:
Thanks again! if everything is OK, feel free to close this issue |
Thanks @attl4s, thanks for the heads up. I might look into the CreateProcessAsUser api in medium integrity contexts: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessasusera |
Souds like the perfect solution! I didn't notice the hToken within that call :P |
Hi Ryan :)
I've been playing around these days with Covenant and I've realized that MakeToken's functionality may not be working as intended.
1 - Token applied wrongly on ShellCmd actions?
The new token created with MakeToken seems is not working with Shellcmd. However, with powershell it does:
2 - Logon Types not working on low-priv users?
When using MakeToken with a low-priv user, only the logon type LOGON32_LOGON_NEW_CREDENTIALS seems to work. If another one is used, let's say LOGON32_LOGON_INTERACTIVE, the session breaks.
However, when doing this same process with an admin user, it succeeds:

I've seen that MakeToken is using
As Microsoft remarks, admin should not be needed (https://docs.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-impersonateloggedonuser):
Many thanks!!
The text was updated successfully, but these errors were encountered: