Example:
Manual Enumeration: cmd /c wmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "c:\windows\" | findstr /i /v """
C:\MyPrograms\Disk Sorter Enterprise\bin\disksrs.exe
If this is unquoted, cmd will search for programs to execute like:
C:\MyPrograms\Disk.exe
C:\MyPrograms\Disk Sorter.exe
1: Check permissions on directories with icacls.
icacls .You can also use a tool named Get-ServiceAcl powershell script https://github.com/Sambal0x/tools/blob/master/Get-ServiceAcl.ps1
Get-ServiceAcl.ps1
"SERVICE_NAME" | Get-ServiceAcl | select -ExpandProperty AccessIf BUILTIN/Users has (AI) and (WD), a user is allowed to create subdirectories and files respectively.
2: msfvenom payload
3: Rename payload to one of the arguments then grant it (F) permissions with icacls
OR
Write a batch file (runme.bat) that the service will execute
Write runme.bat with UTF-16LE and base64 encoding for padding.
Base54 encoded payload
4: Create a temp directory
5: Upload the batch file on target machine
6: Setup listener
7: Restart service
Last updated