-
Notifications
You must be signed in to change notification settings - Fork 6
/
draft-lodderstedt-oauth-security.xml
3135 lines (2546 loc) · 149 KB
/
draft-lodderstedt-oauth-security.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="4"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="no"?>
<rfc category="std" docName="draft-ietf-oauth-v2-threatmodel-00"
ipr="trust200902">
<front>
<title abbrev="OAuth 2.0 Security">OAuth 2.0 Threat Model and Security
Considerations</title>
<author fullname="Dr.-Ing. Torsten Lodderstedt" initials="T."
role="editor" surname="Lodderstedt">
<organization>Deutsche Telekom AG</organization>
<address>
<email>[email protected]</email>
</address>
</author>
<author fullname="Mark McGloin" initials="M." surname="McGloin">
<organization>IBM</organization>
<address>
<email>[email protected]</email>
</address>
</author>
<author fullname="Phil Hunt" initials="P." surname="Hunt">
<organization>Oracle Corporation</organization>
<address>
<email>[email protected]</email>
</address>
</author>
<date day="01" month="July" year="2011" />
<area>Security Area</area>
<workgroup>Web Authorization Protocol (oauth)</workgroup>
<keyword>security</keyword>
<keyword>oauth 2.0</keyword>
<keyword>threat model</keyword>
<abstract>
<t>This document gives security considerations based on a comprehensive
threat model for the OAuth 2.0 Protocol.</t>
</abstract>
<note title="Requirements Language">
<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in <xref
target="RFC2119">RFC 2119</xref>.</t>
</note>
</front>
<middle>
<section title="Introduction">
<t>This document gives security considerations based on a comprehensive
threat model for the OAuth 2.0 Protocol <xref
target="I-D.ietf-oauth-v2"></xref>. It contains the following
content:<list style="symbols">
<t>Documents any assumptions and scope considered when creating the
threat model.</t>
<t>Describes the security features in-built into the OAuth protocol
and how they are intended to thwart attacks.</t>
<t>Gives a comprehensive threat model for OAuth and describes the
respective counter measures to thwart those threats.</t>
</list>Threats include any intentional attacks on OAuth tokens and
resources protected by OAuth tokens as well as security risks introduced
if the proper security measures are not put in place. Threats are
structured along the lines of the protocol structure to aid development
teams implement each part of the protocol securely. For example all
threats for granting access or all threats for a particular client
profile or all threats for protecting the resource server.</t>
</section>
<section title="Overview">
<t></t>
<section title="Scope">
<t>The security considerations document only considers clients bound
to a particular deployment as supported by <xref
target="I-D.ietf-oauth-v2"></xref>. Such deployments have the
following characteristics:</t>
<t><list style="symbols">
<t>Resource server URLs are static and well-known at development
time, authorization server URLs can be static or discovered.</t>
<t>Token scope values (e.g. applicable URLs and methods) are
well-known at development time.</t>
<t>Client registration: Since registration of clients is out of
scope of the current core spec, this document assumes a broad
variety of options from static registration during development
time to dynamic registration at runtime.</t>
</list>The following are considered out of scope :</t>
<t><list style="symbols">
<t>Communication between authorization server and resource
server</t>
<t>Token formats</t>
<t>Except for „Resource Owner Password Credentials“
(see <xref target="I-D.ietf-oauth-v2"></xref>, section 4.3), the
mechanism used by authorization servers to authenticate the
user</t>
<t>Mechanism by which a user obtained an assertion and any
resulting attacks mounted as a result of the assertion being
false.</t>
<t>Clients are not bound to a specific deployment: An example
could by a mail client with support for contact list access via
the portable contacts API (see <xref
target="portable-contacts"></xref>). Such clients cannot be
registered upfront with a particular deployment and must
dynamically discover the URLs relevant for the Oauth protocol.</t>
</list></t>
</section>
<section title="Attack Assumptions">
<t>The following assumptions relate to an attacker and resources
available to an attacker:</t>
<t><list style="symbols">
<t>It is assumed the attacker has full access to the network
between the client and authorization servers and the client and
the resource server, respectively. The attacker may eaves drop on
any communications between those parties. He is not assumed to
have access to communication between authorization and resource
server.</t>
<t>It is assumed an attacker has unlimited resources to mount an
attack.</t>
<t>It is assumed that 2 of the 3 parties involved in the OAuth
protocol may collude to mount an attack against the 3rd party. For
example, the client and authorization server may be under control
of an attacker and collude to trick a user to gain access to
resources.</t>
</list></t>
</section>
<section title="Architectural assumptions">
<t>This section documents the assumptions about the features,
limitations and design options of the different entities of a OAuth
deployment along with the security-sensitive data-elements managed by
those entity. These assumptions are the foundation of the treat
analysis.</t>
<t>The OAuth protocol leaves deployments with a certain degree of
freedom how to implement and apply the standard. The core
specification defines the core concepts of an authorization server and
a resource server. Both servers can be implemented in the same server
entity, or they may also be different entities. The later is typically
the case for multi-service providers with a single authentication and
authorization system, and are more typical in middleware
architectures.</t>
<section title="Authorization Servers">
<t>The following data elements MAY be stored or accessible on the
authorization server:</t>
<t><list style="symbols">
<t>user names and passwords</t>
<t>client ids and secrets</t>
<t>client-specific refresh tokens</t>
<t>client-specific access tokens (in case of handle-based
design)</t>
<t>HTTPS certificate/key</t>
<t>per authorization process (in case of handle-based design):
redirect_uri, client_id, authorization code</t>
</list></t>
</section>
<section title="Resource Server">
<t>The following data elements MAY be stored or accessible on the
resource server:</t>
<t><list style="symbols">
<t>user data (out of scope)</t>
<t>HTTPS certificate/key</t>
<t>authz server credentials (handle-based design), or</t>
<t>authz server shared secret/public key (assertion-based
design)</t>
<t>access tokens (per request)</t>
</list> It is assumed that a resource server has no knowledge of
refresh tokens, user passwords, or client secrets.</t>
</section>
<section title="Client">
<t>The following data elements are stored or accessible on the
client:</t>
<t><list style="symbols">
<t>client id (and client secret or corresponding client
credential)</t>
<t>one or more refresh tokens (persistent) and access tokens
(transient) per end-user or other security-context or delegation
context</t>
<t>trusted CA certs (HTTPS)</t>
<t>per authorization process: redirect_uri, authorization
code</t>
</list></t>
<section title="Web Application">
<t>A web application is a client running on a web server,
typically with its own user management. End-users access the
client via an HTML user interface rendered in a user- agent on the
end-user's device. The client credentials as well as any token
issued to the client are stored on the web server and are not
exposed to or accessible by the end-user. Tokens are bound to a
single user identity at the site. The potential number of tokens
affected by a security breach depends on number of site users.</t>
<t>Such clients are implemented using the authorization code grant
type (see <xref target="code_flow"></xref>).</t>
</section>
<section title="Native Applications">
<t>A native application is a client which is installed and
executes on the end-user's device, such as a notebook, PC, Tablet,
Smartphone, or Gaming Console. The OAuth protocol data and
credentials are accessible to the end-user. It is assumed that
such an application can protect dynamically issued credentials,
such as refresh tokens, from eavesdropping by other applications
residing on the same device.</t>
<t>Massively distributed applications such as these cannot
reliably keep secrets confidential, which are issued per software
package. This is because such secrets would need to be transferred
to the user device as part of the installation process. An
attacker could reverse engineer any secret from the binary or
accompanying resources. Native Applications are able to protect
per installation/instance secrets (e.g. refresh tokens) to some
extent.</t>
<t>Device platforms typically allow users to lock the device with
a PIN code and to segregate different apps or users (multi-user
operation systems).</t>
<t>Some devices can be identified/authenticated (to varying
degrees of assurance):</t>
<t><list style="symbols">
<t>Handsets and smart phones by its International Mobile
Equipment Identity (IMEI)</t>
<t>Set top boxes, gaming consoles, others by using
certificates and TPM module - Note: This does not help to
identify client apps but may be used to bound tokens to
devices and to detect token theft</t>
</list>Mobile devices, such as handsets or smart phones have the
following special characteristics:</t>
<t><list style="symbols">
<t>Limited input capabilities, therefore such clients
typically obtain a refresh token in order to provide automatic
login for sub-sequent application sessions</t>
<t>As mobile and small devices, they can get cloned, stolen or
lost easier than other devices.</t>
<t>Security breach will affect single user (or a few users)
only.</t>
</list>For the purposes of this document, the scenario of
attackers who control a smartphone device entirely is out of
scope.</t>
<t>There are several implementation options for native
applications:</t>
<t><list style="symbols">
<t>The authorization code grant type in combination with an
embedded or external browser (<xref
target="code_flow"></xref>)</t>
<t>The implict grant type in combination with an embedded or
external browser (<xref target="implicite_flow"></xref>)</t>
<t>The resource owner password credentials grant type can be
used as well (<xref target="pwd_flow"></xref>)</t>
</list>Different threats exists for those implementation
options, which are discussed in the respective sections of the
threat model.</t>
</section>
<section title="User-agent-based Applications">
<t>A user-agent-based application is a client in which the client
code is downloaded from a web server and executes within a
user-agent on the end-user's device. The OAuth protocol data and
credentials are accessible to the end-user. Since such
applications directly reside within the user-agent, they can make
seamless use of the user-agent capabilities in the end-user
authorization process.</t>
<t>Such client are implemented using the implicit grant grant type
(<xref target="implicite_flow"></xref>).</t>
</section>
<section title="Autonomous">
<t>Autonomous clients access resource services using rights grants
by client credentials only. Thus the autonomous client becomes the
„user“. Authenticating autonomous clients is
conceptually similar to end-user authentication since the issued
tokens refer to the client's identity. Autonomous clients shall
always be required to use a secret or some other form of
authentication (e.g. client assertion in the form of a SAML
assertion or STS token) acceptable to the authorization/token
services. The client must ensure the confidentiality of
client_secret or other credential.</t>
<t>Such client are implemented using the client credentials grant
type.</t>
</section>
</section>
</section>
</section>
<section title="Security Features">
<t>These are some of the security features which have been built into
the OAuth 2.0 protocol to mitigate attacks and security issues.</t>
<section title="Tokens">
<t>OAuth makes extensive use of all kinds of tokens (access tokens,
refresh tokens, authorization codes). The information content of a
token can be represented in two ways as follows:</t>
<t><list style="hanging">
<t hangText="Handle (or artifact)">a reference to some internal
data structure within the authorization server, the internal data
structure contains the attributes of the token, such as user id,
scope, etc. Handles enable simple revocation and do not require
cryptographic mechanisms to protected token content from being
modified. On the other hand, handles require communication between
issuing and consuming entity (e.g. authorization and resource
server) in order to validate the token and obtain token-bound
data. This communication might have an negative impact on
performance and scalability if both entities reside on different
system. Handles are therefore typically used if the issuing and
consuming entity are the same. A 'handle' token is often referred
to as an 'opaque' token because the resource server does not need
to be able to interpret the token directly, it simply uses the
token.</t>
<t hangText="Assertions (aka self-contained token)">a parseable
token. An assertion typically has a duration, an audience, and is
digitally signed containing information about the user and the
client. Examples of assertion formats are SAML assertions and
Kerberos tickets. Assertions can typically directly be validated
and used by a resource server without interactions with the
authorization server. This results in better performance and
scalability in deployment where issuing and consuming entity
reside on different systems. Implementing token revocation is more
difficult with assertions than with handles.</t>
</list>Tokens can be used in two ways to invoke requests on resource
servers as follows:</t>
<t><list style="hanging">
<t hangText="bearer token">A 'bearer token' is a token that can be
used by any client who has received the token (e.g. <xref
target="I-D.ietf-oauth-v2-bearer"></xref>). Because mere
possession is enough to use the token it is important that
communication between end-points be secured to ensure that only
authorized end-points may capture the token. The bearer token is
convenient to client applications as it does not require them to
do anything to use them (such as a proof of identity). Bearer
tokens have similar characteristics to web SSO cookies used in
browsers.</t>
<t hangText="proof token">A 'proof token' is a token that can only
be used by a specific client. Each use of the token, requires the
client to perform some action that proves that it is the
authorized user of the token. Examples of this are MAC tokens,
which require the client to digitally sign the resource request
with a secret corresponding to the particular token send with the
request (e.g.<xref
target="I-D.ietf-oauth-v2-http-mac"></xref>).</t>
</list></t>
<section title="Scope">
<t>A Scope represents the access authorization associated with a
particular token with respect to resource servers, resources and
methods on those resources. Scopes are the OAuth way to explicitly
manage the power associated with an access token. A scope can be
controlled by the authorization server and/or the end-user in order
to limit access to resources for OAuth clients these parties deem
less secure or trustworthy. Optionally, the client can request the
scope to apply to the token but only for lesser scope than would
otherwise be granted, e.g. to reduce the potential impact if this
token is sent over non secure channels. A scope is typically
complemented by a restriction on a token's lifetime.</t>
</section>
<section title="Expires_In">
<t>Expires_In allows an authorization server (based on its policies
or on behalf of the end-user) to limit the lifetime of the access
token. This mechanisms can be used to issue short-living tokens to
OAuth clients the authorization server deems less secure or where
sending tokens over non secure channels.</t>
</section>
</section>
<section title="Access Token">
<t>An access token is used by a client to access a resource. Access
tokens typically have short life-spans (minutes or hours) that cover
typical session lifetimes. An access token may be refreshed through
the use of a refresh token. The short lifespan of an access token in
combination with the usage of refresh tokens enables the possibility
of passive revocation of access authorization on the expiry of the
current access token.</t>
</section>
<section title="Refresh Token">
<t>A refresh token represents a long-lasting authorization of a
certain client to access resources on behalf of a resource owner. Such
tokens are exchanged between client and authorization server, only.
Clients use this kind of token to obtain ("refresh") new access tokens
used for resource server invocations.</t>
<t>A refresh token, coupled with a short access token lifetime, can be
used to grant longer access to resources without involving end user
authorization. This offers an advantage where resource servers and
authorization servers are not the same entity, e.g. in a distributed
environment, as the refresh token must always be exchanged at the
authorization server. The authorization server can revoke the refresh
token at any time causing the granted access to be revoked once the
current access token expires. Because of this, a short access token
lifetime is important if timely revocation is a high priority.</t>
<t>The refresh token is also a secret bound to the client identifier
and <spanx style="emph">instance</spanx> which originally requested
the authorization and representing the original resource owner grant.
This is ensured by the authorization process as follows:</t>
<t><list style="numbers">
<t>The resource owner and user-agent safely deliver the
authorization code to the client instance in first place.</t>
<t>The client uses it immediately in secure transport-level
communications to the authorization server and then securely
stores the long-lived refresh token.</t>
<t>The client always uses the refresh token in secure
transport-level communications to the authorization server to get
an access token (and optionally rollover the refresh token).</t>
</list>So as long as the confidentiality of the particular token can
be ensured by the client, a refresh tokens can also be used as an
alternative mean to authenticate the client instance itself.</t>
</section>
<section title="Authorization Code">
<t>An Authorization Code represents the intermediary result of a
successful end-user authorization process and is used by the client to
obtain access and refresh token. Authorization codes are sent to the
client's redirect_uri instead of tokens for two purposes.</t>
<t><list style="numbers">
<t>Instead of (longer-lasting) tokens, the short-living
authorization code is exposed to potential attackers via URI query
parameters (HTTP referrer), browser cacher or log file
entries.</t>
<t>It is much simpler to authenticate clients during the direct
request between client and authorization server than in the
context of the indirect authorization request. The later would
require digital signatures.</t>
</list></t>
</section>
<section title="Redirect-URI">
<t>A Redirect-uri helps to identify clients and prevents phishing
attacks from other clients attempting to trick the user into believing
the phisher is the client. The value of the actual redirect_uri used
in the authorization request has to be presented and is verified when
an authorization code is exchanged for tokens. This helps to prevent
attacks, where the authorization code is revealed through redirectors
and counterfeit web app clients. Moreover, the authorization server
may require clients to pre-register their redirect URIs and validate
the redirect_uri in the authorization request in order to detect
malicious clients.</t>
</section>
<section title="State parameter">
<t>The state parameter is used to link requests and callbacks to
prevent CSRF attacks where an attacker authorizes access to his own
resources and then tricks a users into following a redirect with the
attacker's token.</t>
</section>
<section title="Client Identity">
<t>Authentication protocols have typically not taken into account the
identity of the software component acting on behalf of the end-user.
OAuth does this in order to increase the security level in delegated
authorization scenarios and because the client will be able to act
without the user's presence. Depending on the client type, the client
identity can and should be authenticated (see below).</t>
<t>OAuth uses the <spanx style="emph">client_id</spanx> (client
identity) to collate associated request to the same originator, such
as</t>
<t><list style="symbols">
<t>a particular end-user authorization process and the
corresponding request on the tokens endpoint to exchange the
authorization code for tokens or</t>
<t>the initial authorization and issuance of a tokens by an
end-user to a particular client and sub-sequent requests by this
client to obtain tokens w/o user consent (automatic processing of
repeated authorization)</t>
</list>The client identity may also be used by the authorization
server to display relevant registration information to a user when
requesting consent for scope requested by a particular client. The
client identity may be used to limit the number of request for a
particular client or to charge the client per request. Client Identity
may furthermore be useful to differentiate access by different
clients, e.g. in server log files.</t>
<t>The <spanx style="emph">client_secret</spanx> is used to verify the
client identifier. The authorization server should only rely on this
form of client authentication where these secrets can be deployed to
the clients in a secure manner and the client is capable of keeping
its secret confidential. Alternatively, the client identity can also
be verified using the <spanx style="emph">redirect_uri</spanx> or by
the <spanx style="emph">end-user</spanx>.</t>
<t>Clients (and the trustworthiness of its identity) can be classifed
by using the following parameters:</t>
<t><list style="symbols">
<t>Deployment-specific or -independent client_id (Note: for native
apps, every installation of a particular app on a certain device
is considered a deployment.)</t>
<t>Validated properties, such as app name or redirect_uri</t>
<t>Client_secret available</t>
</list>Typical client categories are:</t>
<t><list style="hanging">
<t
hangText="Deployment-independent client_id with pre-registered redirect_uri and without client_secret">Such
an identity is used by multiple installations of the same software
package. The identity of such a client can only be validated with
the help of the end-user. This is a viable option for native apps
in order to identify the client for the purpose of displaying meta
information about the client to the user and to differentiate
clients in log files. Revocation of such an identity will affect
ALL deployments of the respective software.</t>
<t
hangText="Deployment-independent client_id with pre-registered redirect_uri and with client_secret">This
is an option for native applications only, since web application
would require different redirect URIs. This category is not
advisable because the client secret cannot be protected
appropriately (see <xref target="ObtainClientSecrets"></xref>).
Due to its security weaknesses, such client identities have the
same trustlevel as deployment-independent clients without secret.
Revocation will affect ALL deployments.</t>
<t
hangText="Deployment-specific client_id with pre-registered redirect_uri and with client_secret">The
client registration process insures the validation of the client's
properties, such as redirect_uri, website address, web site name,
contacts. Such a client identity can be utilized for all relevant
use cases cited above. This level can be achieved for web
applications in combination with a manual or user-bound
registration process. Achieving this level for native applications
is much more difficult. Either the installation of the app is
conducted by an administrator, who validates the clients
authenticity, or the process from validating the app to the
installation of the app on the device and the creation of the
client credentials is controlled end-to-end by a single entity
(e.g. app market provider). Revocation will affect a single
deployment only.</t>
<t
hangText="Deployment-specific client_id with client_secret without validated properties">Such
a client can be recognized by the authorization server in
transactions with subsequent requests (e.g. authorization and
token issuance, refresh token issuance and access token
refreshment). The authorization server cannot assure any property
of the client to end-users. Automatic processing of
re-authorizations could be allowed as well. Such client
credentials can be generated automatically without any validation
of client properties, which makes it another option especially for
native apps. Revocation will affect a single deployment only.</t>
</list>Use of the client secret is considered a relatively weak form
of credential for the client. Use of stronger mechanisms such as a
client assertion (e.g. SAML), key cryptography, are preferred.</t>
</section>
</section>
<section title="Security Threat Model">
<t>This sections gives a comprehensive threat model of OAuth 2.0.
Threats are grouped first by attackes directed against an OAuth
component, which are client, authorization server, and resource server.
Subsequently, they are grouped by flow, e.g. obtain token or access
protected resources. Every countermeasure description refers to a
detailed description in <xref
target="security_considerations"></xref>.</t>
<section title="Clients">
<t>This section describes possible threats directed to OAuth
clients.</t>
<section anchor="ObtainClientSecrets"
title="Threat: Obtain Client Secrets">
<t>The attacker could try to get access to the secret of a
particular client in order to:</t>
<t><list style="symbols">
<t>replay its refresh tokens and authorization codes, or</t>
<t>obtain tokens on behalf of the attacked client with the
privileges of that client.</t>
</list>The resulting impact would be:</t>
<t><list style="symbols">
<t>Client authentication of access to authorization server can
be bypassed</t>
<t>Stolen refresh tokens or authorization codes can be
replayed</t>
</list>Depending on the client category, there are the following
approaches an attacker could utilize to obtain the client
secret.</t>
<t><spanx style="strong">Attack: Obtain Secret From Source Code or Binary.</spanx>
This applies for all client profiles. For open source projects,
secrets can be extracted directly from source code in their public
repositories. Secrets can be extracted from application binaries
just as easily when published source is not available to the
attacker. Even if an application takes significant measures to
obfuscate secrets in their application distribution one should
consider that the secret can still be reverse-engineered by anyone
with access to a complete functioning application bundle or
binary.</t>
<t><spanx>Countermeasures:</spanx></t>
<t><list style="symbols">
<t>Don't issue secrets to clients with inappropriate security
policy - <xref target="dont_issue"></xref></t>
<t>Clients without secrect require user consent - <xref
target="forced_user_consent"></xref></t>
<t>Use deployment-specific client secrets - <xref
target="depl_specific_secretes"></xref></t>
<t>Client secret revocation - <xref
target="client_secret_revocation"></xref></t>
</list> <spanx xml:space="default"></spanx></t>
<t><spanx style="strong" xml:space="default">Attack: Obtain a
Deployment-Specific Secret.</spanx> An attacker may try to obtain
the secret from a client installation, either from a web site (web
server) or a particular devices (native app).</t>
<t><spanx>Countermeasures:</spanx></t>
<t><list style="symbols">
<t>Web server: apply standard web server protection measures
(for config files and databases) - <xref
target="std_web"></xref></t>
<t>Native apps: Store secrets in a secure local storage - <xref
target="secure_storage"></xref></t>
<t>Client secret revocation - <xref
target="client_secret_revocation"></xref></t>
</list></t>
</section>
<section title="Threat: Obtain Refresh Tokens">
<t>Depending on the client type, there are different ways refresh
tokens may be revealed to an attacker. The following sub-sections
give a more detailed description of the different attacks with
respect to different client types and further specialized
countermeasures. Some generally applicable countermeasure to
mitigate such attacks shall be given in advance:</t>
<t><list style="symbols">
<t>The authorization server must validate the client id
associated with the particular refresh token with every refresh
request- <xref target="binding_refresh_client_id"></xref></t>
<t>Limited scope tokens - <xref target="limit_scope"></xref></t>
<t>Refresh token revocation - <xref
target="refresh_revocation"></xref></t>
<t>Client secret revocation - <xref
target="client_secret_revocation"></xref></t>
<t>Refresh tokens can automatically be replaced in order to
detect unauthorized token usage by another party (Refresh Token
Replacement) - <xref target="refresh_replace"></xref></t>
</list> <spanx style="strong"></spanx></t>
<t><spanx style="strong">Attack: Obtain Refresh Token from Web application.</spanx>
An attack may obtain the refresh tokens issued to a web server
client. Impact: Exposure of all refresh tokens on that side.</t>
<t><spanx style="emph">Countermeasures:</spanx> <list
style="symbols">
<t>Standard web server protection measures - <xref
target="std_web"></xref></t>
<t>Use strong client authentication (e.g. client_assertion /
client_token), so the attacker cannot obtain the client secret
required to exchange the tokens - <xref
target="strong_client_authn"></xref></t>
</list> <spanx style="strong"></spanx></t>
<t><spanx style="strong">Attack: Obtain Refresh Token from Native clients.</spanx>
On native clients, leakage of a refresh token typically affects a
single user, only.</t>
<t><spanx style="emph">Read from local filesystem:</spanx> The
attacker could try get file system access on the device and read the
refresh tokens. The attacker could utilize a malicious app for that
purpose.</t>
<t><spanx style="emph">Countermeasures:</spanx></t>
<t><list style="symbols">
<t>Store secrets in a secure storage - <xref
target="secure_storage"></xref></t>
<t>Utilize device lock to prevent unauthorized device access -
<xref target="device_lock"></xref></t>
</list> <spanx style="emph"></spanx></t>
<t><spanx style="emph">Steal device</spanx>: The host device (e.g.
mobile phone) may be stolen. In that case, the attacker gets access
to all apps under the identity of the legitimate user.</t>
<t><spanx style="emph">Countermeasures:</spanx></t>
<t><list style="symbols">
<t>Utilize device lock to prevent unauthorized device access -
<xref format="default" target="device_lock"></xref></t>
<t>Combine refresh token requests with user-provided secret -
<xref target="user_secret"></xref></t>
<t>Where a user knows the device has been stolen, they can
revoke the affected tokens - <xref
target="refresh_revocation"></xref></t>
</list> <spanx style="emph"></spanx></t>
<t><spanx style="emph">Clone device: </spanx>All device data and
applications are copied to another device. Applications are used
as-is on the target device.</t>
<t><spanx style="emph">Countermeasures:</spanx></t>
<t><list style="symbols">
<t>Combine refresh token request with device identification -
<xref target="device_id"></xref></t>
<t>Combine refresh token requests with user-provided secret -
<xref target="user_secret"></xref></t>
<t>Refresh Token Replacement - <xref
target="refresh_replace"></xref></t>
<t>Where a user knows the device has been cloned, they can use
this countermeasure - Refresh Token Revocation - <xref
target="refresh_revocation"></xref></t>
</list> <spanx style="emph"></spanx></t>
<t><spanx style="emph">Obtain refresh tokens from backup:</spanx> A
refresh token could be obtained from the backup of a client
application, or device.</t>
<t><spanx style="emph">Countermeasures:</spanx></t>
<t><list style="symbols">
<t>tbd</t>
</list></t>
</section>
<section title="Threat: Obtain Access Tokens">
<t>Depending on the client type, there are different ways access
tokens may be revealed to an attacker. Access tokens could be stolen
from the device if the app stores them in a storage, which is
accessible to other applications.</t>
<t>Impact: Where the token is a bearer token and no additional
mechanism is used to identify the client, the attacker can access
all resources associated with the token and its scope.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Keep access tokens in transient memory and limit grants:
<xref target="access_tokens"></xref></t>
<t>Limited scope tokens - <xref target="limit_scope"></xref></t>
<t>Keep access tokens in private memory or apply same protection
means as for refresh tokens - <xref
target="refresh_tokens"></xref></t>
<t>Keep access token lifetime short - <xref
target="short_exp_time"></xref></t>
</list></t>
</section>
<section title="Threat: End-user credentials phished using compromised or embedded browser">
<t>A malicious app could attempt to phish end-user passwords by
misusing an embedded browser in the end-user authorization process,
or by presenting its own user-interface instead of allowing trusted
system browser to render the authorization UI. By doing so, the
usual visual trust mechanisms may be bypassed (e.g. TLS
confirmation, web site mechanisms). By using an embedded or internal
client app UI, the client app has access to additional information
it should not have access to (e.g. uid/password).</t>
<t>Impact: If the client app or the communication is compromised,
the user would not be aware and all information in the authorization
exchange could be captured such as username and password.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Client developers and end-user can be educated to trust an
external System-Browser only.</t>
<t>Client apps could be validated prior publication in a app
market.</t>
<t>Client developers should not collect authentication
information directly from users and should instead use redirects
to and back from a trusted external system-browser.</t>
</list></t>
</section>
</section>
<section title="Authorization Endpoint">
<t></t>
<section title="Threat: Password phishing by counterfeit authorization server">
<t>OAuth makes no attempt to verify the authenticity of the
Authorization Server. A hostile party could take advantage of this
by intercepting the Client's requests and returning misleading or
otherwise incorrect responses. This could be achieved using DNS or
ARP spoofing. Wide deployment of OAuth and similar protocols may
cause Users to become inured to the practice of being redirected to
websites where they are asked to enter their passwords. If Users are
not careful to verify the authenticity of these websites before
entering their credentials, it will be possible for attackers to
exploit this practice to steal Users' passwords.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Authorization servers should consider such attacks when
developing services based on OAuth, and should require
transport-layer security for any requests where the authenticity
of the authorization server or of request responses is an issue
(see <xref target="server_authn"></xref>).</t>
<t>Authorization servers should attempt to educate Users about
the risks phishing attacks pose, and should provide mechanisms
that make it easy for users to confirm the authenticity of their
sites.</t>
</list></t>
</section>
<section title="Threat: User unintentionally grants too much access scope">
<t>When obtaining end user authorization, the end-user may not
understand the scope of the access being granted and to whom or they
may end up providing a client with access to resources which should
not be permitted.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Explain the scope (resources and the permissions) the user is
about to grant in a understandable way - <xref
target="informed_decisions"></xref></t>
<t>Narrow scope based on client-specific policy - When obtaining
end user authorization and where the client requests scope, the
authorization server may want to consider whether to honour that
scope based on who the client is. That decision is between the
client and authorization server and is outside the scope of this
spec. The authorization server may also want to consider what
scope to grant based on the profile used, e.g. providing lower
scope where no client secret is provided from a native
application. - <xref target="limit_scope"></xref></t>
</list></t>
</section>
<section anchor="mal_client3"
title="Threat: Malicious client obtains existing authorization by fraud">
<t>Authorization servers may wish to automatically process
authorization requests from clients which have been previously
authorized by the user. When the user is redirected to the
authorization server's end-user authorization endpoint to grant
access, the authorization server detects that the user has already
granted access to that particular client. Instead of prompting the
user for approval, the authorization server automatically redirects
the user back to the client.</t>
<t>A malicious client may exploit that feature and try to obtain
such an authorization code instead of the legimate client.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Authorization servers should not automatically process repeat
authorizations where the client is not authenticated through a
client secret or some other authentication mechanism such as
signing with security certs (see <xref
target="strong_client_authn"></xref>) or validation of a
pre-registered redirect uri (<xref target="val_redirect"></xref>
)</t>
<t>Authorization servers can mitigate the risks associated with
automatic processing by limiting the scope of Access Tokens
obtained through automated approvals - <xref
target="limit_scope"></xref></t>
</list></t>
</section>
<section title="Threat: Open redirector">
<t>An attacker could use the end-user authorization endpoint and the
redirect_uri parameter to abuse the authorization server as
redirector.</t>
<t>Impact?</t>
<t>Countermeasure</t>
<t><list style="symbols">
<t>don't redirect to redirect_uri, if client identity or
redirect_uri could not be verified</t>
</list></t>
</section>
</section>
<section title="Token endpoint">
<t></t>
<section title="Threat: Eavesdropping access tokens">
<t>Attackers may attempts to eaversdrop access token on transit from
the authorization server to the client.</t>
<t>Impact: The attacker is able to access all resources with the
permissions covered by the scope of the particular access token.</t>
<t>Countermeasures:</t>
<t><list style="symbols">
<t>Authorization servers MUST ensure that these transmissions
are protected using transport-layer mechanisms such as TLS or
SSL (see <xref target="conf_requests"></xref>).</t>
<t>If end-to-end confidentiality cannot be guaranteed, reducing
scope (see <xref target="limit_scope"></xref>) and expiry time
(<xref target="short_exp_time"></xref>) for access tokens can be
used to reduce the damage in case of leaks.</t>
</list></t>
</section>