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

Solve timing attacks against the tokens #1

Closed
Zegnat opened this issue May 6, 2018 · 1 comment
Closed

Solve timing attacks against the tokens #1

Zegnat opened this issue May 6, 2018 · 1 comment
Labels

Comments

@Zegnat
Copy link
Owner

Zegnat commented May 6, 2018

The token should consist of two parts:

  1. unique token identifier,
  2. random blob.

The first part can be used to query the token information from the database. If this part is faulty, nothing can be retrieved, and an error response can be sent. That is exactly as it is now.

That part might be vulnerable to timing attacks against SQLite’s WHERE clause. This means it would take slightly longer to deny a token starting with a known character, versus one without. (See this issue for a similar thing, and the links therein.) Over time the entire valid token can be found.

Mintoken can use the first part of the token to retrieve the second part of the token from the database. Then PHP can do a constant time comparison between the submitted second part and the second part from the database.

This means the second part is protecting us from timing attacks. Even if an attacker has used timing attacks to discover the complete first part of the token, the same attack can not be used against the second part. This protects the entire token against timing attacks.

@Zegnat Zegnat added the security label May 6, 2018
@Zegnat Zegnat added this to the 2.0.0 milestone May 6, 2018
@Zegnat
Copy link
Owner Author

Zegnat commented May 12, 2018

This should be solved by 60c3cc2.

@Zegnat Zegnat closed this as completed May 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant