Re: [hybi] Extensibility mechanisms?

Adam Barth <ietf@adambarth.com> Thu, 22 July 2010 06:12 UTC

Return-Path: <ietf@adambarth.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 763073A6841 for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 23:12:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.661
X-Spam-Level:
X-Spam-Status: No, score=-0.661 tagged_above=-999 required=5 tests=[AWL=-0.773, BAYES_05=-1.11, FM_FORGED_GMAIL=0.622, J_CHICKENPOX_24=0.6]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jHnJgJpeRaZE for <hybi@core3.amsl.com>; Wed, 21 Jul 2010 23:12:05 -0700 (PDT)
Received: from mail-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by core3.amsl.com (Postfix) with ESMTP id 24C3F3A67F1 for <hybi@ietf.org>; Wed, 21 Jul 2010 23:12:05 -0700 (PDT)
Received: by iwn38 with SMTP id 38so8313164iwn.31 for <hybi@ietf.org>; Wed, 21 Jul 2010 23:12:22 -0700 (PDT)
Received: by 10.231.149.12 with SMTP id r12mr1442240ibv.57.1279779140564; Wed, 21 Jul 2010 23:12:20 -0700 (PDT)
Received: from mail-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by mx.google.com with ESMTPS id g31sm29574901ibh.4.2010.07.21.23.12.19 (version=SSLv3 cipher=RC4-MD5); Wed, 21 Jul 2010 23:12:19 -0700 (PDT)
Received: by iwn38 with SMTP id 38so8313112iwn.31 for <hybi@ietf.org>; Wed, 21 Jul 2010 23:12:19 -0700 (PDT)
Received: by 10.231.171.3 with SMTP id f3mr1333466ibz.145.1279779138916; Wed, 21 Jul 2010 23:12:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.143.145 with HTTP; Wed, 21 Jul 2010 23:11:58 -0700 (PDT)
In-Reply-To: <20100722055452.GL7174@1wt.eu>
References: <AANLkTikkfdlUxQ0MGNvVQKa5gfovkGHWdCgyN9juKSQJ@mail.gmail.com> <4C462F9E.9030207@caucho.com> <Pine.LNX.4.64.1007212153110.7242@ps20323.dreamhostps.com> <AANLkTiku76oSucTNDFdwgsFBNFa_cCpC-YktTnMfX47-@mail.gmail.com> <4C479130.4020500@caucho.com> <AANLkTikLDjBP-Xs5t6TxmJuq4nG8jwThQ=n34B4cEmup@mail.gmail.com> <4C479CE4.6070805@caucho.com> <AANLkTims1er0Rbv0ysP4gRs1Kd0He8hapHeJ3nON=JQa@mail.gmail.com> <4C47C5B0.3030006@caucho.com> <AANLkTi=ND-FOH8OoD=TCbiyeSZ-h0LhxQBXN5w-2hfvj@mail.gmail.com> <20100722055452.GL7174@1wt.eu>
From: Adam Barth <ietf@adambarth.com>
Date: Wed, 21 Jul 2010 23:11:58 -0700
Message-ID: <AANLkTik_rpxo=1OfzHkwpC5soQG_NxvGuZNXx7gdhVTh@mail.gmail.com>
To: Willy Tarreau <w@1wt.eu>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Extensibility mechanisms?
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Jul 2010 06:12:06 -0000

Thanks.  Your email is much more lucid.

On Wed, Jul 21, 2010 at 10:54 PM, Willy Tarreau <w@1wt.eu> wrote:
> On Wed, Jul 21, 2010 at 09:40:00PM -0700, Adam Barth wrote:
>> The more I read on this list, the more I think that folks here don't
>> understand the requirements on the protocol, especially the security
>> requirements.  That's understandable if you haven't worked extensively
>> with the browser security model.  Fortunately, Ian is an expert on
>> these topics and has more time to reply to this list than I do.
>
> Unfortunately, if neither of you two can take some time to give concrete
> examples of what you're trying to protect against, you will constantly
> see proposals that don't fit your requirements.

A cross-protocol vulnerability is a very general class of
vulnerability in which the client believes it's speaking one protocol
and the server believes it's speaking another protocol.  The ensuing
confusion leads to a miscommunication that an attacker can exploit to
do something undesirable.

> My understanding of cross-protocol attacks (please correct me if I'm
> wrong) is the fact that a browser can be tricked into sending specially
> crafted data to an IP:port which it believes is one protocol while it's
> another one,

It's not a matter of being tricked.  It's a deliberate ability the
browser grants to guest code (the merits of which aren't really up for
discussion in this forum).

> the typical example being a form designed to send a POST
> to an SMTP server, which will ignore all the HTTP part it does not
> understand and will happily apply the body's data as SMTP commands.

Yes.  HTTP => SMTP has a particularly bad cross-protocol
vulnerability.  The "solution" to the vulnerability is that browsers
forbid HTTP connections to port 25, which is deeply unsatisfying but
effective in practice.

> It's easy to put web sites on the net that build such forms so that browsers
> which get there are accidentely used to perform that attack.

Again, there's no accident involved.  It's entirely reasonable for
users to visit hostile web sites.  It's also entirely reasonable for
those hostile web sites to use these APIs.  It's the browsers job to
make sure the user isn't sad because of this arrangement.

> If this is indeed the issue you're talking about, then I don't see why
> the HTTP-based handshake could be a problem there.

Well, it certainly *could* be a problem if improperly designed.  As a
community, we don't have a good science of cross-protocol
vulnerabilities.  We certainly can't understand all possible
interactions between all protocols.  We have to reason about these
attacks indirectly, for example by reduction.  It's possible to reason
about the security of an HTTP-based handshake by reduction to already
existing abilities the attacker has, provided the protocol is designed
with that sort of reasoning in mind.  Blithely hoping "HTTP likeness"
will avoid all issues isn't sufficient.

> It's not more than any other common HTTP request,

Keep in mind that attacker can only generate a very stylized subset of
HTTP requests in browsers today.  Stepping outside that subset
requires careful consideration.

> it's even better in that no data should
> flow until the server has correctly replied indicating proper support
> for the protocol.

That's also a useful property.  However, we need to be careful when
thinking about what "proper" means in this context.  In many
protocols, the attacker can put words in the server's mouth, so to
speak.  For example, in DNS, the attacker can request TXT records from
domains he control, or in NNTP, the attacker can request posts he
authored.  That's why the server's proof of understanding the client's
hello message is convoluted in current protocol.

> Basically we should get this :
>
>  - the client sends an HTTP handshake (headers only)
>  - the server responds with its HTTP handshake
>  - the client checks the response and only then forwards
>    data.
>
> This standard scheme protects against cross-protocol attacks (as I
> understand them) as the client does not send anything unless the
> server proves its ability to understand the client protocol. Also,
> the request and response are different HTTP messages, so a simple
> echo server can't return the valid handshake by accident.

We're worried about more complex servers than just an echo server.
That's why the proof of understanding is more complex.  Certainly an
identical client -> server and server -> client message would be a
poor design.  However, just because they're not identical doesn't mean
we're out of the woods.

> So with this, I'm sorry I don't see what class of cross-protocol
> attacks remain and which ones we should actively protect against,
> so if you have good examples, it would be nice if you could take
> some time to share them.

Designing a secure protocol doesn't mean enumerating all attacks and
making sure we avoid them all.  We're not smart enough to envision all
attacks.  Instead, we need to convince ourselves that no attacks are
possible, which is much the opposite problem.  I don't have a pile of
attacks in my back pocket.  Instead, I can tell you that the protocol
presented earlier in this thread is unlikely to be free of
cross-protocol vulnerabilities because it lacks a number of defenses
and mitigations, some of which you've listed in your message.

Adam