Re: [secdir] Secdir last call review of draft-ietf-jmap-core-12

Tero Kivinen <kivinen@iki.fi> Tue, 08 January 2019 14:28 UTC

Return-Path: <kivinen@iki.fi>
X-Original-To: secdir@ietfa.amsl.com
Delivered-To: secdir@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 50DCC1200B3; Tue, 8 Jan 2019 06:28:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.42
X-Spam-Level:
X-Spam-Status: No, score=-3.42 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_NEUTRAL=0.779, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=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 0qSKSJhTOo7i; Tue, 8 Jan 2019 06:28:14 -0800 (PST)
Received: from mail.kivinen.iki.fi (fireball.acr.fi [83.145.195.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E08F91200D7; Tue, 8 Jan 2019 06:28:13 -0800 (PST)
Received: from fireball.acr.fi (localhost [127.0.0.1]) by mail.kivinen.iki.fi (8.15.2/8.15.2) with ESMTPS id x08ES5gQ020863 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 8 Jan 2019 16:28:05 +0200 (EET)
Received: (from kivinen@localhost) by fireball.acr.fi (8.15.2/8.14.8/Submit) id x08ES5QJ022217; Tue, 8 Jan 2019 16:28:05 +0200 (EET)
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Message-ID: <23604.45941.279266.464196@fireball.acr.fi>
Date: Tue, 08 Jan 2019 16:28:05 +0200
From: Tero Kivinen <kivinen@iki.fi>
To: Neil Jenkins <neilj@fastmailteam.com>
Cc: secdir@ietf.org, Bron Gondwana <brong@fastmailteam.com>, IETF JMAP Mailing List <jmap@ietf.org>, draft-ietf-jmap-core.all@ietf.org, ietf@ietf.org
In-Reply-To: <ff2e51f3-67f7-48a5-955f-5af656872161@beta.fastmail.com>
References: <154651703823.29557.748556981627156046@ietfa.amsl.com> <cac325d4-e3fd-4dc1-8173-c52192a9ed5e@www.fastmail.com> <7beebd38-7999-4a49-b892-c3c75b36eab4@beta.fastmail.com> <23603.20862.976183.378013@fireball.acr.fi> <ff2e51f3-67f7-48a5-955f-5af656872161@beta.fastmail.com>
X-Mailer: VM 8.2.0b under 25.1.1 (x86_64--netbsd)
X-Edit-Time: 183 min
X-Total-Time: 45 min
Archived-At: <https://mailarchive.ietf.org/arch/msg/secdir/EOGWhI1HaWRtNrnePJp2mqpOA0g>
Subject: Re: [secdir] Secdir last call review of draft-ietf-jmap-core-12
X-BeenThere: secdir@ietf.org
X-Mailman-Version: 2.1.29
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: <https://mailarchive.ietf.org/arch/browse/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: Tue, 08 Jan 2019 14:28:18 -0000

Neil Jenkins writes:
> On Tue, 8 Jan 2019, at 12:17 AM, Tero Kivinen wrote:
> 
>     Actually I think adding confirmation step will make the push
>     notifications more reliable, as that will give you positive feedback
>     that your push notifications do work.
> 
> The issue is that push services (e.g. Apple's APNS and Google's FCM) do not
> guarantee that any particular push will be received. They normally will, but
> may not, especially if the device goes offline for a while. So if your first
> push doesn't make it through your push never works. It's likely to be rare, but
> painful when it happens and makes it feel unreliable.

When you are subscribing the push notifications your devices should be
running and not offline. Note, that you do not need reconfirmation if
you extended the time, but only when new URL is given. If client gives
url, it should make sure it can actually receive those notifications
in the given url for few seconds... 

>     It is really annoying trying to debug which firewall / proxy / encryption
>     is causing the notification to be blocked, if I need to reregister again
>     for every time and need to then somehow still cause one push notification
>     to be sent before I can see does it work. 
> 
> I'm not sure what you're referring to here. Do you mean the JMAP (application)
> server connecting to the push server? Or the push server connecting to the
> client (which is not part of JMAP at all, but where you're more likely to run
> into issues with corporate firewalls and the like)?

Perhaps my understanding of the jmap push service is then wrong, or
perhaps it is badly defined in JMAP. 

>     My understanding is that RFC8030 does not connect random urls,
> 
> My understanding is that is incorrect. There are three entities involved in an
> 8030 push system, and JMAP is only involved with two of them:
> 
>   * The client, which wants to receive the push notifications (the JMAP client)
>   * The application server which contains the data and wants to send the push
>     notifications (the JMAP server) 
>   * The push server (3rd party, depends on the device what is possible)

But client and application server protocol is not defined in RFC8030.
It is left outside the scope of that document. RFC8030 seems to only
document interaction between the client and push service, and
interaction between application and push service.

The URL returned from the push service is somehow magically given to
the application server and whatever verification happens there is not
covered. 

> The situation of the client/application server being one entity and the push
> server being a completely unrelated entity is what 8030 is designed for. For
> example, each browser implements the Push API, whereby if you have a web app
> you can ask the browser for a push subscription endpoint, then send it to your
> application server to connect to. The application server does not know in
> advance which browser the user has or what domains that browser currently uses
> for push subscriptions. It simply gets given an arbitrary URL to post to.

Looking at the text in jmap. It says in section 7.2:

   A push subscription is a message delivery context established between
   the client and a push service.

Push service is not defined in this document, and it does not refer to
RFC8030 for that term. My understanding was that push worked as
follows:

Client does PushSubscription as defined in 7.2 to JMAP server:

   Clients may create a push subscription on the JMAP server, which will
   then make a POST request to the associated push endpoint whenever an
   event occurs.

This push subscription includes an url and when something happens the
JMAP server will connect to that url and send some random garbage
(from the receiver point of view if it does not assume receiveing push
notications) to it using POST. If the receiver end is proper push
service then it will notify the client using some other means.

I.e., when email etc is received the JMAP server will then push
StateChange object (section 7.1):

   When something changes on the server, the server pushes a
   *StateChange* object to the client.

Actually that says "to the client" not to the "push service". Which
one should it be? I always assumed this StateChange object is sent to
the url given in the PushSubscription.

Hmm... and 7.2 then also uses term "push endpoint" which is not
defined anywhere? Is that the same as push service at given url or
something else:

   Clients may create a push subscription on the JMAP server, which will
   then make a POST request to the associated push endpoint whenever an
   event occurs.

Then section 7.2 seems to also describe things not related to the
PushSubscription but instead to the notifications sent by the JMAP
server. Perhaps it would be better to move that to the StateChange
object section, i.e., put all things related to the "push service" in
same place. Now it is split in two places, i.e., StateChange is
defined in section 7.1, but how to transmit that inside https POST
with content type of application/json is described in 7.2.

Also it is not clear which server this is talking about:

							The server
   is expected to understand and handle HTTP status responses in a
   reasonable manner.

Is it push service server, JMAP server, Application server (same as
JMAP server in this case?). My guess it is supposed to be JMAP server
which is actually acting as http-client and making https request to
push service, and if push service returns http errors JMAP server
acting as http-client will process those in reasonable manner. Is that
understaning correct? Perhaps rewording it a bit to make it clear.

Then I have no idea what this text is trying to say:

   The use of this push endpoint conforms with the use of a push
   endpoint by an Application Server as defined in [RFC8030].

what push endpoint? JMAP server? URL given by the client to JMAP
server? 

> JMAP is not defining anything new here. It is just defining the application
> server portion exactly as expected by RFC8030.
> 
>     the push notifications are received by client doing GET request to the
>     subscription server and then later server using server push to that
>     connection or something like that (in section 6 of the RFC8030).
>     Usually that is only way things can work, as most of the people are
>     behind firewalls / NATs / Proxies etc, thus connecting to them from
>     outside is impossible or hard.
> 
> Yes, this is how the client receives the data from the push server in RFC8030.
> This is entirely orthogonal to what we are discussing though.
> 
>     The interaction between UA and the Application server is using
>     "an application-specific method" …
>     The verification would be inside this application-specific method,
>     thus it is not covered in the 8030 because of that.
> 
> Hmm, yes I see your point, although it seems odd for it not to mention at all
> given this is going to apply to pretty much every app that uses this system;
> not specifically JMAP.

Most likely it is not describied in the RFC8030 because the details
depends on the application server. 

>     but if server just answers HTTP ok 200 back, and JMAP server will be
>     happy to keep sending notifications.
> 
> Yes, this is indeed a risk, and I agree that a confirmation step
> would be the only way to mitigate this.

I would expect it to be very easy to find urls in host that will
return success to http posts with application/json and ignore
contents.

> 
>     Attacker can also do 10000 subscriptions to same victim (perhaps using
>     different URLs, but destioned to same victim). It can do this
>     overnight, and then on the morning when someone triggers event the
>     victim will suddenly receive 10000 event notifications
>     (https-connections) from the well connected JMAP server farm, and will
>     be completely swamped before it can even respond to any errors to
>     those notifications.
> 
> I would expect the JMAP server to rate limit the number of push
> subscriptions any one user may have to something considerably lower
> than that.

There is text saying frequency of pushes to be rate limited, but there
is no limit for number of subscriptions account can have, or even
suggestion that there should be limit.

This kind of attacks can also use multiple accounts especially if
there is some kind of public services available. 

> If the attacker had compromised many accounts on the JMAP
> server though, it could set up push subscriptions with each of them
> but then it would have to coordinate making a change in each of
> those accounts at the same time in order to flood the target server
> with a large single burst of requests, which is a much harder thing
> to do.

As people pointed out we have imap server providing access to ietf
mailing lists. There is lots of people on those lists, and even if we
require datatracker account to be able to make subscriptions, making
those accounts require just email address and ability to receive
emails. Most likely datatracker allows creating accounts for:

example+1@gmail.com
example+2@gmail.com
example+3@gmail.com
...
example+99999@gmail.com

and then making subscription for all of those accounts to all ietf
mailing lists and sending notifications to same url x...

Verification step would disable that attack vector too. 

> Summing up, I think that adding a confirmation step removes a small
> risk of being able to use a JMAP application server as a DDOS
> vector, but adds a small risk of the push not being received and the
> push system failing to establish.

Actually I think it will make push system much more reliable, as it
immediately verifies that the system is working, and you will not have
silent failure, where you just notice few days later that I have not
received any notifications, something must be broken.

> (Although, the client would at least know this was the case so could
> alert the user and give them the option to try again.) Would anyone
> else like to weigh in on the relative merits of the options here to
> help come to a consensus on the way forward? I would be particularly
> interested to hear if this was discussed at all, and any conclusions
> reached, in the development of RFC8030.
-- 
kivinen@iki.fi