Re: [OAUTH-WG] Report an authentication issue

nov matake <nov@matake.jp> Sat, 16 June 2012 03:22 UTC

Return-Path: <nov@matake.jp>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 50CB511E8116 for <oauth@ietfa.amsl.com>; Fri, 15 Jun 2012 20:22:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.598
X-Spam-Level:
X-Spam-Status: No, score=-3.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1cBk07pk51e4 for <oauth@ietfa.amsl.com>; Fri, 15 Jun 2012 20:22:25 -0700 (PDT)
Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by ietfa.amsl.com (Postfix) with ESMTP id B8C2F11E8114 for <oauth@ietf.org>; Fri, 15 Jun 2012 20:22:25 -0700 (PDT)
Received: by pbcwy7 with SMTP id wy7so6049453pbc.31 for <oauth@ietf.org>; Fri, 15 Jun 2012 20:22:25 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer:x-gm-message-state; bh=evDPvvKNQELXLHgVBScO9Yg0VKfdU0QfGdGa608weo8=; b=dFTGEoltDUyycTFZcSw0dGRWZwLPkP+I7SYEaY6TRjDLI7dPsIKY3g7hTS6kLT/dcC ZvaJu9gUs33FrXqrW799OqMBWH05+H/KhvKHGIaKt6KLbSMkySts0AIJYWFiUbYdiX1t pn2th7YU2xWWVCQ1+NPhMHD910cS6m4phDt4vMLvDvS8vGC7P2OdOApmFOC9wWwODMkU Z9q1VPfF1u8X0M3fkvK86y8dyEvHCjm/3jfm+RBcjkUVRZ2n6sU+I1HEgbZNS6Phvi63 vUqD+wXvA8wj1q3bZ94wdE+WcHLU0qnNSm0gAhPGDm/qFKBmIp8DVLwGeLyUTCHfE/m4 Ef6A==
Received: by 10.68.222.197 with SMTP id qo5mr15971204pbc.72.1339816944453; Fri, 15 Jun 2012 20:22:24 -0700 (PDT)
Received: from [192.168.1.4] (y241176.dynamic.ppp.asahi-net.or.jp. [118.243.241.176]) by mx.google.com with ESMTPS id ku7sm15351198pbc.31.2012.06.15.20.22.22 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 20:22:23 -0700 (PDT)
Mime-Version: 1.0 (Apple Message framework v1278)
Content-Type: multipart/alternative; boundary="Apple-Mail=_2DD1D5E5-5E44-4BDC-B879-19556A590246"
From: nov matake <nov@matake.jp>
In-Reply-To: <CABzCy2APCsGU9N00K4XYoa4Scxno51b_E=8MKD9MzZk6zxtc1Q@mail.gmail.com>
Date: Sat, 16 Jun 2012 12:22:23 +0900
Message-Id: <BDF3CDE9-B411-4366-9C5F-C3EA17938C21@matake.jp>
References: <CAEEmcpEcNqNHwfVozD-NtfkruiB-v0MTszwNL4cob2rL=QQTSA@mail.gmail.com> <CABzCy2BZLff7EZoWaU+vmCWCgXUSSxn3x-evm-FwzKdnx7QeMA@mail.gmail.com> <1339792496.52712.YahooMailNeo@web125501.mail.ne1.yahoo.com> <CABzCy2APCsGU9N00K4XYoa4Scxno51b_E=8MKD9MzZk6zxtc1Q@mail.gmail.com>
To: Nat Sakimura <sakimura@gmail.com>
X-Mailer: Apple Mail (2.1278)
X-Gm-Message-State: ALoCoQkZTbMQmwjQ6YOwzrtso5FsZONn45Uk7j536NqFd8XKrKoocg2G1m2X+MYIfPjCyCAnQmuj
Cc: "Shuo Chen (MSR)" <shuochen@microsoft.com>, Yuchen Zhou <t-yuzhou@microsoft.com>, oauth <oauth@ietf.org>
Subject: Re: [OAUTH-WG] Report an authentication issue
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/oauth>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 16 Jun 2012 03:22:27 -0000

There are 4 ways to fix this issue.

1. Use response_type=token%20code (It's not in OAuth 2.0 Core, but seems best way for interoperability)
2. Use singed_request (or some signed token like JWT)
3. Use grant_type=fb_exchange_token (Facebook custom way)
4. Access to https://graph.facebook.com/app?access_token=YOUR_TOKEN (Facebook custom way, moreover undocumented API)

Two iPhone app developers I reported this issue fixed it by using (4).

I also tried to use (1) for my own iPhone app implementation, but unfortunately it doesn't work when using authorization codes obtained via FB iOS SDK.
So I'm using (3) in my case.

nov

On 2012/06/16, at 9:16, Nat Sakimura wrote:

> As to how the fix was done, Nov can provide more detail, but ... 
> 
> 1. Properly verify the signature/HMAC of the "signed_request". This will essentially audience restricts the token. 
> 2. There is an undocumented API for Facebook which returns to whom the token was issued. This also audience restricts the token. 
> 
> The service that fixed took these measures. Note that none of the above is defined in OAuth. 
> The same facility was called "id_token" and "check ID endpoint" for OpenID Connect. 
> 
> The scale of the impact is large, too large to disclose the actual names in the public list, though, eventually, we would publish them in a paper. 
> 
> Nat
> 
> On Sat, Jun 16, 2012 at 5:34 AM, Francisco Corella <fcorella@pomcor.com> wrote:
> Hi Nat and Rui,
> 
> Rui, you say that the vulnerability that you found was due to a
> "common misunderstanding among developers", but the attack you
> describe can be carried out against any app that uses the OAuth
> "implicit grant flow", which Facebook calls "client-side
> authentication".  No misunderstanding seems necessary.  What
> misunderstanding are you referring to?  I followed the link in your
> message to the Sophos post, and from there the link to the article in
> The Register.  The article in The Register says that Facebook had
> "fixed the vulnerability promptly".  How did they fix it?  The
> instructions that Facebook provides for implementing "Client-side
> authentication without the JS SDK" at
> https://developers.facebook.com/docs/authentication/client-side/#no-jssdk
> still allows the attack.
> 
> Nat, I agree that the blog post by John Bradley that you link to
> refers to the same vulnerability reported by Rui.  You say that some
> apps have issued a patch to fix it.  Could you explain what the fix
> was?
> 
> Francisco
> 
> From: Nat Sakimura <sakimura@gmail.com>
> To: rui wang <ruiwangwarm@gmail.com> 
> Cc: matake nov <nov@matake.jp>; Yuchen Zhou <t-yuzhou@microsoft.com>; oauth <oauth@ietf.org>; Shuo Chen (MSR) <shuochen@microsoft.com> 
> Sent: Thursday, June 14, 2012 1:50 PM
> Subject: Re: [OAUTH-WG] Report an authentication issue
> 
> This is a fairly well known (hopefully by now) issue. We, at the OpenID Foundation, call it "access_token phishing" attack these days. See: http://www.thread-safe.com/2012/01/problem-with-oauth-for-authentication.html
> 
> Nov Matake has actually built the code on iPhone to verify the problem, and has notified bunch of parties back in February including Facebook and Apple. We have the code that actually runs on a phone, and we have successfully logged in to bunch of apps, including very well known ones. They were all informed of the issue. Some immediately issued a patch to fix it while others have not.  
> 
> The problem is that even if these apps gets fixed, the problem does not go away. As long as the attacker has the vulnerable version of the app, he still can impersonate the victim. To stop it, the server side has to completely disable the older version, which means the service has to cut off many users pausing business problems. 
> 
> Nat
> 
> On Fri, Jun 15, 2012 at 2:18 AM, rui wang <ruiwangwarm@gmail.com> wrote:
> Dear Facebook Security Team and OAuth Standard group,
> We are a research team in Microsoft Research. In January, 2011, we reported a vulnerability in Facebook Connect which allowed everyone to sign into Facebook-secured relying parties without password. It was promptly fixed after reporting. (http://nakedsecurity.sophos.com/2011/02/02/facebook-flaw-websites-steal-personal-data/)
> Recently, we found a common misunderstanding among developers of mobile/metro apps when using OAuth (including Facebook’s OAuth) for authentication. The vulnerability resulted from this misunderstanding also allows an attacker to log into a victim user's account without password.
> Let's take Soluto's metro app as an example to describe the problem. The app supports Facebook Login. As an attacker, we can write a regular Facebook app. Once the victim user allows our app to access her Facebook data, we receive an access_token from the traffic. Then, on our own machine (i.e., the "attacker" machine), we run the metro app of Soluto, and use a HTTP proxy to insert the victim's access_token into the traffic of Facebook login. Through this way, we are able to log into the victim's Soluto account from our machine. Other than Soluto, we also have confirmed the same issue on another Windows 8 metro-app Givit.
> The Facebook SDK for Android apps (https://developers.facebook.com/docs/mobile/android/build/#sdk) seems to have the possibility to mislead developers too. At least, the issue that we found is not clearly mentioned. In the SDK, we ran the sample code called "Hackbook" using Android Emulator (imagine it is an attacker device). Note that we have already received the access token of the victim user from our regular Facebook app. We then inject the token to the traffic of Hackbook. Through this way, Hackbook app on our own machine recognizes us as the victim. Note that this is not a convincing security exploit yet, because this sample code does not include the server-side code. However, given that we have seen real server-side code having this problem, such as Soluto, Givit and others, we do believe that the sample code can mislead mobile/metro developers. We also suspect that this may be a general issue of many OAuth implementations on mobile platforms, so we send this message to OAuth Standard group as well.
> We have contacted the vendors of the two vulnerable metro-apps, Soluto and Gavit.
> Please kindly give us an ack when you receive this message. If you want to know more details, please let us know.
> Best Regards,
> Yuchen Zhou, Rui Wang, and Shuo Chen
> 
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth
> 
> 
> 
> 
> -- 
> Nat Sakimura (=nat)
> Chairman, OpenID Foundation
> http://nat.sakimura.org/
> @_nat_en
> 
> 
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth
> 
> 
> 
> 
> 
> -- 
> Nat Sakimura (=nat)
> Chairman, OpenID Foundation
> http://nat.sakimura.org/
> @_nat_en
> 
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth