From 7964823e3f398c41a7ad1c0e8c4c28c0806a9c0d Mon Sep 17 00:00:00 2001 From: HarmJ0y Date: Wed, 14 Dec 2016 11:53:29 -0500 Subject: Added documentation for PowerUp --- docs/Privesc/Set-ServiceBinaryPath.md | 92 +++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 docs/Privesc/Set-ServiceBinaryPath.md (limited to 'docs/Privesc/Set-ServiceBinaryPath.md') diff --git a/docs/Privesc/Set-ServiceBinaryPath.md b/docs/Privesc/Set-ServiceBinaryPath.md new file mode 100755 index 0000000..b39926f --- /dev/null +++ b/docs/Privesc/Set-ServiceBinaryPath.md @@ -0,0 +1,92 @@ +# Set-ServiceBinaryPath + +## SYNOPSIS +Sets the binary path for a service to a specified value. + +Author: Will Schroeder (@harmj0y), Matthew Graeber (@mattifestation) +License: BSD 3-Clause +Required Dependencies: PSReflect + +## SYNTAX + +``` +Set-ServiceBinaryPath [-Name] [-Path] +``` + +## DESCRIPTION +Takes a service Name or a ServiceProcess.ServiceController on the pipeline and first opens up a +service handle to the service with ConfigControl access using the GetServiceHandle +Win32 API call. +ChangeServiceConfig is then used to set the binary path (lpBinaryPathName/binPath) +to the string value specified by binPath, and the handle is closed off. + +Takes one or more ServiceProcess.ServiceController objects on the pipeline and adds a +Dacl field to each object. +It does this by opening a handle with ReadControl for the +service with using the GetServiceHandle Win32 API call and then uses +QueryServiceObjectSecurity to retrieve a copy of the security descriptor for the service. + +## EXAMPLES + +### -------------------------- EXAMPLE 1 -------------------------- +``` +Set-ServiceBinaryPath -Name VulnSvc -Path 'net user john Password123! /add' +``` + +Sets the binary path for 'VulnSvc' to be a command to add a user. + +### -------------------------- EXAMPLE 2 -------------------------- +``` +Get-Service VulnSvc | Set-ServiceBinaryPath -Path 'net user john Password123! /add' +``` + +Sets the binary path for 'VulnSvc' to be a command to add a user. + +## PARAMETERS + +### -Name +An array of one or more service names to set the binary path for. +Required. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: ServiceName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Path +The new binary path (lpBinaryPathName) to set for the specified service. +Required. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: BinaryPath, binPath + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +## INPUTS + +## OUTPUTS + +### System.Boolean + +$True if configuration succeeds, $False otherwise. + +## NOTES + +## RELATED LINKS + +[https://msdn.microsoft.com/en-us/library/windows/desktop/ms681987(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681987(v=vs.85).aspx) + -- cgit v1.2.3