Re: [xmpp] IQ Handling vulnerabilities

Kevin Smith <kevin@kismith.co.uk> Fri, 07 February 2014 12:21 UTC

Return-Path: <k.i.smith@gmail.com>
X-Original-To: xmpp@ietfa.amsl.com
Delivered-To: xmpp@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 51F611A1DBE for <xmpp@ietfa.amsl.com>; Fri, 7 Feb 2014 04:21:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.278
X-Spam-Level:
X-Spam-Status: No, score=-1.278 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] 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 1k2dPyOh8qy7 for <xmpp@ietfa.amsl.com>; Fri, 7 Feb 2014 04:21:10 -0800 (PST)
Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [IPv6:2607:f8b0:400c:c03::22d]) by ietfa.amsl.com (Postfix) with ESMTP id D4A571A0398 for <xmpp@ietf.org>; Fri, 7 Feb 2014 04:21:09 -0800 (PST)
Received: by mail-vc0-f173.google.com with SMTP id ld13so2592127vcb.32 for <xmpp@ietf.org>; Fri, 07 Feb 2014 04:21:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=WrKpSsDeq82WFJD8T+uKqe3NdNRlOlwPSZhoaZ/WyHM=; b=TXXi8AterrX370oYxJlHtYX7sOzXjwcFEYvGV3QgkApH6yNt+vT2KUmqc+48rWVwbu widsduqsj5jCzAxjOhBuewE1dEcRtd+pBch8KW4xhucexXpsKVL89r5vHYFwsUUFkC9c nHvK6dZ8rjzODN5hQQKzuTuzGofgxdbmSOLjyrQyRS+U5tYYv+u1J+XiBUIA9y14Hca4 1JWZF7QIri4teMeXSRK+2eTZiqtkJI6JOL8Gq0/gWfeYZiBSa3uexcHRY2BUxInlvkKL sq1uOUcDNJNgm0z2kvPjLqf4hnAz3EYlcs6on9onBnjcC84a7M7TyWzq1barXBdVfOUd QtxA==
MIME-Version: 1.0
X-Received: by 10.58.255.233 with SMTP id at9mr10423352ved.20.1391775669675; Fri, 07 Feb 2014 04:21:09 -0800 (PST)
Sender: k.i.smith@gmail.com
Received: by 10.52.245.134 with HTTP; Fri, 7 Feb 2014 04:21:09 -0800 (PST)
In-Reply-To: <52F4C22C.6080305@ahsoftware.de>
References: <CAOb_FnxS-dMT85N7LHj5M9JWk3pL85=ugrDqaT7j5d28HBr0Cw@mail.gmail.com> <52F4C22C.6080305@ahsoftware.de>
Date: Fri, 07 Feb 2014 12:21:09 +0000
X-Google-Sender-Auth: KviLIJFa7cgF6pA4z3JPNWpAyJU
Message-ID: <CAOb_FnxCGcdmFGaxZfS4_Sf1goMVXQvX_+QmK77QBNMSyBrEPQ@mail.gmail.com>
From: Kevin Smith <kevin@kismith.co.uk>
To: Alexander Holler <holler@ahsoftware.de>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: XMPP Working Group <xmpp@ietf.org>
Subject: Re: [xmpp] IQ Handling vulnerabilities
X-BeenThere: xmpp@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: kevin@kismith.co.uk
List-Id: XMPP Working Group <xmpp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/xmpp>, <mailto:xmpp-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/xmpp/>
List-Post: <mailto:xmpp@ietf.org>
List-Help: <mailto:xmpp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/xmpp>, <mailto:xmpp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Feb 2014 12:21:11 -0000

On Fri, Feb 7, 2014 at 11:23 AM, Alexander Holler <holler@ahsoftware.de> wrote:
> Am 06.02.2014 12:26, schrieb Kevin Smith:
>>
>> Hi folks,
>>
>>    Discussion in the XSF and at the recent XMPP Summit has shown that
>> there are widespread issues with handling of iq responses in XMPP
>> software. This is probably something we need to consider handling.
>>
>> The basis of this is that many libraries/clients
>> a) Only check the id of an iq error/result, not the sender, to check
>> it matches one they've sent (Very Wrong)
>> b) Use predictably generated ids for stanzas (ill-advised, but not
>> strictly wrong)
>> c) Use known resource strings (bad, but not strictly wrong)
>
>
> Just to make it clear, the real problem here is neither the IDs nor the
> resources, but not checking the sender of the reply.

There are three issues here. They have different severities, as I
noted initially, and not checking the sender of a reply is the one
that is completely and fundamentally broken. That doesn't preclude
that the other two are also issues (which we may or may not decide
need addressing right now - although I'm of the opinion that while
writing a document explaining the issues, explaining all three would
be worthwhile).  The most egregious of the vulnerabilities involve
having all three present.

We've known the from checking to be an issue for at least three years
(that's the first record I could easily find of discussing the
problem), but how widespread that problem is is news. Using
predictable ids and resources is well known.

(There's an additional point to be made about checking the from of
roster pushes, although I believe this to be a less widespread
problem)

> One of the reasons why clients don't check the sender part seems to be that
> it wasn't clear what the sender of a reply is, if the IQ query was without
> an explicit 'to' attribute.

I'd assert that the correct handling is clear, just that it seems to
go unnoticed for some reason - but why we're in the state of needing
to say something about this seems less important than what we now say.

> A simple rule for clients could be to check that the JID of IQ replies where
> the origin should be the connected server is either the JID of the server
> (no node, no resource) or the received bare JID (stripping a possible
> resource) is the bare JID of the client.

The rules here are clear. If a client sends a stanza without a 'to',
the server is to handle it as if it was sent to the bare JID of the
client's session. The server replying with the server JID is a bug.

/K