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

Will Bartlett <wibartle@microsoft.com> Tue, 21 December 2021 18:20 UTC

Return-Path: <wibartle@microsoft.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 6D4D73A11EF for <oauth@ietfa.amsl.com>; Tue, 21 Dec 2021 10:20:56 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.8
X-Spam-Level:
X-Spam-Status: No, score=-2.8 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.701, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=microsoft.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 k1F-1S5AKhhh for <oauth@ietfa.amsl.com>; Tue, 21 Dec 2021 10:20:51 -0800 (PST)
Received: from na01-obe.outbound.protection.outlook.com (mail-cusazon11020018.outbound.protection.outlook.com [52.101.61.18]) (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 8C4083A11ED for <oauth@ietf.org>; Tue, 21 Dec 2021 10:20:49 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5MjdWAm1jOyMaWMaZt2PcZB5gASdjfjaJCcmuWlhRjxxvLjv6UtIduQbuSsLB6AvHTZkkpeIBPn0WzTEReIencwtT5ukcif+3Mqlmcg5Oh73eDp1EfT8b0YyWp1PcEA7MWRzA87NhGhfukeCrwyS/9ZqT4Chg4++rdTXti0pDcJOXFjzpiyzGlIQjuVg2W0W7i7KwCKFiULqM2WSDNe6z1NGR1YfXjMva09Bsvdmzw1AScP39HUFEId1lVuHZaO7+VjP3+sufzWqmd+rz3h7KiFgtO+qjz1VGHNp+QWB/ppasib4bQt+xBZd7g00WCLqCceevWX7eQnIwUHN5AT5A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Xw7kqn6CCZBhk0UMMJZLmGV8IwBquW2Q8jrnAl1MIu4=; b=iyn5N5qHeeVeddjuZ0NoEgqE5Yag8+g2sqvDZ/E62hw/Vm1I9zCqrtmAWuEyJvu5t+4nNrx+vRFUGztP5ked6d9Cp6WJyY4pCBSWu4+Xh/sYaMFp/LK17YyfgHWJ2rQ7A6OizNFE8F33BPNXbPdTkYuXx1uALRG7zS9G+58dKvH+pGwouFaoa2PvyEYtEUFsXl6g96TchlUKpqX5Jeem2B06EktJt0fGUrIlwpgwJMDR+V76xW3mGiFr23Gx3cU7Yd25AfkYTrL58mQqLuBHMV/Z9IYeEhAL3DeyHmYlcDI6CA9MtP21cVF8Hs7+7WkrdnmkXSxlFI+FHs4N1DQkug==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xw7kqn6CCZBhk0UMMJZLmGV8IwBquW2Q8jrnAl1MIu4=; b=Fc0rvsB9Ttesu2z5ZZw7HHPWZrxiuEG9zDgQMdPlCKsDbn/nbWrPMI59/TetePbsLUiYNdy3Wnjh6wKleLFiUP+tpAyQqnaeSaKlxQKNsH0HB2GSsv2zqqYnbaSrGVM8QOnMlf+Kk7sHrynhJxeBJQGmfqSSHhIGKwWxvg1QRd0=
Received: from SA1PR00MB1309.namprd00.prod.outlook.com (2603:10b6:806:1fc::6) by PH0PR00MB1184.namprd00.prod.outlook.com (2603:10b6:510:9e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4861.0; Tue, 21 Dec 2021 18:20:45 +0000
Received: from SA1PR00MB1309.namprd00.prod.outlook.com ([fe80::c957:182f:12af:c9b9]) by SA1PR00MB1309.namprd00.prod.outlook.com ([fe80::c957:182f:12af:c9b9%7]) with mapi id 15.20.4861.000; Tue, 21 Dec 2021 18:20:45 +0000
From: Will Bartlett <wibartle@microsoft.com>
To: Brian Campbell <bcampbell=40pingidentity.com@dmarc.ietf.org>, Hans Zandbelt <hans.zandbelt@zmartzone.eu>
CC: oauth <oauth@ietf.org>
Thread-Topic: [OAUTH-WG] [EXTERNAL] Re: OAuth Redirection Attacks
Thread-Index: AQHX84kNQ3Xq9uE/o0OjPYc+AsXFGqw3N3CAgAYJnsA=
Date: Tue, 21 Dec 2021 18:20:45 +0000
Message-ID: <SA1PR00MB13098D93EAC81F74BBCE4888D37C9@SA1PR00MB1309.namprd00.prod.outlook.com>
References: <CADNypP_AJFBc+HzKfFZ8d0hk7BZc=fYTDLNP6MroHUg-=r7FvQ@mail.gmail.com> <CAJot-L2X+Ma5BnXJ6Ys3UPJgHc_WnYtU33ast-myT2PN6rU5OQ@mail.gmail.com> <CAO_FVe5fUgS+=FoB9fJN7V0ujG+tDSb_20CgU2ffcPO3kENC=w@mail.gmail.com> <AM7PR83MB04521F9B225816B5D4D1A8F891789@AM7PR83MB0452.EURPRD83.prod.outlook.com> <CAJot-L2jB63K9RVK8F8PFEtOSXjJk+Eg4iJxs9qm7jt7zq1nMw@mail.gmail.com> <AM7PR83MB0452B729482E04F9B333D37791789@AM7PR83MB0452.EURPRD83.prod.outlook.com> <CA+iA6ujXrAqm5bY-akQyB3seD7zhZg1K26AnViOE2cHGEAvEoA@mail.gmail.com> <CA+k3eCS2jNEj4nePQ4kzsvERGnTAw_kimkym1v=a=xFQJG78NA@mail.gmail.com>
In-Reply-To: <CA+k3eCS2jNEj4nePQ4kzsvERGnTAw_kimkym1v=a=xFQJG78NA@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-12-21T18:05:39Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=28821379-c25f-40e1-a2b5-2cda5e9b620d; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0
authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 25853fb3-d149-4822-cb9f-08d9c4ae9b49
x-ms-traffictypediagnostic: PH0PR00MB1184:EE_
x-ms-exchange-atpmessageproperties: SA|SL
x-microsoft-antispam-prvs: <PH0PR00MB11845C3619983B4DE35F1EDFD37C9@PH0PR00MB1184.namprd00.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:1728;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: BFbxYaRKRnFg0lwpsHfgp9s+TmA8IzjKd3O1bpWERW9KVU/3ou53Ac58oEh/gu0d8Sk6oWs+Y8GuCEPTKnJIrrLBteirVoqoKH1T74zEKhVoOiCuMc7e7X/d4cI1ogYLB9kveeKE4oMZDvJed1fAKl9Z7o7CgMgE2v/R1fvvXPFiGisQ5X+xzmmIZ7w5erloT/1NhuJkacW5fKabMJPI1XhnLBwHkqAoF8REoMb7mJ5agqsHb7VWnpYCbrRA8gq/4eM4F8kMng8q3CHN+xsP+YKJw0E0ZqAO8ObgRqLEP5p9DRsPWhLic5KXleJ9K1ZrzefbOsdOsJ00HzdVzvuBKD78QljaRec4+VYbF12JBUauwt8XNHFMBNS8sJmsfCvE1uxwWrnQJe9Sfz8yw09XMejDfUt3/TIsL4o3QaLvjACGf/4Tt9AVqYuqml2DVXdg9zlw5u9ad8igmBRPYXYPgNe8TfZPfKVNN1AbHUVg672iWuz39p0nWTBSopUqPEu6Nqap8b8A7ge6wFiUjr7Ol6+iNMJa2mB5QD14Ifi746REDoZbnnzHZxfRVLY6C5hpx8N871tt2H3LbRRveOwVf3jhVMMhaL3bMygUk1xueSOq1HfnKgLqSfIBay9HKgw3/qh4PmZ1p3ZqYCoFGUz53vIz2FaLmCzJ9L0/wIy1rcor35GKt1DlgdweN4eKoABoYj2185t5eqnepvAra6aL8RsqKtbsqiJGctyGl/PzKDahJsgVnTdBX9kLcJnSvi4l4rF0xjnT7urqOIj+HbdCCbHybdu8rt7oI+qbJz/1dFQRnjM8LDdnjDWidORegI2iYjsx0s3zwI8S1csWyKo1DvhSYkzfagAp39f/Avu1hETyJLpIxhp5Ls9vRMfd500U42CghsOAUMzXPM+fjp6k0A==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA1PR00MB1309.namprd00.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(30864003)(5660300002)(8936002)(26005)(52536014)(186003)(166002)(66476007)(66556008)(64756008)(66446008)(4326008)(33656002)(38070700005)(53546011)(8676002)(8990500004)(10290500003)(2906002)(6506007)(99936003)(7696005)(55016003)(316002)(71200400001)(110136005)(83380400001)(38100700002)(66946007)(122000001)(76116006)(86362001)(508600001)(82960400001)(66574015)(9686003)(966005)(82950400001)(91840200004)(20210929001); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?h3EVT+rg154n/TpttDyWGZvzNxLURz/u6p4S0TlXProKKowcXgthSup7DemP?= =?us-ascii?Q?5m8vYa8C9DLTFy78A7KUmgRb3D472u+8FnpVXHVYhXdP/dnFVdzKE3oZea7B?= =?us-ascii?Q?gKgsdrvGCAe2stGm5WkgLOP961zPW+R1jH9YU+FxL95CdHQvxV9arIp1v9Xf?= =?us-ascii?Q?+UtVKh2Vs39CFI6fWgPdXcEU5K4Ji9aIeXhtgUSatQPxBs4UTrPbBYuB2tc0?= =?us-ascii?Q?iZJdy1aID17UBw1X+If0MDjMVQ1YrXwWR45pFI0UqwzBjZ3rC6brFOLGaqnE?= =?us-ascii?Q?q5uA7NzggIVQ6MTCEJBcNMTOmYNSuqxk19Wk7lrm12CY6x9iSZB9NZCQWLiB?= =?us-ascii?Q?QREHvNjCkvL1LZydZVGq0hA8zreVCKUxZrXYjet/+fNFT1Da46P2Ph+ezWDq?= =?us-ascii?Q?FP3fqScIDJjbX7tqBOkKOEktXYoj1XVj79/gn8UpN7n9aABU7l/qvMhGwShk?= =?us-ascii?Q?dCVX49bZLc23LFBaFMy4T6OecEbX+iyLhb5WPpLMhB+Dz1/hy4KQ8jNdCY27?= =?us-ascii?Q?gErA7P0vciM29cjXxJu8a0uM0uye7CXbg7Qqzc2NONv742ttaY/mIKWgS2S2?= =?us-ascii?Q?bPQjYybxhfoBZreUlkl4PMXUyoyQa/jfJ2zth2cChg038IhhodSEAagmsq9M?= =?us-ascii?Q?J/2dicZqjTjjNdTAz86k+SqeAbheq/bL9R8+eaf0QH3kNYalbLUe7ZqB6A/A?= =?us-ascii?Q?rgV7u0/slKBUvA4Si3pUZQEBjXS9+Om6uFp/iCfgtYsVPs7AC6xV6/RmXi/h?= =?us-ascii?Q?E9WQf7FC1KpVMhdAmNX7OXPVPXV/rS+yxG2IH3XCZM0bUjuuAYCCH68b3X96?= =?us-ascii?Q?B9pZf6P2nA8SN/gc8pBKTe/oz2y1NvzPchP9gIT9e7JB0v4bANWRLVDsCvaN?= =?us-ascii?Q?nXawSWqQc7hkRWqYKmFr6z9vkSgfeaZxWgHjT3keCwJpuDPRI8t2YKtlZRVQ?= =?us-ascii?Q?fpqF150STRdtHDPtPl7liZRmHqlr1Es22oDpSiO+pkfxhhpa15pgESmuAWyS?= =?us-ascii?Q?tPXLQKO5thcA4N/Mirm/QUODxV8eAS6BEQfOfz2Knp3OItOF+QalpHl2Wcov?= =?us-ascii?Q?PPlSktDLA3MOP1Vc/lC8KYJcyWnIJ+LhJ6y1Wh+7di2P7XJCEncg4dRO5/BU?= =?us-ascii?Q?a2CMJUJBTQH0DPrQp6XODLcUOXYEcnNqlp+7Gdb0JWjxGeZNDxxDeq3+PskD?= =?us-ascii?Q?edFydM9S6n67nahRz2Je+BMITD1f9nYTabA+O2mAF1VQ/4Rq8PwxSHZtayQM?= =?us-ascii?Q?oJBWSf6LmZs/jda0TlARgmk+fGLdn7lyjLXcOxCa0/HSHbIbE5diBmkmXArp?= =?us-ascii?Q?Bhxdj9qR9i1Ot8IZyGh3mN+CGG06Qd6yXqAcLdcULhVImPwInUxZdRjfBbfd?= =?us-ascii?Q?oizw3lN6gJIQ0q+1oOdGLYNi/3ofTBfTixdpXfyjlruQkA8TjF2Vsa9ue3pb?= =?us-ascii?Q?kkt2FAcz1/y8g+asWXBuCTJXXWjkJRNv4p06o1qtgy4mdY48zAMrUr2dvocD?= =?us-ascii?Q?rRGIFLApLYHE+6U7W41KGgWOc+kBAHbEQ2yR8asMr5zcWHAbopA3gXGH0fiH?= =?us-ascii?Q?ntbfb8Ptvy9llahp4F9iiiVmb7fEObJW69XNlhX7DXat+3BQzK3iYQAWHkep?= =?us-ascii?Q?4aaDoG3BCdZ3c6h3nUPmY+0=3D?=
Content-Type: multipart/related; boundary="_004_SA1PR00MB13098D93EAC81F74BBCE4888D37C9SA1PR00MB1309namp_"; type="multipart/alternative"
MIME-Version: 1.0
X-OriginatorOrg: microsoft.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA1PR00MB1309.namprd00.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 25853fb3-d149-4822-cb9f-08d9c4ae9b49
X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Dec 2021 18:20:45.6894 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: BVFluE6mO77qsxH4ynX/gbyfWbMXzEAaFc9TCq4tzMsQADpXRMp13DiUiuXeXrheZML2PHrcqDtpD/idhdHMkQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR00MB1184
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/Id6nvSoSnZE9rpqe9DWLqSl1Np8>
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: Tue, 21 Dec 2021 18:20:57 -0000

I tend to agree that the requirement to send errors back to the original domain is "over-zealous". It's also looping prone at scale - I've seen many a buggy https://contoso.example that issues a request to https://idp.example?redirect_uri=https://contoso.example<https://idp.example?redirect_uri=https:/contoso.example> and gets an error response https://contoso.example?error=invalid_request and promptly issues the same login request with an updated state value again - https://idp.example?redirect_uri=https://conoto.example&state= https://contoso.example?error%3Dinvalid_request. In practice, I think most large scale OAuth providers end up implementing some sort of loop breaking behavior (which is inevitably not-by-spec, as it returns a 200/4xx error page rather than a 302 redirect, even though the redirect_uri is "correct"). While not all of these looping cases come from invalid_request, probably the majority do.

With that said, I do it is useful for apps to get error reports with specific error descriptions to their domain. At first glance, I wonder why the STS couldn't choose the notify the app's error URI AJAX (or even S2S) - this would break loops and fix open redirects, while maintaining diagnosability.

Prompt=none is unfortunately, the one really hard case, as redirection is essential for the UX. I've previously had discussions around logic like:

  1.  Permit prompt=none if domainCheck(headers.Referer, request.redirectUri) == true
  2.  Permit prompt=none if login_hint present and that user has previously signed into the app in that browser session
  3.  Otherwise, deny prompt=none. (invalid_request)
There is a suggestion that #1 should cover the "optimistic auth" case and #2 should cover the "reauth" case, and those are all the use cases for prompt=none. This would block open redirectors, apart from the domain the user is already present on, which is really not much of an attack at all. However, "Referer" remains controversial.

I'm fairly dubious of phishing filters. They work ok at scale (i.e. for broad rather than targeted attacks), but domains are cheap. I'd rather see standards try to fix this, than patch it with phishing filters.

Thanks,
Will

From: OAuth <oauth-bounces@ietf.org> On Behalf Of Brian Campbell
Sent: Friday, December 17, 2021 1:44 PM
To: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
Cc: oauth <oauth@ietf.org>
Subject: Re: [OAUTH-WG] [EXTERNAL] Re: OAuth Redirection Attacks

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"<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdatatracker.ietf.org%2Fdoc%2Fhtml%2Fdraft-ietf-oauth-closing-redirectors-00%23section-2.1&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FZHy3ugosgps8fQGSP2UYUaTErspOOWWbdmIgcaqBg0%3D&reserved=0> 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<mailto:hans.zandbelt@zmartzone.eu>> wrote:
AFAIK this topic has been discussed before, e.g.:
https://mailarchive.ietf.org/arch/msg/oauth/gIuIrxeXudRBg8L6RYGDElxrc4s/<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailarchive.ietf.org%2Farch%2Fmsg%2Foauth%2FgIuIrxeXudRBg8L6RYGDElxrc4s%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y7i0X48%2FZEYsM00yohZPva3E3Ijr8GgVGzF%2FCeMI%2BDQ%3D&reserved=0>

Hans.

On Fri, Dec 17, 2021 at 9:44 PM Pieter Kasselman <pieter.kasselman=40microsoft.com@dmarc.ietf.org<mailto: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<mailto:40rhosys.ch@dmarc.ietf.org>>
Sent: Friday 17 December 2021 20:27
To: Pieter Kasselman <pieter.kasselman@microsoft.com<mailto:pieter.kasselman@microsoft.com>>
Cc: Vittorio Bertocci <Vittorio@auth0.com<mailto:Vittorio@auth0.com>>; oauth <oauth@ietf.org<mailto: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.


[Image removed by sender.]

Warren Parad

Founder, CTO
Secure your user data with IAM authorization as a service. Implement Authress<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fauthress.io%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nxOW61%2B9y7YmhKa6aUNjEx%2BgNmGfCFpirw6sx1MICq0%3D&reserved=0>.


On Fri, Dec 17, 2021 at 9:23 PM Pieter Kasselman <pieter.kasselman=40microsoft.com@dmarc.ietf.org<mailto: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<mailto: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<mailto:40rhosys.ch@dmarc.ietf.org>>
Cc: oauth <oauth@ietf.org<mailto: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<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fherokuapp.com%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Ddgp8nsuQKDWDNFAP3LlF0CRKXdK61%2B4YRRiqGddYJI%3D&reserved=0> vs heroku.com<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fheroku.com%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VXLtL1vCFvVfTbKQdP2ZHREm8wzh%2FCibPW5o98%2FzCi0%3D&reserved=0>) 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<mailto: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<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdatatracker.ietf.org%2Fdoc%2Fhtml%2Fdraft-ietf-oauth-v2-1-04%23section-4.1.2.1&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=azPPkMHdIvZM4w0HIVcS%2FwgrzCd9WvHNVAbUAdKbl4I%3D&reserved=0>
   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<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.trendmicro.com%2Fen_us%2Fresearch%2F17%2Fd%2Fpawn-storm-abuses-open-authentication-advanced-social-engineering-attacks.html&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4RBL68YWSrTiCZrDrxBZJASwEcFyy7G1XHMjORF3cy0%3D&reserved=0>

If we can't protect against these latter ones, I hardly think protecting against the former is useful/interesting/valuable.


[Image removed by sender.]

Warren Parad

Founder, CTO
Secure your user data with IAM authorization as a service. Implement Authress<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fauthress.io%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309021764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nxOW61%2B9y7YmhKa6aUNjEx%2BgNmGfCFpirw6sx1MICq0%3D&reserved=0>.


On Thu, Dec 16, 2021 at 9:05 PM Rifaat Shekh-Yusef <rifaat.s.ietf@gmail.com<mailto: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<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.proofpoint.com%2Fus%2Fblog%2Fcloud-security%2Fmicrosoft-and-github-oauth-implementation-vulnerabilities-lead-redirection&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Unfy21xWkDqH7w7Fe3qKSq8qVJLTXBsUkzo129Pwvpo%3D&reserved=0>




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<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ietf.org%2Fmailman%2Flistinfo%2Foauth&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dBKEZF8CDX%2FJ7asiHvElHqBv9%2Bw3UZZUcpxeJ411cgs%3D&reserved=0>
_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ietf.org%2Fmailman%2Flistinfo%2Foauth&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dBKEZF8CDX%2FJ7asiHvElHqBv9%2Bw3UZZUcpxeJ411cgs%3D&reserved=0>
_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ietf.org%2Fmailman%2Flistinfo%2Foauth&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dBKEZF8CDX%2FJ7asiHvElHqBv9%2Bw3UZZUcpxeJ411cgs%3D&reserved=0>


--
hans.zandbelt@zmartzone.eu<mailto:hans.zandbelt@zmartzone.eu>
ZmartZone IAM - www.zmartzone.eu<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.zmartzone.eu%2F&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=oEOw9XfdmFaBqH88tmGZDLQL8nk5CrNMYrQrP9Ii9VI%3D&reserved=0>
_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ietf.org%2Fmailman%2Flistinfo%2Foauth&data=04%7C01%7Cwibartle%40microsoft.com%7C331dc63ebbb7434f519a08d9c1a683e0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637753743309071753%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dBKEZF8CDX%2FJ7asiHvElHqBv9%2Bw3UZZUcpxeJ411cgs%3D&reserved=0>

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.