Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Privesc/PowerUp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ function Get-ModifiablePath {
# if the path doesn't exist, check if the parent folder allows for modification
try {
$ParentPath = (Split-Path -Path $TempPath -Parent).Trim()
if($ParentPath -and ($ParentPath -ne '') -and (Test-Path -Path $ParentPath )) {
if($ParentPath -and ($ParentPath -ne '','C:\') -and (Test-Path -Path $ParentPath )) {
$CandidatePaths += Resolve-Path -Path $ParentPath | Select-Object -ExpandProperty Path
}
}
Expand Down Expand Up @@ -1455,7 +1455,7 @@ function Get-ServiceUnquoted {

$ModifiableFiles = $Service.pathname.split(' ') | Get-ModifiablePath

$ModifiableFiles | Where-Object {$_ -and $_.ModifiablePath -and ($_.ModifiablePath -ne '')} | Foreach-Object {
$ModifiableFiles | Where-Object -filterscript {$_ -and $_.ModifiablePath -and ($_.ModifiablePath -ne '') -and -not ($_.ModifiablePath.EndsWith('C:\'))} | Foreach-Object {
$ServiceRestart = Test-ServiceDaclPermission -PermissionSet 'Restart' -Name $Service.name

if($ServiceRestart) {
Expand Down