You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2021. It is now read-only.
Right now we secure the connection between the webview and Express-PouchDB using a secret sent in the clear over HTTP on localhost. Eventually the connection will be encrypted but in the meantime the real problem is a timing attack.
Imagine that bad client A connects to good Express-PouchDB server B on the mobile device. A doesn't know the authorization password. But what A can do is send a fake password starting with some binary value. Then by timing how long it takes for the Express-PouchDB server to return an error response it is in theory possible for the attacker to figure out how many characters into the fake password the string compare got before failing. This would allow the attacker to just try repeated authorization attempts in order to figure out the password.
I can't prove that this attack is workable in practice but it seems like the kind of thing we should protect again.
The first defense is to make sure that we use a constant time compare when validating the authorization
header.
The second defense, which is trickier, is to throttle how many compares we do. But we have to be careful or we would throttle the white hats along with the black hats. So we would need to do throttling on a per TCP connection and not a blind per HTTP request basis.