Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit d12e151

Browse files
committed
increased PowerUp error checking
1 parent f8d2a34 commit d12e151

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Privesc/PowerUp.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,13 @@ a modifiable path.
875875

876876
else {
877877
# if the path doesn't exist, check if the parent folder allows for modification
878-
$ParentPath = (Split-Path -Path $TempPath -Parent -ErrorAction SilentlyContinue).Trim()
879-
if ($ParentPath -and ($ParentPath -ne '') -and (Test-Path -Path $ParentPath -ErrorAction SilentlyContinue)) {
880-
$CandidatePaths += Resolve-Path -Path $ParentPath -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path
878+
try {
879+
$ParentPath = (Split-Path -Path $TempPath -Parent -ErrorAction SilentlyContinue).Trim()
880+
if ($ParentPath -and ($ParentPath -ne '') -and (Test-Path -Path $ParentPath -ErrorAction SilentlyContinue)) {
881+
$CandidatePaths += Resolve-Path -Path $ParentPath -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path
882+
}
881883
}
884+
catch {}
882885
}
883886
}
884887
}
@@ -5012,5 +5015,4 @@ $Kernel32 = $Types['kernel32']
50125015
$NTDll = $Types['ntdll']
50135016

50145017
Set-Alias Get-CurrentUserTokenGroupSid Get-ProcessTokenGroup
5015-
Set-Alias Get-UnquotedService Get-UnquotedService
50165018
Set-Alias Invoke-AllChecks Invoke-PrivescAudit

0 commit comments

Comments
 (0)