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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
|
<pre>Internet Architecture Board (IAB) D. Thaler, Ed.
Request for Comments: 6943 Microsoft
Category: Informational May 2013
ISSN: 2070-1721
<span class="h1">Issues in Identifier Comparison for Security Purposes</span>
Abstract
Identifiers such as hostnames, URIs, IP addresses, and email
addresses are often used in security contexts to identify security
principals and resources. In such contexts, an identifier presented
via some protocol is often compared using some policy to make
security decisions such as whether the security principal may access
the resource, what level of authentication or encryption is required,
etc. If the parties involved in a security decision use different
algorithms to compare identifiers, then failure scenarios ranging
from denial of service to elevation of privilege can result. This
document provides a discussion of these issues that designers should
consider when defining identifiers and protocols, and when
constructing architectures that use multiple protocols.
Status of This Memo
This document is not an Internet Standards Track specification; it is
published for informational purposes.
This document is a product of the Internet Architecture Board (IAB)
and represents information that the IAB has deemed valuable to
provide for permanent record. It represents the consensus of the
Internet Architecture Board (IAB). Documents approved for
publication by the IAB are not a candidate for any level of Internet
Standard; see <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc6943">http://www.rfc-editor.org/info/rfc6943</a>.
<span class="grey">Thaler Informational [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document.
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-3">3</a>
<a href="#section-1.1">1.1</a>. Classes of Identifiers .....................................<a href="#page-5">5</a>
<a href="#section-1.2">1.2</a>. Canonicalization ...........................................<a href="#page-5">5</a>
<a href="#section-2">2</a>. Identifier Use in Security Policies and Decisions ...............<a href="#page-6">6</a>
<a href="#section-2.1">2.1</a>. False Positives and Negatives ..............................<a href="#page-7">7</a>
<a href="#section-2.2">2.2</a>. Hypothetical Example .......................................<a href="#page-8">8</a>
<a href="#section-3">3</a>. Comparison Issues with Common Identifiers .......................<a href="#page-9">9</a>
<a href="#section-3.1">3.1</a>. Hostnames ..................................................<a href="#page-9">9</a>
<a href="#section-3.1.1">3.1.1</a>. IPv4 Literals ......................................<a href="#page-11">11</a>
<a href="#section-3.1.2">3.1.2</a>. IPv6 Literals ......................................<a href="#page-12">12</a>
<a href="#section-3.1.3">3.1.3</a>. Internationalization ...............................<a href="#page-13">13</a>
<a href="#section-3.1.4">3.1.4</a>. Resolution for Comparison ..........................<a href="#page-14">14</a>
<a href="#section-3.2">3.2</a>. Port Numbers and Service Names ............................<a href="#page-14">14</a>
<a href="#section-3.3">3.3</a>. URIs ......................................................<a href="#page-15">15</a>
<a href="#section-3.3.1">3.3.1</a>. Scheme Component ...................................<a href="#page-16">16</a>
<a href="#section-3.3.2">3.3.2</a>. Authority Component ................................<a href="#page-16">16</a>
<a href="#section-3.3.3">3.3.3</a>. Path Component .....................................<a href="#page-17">17</a>
<a href="#section-3.3.4">3.3.4</a>. Query Component ....................................<a href="#page-17">17</a>
<a href="#section-3.3.5">3.3.5</a>. Fragment Component .................................<a href="#page-17">17</a>
<a href="#section-3.3.6">3.3.6</a>. Resolution for Comparison ..........................<a href="#page-18">18</a>
<a href="#section-3.4">3.4</a>. Email Address-Like Identifiers ............................<a href="#page-18">18</a>
<a href="#section-4">4</a>. General Issues .................................................<a href="#page-19">19</a>
<a href="#section-4.1">4.1</a>. Conflation ................................................<a href="#page-19">19</a>
<a href="#section-4.2">4.2</a>. Internationalization ......................................<a href="#page-20">20</a>
<a href="#section-4.3">4.3</a>. Scope .....................................................<a href="#page-21">21</a>
<a href="#section-4.4">4.4</a>. Temporality ...............................................<a href="#page-21">21</a>
<a href="#section-5">5</a>. Security Considerations ........................................<a href="#page-22">22</a>
<a href="#section-6">6</a>. Acknowledgements ...............................................<a href="#page-22">22</a>
<a href="#section-7">7</a>. IAB Members at the Time of Approval ............................<a href="#page-23">23</a>
<a href="#section-8">8</a>. Informative References .........................................<a href="#page-23">23</a>
<span class="grey">Thaler Informational [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
In computing and the Internet, various types of "identifiers" are
used to identify humans, devices, content, etc. This document
provides a discussion of some security issues that designers should
consider when defining identifiers and protocols, and when
constructing architectures that use multiple protocols. Before
discussing these security issues, we first give some background on
some typical processes involving identifiers. Terms such as
"identifier", "identity", and "principal" are used as defined in
[<a href="./rfc4949" title=""Internet Security Glossary, Version 2"">RFC4949</a>].
As depicted in Figure 1, there are multiple processes relevant to our
discussion.
1. An identifier is first generated. If the identifier is intended
to be unique, the generation process must include some mechanism,
such as allocation by a central authority or verification among
the members of a distributed authority, to help ensure
uniqueness. However, the notion of "unique" involves determining
whether a putative identifier matches any other identifier that
has already been allocated. As we will see, for many types of
identifiers, this is not simply an exact binary match.
After generating the identifier, it is often stored in two
locations: with the requester or "holder" of the identifier, and
with some repository of identifiers (e.g., DNS). For example, if
the identifier was allocated by a central authority, the
repository might be that authority. If the identifier identifies
a device or content on a device, the repository might be that
device.
2. The identifier is distributed, either by the holder of the
identifier or by a repository of identifiers, to others who could
use the identifier. This distribution might be electronic, but
sometimes it is via other channels such as voice, business card,
billboard, or other form of advertisement. The identifier itself
might be distributed directly, or it might be used to generate a
portion of another type of identifier that is then distributed.
For example, a URI or email address might include a server name,
and hence distributing the URI or email address also inherently
distributes the server name.
3. The identifier is used by some party. Generally, the user
supplies the identifier, which is (directly or indirectly) sent
to the repository of identifiers. The repository of identifiers
must then attempt to match the user-supplied identifier with an
identifier in its repository.
<span class="grey">Thaler Informational [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
For example, using an email address to send email to the holder
of an identifier may result in the email arriving at the holder's
email server, which has access to the mail stores.
+------------+
| Holder of | 1. Generation
| identifier +<---------+
+----+-------+ |
| | Match
| v/
| +-------+-------+
+----------+ Repository of |
| | identifiers |
| +-------+-------+
2. Distribution | ^\
| | Match
v |
+---------+-------+ |
| User of | |
| identifier +----------+
+-----------------+ 3. Use
Figure 1: Typical Identifier Processes
Another variation is where a user is given the identifier of a
resource (e.g., a web site) to access securely, sometimes known as a
"reference identifier" [<a href="./rfc6125" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">RFC6125</a>], and the server hosting the resource
then presents its identity at the time of use. In this case, the
user application attempts to match the presented identity against the
reference identifier.
One key aspect is that the identifier values passed in generation,
distribution, and use may all be in different forms. For example, an
identifier might be exchanged in printed form at generation time,
distributed to a user via voice, and then used electronically. As
such, the match process can be complicated.
Furthermore, in many cases, the relationship between holder,
repositories, and users may be more involved. For example, when a
hierarchy of web caches exists, each cache is itself a repository of
a sort, and the match process is usually intended to be the same as
on the origin server.
Another aspect to keep in mind is that there can be multiple
identifiers that refer to the same object (i.e., resource, human,
device, etc.). For example, a human might have a passport number and
a drivers license number, and an RFC might be available at multiple
locations (rfc-editor.org and ietf.org). In this document, we focus
<span class="grey">Thaler Informational [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
on comparing two identifiers to see whether they are the same
identifier, rather than comparing two different identifiers to see
whether they refer to the same entity (although a few issues with the
latter are touched on in several places, such as Sections <a href="#section-3.1.4">3.1.4</a> and
3.3.6).
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Classes of Identifiers</span>
In this document, we will refer to the following classes of
identifiers:
o Absolute: identifiers that can be compared byte-by-byte for
equality. Two identifiers that have different bytes are defined
to be different. For example, binary IP addresses are in this
class.
o Definite: identifiers that have a single well-defined comparison
algorithm. For example, URI scheme names are required to be
US-ASCII [<a href="#ref-USASCII" title=""Coded Character Sets -- 7-bit American Standard Code for Information Interchange (7-bit ASCII)"">USASCII</a>] and are defined to match in a case-insensitive
way; the comparison is thus definite, since there is a well-
specified algorithm (<a href="./rfc4790#section-9.2.1">Section 9.2.1 of [RFC4790]</a>) on how to do a
case-insensitive match among ASCII strings.
o Indefinite: identifiers that have no single well-defined
comparison algorithm. For example, human names are in this class.
Everyone might want the comparison to be tailored for their
locale, for some definition of "locale". In some cases, there may
be limited subsets of parties that might be able to agree (e.g.,
ASCII users might all agree on a common comparison algorithm,
whereas users of other Roman-derived scripts, such as Turkish, may
not), but identifiers often tend to leak out of such limited
environments.
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. Canonicalization</span>
Perhaps the most common algorithm for comparison involves first
converting each identifier to a canonical form (a process known as
"canonicalization" or "normalization") and then testing the resulting
canonical representations for bitwise equality. In so doing, it is
thus critical that all entities involved agree on the same canonical
form and use the same canonicalization algorithm so that the overall
comparison process is also the same.
Note that in some contexts, such as in internationalization, the
terms "canonicalization" and "normalization" have a precise meaning.
In this document, however, we use these terms synonymously in their
more generic form, to mean conversion to some standard form.
<span class="grey">Thaler Informational [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
While the most common method of comparison includes canonicalization,
comparison can also be done by defining an equivalence algorithm,
where no single form is canonical. However, in most cases, a
canonical form is useful for other purposes, such as output, and so
in such cases defining a canonical form suffices to define a
comparison method.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Identifier Use in Security Policies and Decisions</span>
Identifiers such as hostnames, URIs, and email addresses are used in
security contexts to identify security principals (i.e., entities
that can be authenticated) and resources as well as other security
parameters such as types and values of claims. Those identifiers are
then used to make security decisions based on an identifier presented
via some protocol. For example:
o Authentication: a protocol might match a security principal's
identifier to look up expected keying material and then match
keying material.
o Authorization: a protocol might match a resource name against some
policy. For example, it might look up an access control list
(ACL) and then look up the security principal's identifier (or a
surrogate for it) in that ACL.
o Accounting: a system might create an accounting record for a
security principal's identifier or resource name, and then might
later need to match a presented identifier to (for example) add
new filtering rules based on the records in order to stop an
attack.
If the parties involved in a security decision use different matching
algorithms for the same identifiers, then failure scenarios ranging
from denial of service to elevation of privilege can result, as we
will see.
This is especially complicated in cases involving multiple parties
and multiple protocols. For example, there are many scenarios where
some form of "security token service" is used to grant to a requester
permission to access a resource, where the resource is held by a
third party that relies on the security token service (see Figure 2).
The protocol used to request permission (e.g., Kerberos or OAuth) may
be different from the protocol used to access the resource (e.g.,
HTTP). Opportunities for security problems arise when two protocols
define different comparison algorithms for the same type of
identifier, or when a protocol is ambiguously specified and two
endpoints (e.g., a security token service and a resource holder)
implement different algorithms within the same protocol.
<span class="grey">Thaler Informational [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
+----------+
| security |
| token |
| service |
+----------+
^
| 1. supply credentials and
| get token for resource
| +--------+
+----------+ 2. supply token and access resource |resource|
|requester |=------------------------------------->| holder |
+----------+ +--------+
Figure 2: Simple Security Exchange
In many cases, the situation is more complex. With X.509 Public Key
Infrastructure (PKIX) certificates [<a href="./rfc6125" title=""Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)"">RFC6125</a>], for example, the name
in a certificate gets compared against names in ACLs or other things.
In the case of web site security, the name in the certificate gets
compared to a portion of the URI that a user may have typed into a
browser. The fact that many different people are doing the typing,
on many different types of systems, complicates the problem.
Add to this the certificate enrollment step, and the certificate
issuance step, and two more parties have an opportunity to adjust the
encoding, or worse, the software that supports them might make
changes that the parties are unaware are happening.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. False Positives and Negatives</span>
It is first worth discussing in more detail the effects of errors in
the comparison algorithm. A "false positive" results when two
identifiers compare as if they were equal but in reality refer to two
different objects (e.g., security principals or resources). When
privilege is granted on a match, a false positive thus results in an
elevation of privilege -- for example, allowing execution of an
operation that should not have been permitted otherwise. When
privilege is denied on a match (e.g., matching an entry in a
block/deny list or a revocation list), a permissible operation is
denied. At best, this can cause worse performance (e.g., a cache
miss or forcing redundant authentication) and at worst can result in
a denial of service.
<span class="grey">Thaler Informational [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
A "false negative" results when two identifiers that in reality refer
to the same thing compare as if they were different, and the effects
are the reverse of those for false positives. That is, when
privilege is granted on a match, the result is at best worse
performance and at worst a denial of service; when privilege is
denied on a match, elevation of privilege results.
Figure 3 summarizes these effects.
| "Grant on match" | "Deny on match"
---------------+------------------------+-----------------------
False positive | Elevation of privilege | Denial of service
---------------+------------------------+-----------------------
False negative | Denial of service | Elevation of privilege
---------------+------------------------+-----------------------
Figure 3: Worst Effects of False Positives/Negatives
When designing a comparison algorithm, one can typically modify it to
increase the likelihood of false positives and decrease the
likelihood of false negatives, or vice versa. Which outcome is
better depends on the context.
Elevation of privilege is almost always seen as far worse than denial
of service. Hence, for URIs, for example, <a href="./rfc3986#section-6.1">Section 6.1 of [RFC3986]</a>
states that "comparison methods are designed to minimize false
negatives while strictly avoiding false positives".
Thus, URIs were defined with a "grant privilege on match" paradigm in
mind, where it is critical to prevent elevation of privilege while
minimizing denial of service. Using URIs in a "deny privilege on
match" system can thus be problematic.
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Hypothetical Example</span>
In this example, both security principals and resources are
identified using URIs. Foo Corp has paid example.com for access to
the Stuff service. Foo Corp allows its employees to create accounts
on the Stuff service. Alice gets the account
"http://example.com/Stuff/FooCorp/alice" and Bob gets
"http://example.com/Stuff/FooCorp/bob". It turns out, however, that
Foo Corp's URI canonicalizer includes URI fragment components in
comparisons whereas example.com's does not, and Foo Corp does not
disallow the # character in the account name. So Chuck, who is a
malicious employee of Foo Corp, asks to create an account at
example.com with the name alice#stuff. Foo Corp's URI logic checks
its records for accounts it has created with stuff and sees that
there is no account with the name alice#stuff. Hence, in its
<span class="grey">Thaler Informational [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
records, it associates the account alice#stuff with Chuck and will
only issue tokens good for use with
"http://example.com/Stuff/FooCorp/alice#stuff" to Chuck.
Chuck, the attacker, goes to a security token service at Foo Corp and
asks for a security token good for
"http://example.com/Stuff/FooCorp/alice#stuff". Foo Corp issues the
token, since Chuck is the legitimate owner (in Foo Corp's view) of
the alice#stuff account. Chuck then submits the security token in a
request to "http://example.com/Stuff/FooCorp/alice".
But example.com uses a URI canonicalizer that, for the purposes of
checking equality, ignores fragments. So when example.com looks in
the security token to see if the requester has permission from Foo
Corp to access the given account, it successfully matches the URI in
the security token, "http://example.com/Stuff/FooCorp/alice#stuff",
with the requested resource name
"http://example.com/Stuff/FooCorp/alice".
Leveraging the inconsistencies in the canonicalizers used by Foo Corp
and example.com, Chuck is able to successfully launch an elevation-
of-privilege attack and access Alice's resource.
Furthermore, consider an attacker using a similar corporation, such
as "foocorp" (or any variation containing a non-ASCII character that
some humans might expect to represent the same corporation). If the
resource holder treats them as different but the security token
service treats them as the same, then elevation of privilege can
occur in this scenario as well.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Comparison Issues with Common Identifiers</span>
In this section, we walk through a number of common types of
identifiers and discuss various issues related to comparison that may
affect security whenever they are used to identify security
principals or resources. These examples illustrate common patterns
that may arise with other types of identifiers.
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Hostnames</span>
Hostnames (composed of dot-separated labels) are commonly used either
directly as identifiers, or as components in identifiers such as in
URIs and email addresses. Another example is in Sections <a href="#section-7.2">7.2</a> and <a href="#section-7.3">7.3</a>
of [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>] (and updated in <a href="./rfc6818#section-3">Section 3 of [RFC6818]</a>), which specify
use in PKIX certificates.
In this section, we discuss a number of issues in comparing strings
that appear to be some form of hostname.
<span class="grey">Thaler Informational [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
It is first worth pointing out that the term "hostname" itself is
often ambiguous, and hence it is important that any use clarify which
definition is intended. Some examples of definitions include:
a. A Fully Qualified Domain Name (FQDN),
b. An FQDN that is associated with address records in the DNS,
c. The leftmost label in an FQDN, or
d. The leftmost label in an FQDN that is associated with address
records.
The use of different definitions in different places results in
questions such as whether "example" and "example.com" are considered
equal or not, and hence it is important when writing new
specifications to be clear about which definition is meant.
<a href="./rfc6055#section-3">Section 3 of [RFC6055]</a> discusses the differences between a "hostname"
and a "DNS name", where the former is a subset of the latter by using
a restricted set of characters (letters, digits, and hyphens). If
one canonicalizer uses the "DNS name" definition whereas another uses
a "hostname" definition, a name might be valid in the former but
invalid in the latter. As long as invalid identifiers are denied
privilege, this difference will not result in elevation of privilege.
<a href="./rfc1034#section-3.1">Section 3.1 of [RFC1034]</a> discusses the difference between a
"complete" domain name, which ends with a dot (such as
"example.com."), and a multi-label relative name such as
"example.com" that assumes the root (".") is in the suffix search
list. In most contexts, these are considered equal, but there may be
issues if different entities in a security architecture have
different interpretations of a relative domain name.
[<a id="ref-IAB1123">IAB1123</a>] briefly discusses issues with the ambiguity around whether
a label will be "alphabetic" -- including, among other issues, how
"alphabetic" should be interpreted in an internationalized
environment -- and whether a hostname can be interpreted as an IP
address. We explore this last issue in more detail below.
<span class="grey">Thaler Informational [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h4"><a class="selflink" id="section-3.1.1" href="#section-3.1.1">3.1.1</a>. IPv4 Literals</span>
<a href="./rfc1123#section-2.1">Section 2.1 of [RFC1123]</a> states:
Whenever a user inputs the identity of an Internet host, it SHOULD
be possible to enter either (1) a host domain name or (2) an IP
address in dotted-decimal ("#.#.#.#") form. The host SHOULD check
the string syntactically for a dotted-decimal number before
looking it up in the Domain Name System.
and
This last requirement is not intended to specify the complete
syntactic form for entering a dotted-decimal host number; that is
considered to be a user-interface issue.
In specifying the inet_addr() API, the Portable Operating System
Interface (POSIX) standard [<a href="#ref-IEEE-1003.1">IEEE-1003.1</a>] defines "IPv4 dotted decimal
notation" as allowing not only strings of the form "10.0.1.2" but
also allowing octal and hexadecimal, and addresses with less than
four parts. For example, "10.0.258", "0xA000102", and "012.0x102"
all represent the same IPv4 address in standard "IPv4 dotted decimal"
notation. We will refer to this as the "loose" syntax of an IPv4
address literal.
In <a href="./rfc3493#section-6.1">Section 6.1 of [RFC3493]</a>, getaddrinfo() is defined to support the
same (loose) syntax as inet_addr():
If the specified address family is AF_INET or AF_UNSPEC, address
strings using Internet standard dot notation as specified in
inet_addr() are valid.
In contrast, <a href="#section-6.3">Section 6.3</a> of the same RFC states, specifying
inet_pton():
If the af argument of inet_pton() is AF_INET, the src string shall
be in the standard IPv4 dotted-decimal form:
ddd.ddd.ddd.ddd
where "ddd" is a one to three digit decimal number between 0 and
255. The inet_pton() function does not accept other formats (such
as the octal numbers, hexadecimal numbers, and fewer than four
numbers that inet_addr() accepts).
<span class="grey">Thaler Informational [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
As shown above, inet_pton() uses what we will refer to as the
"strict" form of an IPv4 address literal. Some platforms also use
the strict form with getaddrinfo() when the AI_NUMERICHOST flag is
passed to it.
Both the strict and loose forms are standard forms, and hence a
protocol specification is still ambiguous if it simply defines a
string to be in the "standard IPv4 dotted decimal form". And, as a
result of these differences, names such as "10.11.12" are ambiguous
as to whether they are an IP address or a hostname, and even
"10.11.12.13" can be ambiguous because of the "SHOULD" in the above
text from <a href="./rfc1123">RFC 1123</a>, making it optional whether to treat it as an
address or a DNS name.
Protocols and data formats that can use addresses in string form for
security purposes need to resolve these ambiguities. For example,
for the host component of URIs, <a href="./rfc3986#section-3.2.2">Section 3.2.2 of [RFC3986]</a> resolves
the first ambiguity by only allowing the strict form and resolves the
second ambiguity by specifying that it is considered an IPv4 address
literal. New protocols and data formats should similarly consider
using the strict form rather than the loose form in order to better
match user expectations.
A string might be valid under the "loose" definition but invalid
under the "strict" definition. As long as invalid identifiers are
denied privilege, this difference will not result in elevation of
privilege. Some protocols, however, use strings that can be either
an IP address literal or a hostname. Such strings are at best
Definite identifiers, and often turn out to be Indefinite
identifiers. (See <a href="#section-4.1">Section 4.1</a> for more discussion.)
<span class="h4"><a class="selflink" id="section-3.1.2" href="#section-3.1.2">3.1.2</a>. IPv6 Literals</span>
IPv6 addresses similarly have a wide variety of alternate but
semantically identical string representations, as defined in
<a href="./rfc4291#section-2.2">Section 2.2 of [RFC4291]</a> and <a href="./rfc6874#section-2">Section 2 of [RFC6874]</a>. As discussed in
<a href="./rfc5952#section-3.2.5">Section 3.2.5 of [RFC5952]</a>, this fact causes problems in security
contexts if comparison (such as in PKIX certificates) is done between
strings rather than between the binary representations of addresses.
[<a id="ref-RFC5952">RFC5952</a>] specified a recommended canonical string format as an
attempt to solve this problem, but it may not be ubiquitously
supported at present. And, when strings can contain non-ASCII
characters, the same issues (and more, since hexadecimal and colons
are allowed) arise as with IPv4 literals.
<span class="grey">Thaler Informational [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
Whereas (binary) IPv6 addresses are Absolute identifiers, IPv6
address literals are Definite identifiers, since string-to-address
conversion for IPv6 address literals is unambiguous.
<span class="h4"><a class="selflink" id="section-3.1.3" href="#section-3.1.3">3.1.3</a>. Internationalization</span>
The IETF policy on character sets and languages [<a href="./rfc2277" title=""IETF Policy on Character Sets and Languages"">RFC2277</a>] requires
support for UTF-8 in protocols, and as a result many protocols now do
support non-ASCII characters. When a hostname is sent in a UTF-8
field, there are a number of ways it may be encoded. For example,
hostname labels might be encoded directly in UTF-8, or they might
first be Punycode-encoded [<a href="./rfc3492" title=""Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)"">RFC3492</a>] or even percent-encoded from
UTF-8.
For example, in URIs, <a href="./rfc3986#section-3.2.2">Section 3.2.2 of [RFC3986]</a> specifically allows
for the use of percent-encoded UTF-8 characters in the hostname as
well as the use of Internationalized Domain Names in Applications
(IDNA) encoding [<a href="./rfc3490" title=""Internationalizing Domain Names in Applications (IDNA)"">RFC3490</a>] using the Punycode algorithm.
Percent-encoding is unambiguous for hostnames, since the percent
character cannot appear in the strict definition of a "hostname",
though it can appear in a DNS name.
Punycode-encoded labels (or "A-labels"), on the other hand, can be
ambiguous if hosts are actually allowed to be named with a name
starting with "xn--", and false positives can result. While this may
be extremely unlikely for normal scenarios, it nevertheless provides
a possible vector for an attacker.
A hostname comparator thus needs to decide whether a Punycode-encoded
label should or should not be considered a valid hostname label, and
if so, then whether it should match a label encoded in some other
form such as a percent-encoded Unicode label (U-label).
For example, <a href="#section-3">Section 3</a> of "Transport Layer Security (TLS) Extensions:
Extension Definitions" [<a href="./rfc6066" title=""Transport Layer Security (TLS) Extensions: Extension Definitions"">RFC6066</a>] states:
"HostName" contains the fully qualified DNS hostname of the
server, as understood by the client. The hostname is represented
as a byte string using ASCII encoding without a trailing dot.
This allows the support of internationalized domain names through
the use of A-labels defined in [<a href="./rfc5890">RFC5890</a>]. DNS hostnames are case-
insensitive. The algorithm to compare hostnames is described in
<a href="./rfc5890#section-2.3.2.4">[RFC5890], Section 2.3.2.4</a>.
For some additional discussion of security issues that arise with
internationalization, see <a href="#section-4.2">Section 4.2</a> and [<a href="#ref-TR36" title=""Unicode Security Considerations"">TR36</a>].
<span class="grey">Thaler Informational [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h4"><a class="selflink" id="section-3.1.4" href="#section-3.1.4">3.1.4</a>. Resolution for Comparison</span>
Some systems (specifically Java URLs [<a href="#ref-JAVAURL" title=""Class URL"">JAVAURL</a>]) use the rule that if
two hostnames resolve to the same IP address(es) then the hostnames
are considered equal. That is, the canonicalization algorithm
involves name resolution with an IP address being the canonical form.
For example, if resolution was done via DNS, and DNS contained:
example.com. IN A 10.0.0.6
example.net. CNAME example.com.
example.org. IN A 10.0.0.6
then the algorithm might treat all three names as equal, even though
the third name might refer to a different entity.
With the introduction of dynamic IP addresses; private IP addresses;
multiple IP addresses per name; multiple address families (e.g., IPv4
vs. IPv6); devices that roam to new locations; commonly deployed DNS
tricks that result in the answer depending on factors such as the
requester's location and the load on the server whose address is
returned; etc., this method of comparison cannot be relied upon.
There is no guarantee that two names for the same host will resolve
the name to the same IP addresses; nor that the addresses resolved
refer to the same entity, such as when the names resolve to private
IP addresses; nor even that the system has connectivity (and the
willingness to wait for the delay) to resolve names at the time the
answer is needed. The lifetime of the identifier, and of any cached
state from a previous resolution, also affects security (see
<a href="#section-4.4">Section 4.4</a>).
In addition, a comparison mechanism that relies on the ability to
resolve identifiers such as hostnames to other identifiers such as IP
addresses leaks information about security decisions to outsiders if
these queries are publicly observable. (See [<a href="#ref-PRIVACY-CONS">PRIVACY-CONS</a>] for a
deeper discussion of information disclosure.)
Finally, it is worth noting that resolving two identifiers to
determine if they refer to the same entity can be thought of as a use
of such identifiers, as opposed to actually comparing the identifiers
themselves, which is the focus of this document.
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Port Numbers and Service Names</span>
Port numbers and service names are discussed in depth in [<a href="./rfc6335" title=""Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry"">RFC6335</a>].
Historically, there were port numbers, service names used in SRV
records, and mnemonic identifiers for assigned port numbers (known as
port "keywords" at [<a href="#ref-IANA-PORT">IANA-PORT</a>]). The latter two are now unified, and
<span class="grey">Thaler Informational [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
various protocols use one or more of these types in strings. For
example, the common syntax used by many URI schemes allows port
numbers but not service names. Some implementations of the
getaddrinfo() API support strings that can be either port numbers or
port keywords (but not service names).
For protocols that use service names that must be resolved, the
issues are the same as those for resolution of addresses in
<a href="#section-3.1.4">Section 3.1.4</a>. In addition, <a href="./rfc6335#section-5.1">Section 5.1 of [RFC6335]</a> clarifies that
service names/port keywords must contain at least one letter. This
prevents confusion with port numbers in strings where both are
allowed.
<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. URIs</span>
This section looks at issues related to using URIs for security
purposes. For example, <a href="./rfc5280#section-7.4">Section 7.4 of [RFC5280]</a> specifies comparison
of URIs in certificates. Examples of URIs in security-token-based
access control systems include WS-*, SAML 2.0 [<a href="#ref-OASIS-SAMLv2-CORE">OASIS-SAMLv2-CORE</a>],
and OAuth Web Resource Authorization Profiles (WRAP) [<a href="#ref-OAuth-WRAP">OAuth-WRAP</a>].
In such systems, a variety of participants in the security
infrastructure are identified by URIs. For example, requesters of
security tokens are sometimes identified with URIs. The issuers of
security tokens and the relying parties who are intended to consume
security tokens are frequently identified by URIs. Claims in
security tokens often have their types defined using URIs, and the
values of the claims can also be URIs.
URIs are defined with multiple components, each of which has its own
rules. We cover each in turn below. However, it is also important
to note that there exist multiple comparison algorithms. <a href="./rfc3986#section-6.2">Section 6.2
of [RFC3986]</a> states:
A variety of methods are used in practice to test URI equivalence.
These methods fall into a range, distinguished by the amount of
processing required and the degree to which the probability of
false negatives is reduced. As noted above, false negatives
cannot be eliminated. In practice, their probability can be
reduced, but this reduction requires more processing and is not
cost-effective for all applications.
If this range of comparison practices is considered as a ladder,
the following discussion will climb the ladder, starting with
practices that are cheap but have a relatively higher chance of
producing false negatives, and proceeding to those that have
higher computational cost and lower risk of false negatives.
<span class="grey">Thaler Informational [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
The ladder approach has both pros and cons. On the pro side, it
allows some uses to optimize for security, and other uses to optimize
for cost, thus allowing URIs to be applicable to a wide range of
uses. A disadvantage is that when different approaches are taken by
different components in the same system using the same identifiers,
the inconsistencies can result in security issues.
<span class="h4"><a class="selflink" id="section-3.3.1" href="#section-3.3.1">3.3.1</a>. Scheme Component</span>
[<a id="ref-RFC3986">RFC3986</a>] defines URI schemes as being case-insensitive US-ASCII and
in <a href="#section-6.2.2.1">Section 6.2.2.1</a> specifies that scheme names should be normalized
to lowercase characters.
New schemes can be defined over time. In general, however, two URIs
with an unrecognized scheme cannot be safely compared. This is
because the canonicalization and comparison rules for the other
components may vary by scheme. For example, a new URI scheme might
have a default port of X, and without that knowledge, a comparison
algorithm cannot know whether "example.com" and "example.com:X"
should be considered to match in the authority component. Hence, for
security purposes, it is safest for unrecognized schemes to be
treated as invalid identifiers. However, if the URIs are only used
with a "grant access on match" paradigm, then unrecognized schemes
can be supported by doing a generic case-sensitive comparison, at the
expense of some false negatives.
<span class="h4"><a class="selflink" id="section-3.3.2" href="#section-3.3.2">3.3.2</a>. Authority Component</span>
The authority component is scheme-specific, but many schemes follow a
common syntax that allows for userinfo, host, and port.
<span class="h5"><a class="selflink" id="section-3.3.2.1" href="#section-3.3.2.1">3.3.2.1</a>. Host</span>
<a href="#section-3.1">Section 3.1</a> discusses issues with hostnames in general. In addition,
<a href="./rfc3986#section-3.2.2">Section 3.2.2 of [RFC3986]</a> allows future changes using the IPvFuture
production. As with IPv4 and IPv6 literals, IPvFuture formats may
have issues with multiple semantically identical string
representations and may also be semantically identical to an IPv4 or
IPv6 address. As such, false negatives may be common if IPvFuture is
used.
<span class="h5"><a class="selflink" id="section-3.3.2.2" href="#section-3.3.2.2">3.3.2.2</a>. Port</span>
See discussion in <a href="#section-3.2">Section 3.2</a>.
<span class="grey">Thaler Informational [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h5"><a class="selflink" id="section-3.3.2.3" href="#section-3.3.2.3">3.3.2.3</a>. Userinfo</span>
[<a id="ref-RFC3986">RFC3986</a>] defines the userinfo production that allows arbitrary data
about the user of the URI to be placed before '@' signs in URIs. For
example, "<a href="ftp://alice:bob@example.com/bar">ftp://alice:bob@example.com/bar</a>" has the value "alice:bob"
as its userinfo. When comparing URIs in a security context, one must
decide whether to treat the userinfo as being significant or not.
Some URI comparison services, for example, treat
"<a href="ftp://alice:ick@example.com">ftp://alice:ick@example.com</a>" and "ftp://example.com" as being equal.
When the userinfo is treated as being significant, it has additional
considerations (e.g., whether or not it is case sensitive), which we
cover in <a href="#section-3.4">Section 3.4</a>.
<span class="h4"><a class="selflink" id="section-3.3.3" href="#section-3.3.3">3.3.3</a>. Path Component</span>
[<a id="ref-RFC3986">RFC3986</a>] supports the use of path segment values such as "./" or
"../" for relative URIs. As discussed in <a href="./rfc3986#section-6.2.2.3">Section 6.2.2.3 of
[RFC3986]</a>, they are intended only for use within a reference relative
to some other base URI, but <a href="./rfc3986#section-5.2.4">Section 5.2.4 of [RFC3986]</a> nevertheless
defines an algorithm to remove them as part of URI normalization.
Unless a scheme states otherwise, the path component is defined to be
case sensitive. However, if the resource is stored and accessed
using a filesystem using case-insensitive paths, there will be many
paths that refer to the same resource. As such, false negatives can
be common in this case.
<span class="h4"><a class="selflink" id="section-3.3.4" href="#section-3.3.4">3.3.4</a>. Query Component</span>
There is the question as to whether "http://example.com/foo",
"http://example.com/foo?", and "http://example.com/foo?bar" are each
considered equal or different.
Similarly, it is unspecified whether the order of values matters.
For example, should "http://example.com/blah?ick=bick&foo=bar" be
considered equal to "http://example.com/blah?foo=bar&ick=bick"? And
if a domain name is permitted to appear in a query component (e.g.,
in a reference to another URI), the same issues in <a href="#section-3.1">Section 3.1</a> apply.
<span class="h4"><a class="selflink" id="section-3.3.5" href="#section-3.3.5">3.3.5</a>. Fragment Component</span>
Some URI formats include fragment identifiers. These are typically
handles to locations within a resource and are used for local
reference. A classic example is the use of fragments in HTTP URIs
where a URI of the form "http://example.com/blah.html#ick" means
retrieve the resource "http://example.com/blah.html" and, once it has
arrived locally, find the HTML anchor named "ick" and display that.
<span class="grey">Thaler Informational [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
So, for example, when a user clicks on the link
"http://example.com/blah.html#baz", a browser will check its cache by
doing a URI comparison for "http://example.com/blah.html" and, if the
resource is present in the cache, a match is declared.
Hence, comparisons for security purposes typically ignore the
fragment component and treat all fragments as equal to the full
resource. However, if one were actually trying to compare the piece
of a resource that was identified by the fragment identifier,
ignoring it would result in potential false positives.
<span class="h4"><a class="selflink" id="section-3.3.6" href="#section-3.3.6">3.3.6</a>. Resolution for Comparison</span>
It may be tempting to define a URI comparison algorithm based on
whether URIs resolve to the same content, along the lines of
resolving hostnames as described in <a href="#section-3.1.4">Section 3.1.4</a>. However, such an
algorithm would result in similar problems, including content that
dynamically changes over time or that is based on factors such as the
requester's location, potential lack of external connectivity at the
time or place that comparison is done, introduction of potentially
undesirable delay, etc.
In addition, as noted in <a href="#section-3.1.4">Section 3.1.4</a>, resolution leaks information
about security decisions to outsiders if the queries are publicly
observable.
<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. Email Address-Like Identifiers</span>
<a href="./rfc5322#section-3.4.1">Section 3.4.1 of [RFC5322]</a> defines the syntax of an email address-
like identifier, and <a href="./rfc6532#section-3.2">Section 3.2 of [RFC6532]</a> updates it to support
internationalization. <a href="./rfc5280#section-7.5">Section 7.5 of [RFC5280]</a> further discusses the
use of internationalized email addresses in certificates.
Regarding the security impact of internationalized email headers,
[<a href="./rfc6532" title=""Internationalized Email Headers"">RFC6532</a>] points to <a href="./rfc6530#section-14">Section 14 of [RFC6530]</a>, which contains a
discussion of many issues resulting from internationalization.
Email address-like identifiers have a local part and a domain part.
The issues with the domain part are essentially the same as with
hostnames, as covered earlier in <a href="#section-3.1">Section 3.1</a>.
The local part is left for each domain to define. People quite
commonly use email addresses as usernames with web sites such as
banks or shopping sites, but the site doesn't know whether
foo@example.com is the same person as FOO@example.com. Thus, email
address-like identifiers are typically Indefinite identifiers.
<span class="grey">Thaler Informational [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
To avoid false positives, some security mechanisms (such as those
described in [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>]) compare the local part using an exact match.
Hence, like URIs, email address-like identifiers are designed for use
in grant-on-match security schemes, not in deny-on-match schemes.
Furthermore, when such identifiers are actually used as email
addresses, <a href="./rfc5321#section-2.4">Section 2.4 of [RFC5321]</a> states that the local part of a
mailbox must be treated as case sensitive, but if a mailbox is stored
and accessed using a filesystem using case-insensitive paths, there
may be many paths that refer to the same mailbox. As such, false
negatives can be common in this case.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. General Issues</span>
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Conflation</span>
There are a number of examples (some in the preceding sections) of
strings that conflate two types of identifiers, using some heuristic
to try to determine which type of identifier is given. Similarly,
two ways of encoding the same type of identifier might be conflated
within the same string.
Some examples include:
1. A string that might be an IPv4 address literal or an IPv6 address
literal
2. A string that might be an IP address literal or a hostname
3. A string that might be a port number or a service name
4. A DNS label that might be literal or be Punycode-encoded
Strings that allow such conflation can only be considered Definite if
there exists a well-defined rule to determine which identifier type
is meant. One way to do so is to ensure that the valid syntax for
the two is disjoint (e.g., distinguishing IPv4 vs. IPv6 address
literals by the use of colons in the latter). A second way to do so
is to define a precedence rule that results in some identifiers being
inaccessible via a conflated string (e.g., a host literally named
"xn--de-jg4avhby1noc0d" may be inaccessible due to the "xn--" prefix
denoting the use of Punycode encoding). In some cases, such
inaccessible space may be reserved so that the actual set of
identifiers in use is unambiguous. For example, <a href="./rfc4291#section-2.5.5.2">Section 2.5.5.2 of
[RFC4291]</a> defines a range of the IPv6 address space for representing
IPv4 addresses.
<span class="grey">Thaler Informational [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Internationalization</span>
In addition to the issues with hostnames discussed in <a href="#section-3.1.3">Section 3.1.3</a>,
there are a number of internationalization issues that apply to many
types of Definite and Indefinite identifiers.
First, there is no DNS mechanism for identifying whether
non-identical strings would be seen by a human as being equivalent.
There are problematic examples even with US-ASCII (Basic Latin)
strings, including regional spelling variations such as "color" and
"colour", and with many non-English cases, including partially
numeric strings in Arabic script contexts, Chinese strings in
Simplified and Traditional forms, and so on. Attempts to produce
such alternate forms algorithmically could produce false positives
and hence have an adverse effect on security.
Second, some strings are visually confusable with others, and hence
if a security decision is made by a user based on visual inspection,
many opportunities for false positives exist. As such, using visual
inspection for security is unreliable. In addition to the security
issues, visual confusability also adversely affects the usability of
identifiers distributed via visual media. Similar issues can arise
with audible confusability when using audio (e.g., for radio
distribution, accessibility to the blind, etc.) in place of a visual
medium. Furthermore, when strings conflate two types of identifiers
as discussed in <a href="#section-4.1">Section 4.1</a>, allowing non-ASCII characters can cause
one type of identifier to appear to a human as another type of
identifier. For example, characters that may look like digits and
dots may appear to be an IPv4 literal to a human (especially to one
who might expect digits to appear in his or her native script).
Hence, conflation often increases the chance of confusability.
Determining whether a string is a valid identifier should typically
be done after, or as part of, canonicalization. Otherwise, an
attacker might use the canonicalization algorithm to inject (e.g.,
via percent encoding, Normalization Form KC (NFKC), or non-shortest-
form UTF-8) delimiters such as '@' in an email address-like
identifier, or a '.' in a hostname.
Any case-insensitive comparisons need to define how comparison is
done, since such comparisons may vary by the locale of the endpoint.
As such, using case-insensitive comparisons in general often results
in identifiers being either Indefinite or, if the legal character set
is restricted (e.g., to US-ASCII), Definite.
See also [<a href="#ref-WEBER" title=""Attacking Software Globalization"">WEBER</a>] for a more visual discussion of many of these
issues.
<span class="grey">Thaler Informational [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
Finally, the set of permitted characters and the canonical form of
the characters (and hence the canonicalization algorithm) sometimes
vary by protocol today, even when the intent is to use the same
identifier, such as when one protocol passes identifiers to the
other. See [<a href="./rfc6885" title=""Stringprep Revision and Problem Statement for the Preparation and Comparison of Internationalized Strings (PRECIS)"">RFC6885</a>] for further discussion.
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Scope</span>
Another issue arises when an identifier (e.g., "localhost",
"10.11.12.13", etc.) is not globally unique. <a href="./rfc3986#section-1.1">Section 1.1 of
[RFC3986]</a> states:
URIs have a global scope and are interpreted consistently
regardless of context, though the result of that interpretation
may be in relation to the end-user's context. For example,
"<a href="http://localhost/">http://localhost/</a>" has the same interpretation for every user of
that reference, even though the network interface corresponding to
"localhost" may be different for each end-user: interpretation is
independent of access.
Whenever an identifier that is not globally unique is passed to
another entity outside of the scope of uniqueness, it will refer to a
different resource and can result in a false positive. This problem
is often addressed by using the identifier together with some other
unique identifier of the context. For example, "alice" may uniquely
identify a user within a system but must be used with "example.com"
(as in "alice@example.com") to uniquely identify the context outside
of that system.
It is also worth noting that IPv6 addresses that are not globally
scoped can be written with, or otherwise associated with, a "zone ID"
to identify the context (see [<a href="./rfc4007" title=""IPv6 Scoped Address Architecture"">RFC4007</a>] for more information).
However, zone IDs are only unique within a host, so they typically
narrow, rather than expand, the scope of uniqueness of the resulting
identifier.
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Temporality</span>
Often, identifiers are not unique across all time but have some
lifetime associated with them after which they may be reassigned to
another entity. For example, bob@example.com might be assigned to an
employee of the Example company, but if he leaves and another Bob is
later hired, the same identifier might be reused. As another
example, IP address 203.0.113.1 might be assigned to one subscriber
and then later reassigned to another subscriber. Security issues can
arise if updates are not made in all entities that store the
identifier (e.g., in an access control list as discussed in
<a href="#section-2">Section 2</a>, or in a resolution cache as discussed in <a href="#section-3.1.4">Section 3.1.4</a>).
<span class="grey">Thaler Informational [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
This issue is similar to the issue of scope discussed in <a href="#section-4.3">Section 4.3</a>,
except that the scope of uniqueness is temporal rather than
topological.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span>
This entire document is about security considerations.
To minimize issues related to elevation of privilege, any system that
requires the ability to use both deny and allow operations within the
same identifier space should avoid the use of Indefinite identifiers
in security comparisons.
To minimize future security risks, any new identifiers being designed
should specify an Absolute or Definite comparison algorithm, and if
extensibility is allowed (e.g., as new schemes in URIs allow), then
the comparison algorithm should remain invariant so that unrecognized
extensions can be compared. That is, security risks can be reduced
by specifying the comparison algorithm, making sure to resolve any
ambiguities pointed out in this document (e.g., "standard dotted
decimal").
Some issues (such as unrecognized extensions) can be mitigated by
treating such identifiers as invalid. Validity checking of
identifiers is further discussed in [<a href="./rfc3696" title=""Application Techniques for Checking and Transformation of Names"">RFC3696</a>].
Perhaps the hardest issues arise when multiple protocols are used
together, such as in Figure 2, where the two protocols are defined or
implemented using different comparison algorithms. When constructing
an architecture that uses multiple such protocols, designers should
pay attention to any differences in comparison algorithms among the
protocols in order to fully understand the security risks. How to
deal with such security risks in current systems is an area for
future work.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Acknowledgements</span>
Yaron Goland contributed to the discussion on URIs. Patrik Faltstrom
contributed to the background on identifiers. John Klensin
contributed text in a number of different sections. Additional
helpful feedback and suggestions came from Bernard Aboba, Fred Baker,
Leslie Daigle, Mark Davis, Jeff Hodges, Bjoern Hoehrmann, Russ
Housley, Christian Huitema, Magnus Nystrom, Tom Petch, and Chris
Weber.
<span class="grey">Thaler Informational [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. IAB Members at the Time of Approval</span>
Bernard Aboba
Jari Arkko
Marc Blanchet
Ross Callon
Alissa Cooper
Spencer Dawkins
Joel Halpern
Russ Housley
David Kessens
Danny McPherson
Jon Peterson
Dave Thaler
Hannes Tschofenig
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Informative References</span>
[<a id="ref-IAB1123">IAB1123</a>] Internet Architecture Board, "IAB Statement: 'The
interpretation of rules in the ICANN gTLD Applicant
Guidebook'", February 2012, <<a href="http://www.iab.org/documents/">http://www.iab.org/documents/</a>
correspondence-reports-documents/2012-2/iab-statement-the-
interpretation-of-rules-in-the-icann-gtld-applicant-
guidebook>.
[<a id="ref-IANA-PORT">IANA-PORT</a>]
IANA, "Service Name and Transport Protocol Port Number
Registry", March 2013,
<<a href="http://www.iana.org/assignments/service-names-port-numbers/">http://www.iana.org/assignments/service-names-port-</a>
<a href="http://www.iana.org/assignments/service-names-port-numbers/">numbers/</a>>.
[<a id="ref-IEEE-1003.1">IEEE-1003.1</a>]
IEEE and The Open Group, "The Open Group Base
Specifications, Issue 6, IEEE Std 1003.1, 2004 Edition",
IEEE Std 1003.1, 2004.
[<a id="ref-JAVAURL">JAVAURL</a>] Oracle, "Class URL", Java(TM) Platform Standard Ed. 7,
2013, <<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html">http://docs.oracle.com/javase/7/docs/api/java/net/</a>
<a href="http://docs.oracle.com/javase/7/docs/api/java/net/URL.html">URL.html</a>>.
[<a id="ref-OASIS-SAMLv2-CORE">OASIS-SAMLv2-CORE</a>]
Cantor, S., Ed., Kemp, J., Ed., Philpott, R., Ed., and E.
Maler, Ed., "Assertions and Protocols for the OASIS
Security Assertion Markup Language (SAML) V2.0", OASIS
Standard saml-core-2.0-os, March 2005,
<<a href="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">http://docs.oasis-open.org/security/saml/v2.0/</a>
<a href="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">saml-core-2.0-os.pdf</a>>.
<span class="grey">Thaler Informational [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
[<a id="ref-OAuth-WRAP">OAuth-WRAP</a>]
Hardt, D., Ed., Tom, A., Eaton, B., and Y. Goland, "OAuth
Web Resource Authorization Profiles", Work in Progress,
January 2010.
[<a id="ref-PRIVACY-CONS">PRIVACY-CONS</a>]
Cooper, A., Tschofenig, H., Aboba, B., Peterson, J.,
Morris, J., Hansen, M., and R. Smith, "Privacy
Considerations for Internet Protocols", Work in Progress,
April 2013.
[<a id="ref-RFC1034">RFC1034</a>] Mockapetris, P., "Domain names - concepts and facilities",
STD 13, <a href="./rfc1034">RFC 1034</a>, November 1987.
[<a id="ref-RFC1123">RFC1123</a>] Braden, R., "Requirements for Internet Hosts - Application
and Support", STD 3, <a href="./rfc1123">RFC 1123</a>, October 1989.
[<a id="ref-RFC2277">RFC2277</a>] Alvestrand, H.T., "IETF Policy on Character Sets and
Languages", <a href="https://www.rfc-editor.org/bcp/bcp18">BCP 18</a>, <a href="./rfc2277">RFC 2277</a>, January 1998.
[<a id="ref-RFC3490">RFC3490</a>] Faltstrom, P., Hoffman, P., and A. Costello,
"Internationalizing Domain Names in Applications (IDNA)",
<a href="./rfc3490">RFC 3490</a>, March 2003.
[<a id="ref-RFC3492">RFC3492</a>] Costello, A., "Punycode: A Bootstring encoding of Unicode
for Internationalized Domain Names in Applications
(IDNA)", <a href="./rfc3492">RFC 3492</a>, March 2003.
[<a id="ref-RFC3493">RFC3493</a>] Gilligan, R., Thomson, S., Bound, J., McCann, J., and W.
Stevens, "Basic Socket Interface Extensions for IPv6",
<a href="./rfc3493">RFC 3493</a>, February 2003.
[<a id="ref-RFC3696">RFC3696</a>] Klensin, J., "Application Techniques for Checking and
Transformation of Names", <a href="./rfc3696">RFC 3696</a>, February 2004.
[<a id="ref-RFC3986">RFC3986</a>] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66,
<a href="./rfc3986">RFC 3986</a>, January 2005.
[<a id="ref-RFC4007">RFC4007</a>] Deering, S., Haberman, B., Jinmei, T., Nordmark, E., and
B. Zill, "IPv6 Scoped Address Architecture", <a href="./rfc4007">RFC 4007</a>,
March 2005.
[<a id="ref-RFC4291">RFC4291</a>] Hinden, R. and S. Deering, "IP Version 6 Addressing
Architecture", <a href="./rfc4291">RFC 4291</a>, February 2006.
<span class="grey">Thaler Informational [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
[<a id="ref-RFC4790">RFC4790</a>] Newman, C., Duerst, M., and A. Gulbrandsen, "Internet
Application Protocol Collation Registry", <a href="./rfc4790">RFC 4790</a>,
March 2007.
[<a id="ref-RFC4949">RFC4949</a>] Shirey, R., "Internet Security Glossary, Version 2",
<a href="./rfc4949">RFC 4949</a>, August 2007.
[<a id="ref-RFC5280">RFC5280</a>] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", <a href="./rfc5280">RFC 5280</a>, May 2008.
[<a id="ref-RFC5321">RFC5321</a>] Klensin, J., "Simple Mail Transfer Protocol", <a href="./rfc5321">RFC 5321</a>,
October 2008.
[<a id="ref-RFC5322">RFC5322</a>] Resnick, P., Ed., "Internet Message Format", <a href="./rfc5322">RFC 5322</a>,
October 2008.
[<a id="ref-RFC5952">RFC5952</a>] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6
Address Text Representation", <a href="./rfc5952">RFC 5952</a>, August 2010.
[<a id="ref-RFC6055">RFC6055</a>] Thaler, D., Klensin, J., and S. Cheshire, "IAB Thoughts on
Encodings for Internationalized Domain Names", <a href="./rfc6055">RFC 6055</a>,
February 2011.
[<a id="ref-RFC6066">RFC6066</a>] Eastlake, D., "Transport Layer Security (TLS) Extensions:
Extension Definitions", <a href="./rfc6066">RFC 6066</a>, January 2011.
[<a id="ref-RFC6125">RFC6125</a>] Saint-Andre, P. and J. Hodges, "Representation and
Verification of Domain-Based Application Service Identity
within Internet Public Key Infrastructure Using X.509
(PKIX) Certificates in the Context of Transport Layer
Security (TLS)", <a href="./rfc6125">RFC 6125</a>, March 2011.
[<a id="ref-RFC6335">RFC6335</a>] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S.
Cheshire, "Internet Assigned Numbers Authority (IANA)
Procedures for the Management of the Service Name and
Transport Protocol Port Number Registry", <a href="https://www.rfc-editor.org/bcp/bcp165">BCP 165</a>,
<a href="./rfc6335">RFC 6335</a>, August 2011.
[<a id="ref-RFC6530">RFC6530</a>] Klensin, J. and Y. Ko, "Overview and Framework for
Internationalized Email", <a href="./rfc6530">RFC 6530</a>, February 2012.
[<a id="ref-RFC6532">RFC6532</a>] Yang, A., Steele, S., and N. Freed, "Internationalized
Email Headers", <a href="./rfc6532">RFC 6532</a>, February 2012.
<span class="grey">Thaler Informational [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc6943">RFC 6943</a> Identifier Comparison May 2013</span>
[<a id="ref-RFC6818">RFC6818</a>] Yee, P., "Updates to the Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", <a href="./rfc6818">RFC 6818</a>, January 2013.
[<a id="ref-RFC6874">RFC6874</a>] Carpenter, B., Cheshire, S., and R. Hinden, "Representing
IPv6 Zone Identifiers in Address Literals and Uniform
Resource Identifiers", <a href="./rfc6874">RFC 6874</a>, February 2013.
[<a id="ref-RFC6885">RFC6885</a>] Blanchet, M. and A. Sullivan, "Stringprep Revision and
Problem Statement for the Preparation and Comparison of
Internationalized Strings (PRECIS)", <a href="./rfc6885">RFC 6885</a>, March 2013.
[<a id="ref-TR36">TR36</a>] Unicode Consortium, "Unicode Security Considerations",
Unicode Technical Report #36, Revision 11, July 2012,
<<a href="http://www.unicode.org/reports/tr36/">http://www.unicode.org/reports/tr36/</a>>.
[<a id="ref-USASCII">USASCII</a>] American National Standards Institute, "Coded Character
Sets -- 7-bit American Standard Code for Information
Interchange (7-bit ASCII)", ANSI X3.4, 1986.
[<a id="ref-WEBER">WEBER</a>] Weber, C., "Attacking Software Globalization", March 2010,
<<a href="http://www.lookout.net/files/Chris_Weber_Character%20Transformations%20v1.7_IUC33.pdf">http://www.lookout.net/files/</a>
<a href="http://www.lookout.net/files/Chris_Weber_Character%20Transformations%20v1.7_IUC33.pdf">Chris_Weber_Character%20Transformations%20v1.7_IUC33.pdf</a>>.
Author's Address
Dave Thaler (editor)
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA
Phone: +1 425 703 8835
EMail: dthaler@microsoft.com
Thaler Informational [Page 26]
</pre>
|