Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Token generation time drift - NTP update frequency issue? #160

Open
4 tasks done
sleemanj opened this issue Aug 15, 2024 · 0 comments
Open
4 tasks done

bug: Token generation time drift - NTP update frequency issue? #160

sleemanj opened this issue Aug 15, 2024 · 0 comments
Labels
Bug Something isn't working

Comments

@sleemanj
Copy link

sleemanj commented Aug 15, 2024

Bug type

Other

App version

5.4.5

Device environment

Android 10 on Smart E11

Bug description

TLDR: P1070295_001 the android system clock, the NTP time, and what 2FAS thinks the time is can drift apart causing token issues.

1, My device is set to use network-provided time in Android settings.
2, My device is currently 0.980s ahead of NTP, it does drift a little, but not a lot
3. When the 2FAS app is first started, I believe I am correct in saying it polls the NTP servers, it initialy generates tokens at the correct NTP times.
4. Over time, hours, days, 2FAS's concept of the time seems to drift away from that initial NTP sync, to ao considerable degree. What we see here is just a few hours drifting, and 2FAS is already generting tokens 10 seconds early.
5. Over longer periods of time it gets too far out
6. The Android system clock is never that far out
7. Killing 2FAS app and restarting it again syncs to NTP and all is well again

I think perhaps that 2FAS isn't checking on any periodic schedule that it's initial NTP derived time is still true and that for some reason it can drift to a considerable degree.

Probably it should periodically poll NTP servers to resync, or should be able to simply generate tokens against the Android system clock instead of NTP, as that is easier for people to see is inaccurate.

Solution

Turn it off and on again (kill the 2FAS app by swiping off the active apps list, then restart it).

Additional context

It's possible that goign to airplane mode and back may also fix it it, I'm not 100% sure on that, doing so does re-sync the system clock if it has drifted a little. No it doesn't, but killing and restarting 2FAS always does.

Acknowledgements

  • This issue is not a duplicate of an existing bug report.
  • I understand that security vulnerabilities should be reported to [email protected] instead of on GitHub.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@sleemanj sleemanj added the Bug Something isn't working label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant