Subject: [hybi] RFC 6455 Client-Server Masking

From: Denis McMahon <[email-masked]>
Date: Sun, 27 Jan 2013 23:58:37 +0000

The unpredictability of the masking key is essential to prevent authors
of malicious applications from selecting the bytes that appear on the wire.

>From this statement, I assume that the purpose of masking is "to prevent
authors of malicious applications from selecting the bytes that appear
on the wire."

-= However =-

The masking key is transmitted as part of the packet, and appears as 4
bytes ABCD. This is like sending data inside a locked casket for
security, WITH THE KEY SAFELY TIED TO THE CASKET!

It follows from the protocol description that to detect any arbitrary
sequence of n bytes in length, it is merely necessary to determine the
four possible bit sequences that those bytes might represent, and
monitor for all four of those bit sequences.

The masking sequence for any N bytes of data will be one of four
sequences, based on the mask bytes ABCD:

012345678.....n
ABCDABCDA......
BCDABCDAB......
CDABCDABC......
DABCDABCD......

Given any sequence b1 ... bn which the attacker wishes to detect, the
attacker simply has to combine, for each frame, b1 ... bn with each of
the 4 possible sequences of n bytes in length of masking bytes, and
listen for all 4 sequences. Computationally this is a trivial exercise!

This mechanism does nothing to significantly increase the difficulty of
a malicious application listening to the bytes on the wire with the
intention of detecting specific patterns.

It would be much better if the protocol dropped the masking concept,
stated that it makes no attempt to protect data from eavesdropping or
interception, and made the recommendation that if data security is
desired, then appropriate transport layer security eg RFC 5246 TLS1.2 /
RFC 6101 SSL3.0 should be employed.

Denis McMahon

---

From: Brian McKelvey <[email-masked]>
Date: Sun, 27 Jan 2013 17:26:07 -0800

The purpose of the masking has nothing to do with preventing eavesdropping or interception.  It's meant to prevent malicious javascript running in a web browser from connecting to arbitrary non-websocket services, or from tricking http-unaware proxies into doing the attacker's bidding, caching malicious data, etc.

It's about preventing browsers from initiating attacks against unsuspecting services, not about preventing eavesdropping or securing the privacy of data in transit.  The use of TLS with WebSockets is required for that.

Brian

Sent from my iPhone

On Jan 27, 2013, at 3:58 PM, Denis McMahon <[email-masked]> wrote:

> _______________________________________________
> hybi mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/hybi