Security: Add permission check to ExecuteProcess API#511
Open
r3352 wants to merge 1 commit intogoogle:masterfrom
Open
Security: Add permission check to ExecuteProcess API#511r3352 wants to merge 1 commit intogoogle:masterfrom
r3352 wants to merge 1 commit intogoogle:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
bed5c21 to
5a95b24
Compare
5a95b24 to
d086f0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ExecuteProcessandExecuteProcessReturnOutputinUtility.javacallRuntime.getRuntime().exec()with no permission check, allowing any connected client to execute arbitrary OS commands on the serverExecuteProcesspermission toPermissions.javaand gates both functions behindPermissions.hasPermission()before processing argumentsSecurity.java,Configuration.java)Vulnerability Details
CWE-78 (OS Command Injection) / CWE-862 (Missing Authorization)
The
ExecuteProcessfunction atUtility.java:1284andExecuteProcessReturnOutputatUtility.java:1371pass caller-supplied command strings directly toRuntime.exec()without any authorization check. These functions are callable over the network viaSageTVConnection.recvAction(), which has no method whitelist. Other sensitive operations in the codebase (e.g.,SetDefaultSecurityProfile) correctly checkPermissions.hasPermission()before executing — these two functions were missing that check.Changes
Permissions.java: AddedPERMISSION_EXECUTEPROCESS = "ExecuteProcess"constant and added it toPREDEFINED_PERMISSIONSarrayUtility.java: AddedPermissions.hasPermission(PERMISSION_EXECUTEPROCESS, stack.getUIMgr())check at the start of bothExecuteProcessandExecuteProcessReturnOutput— returns null if deniedBackward Compatibility
By default, permissions that have not been explicitly set to
falsereturntrue(seeHasPermissiondocumentation). Existing deployments will continue to allow process execution unless an administrator explicitly restricts theExecuteProcesspermission on a security profile. This gives administrators the ability to lock down process execution for untrusted clients while maintaining backward compatibility.