Re: [OAUTH-WG] [EXTERNAL] Re: OAuth Redirection Attacks

Nov Matake <matake@gmail.com> Sat, 18 December 2021 02:18 UTC

Return-Path: <matake@gmail.com>
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 216853A1038 for <oauth@ietfa.amsl.com>; Fri, 17 Dec 2021 18:18:09 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.096
X-Spam-Level:
X-Spam-Status: No, score=-2.096 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 rYFHqVGPDekV for <oauth@ietfa.amsl.com>; Fri, 17 Dec 2021 18:18:04 -0800 (PST)
Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1EF0F3A1033 for <oauth@ietf.org>; Fri, 17 Dec 2021 18:18:04 -0800 (PST)
Received: by mail-pl1-x634.google.com with SMTP id q17so3328528plr.11 for <oauth@ietf.org>; Fri, 17 Dec 2021 18:18:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=GhaZ8RtZRFn9HRiGW1pzwNd+Dy2Ha8YcxkcAF/YcPeY=; b=ZOpXfccQVq3Olfjsj2n9cFTSwRIZRxJm9CqSCnsIpTHZ4tw1mE/k5UqGeocfD4iESG VD0XPxQbISNucM2PJkxnTRacRTQjwB1EdoXzEw9m2ll2kHrDxK/7Psz4GLpPbXZQT/bK xiJSCiRwz7EgmzBHtk1RcLpLIbM3FocZkr4QpQecxyJa5T4ExPBmYCB9RrC7kLkRnAsT 1QJQMJxuj52BnPu54rIKEtfVJ3vWxdrntU1afYDbMulVDzN5enlDrAPIBOMyY/wpZItr YP5mKfoKFxQPwFFO63EnVgBj5qmzffjXF/aMpikY7Mo4qLXTIt095/ISPgXXtFgqWDOH 5Uag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=GhaZ8RtZRFn9HRiGW1pzwNd+Dy2Ha8YcxkcAF/YcPeY=; b=YN2M/BNijIfTizcMlnfdoHr68C5HiMDCTOTX0Y806WwGvtyGM5FAmFhhEnPt2uRByb aW12scroB+H2supm82fQ0ap6vjbh5waKeHPKALqEQkPncki8hzQJCNhPPTtbXatRuewF B1z7ASHrSBO6uagBS749P5IPpHddoF+t1DIwy2eeiGgeoJoia8vjOdyu7SpCCoBDdl62 LONkerhbl5uLxP+t2IXv/vEEFs3a2ci3DDdt9KN9Uz/XHuGG+94z7cFmzZiiWAuHdjUa T86DS5aeSVgMZmVUFaTxdJszUT0aS3ozW+h6MBFavpKAVUd67xuTJApvPt7k1RE6navB aJRQ==
X-Gm-Message-State: AOAM530MBowcmjdioTsnezH1QM76OE5qGFHLq+hl2it0XuktlYC9DP0j 5GdLNUdMT/fuuFo2KTgLyikG39Ta0oY=
X-Google-Smtp-Source: ABdhPJwFk2y5oyCMt4mYIlJCXYIJhotlvRM+Xg5kp2b7yqlaIbCXBml7Vyv5/+CLA2bmaELyPxuIPg==
X-Received: by 2002:a17:902:6b8c:b0:148:8a86:a01c with SMTP id p12-20020a1709026b8c00b001488a86a01cmr6069663plk.50.1639793882531; Fri, 17 Dec 2021 18:18:02 -0800 (PST)
Received: from smtpclient.apple (om126254235052.33.openmobile.ne.jp. [126.254.235.52]) by smtp.gmail.com with ESMTPSA id c81sm10454565pfb.166.2021.12.17.18.18.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Dec 2021 18:18:01 -0800 (PST)
Content-Type: multipart/alternative; boundary=Apple-Mail-E1F26585-D8EB-4C88-8DFF-1A41695D7C07
Content-Transfer-Encoding: 7bit
From: Nov Matake <matake@gmail.com>
Mime-Version: 1.0 (1.0)
Date: Sat, 18 Dec 2021 11:18:00 +0900
Message-Id: <3B0BD22B-5837-4776-BD1A-F2A27D07686B@gmail.com>
References: <CA+k3eCS2jNEj4nePQ4kzsvERGnTAw_kimkym1v=a=xFQJG78NA@mail.gmail.com>
Cc: Hans Zandbelt <hans.zandbelt@zmartzone.eu>, oauth <oauth@ietf.org>
In-Reply-To: <CA+k3eCS2jNEj4nePQ4kzsvERGnTAw_kimkym1v=a=xFQJG78NA@mail.gmail.com>
To: Brian Campbell <bcampbell=40pingidentity.com@dmarc.ietf.org>
X-Mailer: iPhone Mail (19C57)
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/Zu_HuTdHnXgTM6lD68B8pALLSSU>
Subject: Re: [OAUTH-WG] [EXTERNAL] Re: OAuth Redirection Attacks
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
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: <https://mailarchive.ietf.org/arch/browse/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, 18 Dec 2021 02:18:09 -0000

Phishing filters can simply handle all OAuth AuthZ request like URLs in emails malicious.

> 2021/12/18 6:45、Brian Campbell <bcampbell=40pingidentity.com@dmarc.ietf.org>のメールt;のメール:
> 
> 
> Yeah, I think it has been discussed before. And if I'm understanding correctly, it is unfortunately a tricky area. It sounds like more or less the same thing as "Abuse: The Authorization Server As Open Redirector" described in the dormant WG draft, which is ultimately predicated on a client being registered with a malicious redirect URI. The twist in that Proofpoint article seems to be using it to evade detection by products/services that scan email for phishing links. 
> 
> The "obvious" answer would be to prevent malicious client registration in the first place. But that's not tenable in many, many situations. Providing some more guidance about the importance of being as prudent as possible there couldn't hurt though.  
> 
> A couple other things that could be considered (acknowledging that the details of providing guidance that might impact protocol is very tricky):
> 
> Require the redirect_uir parameter on the authorization request in all cases (even when only one is registered for a given client). This would make it so the malicious URL couldn't be entirely hidden from the email filters.
> 
> Relax how aggressively OAuth demands that the AS automatically redirect in error conditions. And either respond with a 400 directly (which just stops things at that point) or provide a meaningful interstitial page to the user before redirecting them (which at least helps users see something is amiss). I do think OAuth is a bit overzealous in automatically returning the user's browser context to the client in error conditions. There are some situations (like prompt=none) that rely on the behavior but in most cases it isn't necessary or helpful and can be problematic. 
> 
> On Fri, Dec 17, 2021 at 1:59 PM Hans Zandbelt <hans.zandbelt@zmartzone.eu> wrote:
>> AFAIK this topic has been discussed before, e.g.:
>> https://mailarchive.ietf.org/arch/msg/oauth/gIuIrxeXudRBg8L6RYGDElxrc4s/
>> 
>> Hans.
>> 
>> On Fri, Dec 17, 2021 at 9:44 PM Pieter Kasselman <pieter.kasselman=40microsoft.com@dmarc.ietf.org> wrote:
>>> The problem isn’t invalid URLs but malicious ones. Given a choice between a sub-optimal user experience and a phished end-user, perhaps an option that allows the authorization server to handle the error, rather than redirecting can serve end-users better. But as Vittorio points, out, there are probably other options as well to consider. URL reputation services is another option, but problematic since they are imperfect and I expect hard to standardise to a point that creates a common minimum level of assurance (similar to any fraud calculation or risk score).
>>> 
>>>  
>>> 
>>> From: Warren Parad <wparad=40rhosys.ch@dmarc.ietf.org> 
>>> Sent: Friday 17 December 2021 20:27
>>> To: Pieter Kasselman <pieter.kasselman@microsoft.com>
>>> Cc: Vittorio Bertocci <Vittorio@auth0.com>om>; oauth <oauth@ietf.org>
>>> Subject: Re: [EXTERNAL] Re: [OAUTH-WG] OAuth Redirection Attacks
>>> 
>>>  
>>> 
>>> You want to redirect on some errors because the last thing an AS wants is to leave the user in the AS because the user can't do anything there and the AS can't do anything either. It's just bad UX. But if the redirect url isn't valid, this is absolutely the time that the AS should keep the user there for user's protection.  Any AS redirecting the user to an invalid redirect url, isn't doing the right thing.
>>> 
>>>  
>>> 
>>> But that only solves the illegitimate phishing urls, it doesn't solve the class of problem where a phishing application is legitimately registered.
>>> 
>>> 
>>> 
>>> 
>>> Warren Parad
>>> Founder, CTO
>>> Secure your user data with IAM authorization as a service. Implement Authress.
>>> 
>>>  
>>> 
>>>  
>>> 
>>> On Fri, Dec 17, 2021 at 9:23 PM Pieter Kasselman <pieter.kasselman=40microsoft.com@dmarc.ietf.org> wrote:
>>> 
>>> Agreed that the attackers goal is to bypass phishing filters and they found a way to achieve this by using an IdP that adheres to the standards. I don’t have the context for the design choice to redirect on an error condition, but am curious why the IdP should not be allowed to handle the error condition, rather than redirect (or at least have the option to do so)?
>>> 
>>>  
>>> 
>>> From: OAuth <oauth-bounces@ietf.org> On Behalf Of Vittorio Bertocci
>>> Sent: Friday 17 December 2021 19:55
>>> To: Warren Parad <wparad=40rhosys.ch@dmarc.ietf.org>
>>> Cc: oauth <oauth@ietf.org>
>>> Subject: [EXTERNAL] Re: [OAUTH-WG] OAuth Redirection Attacks
>>> 
>>>  
>>> 
>>> The attack doesn't rely on redirecting to unregistered URLs, that's the problem.
>>> 
>>> The goal of the attack is to circumvent phishing filters, by presenting a URL from a legitimate domain (the AS) that eventually redirects to the actual phishing URL. The actual phishing page doesn't need to target the same authorization server, or an authorization server at all for that matter. 
>>> 
>>> An attacker can register a legitimate app on any authorization server as a service, on their own tenant. The goal is just to have a starting URL that phishing filters won't block, and the attacker is in full control of the redirect URIs they register in their own tenant. 
>>> 
>>>  
>>> 
>>> My take: it might be tricky to change the redirect on error behavior at this point, but we should at least note the issue in the security considerations/BCPs and possibly give some advice. For example, on top of my head: AS should expose their endpoints on a domain dedicated to OAuth/OIDC operations, and avoid using its top level domains (different area/service, but think herokuapp.com vs heroku.com) so that if a phishing filter decides to block direct links to the issuing endpoints will only impact things like IdP initiated flows (solvable by adding jumpstart endpoints on the RP anyway, just like IdP initiated sign in works in OIDC). I am sure there are lots of other things we can come up with that can make the problem better.
>>> 
>>>  
>>> 
>>> On Fri, Dec 17, 2021 at 5:00 AM Warren Parad <wparad=40rhosys.ch@dmarc.ietf.org> wrote:
>>> 
>>> I think this just falls into the category of never redirect the user to a url that doesn't match one of the preregistered redirect urls (or logout urls for that matter). Any application that has redirects anywhere provides an opportunity for this attack vector, OAuth isn't unique in that way, it just is consistent and documented. And the 2.1 draft is pretty clear on this front:
>>> 
>>>  
>>> 
>>> https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-04#section-4.1.2.1
>>> 
>>>    If the request fails due to a missing, invalid, or mismatching
>>>    redirect URI, or if the client identifier is missing or invalid, the
>>>    authorization server SHOULD inform the resource owner of the error
>>>    and MUST NOT automatically redirect the user agent to the invalid
>>>    redirect URI.
>>> 
>>>  
>>> 
>>> I want to call this attack vector "illegitimate phishing applications" which is easily blocked by preregistration and/or PARs. And is only a very small subset of phishing attacks with OAuth, of which the larger group is "legitimate phishing applications". An app can be registered correctly, and still issue a phishing attack as phishing attacks through OAuth are actually indistinguishable from standard user delegation. There is no way to prevent these without an application review before registration is completed, here's an example that cloned Google apps y creating a fake app called google defender: https://www.trendmicro.com/en_us/research/17/d/pawn-storm-abuses-open-authentication-advanced-social-engineering-attacks.html
>>> 
>>>  
>>> 
>>> If we can't protect against these latter ones, I hardly think protecting against the former is useful/interesting/valuable.
>>> 
>>> 
>>> 
>>> 
>>> Warren Parad
>>> Founder, CTO
>>> Secure your user data with IAM authorization as a service. Implement Authress.
>>> 
>>>  
>>> 
>>>  
>>> 
>>> On Thu, Dec 16, 2021 at 9:05 PM Rifaat Shekh-Yusef <rifaat.s.ietf@gmail.com> wrote:
>>> 
>>> All,
>>>  
>>> An article was recently published discussing some OAuth Redirection Attacks to try to bypass phishing detection solutions. See the details of these attacks in the following link:
>>>  
>>> https://www.proofpoint.com/us/blog/cloud-security/microsoft-and-github-oauth-implementation-vulnerabilities-lead-redirection
>>>  
>>> 
>>>  
>>> The article discusses attacks on Microsoft and GitHub, but these attacks are not unique to these companies.
>>> The attacks take advantage of how OAuth handles error responses, which sends responses to the application’s redirect URL.
>>>  
>>> 
>>> I would like to get the thoughts of the working group on these types of attacks. 
>>> What is the best way to mitigate these attacks?
>>> Do we need a new approach for handling errors with OAuth?
>>>  
>>> 
>>> Regards,
>>>  Rifaat
>>>  
>>> 
>>> _______________________________________________
>>> OAuth mailing list
>>> OAuth@ietf.org
>>> https://www.ietf.org/mailman/listinfo/oauth
>>> 
>>> _______________________________________________
>>> OAuth mailing list
>>> OAuth@ietf.org
>>> https://www.ietf.org/mailman/listinfo/oauth
>>> 
>>> _______________________________________________
>>> OAuth mailing list
>>> OAuth@ietf.org
>>> https://www.ietf.org/mailman/listinfo/oauth
>> 
>> 
>> -- 
>> hans.zandbelt@zmartzone.eu
>> ZmartZone IAM - www.zmartzone.eu
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
> 
> CONFIDENTIALITY NOTICE: This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by e-mail and delete the message and any file attachments from your computer. Thank you._______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth