On 17 Jan 2014, at 19:46, Frederik Gladhorn <[email protected]> wrote:

> Just another remark which I'm not sure about:
> In section 5.2 of rfc 6455 randomness is mentioned. I didn't read up on the 
> background but currently there is only a call to initialize qsrand with 
> QDateTime::currentMSecsSinceEpoch() which is probably not quite according to:
> 
>   The masking key needs to
>   be unpredictable; thus, the masking key MUST be derived from a strong
>   source of entropy, and the masking key for a given frame MUST NOT
>   make it simple for a server/proxy to predict the masking key for a
>   subsequent frame.  The unpredictability of the masking key is
>   essential to prevent authors of malicious applications from selecting
>   the bytes that appear on the wire.

Date and time are quite predictable :-)
Creating random numbers with a high entropy is quite expensive (if not cached 
beforehand).
This can be problematic, as a new mask has to be calculated for every frame.

What I do find strange though, is that the masking key is sent along 
unencrypted with the frame header and is thus readable by everyone (if not sent 
over secure websockets).
The messages can thus be perfectly decoded, and as the server is not checking 
for the source, a malicious application can invent his own masking keys or 
intercept the message and repackage it (the server just takes whatever masking 
key that is in the header).
I honestly don’t see how this mechanism can protect against malicious 
applications.

So, I wonder if it is worth the effort.

Cheers,

Kurt

> I'd like others with more experience in this area to chime in though.
> 
> Greetings,
> Frederik

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to