Re: [secdir] [http-auth] secdir review of draft-ietf-httpauth-basicauth-update-06

"Roy T. Fielding" <fielding@gbiv.com> Thu, 19 February 2015 23:06 UTC

Return-Path: <fielding@gbiv.com>
X-Original-To: secdir@ietfa.amsl.com
Delivered-To: secdir@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D43FF1A0398; Thu, 19 Feb 2015 15:06:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.666
X-Spam-Level:
X-Spam-Status: No, score=-1.666 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xv9KREIBfMgs; Thu, 19 Feb 2015 15:06:44 -0800 (PST)
Received: from homiemail-a96.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by ietfa.amsl.com (Postfix) with ESMTP id 117C21A0371; Thu, 19 Feb 2015 15:06:44 -0800 (PST)
Received: from homiemail-a96.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a96.g.dreamhost.com (Postfix) with ESMTP id 0CB953B805C; Thu, 19 Feb 2015 15:06:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=puE9hLU3cluv6aZuUUYHf4gRF4Q=; b=qifJHA2UKDqYdqdSoY/Vw2gyCzdB PpbC4SnqebFQgyeOAb8Xg/ZZMzbObzHwe8WtNoTqMPqtF4u4J19CnTwfnSzyb0cr WLJAo/euxZieNOS+T3jTgX682hndMU0y1wBDMFng534XWsV7c12rFgs8cp8/KsSf SZfrYJCepBHKWzM=
Received: from [192.168.1.12] (ip68-228-83-124.oc.oc.cox.net [68.228.83.124]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a96.g.dreamhost.com (Postfix) with ESMTPSA id CD40D3B8059; Thu, 19 Feb 2015 15:06:42 -0800 (PST)
Mime-Version: 1.0 (Apple Message framework v1283)
Content-Type: text/plain; charset=iso-8859-1
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <54E648B9.6030606@gmx.de>
Date: Thu, 19 Feb 2015 15:06:42 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <9A93C4F9-C14E-410E-81B7-E36E05270FD2@gbiv.com>
References: <874mqjd49v.fsf@alice.fifthhorseman.net> <54E50FC3.9080708@gmx.de> <871tllbw2c.fsf@alice.fifthhorseman.net> <54E6348A.3080606@gmx.de> <87mw49ac9h.fsf@alice.fifthhorseman.net> <54E648B9.6030606@gmx.de>
To: Julian Reschke <julian.reschke@gmx.de>
X-Mailer: Apple Mail (2.1283)
Archived-At: <http://mailarchive.ietf.org/arch/msg/secdir/medwUS8fTxy4cEUWazrfLVj9U9Y>
X-Mailman-Approved-At: Thu, 19 Feb 2015 15:28:29 -0800
Cc: "http-auth@ietf.org" <http-auth@ietf.org>, draft-ietf-httpauth-basicauth-update.all@tools.ietf.org, iesg@ietf.org, secdir@ietf.org
Subject: Re: [secdir] [http-auth] secdir review of draft-ietf-httpauth-basicauth-update-06
X-BeenThere: secdir@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Security Area Directorate <secdir.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/secdir>, <mailto:secdir-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/secdir/>
List-Post: <mailto:secdir@ietf.org>
List-Help: <mailto:secdir-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/secdir>, <mailto:secdir-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Feb 2015 23:06:46 -0000

On Feb 19, 2015, at 12:34 PM, Julian Reschke wrote:
> On 2015-02-19 21:15, Daniel Kahn Gillmor wrote:
>> On Thu 2015-02-19 14:07:54 -0500, Julian Reschke wrote:
>>> The network exchange will be take milliseconds. The string comparison
>>> microseconds. /me not convinced there's a problem here.
>> 
>> as long as the attacker can measure microseconds, and the network
>> exchange has small or regular-enough jitter to be accounted for with
>> statistical techniques, the size difference between these parts doesn't
>> matter to a timing attack.
>> 
>>   http://www.cs.rice.edu/~dwallach/pub/crosby-timing2009.pdf
>> 
>> says:
>> 
>>    The resolution an attacker can time a remote host depends on how many
>>    measurements they can collect. Our simulated attacker using
>>    statistical hypothesis testing was able to reliably distinguish a
>>    processing time differences as low as 200ns and 30µs with 1,000
>>    measurements on the LAN and WAN respectively with. (See Section 6.)
>> 
>> Note that salted, hashed passwords where the attacker doesn't know the
>> salt are resistant to using a timing oracle like this to do byte-by-byte
>> guessing.  I still think it's simpler to just recommend that the tests
>> should be constant time.
> 
> I'm sorry, I'm not convinced. What do others think?

It is possible to run a timing attack on a remote server that uses
any form of authentication scheme.  However, the likelihood of detecting
within the attack a difference of matching N characters vs N+1 characters
is incredibly small (usually less than 1 nanosecond) unless the matching
algorithm itself is unusually complicated.

In any case, we can't just recommend that the tests should be constant time.
Very few people understand what that means, even in a security discussion.
I don't think we use any matching schemes within Apache that do partial
comparison during mid-algorithm -- IIRC, we recreate the hash based on the
complete input and then use a string function to compare the result to the
stored password.  Of course, others could extend Apache to do more.

A more reasonable thing to say is that any authentication system that
allows a client to perform more than three failed authentication attempts
on a single connection, or more than ten on a single account over multiple
connections, is likely to be vulnerable to password guessing attacks.
Timing attacks then become completely irrelevant.

[...]

>>>> And sorry, one more question arises for me on re-read. i'm not sure i
>>>> understand what this means:
>>>> 
>>>>     Server implementers SHOULD guard against the possibility of this sort
>>>>     of counterfeiting by gateways or CGI scripts.  In particular it is
>>>>     very dangerous for a server to simply turn over a connection to a
>>>>     gateway.  That gateway can then use the persistent connection
>>>>     mechanism to engage in multiple transactions with the client while
>>>>     impersonating the original server in a way that is not detectable by
>>>>     the client.
>>>> 
>>>> How should the server guard against this attack?  what sort does it mean
>>>> to "turn over a connection to a gateway"?  does "gateway" mean
>>>> "transparent HTTP proxy" or does it refer to something else?  Sorry if
>>>> this is elementary stuff, but the term "gateway" only appears in this
>>>> paragraph.
>>> 
>>> That text is present in RFC 2617; I don't understand it completely either.

This is about web server internals.  Back in the early days, when HTTP was
limited to one request per connection, there was a thing called NPH scripts
that would allow a script to directly respond to the client instead of their
response being framed by the server; a trivial implementation could hand
off the file descriptor to the script and exit.  However, that kind of
implementation became a potential security hole when persistent connections
were introduced, since the script could redirect the client to a
protected space within the same origin (controlled by someone else)
and receive the redirected request within the script input, bypassing the
web server's normal request-target hierarchy and collecting the credentials.
The solution is to never delegate message framing.

>>> 
>>> Maybe just drop the second half of the paragraph and only mention the
>>> thread itself?
>> 
>> If we drop the second half, i'd still like to know what kind of steps a
>> server should take to guard against the possibility of counterfeiting.
>> If we don't have any recommendations or external references, an
>> unactionable SHOULD seems troublesome.
> 
> I'd just say
> 
> "Basic Authentication is also vulnerable to spoofing by counterfeit servers. If a user can be led to believe that he is connecting to a host containing information protected by Basic authentication when, in fact, he is connecting to a hostile server or gateway, then the attacker can request a password, store it for later use, and feign an error. This type of attack is not possible with other authentication schemes, such as Digest Authentication."

Er, it is possible with Digest, but less productive (the credentials are
only usable for as long as the nonce works).

....Roy