Table of Contents
Summery
Due to semi-often need of working with time on engagment and a plothera of different commands related to it, here’s a note that tries to make a sense of it all.
Kerberos Clock Skew
If while working with Kerberos you get a message saying Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) or similar, you need to adjust your system time to the domain controller time. Usually you can be 5 minutes ahead or past the DC time, but it’s of course best to set it up perfectly.
The go-to commands here is ntpdate.
Check time
Get-Date -Format "HH:mm:ss" or simply Get-Date -Format - Get the current time of a Windows host with Powershell
time /t - Get the current time of a Windows host with CMD
w32tm /stripchart /computer:DCSRV1.beyond.com /samples:3 /dataonly - Get the current time of a remote windows machine and checks the time difference between you two.
proxychains net time -S <IP> - Ask for a host’s current time
Change time
sudo date -s "10:01:00" - Manually set local system time on Linux
sudo ntpdate sequel.htb / sudo ntpdate 10.10.10.10 - Automatically get the current time from the NTP server of a specific host
Fake time
You can also fake the time change for given commands.
faketime 'YYYY-MM-DD HH:MM:SS' date - Temporarily makes the command you run believe the system time is that specified time. It does not actually change your Linux machine’s clock.
Examples of usage:
sudo proxychains faketime -f "+7h" impacket-GetUserSPNs -dc-ip 10.10.185.146 domain.com/Eric.Wallows -request - Works like a charm
sudo proxychains faketime YYYY-MM-DD HH:MM:SS' -q impacket-GetUserSPNs -request -dc-ip DC_IP beyond.com/john - NEVER had luck with that command or it’s variants
Time zones
You can easly find the host’s time zones with systeminfo on Windows and sudo date on Linux.
This site is a great resource as always to workout the time differences with timezones.
Cheatsheet
Random time cheatsheet, might oneday come in useful.
| Unit | Seconds | Minutes | Hours | Days | Weeks | Months (30 days) | Years (365 days) |
|---|---|---|---|---|---|---|---|
| 1 second | 1 | 0.0167 | 0.000278 | 0.0000116 | 0.00000165 | 0.000000386 | 0.0000000317 |
| 1 minute | 60 | 1 | 0.0167 | 0.000694 | 0.0000992 | 0.0000231 | 0.00000190 |
| 1 hour | 3,600 | 60 | 1 | 0.0417 | 0.00595 | 0.00139 | 0.000114 |
| 1 day | 86,400 | 1,440 | 24 | 1 | 0.1429 | 0.0333 | 0.00274 |
| 1 week | 604,800 | 10,080 | 168 | 7 | 1 | 0.2333 | 0.01918 |
| 1 month | 2,592,000 | 43,200 | 720 | 30 | 4.2857 | 1 | 0.08219 |
| 1 year | 31,536,000 | 525,600 | 8,760 | 365 | 52.1429 | 12.1667 | 1 |