GrapheneOS / os-issue-tracker

Issue tracker for GrapheneOS Android Open Source Project hardening work. Standalone projects like Auditor, AttestationServer and hardened_malloc have their own dedicated trackers.
https://grapheneos.org/
351 stars 19 forks source link

NTS support #884

Closed jpds closed 2 years ago

jpds commented 2 years ago

Wishlist issue, but it would be neat if Graphene could use NTS to do time synchronization:

ghost commented 2 years ago

GrapheneOS already has a secure implementation of time keeping using HTTPS.

The OS makes a HTTPS request to a server that generates a 204 blank response. The OS gets the Date header and uses that for the time and date. It's far better than NTS and has all the security benefits of HTTPS such as TLS 1.3, secure ciphers, etc.

https://grapheneos.org/faq#default-connections

An HTTPS connection is made to https://time.grapheneos.org/ to update the time from the date header field. This is a full replacement of Android's standard network time update implementation, which uses the cellular network when available with a fallback to SNTP when it's not available. Network time updates are security sensitive since certificate validation depends on having an accurate time, but the standard NTP / SNTP protocols used across most OSes have no authentication.

jpds commented 2 years ago

GrapheneOS already has a secure implementation of time keeping using HTTPS.

This isn't an Internet standard, and by extension makes one easy to identify as a GrapheneOS user (which wouldn't be an issue using standard NTS network servers - which would also remove a single point of failure on time.g.o).

It's far better than NTS and has all the security benefits of HTTPS such as TLS 1.3, secure ciphers, etc.

NTS has TLS1.3, secure ciphers and also additional privacy characteristics.

thestinger commented 2 years ago

This is far too complex to implement ourselves and the only advantage over HTTPS is that it would provide more precise network time.

This isn't an Internet standard, and by extension makes one easy to identify as a GrapheneOS user (which wouldn't be an issue using standard NTS network servers - which would also remove a single point of failure on time.g.o).

It is an internet standard. TLS and HTTPS each include the time with second precision (which isn't great) which is all we're currently using. We were going to improve the precision with more accurate latency compensation and a more precise time field but we haven't done that yet. It's literally just using standard TLS / HTTP with no special stuff.

thestinger commented 2 years ago

Android doesn't use NTS and hardly anything else does either so using NTS doesn't blend in any more.

ypid commented 2 years ago

First of all, I was about to open the same issue because I recently looked into NTS and was happy to see a standard that covers basic requirements.

We were going to improve the precision with more accurate latency compensation and a more precise time field but we haven't done that yet.

This sounds like redundant work to me. I hope AOSP would support NTS eventually. I don’t think sub-second accuracy is so important on a phone. Am I missing something? Why not leave the current HTTPS implementation as simple as it is right now?

jpds commented 2 years ago

It is an internet standard. TLS and HTTPS each include the time with second precision

Synchronizing clocks from arbitrary HTTPS endpoints is not an Internet standard:

And whilst this is talking about logs, there is this bit in 5.2:

TLS clients MUST reject SCTs whose timestamp is in the future.

NTS doesn't blend in any more.

To be clear: NTS-KE is only used for establishing crypto parameters and the initial cookie - after that, the clients fallback to NTP traffic (albeit with NTS extension fields).

But yes, this will likely need to be imported from AOSP.

thestinger commented 2 years ago

We're not planning to implement this downstream.

thestinger commented 2 years ago

If AOSP supported NTS, we'd happily be hosting a server and using it. There's no way we're implementing this and we're more than happy with the HTTPS-based checks. The checks go over the VPN and they aren't a privacy issue. NTS would be useless if it was just used with an untrusted pool with open membership.