2FA on Microsoft Teams fails (wrong timestamp)

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Corono
Posts: 5
Joined: 2. Apr 2024, 14:51

2FA on Microsoft Teams fails (wrong timestamp)

Post by Corono »

Hi
I have a strange problem: I can't login to Microsoft Teams on my Win11 Virtualbox installation. The two factor authentication always fails. If I check the timestamp, I can see that the MS teams requests a code that is 2 ours behind my local time. The displayed time of the operation system itself is correct.

I know that there is a problem with local time/UTC between Linux and Windows. I already tried changing the Linux host to local time (timedatectl set-local-rtc 1). Has no impact. I also tried the " Enable Hardware Clock in UTC time" setting in the Virtualbox configuration, no change.

My setup:
Virtualbox: Version 7.0.14
Host: Ubuntu 2310
Guest: Win11

Any idea how to solve this problem?
Thank you.
klaus
Oracle Corporation
Posts: 1141
Joined: 10. May 2007, 14:57

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by klaus »

Provide more information about your VM (and its config). Do you have Guest Additions installed inside the VM? Any other influence on the time used by the guest OS?
Corono
Posts: 5
Joined: 2. Apr 2024, 14:51

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by Corono »

Guest Additions are installed, yes.

I tried to login into some other accounts with the browser. Mozilla login with 2FA in browser works for example, but login into Microsoft account in a browser fails too (in Firefox or Edge). Seems to be a Microsoft problem.

I couldn't detect any other problem with the time yet.
linux-aarhus
Posts: 7
Joined: 10. Mar 2023, 10:34

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by linux-aarhus »

Corono wrote: 2. Apr 2024, 15:03 I know that there is a problem with local time/UTC between Linux and Windows. I already tried changing the Linux host to local time (timedatectl set-local-rtc 1). Has no impact. I also tried the " Enable Hardware Clock in UTC time" setting in the Virtualbox configuration, no change.
Any idea how to solve this problem?
On Manjaro forum we usually recommend modifying the Windows Guest to use UTC and disable the guest NtpClient

https://forum.manjaro.org/t//1167

On a systemd based host - run as root

Code: Select all

timedatectl set-local-rtc 0
systemctl enable --now systemd-timesyncd
Create file timezone.reg with below content and import it on the Windows guest

You can also do it manually using regedit and navigate the tree - you may need to create the entries if they do not exist.

Code: Select all

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
"Enabled"=dword:00000000
Corono
Posts: 5
Joined: 2. Apr 2024, 14:51

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by Corono »

Thank you for your answer. Tried it. Still doesn't work:
Timestamp: 2024-04-03T15:35:40Z

Which is two hours behind.
klaus
Oracle Corporation
Posts: 1141
Joined: 10. May 2007, 14:57

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by klaus »

The timesync service which is part of VirtualBox Guest Additions is known to handle time zones correctly. But if you see a 2 hour difference in the VM then something else must be "winning" against it. Because timesync would do a step adjustment if the difference is bigger than 2 minutes.
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by fth0 »

Corono wrote: 3. Apr 2024, 17:41 Timestamp: 2024-04-03T15:35:40Z

Which is two hours behind.
I'm wondering if you're perhaps confusing something related to time zones, because "15:35:40Z" equals "17:35:40 CEST/MESZ", which was roughly 5 minutes earlier than your post that I'm replying to.
Corono
Posts: 5
Joined: 2. Apr 2024, 14:51

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by Corono »

fth0 wrote: 5. Apr 2024, 23:31
Corono wrote: 3. Apr 2024, 17:41 Timestamp: 2024-04-03T15:35:40Z

Which is two hours behind.
I'm wondering if you're perhaps confusing something related to time zones, because "15:35:40Z" equals "17:35:40 CEST/MESZ", which was roughly 5 minutes earlier than your post that I'm replying to.
Hmm, then it is probably not a timestamp problem. This would explain why all other 2FA logins work except the one from Microsoft.
What could be the problem then? I can't login to Microsoft nether in browser nor in Teams itself. But other 2FA logins work.
linux-aarhus
Posts: 7
Joined: 10. Mar 2023, 10:34

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by linux-aarhus »

The timesync service which is part of VirtualBox Guest Additions is known to handle time zones correctly.
You are right - my bad :roll: - I was thinking dual boot Windows/Linux - which can be quite challenging
Corono
Posts: 5
Joined: 2. Apr 2024, 14:51

Re: 2FA on Microsoft Teams fails (wrong timestamp)

Post by Corono »

Problem seems to be solved.
Once again, the problem was Microsoft itself. They really made a mess with the accounts. Resetting the account completely solved the problem. Cannot completely explain it, 2FA was set to disabled and Microsoft was still asking for the code. :shock:
Post Reply