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

client: check msg_id for replay attacks #157

Closed
ernado opened this issue Feb 19, 2021 · 1 comment · Fixed by #159
Closed

client: check msg_id for replay attacks #157

ernado opened this issue Feb 19, 2021 · 1 comment · Fixed by #159
Labels
area: client telegram package issues security Security-related issues

Comments

@ernado
Copy link
Member

ernado commented Feb 19, 2021

The client must check that msg_id has even parity for messages from client to server, and odd parity for messages from server to client. (1)

In addition, the identifiers (msg_id) of the last N messages received from the other side must be stored, and if a message comes in with an msg_id lower than all or equal to any of the stored values, that message is to be ignored. Otherwise, the new message msg_id is added to the set, and, if the number of stored msg_id values is greater than N, the oldest (i. e. the lowest) is discarded. (2)

In addition, msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored (recall that msg_id approximately equals unixtime * 2^32). This is especially important for the server. The client would also find this useful (to protect from a replay attack), but only if it is certain of its time (for example, if its time has been synchronized with that of the server). (3)

We've already implemented (3) and (1), this issue tracks implementation of (2)

Epic: #155

@ernado ernado added area: client telegram package issues security Security-related issues labels Feb 19, 2021
@Lakbaypanahon
Copy link

Lakbaypanahon commented Feb 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: client telegram package issues security Security-related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants