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

Rolling a homeserver's database back via backup could cause duplicate OTKs and hence UISIs #2155

Open
Tracked by #245
richvdh opened this issue Oct 19, 2023 · 5 comments
Labels
A-E2EE Z-UISI Unable to decrypt errors

Comments

@richvdh
Copy link
Member

richvdh commented Oct 19, 2023

  • Alice messages Bob, claiming a OTK.
  • Bob's server suffers a meltdown. Bob restores his database from backup.
  • Carol messages Bob, claiming a OTK. Bob's server re-issues the OTK already given to Alice.
  • Bob cannot decrypt Carol.

This is somewhat related to https://github.com/vector-im/element-web/issues/3309, in that both are fundamentally about OTKs getting out of sync between client and server.

@richvdh richvdh added Z-UISI Unable to decrypt errors A-E2EE labels Nov 7, 2023
@kegsay
Copy link

kegsay commented Jan 12, 2024

This will happen 100% of the time in cases where the server is rolled back and someone has claimed a OTK during the bad new deployment.

@richvdh
Copy link
Member Author

richvdh commented Jan 12, 2024

A fix to #1992 would also solve this.

@richvdh
Copy link
Member Author

richvdh commented May 28, 2024

@uhoreg proposes an interesting mitigation measure: don't back up the OTKs table

@uhoreg
Copy link
Member

uhoreg commented May 28, 2024

pg_dump has an option, --exclude-table-data=..., to exclude the data from certain tables, but still back up the table definition

@richvdh
Copy link
Member Author

richvdh commented Oct 16, 2024

pg_dump has an option, --exclude-table-data=..., to exclude the data from certain tables, but still back up the table definition

This idea seems good. It will mean that we fall back to fallback keys after the rollback, but that's fine. (Fallback keys are in a separate table to OTKs)

We could also document that you could TRUNCATE TABLE on the OTKs table after restore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-E2EE Z-UISI Unable to decrypt errors
Projects
None yet
Development

No branches or pull requests

3 participants