covid19cz / erouska-android

Fighting against COVID-19 via privacy-first Bluetooth tracing
https://erouska.cz
MIT License
202 stars 55 forks source link

DOC: Reverse engineering of TraceTogether #94

Closed ocordeiro closed 4 years ago

ocordeiro commented 4 years ago

Probably this study help to improve this project :)

https://medium.com/@frankvolkel/tracetogether-under-the-hood-7d5e509aeb5d

Are plans to implement crypt and temporary (anonymous) uid?

Kobzol commented 4 years ago

We are considering adding something like this. We can implement floating device IDs rather easily, but we didn't find a way yet how to make encryption work, because we can only send a very limited amount of bytes on the BLE connection. It would be great if TraceTogether was open source and we could look at their code.

davidvavra commented 4 years ago

Let us know if TraceTogether is open-source somewhere.

ocordeiro commented 4 years ago

How limited in bytes?

Kobzol commented 4 years ago

10 bytes maximum at this moment, because of the way BLE advertising is used. It's possible that this will change in the future.

ocordeiro commented 4 years ago

And if you don't transfer encrypted. But using public key encryption. Encrypt before inserting into the database?

"Data encrypted with the public key can only be decrypted with the private key"

https://www.cloudflare.com/learning/ssl/how-does-public-key-encryption-work/

ocordeiro commented 4 years ago

ProteGo App from Polish apparently solved this.

https://github.com/ProteGO-app

Kobzol commented 4 years ago

Storing the ID encrypted on the phone is nice to have, but it's not the main problem, we need encryption for transmitting. I looked at the polish app and it seems very similar, if I understand the description correctly they don't encrypt the ID but they rotate it regularly, that's what we plan to implement soon too.

ocordeiro commented 4 years ago

Excellent, this project has more organization and quality of code.

About cryptography. In English overview of ProteGO they says:

"This data is stored encrypted only on citizens..."

none mention about transfer.

On the other hand TraceTogether overview:

"... both phones use Bluetooth to exchange a Temporary ID. This Temporary ID is generated by encrypting the User ID with a private key"

none mention about storage.

davidvavra commented 4 years ago

@ocordeiro Look at PR #103

ocordeiro commented 4 years ago

Congratulations. I Am writing a paper to propose turn this app as official Contact Tracer of Brazil MOH.

Still about TraceTogether: PrivacyStatement: "...A random anonymised User ID e.g. 9I8VPeQeWDofj39c8dPySoUXLqh2" (28 bytes)

How is my data protected "the data collected is stored locally in the user’s phone in an encrypted form"

simekadam commented 4 years ago

I think it's crucial to properly anonymize/enrypt/rotate the broadcasted ID as at the end of the day that's what prevents users privacy. Encrypting data locally is pointless imo as long as the former is done right. One of our main points is also that the user can see all the data that we store. This would be no longer possible if we were to implement assymetric encryption.

ocordeiro commented 4 years ago

I think, crypting only TUID whit a random string maintain data logs visible to user and add a more layer of privacy.

Something like:

crypt(TUID + randomString(), publicKey)
ocordeiro commented 4 years ago

All data keeps accessible for user, except TUID. This only can read with a private key. Available only for MOH.

Foxlik commented 4 years ago

@ocordeiro against what exactly are you trying to protect the data?

ocordeiro commented 4 years ago

Let us know if TraceTogether is open-source somewhere.

TraceTogether opensourced.. Called OpenTrace:

https://github.com/opentrace-community

ocordeiro commented 4 years ago

@ocordeiro against what exactly are you trying to protect the data?

Anything that could read the database and use the plaintext TUID (even if randomized) to associate with an user.

Like Exploits, Unauthorized authority governments, etc...

Encrypting TUID with public key will be like putting it in a safe box that I don't have the key to open