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

Feature Request: sudoers (run as someone who's password I don't know) #293

Open
keremers opened this issue Aug 26, 2023 · 2 comments
Open

Comments

@keremers
Copy link

Hello,

gsudo asks administrator password when using a privileged operation. But is must be asking the current user password, not the administrator. There's another sudo application that does this but unfortunately, I could not get to run it with my program. ıs it possible to ask just the user password but not the administrator? Because this way I should be giving the admin password to everyone.

@gerardog gerardog changed the title Feature Request: Feature Request: sudoers (run as someone who's password I don't know) Aug 31, 2023
@gerardog
Copy link
Owner

Yes. I desire this feature as well, but is a quite challenging thing to create. I don't have a design for it currently. Too many aspects to consider.

For example: Would it be necessary to pre-configure and store the target user(s) credentials? or should gsudo just hack/create a security token for someone not logged?

@jborean93
Copy link

jborean93 commented Sep 27, 2023

Windows has the ability to create an access token for another user that you don't know the password off. You use LsaLogonUser with the MSV1_0_S4U_LOGON as the AuthenticationInformation value. It's not documented on the online MS docs but it's essentially the same as KERB_S4U_LOGON. Some caveats to this approach

  • You need to have the SeTcbPrivilege (impersonating SYSTEM to call this func is fine)
  • It's a batch logon type not interactive, so some things that grant access for interactive logons won't apply to it
  • It cannot delegate to another host, outbound authentication appears as an anonymous user

This is the same concept that task scheduler uses when running as a non-logged in user without the password being saved.

A proof of concept of LsaLogonUser using the PowerShell ctypes module can be found at https://gist.github.com/jborean93/ca63f50ecaa9be5b517df5ad3433d461. With this I can spawn a new process as that user with APIs like CreateProcessAsUser or CreateProcessWithToken

image

Edit: I forgot to mention but all this can be simplified with the WindowsIdentity string constructor. Unfortunately it only works for domain accounts and not local ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants