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

Starting a ConPTY process with UAC elevation #332

Closed
Eugeny opened this issue Dec 23, 2018 · 8 comments
Closed

Starting a ConPTY process with UAC elevation #332

Eugeny opened this issue Dec 23, 2018 · 8 comments
Labels
Area-Interop Communication between processes Issue-Question For questions or discussion Product-Conpty For console issues specifically related to conpty Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.

Comments

@Eugeny
Copy link

Eugeny commented Dec 23, 2018

What is the Microsoft's recommended way to start an elevated process with an attached PTY?

  1. CredUIPromptForWindowsCredentialsW + LogonUserW + CreateProcessWithTokenW?
  2. Running runas.exe with a PTY?
  3. Something else?
@Biswa96
Copy link

Biswa96 commented Dec 23, 2018

KernelBase.dll has an un-exported function CreatePseduoConsoleAsUser() which uses CreateProcessAsUserW(hToken, ...). The hToken parameter can be configured with admin privileges. It seems that the underlying conhost.exe process should also be run as administrator.

@DHowett
Copy link
Member

DHowett commented Dec 23, 2018

@Biswa96 please do not encourage people to rely on our private APIs.

@DHowett
Copy link
Member

DHowett commented Dec 23, 2018

@Eugeny we don’t have an official stance on elevating a pseudoconsole client. At the moment, you’d have the best chance of success by shipping an elevated helper and using that to broker communication with your lower-IL process.

@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Product-Conpty For console issues specifically related to conpty labels Jan 2, 2019
@parkovski
Copy link

parkovski commented Jan 5, 2019

I don't think the private API really matters here - when you call CreateProcessAsUser, you need to have SE_ASSIGNPRIMARYTOKEN_NAME, which restricted tokens don't have. So the only thing that API would help with is letting you create a PTY as another user if you are already elevated.

I'm experimenting with these scenarios here, but it's very experimental at the moment.

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label May 17, 2019
@DHowett-MSFT DHowett-MSFT added the Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason. label May 18, 2019
@DHowett-MSFT
Copy link
Contributor

This discussion has, perhaps, outlived its usefulness.

@DHowett-MSFT DHowett-MSFT added the Area-Interop Communication between processes label May 18, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 18, 2019
@Biswa96
Copy link

Biswa96 commented Sep 22, 2019

The private API CreatePseduoConsoleAsUser() now becomes a open source one in src/winconpty/winconpty.cpp.

@DHowett-MSFT
Copy link
Contributor

Creating a process as a different user was always possible, even without a pseudoconsole running as that user. The hard part is getting the correct part of the user's split token to launch elevated, which CreatePseudoConsoleAsUser still doesn't let you do. 😄

@DHowett-MSFT
Copy link
Contributor

to wit: it is subject to the same limitation @parkovski already pointed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interop Communication between processes Issue-Question For questions or discussion Product-Conpty For console issues specifically related to conpty Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.
Projects
None yet
Development

No branches or pull requests

7 participants