From bc7be3bdfff885549b44b58d41992735ea1ac728 Mon Sep 17 00:00:00 2001 From: Michael Koehler Date: Fri, 29 Sep 2017 21:48:00 -0400 Subject: [PATCH] Get-ModifiablePath - Added test to exclude ParentPath of \ from candidates as c:\ is always modifiable and not relevant. This only comes up with parameters being misread as paths. --- Privesc/PowerUp.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Privesc/PowerUp.ps1 b/Privesc/PowerUp.ps1 index 072b03e..465ad6b 100644 --- a/Privesc/PowerUp.ps1 +++ b/Privesc/PowerUp.ps1 @@ -853,7 +853,7 @@ function Get-ModifiablePath { # if the path doesn't exist, check if the parent folder allows for modification try { $ParentPath = Split-Path $TempPath -Parent - if($ParentPath -and (Test-Path -Path $ParentPath)) { + if ($ParentPath -and ($ParentPath -ne '') -and ($ParentPath -ne '\') -and (Test-Path -Path $ParentPath )) { $CandidatePaths += Resolve-Path -Path $ParentPath -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path } } @@ -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 '') -and ($ParentPath -ne '\') -and (Test-Path -Path $ParentPath )) { $CandidatePaths += Resolve-Path -Path $ParentPath | Select-Object -ExpandProperty Path } }