-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Elevated Commands Redesign #1123
Conversation
Your PR was set to |
In the "elevation requested" case, I think we should always use the token given by
Any changes we do to potentially move the web service into a separate lower-privileged process should be invisible to users. That process would still communicate with the Sunshine service via some IPC interface that would allow changes to be made to settings without needing elevation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are considering changing the way WebAPI operates, specifically to prevent it from running everything under the System account, which is a vector for exploits.
What exploits? Or this is just a theoretical statement?
Not theory, any input received by the web server is vulnerable to exploits if not validated. One vulnerably was fixed in previous pull requests and I'm sure I'll find others once I do a detailed security review over it when I get to that. Ideally we wouldn't want a web service running as system but I don't have any other solutions that are effective enough to not be any difference to the user experience basically. |
Okay, it's ready for feedback/review |
@cgutman Any other changes needed? Been about two weeks so was just curious |
Almost everything looks good in my testing. I'm seeing a bug though where trying to quit a running app from Moonlight never completes. It works in nightly, so it looks like a regression specific to this PR. |
I am not observing this behavior, but I did pull some changes from nightly so maybe it was fixed in nightly? IDK. I am able to quit apps without issues. |
ed2d576
to
91c67db
Compare
…ll execute between different platforms
…de the platf namespace
…launches it in non-admin mode
…ing suggestions of cgutman
…unt was not an administrator
This was merged in so a user could test to see if their problem is related to that
This is no longer necessary with the elevation rework
4dfdfdf
to
4e9a753
Compare
… terminating in Moonlight
Fixes
Description
This pull request aims to rework the way commands are executed, specifically on the Windows platform. The main goal is to provide a safe method for users to elevate permissions without being prompted for UAC permissions. By doing this, we also prevent potential privilege exploits that are currently possible in Sunshine due to its existing design.
The core issue with Sunshine is that it allows adding commands without administrator rights, enabling anyone with user-level permissions to reset credentials and run elevated commands without additional safety checks.
Although there is a proof of concept demonstrating that secure administrative rights can be achieved without refactoring a significant portion of the code base, it does not address the fundamental problem. Additionally, it does not provide an option for users to safely disable elevation prompts.
To achieve this goal, we will need to implement several high-level changes, which I will outline below.
Sunshine as a Service is Mandatory
If using the installer, installing Sunshine as a service will no longer be optional. The primary reason for this change is to allow us to securely configure the apps.json file and require elevated permissions to modify it. Please note that this change will not affect portable installations of Sunshine.
All Commands are Un-elevated
As Sunshine runs under the SYSTEM context, it would be unwise to let commands run under this account, as it can lead to issues with certain scripts that need access to the UI on your PC. For instance, if you're trying to create a pre-command and need to swap monitors before the stream starts, this would not work until we execute those commands under the user's profile.
Elevation as an Option
After changing the permissions of the app.json file, we will need administrative access to make modifications to it. This means we can "safely" allow users to mark a command as "elevated." Once that is done, Sunshine will run any command marked with this flag under admin, launching as the current user's profile without any UAC prompts. If the current user's profile does not have admin privileges, then it would execute under the System context instead.
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.