2023年09月04日 10:00
internationalized domain names (idn) in googlechrome
google chrome中的国际化域名(idn)
background
背景
many years ago, domains could only consist of the latin letters a to z,digits, and a few other characters. internationalized domain names (idns) were created to better support non-latinalphabets for web users around the globe.
许多年前,域名只能由拉丁字母a到z、数字和其他几个字符组成。创建国际化域名(idn)是为了更好地支持全球互联网用户的非拉丁字符的使用。
different characters from different (or even the same!) languages can lookvery similar. we’ve seen reports of proof-of-concept attacks. these arecalled homograph attacks. for example, the latin “a” looks a lot like the cyrillic“а”, so someone could register http://ebаy.com (usingcyrillic “а”), which could be confused for http://ebay.com. this is a limitation of how urls are displayed in browsers in general,not a specific bug in chrome.
来自不同语言(甚至相同语言!)的不同字符看起来可能非常相似。我们已经看到了概念验证攻击的报告。这些被称为同形异义字攻击。例如,拉丁语“a”看起来很像西里尔语“a”,所以有人可以注册http://ebаy.com(使用西里尔语“а”),这可能会与http://ebay.com混淆。这不是chrome中的漏洞,而是url在浏览器中显示方式局限性的问题。
in a perfect world, domain registrars would not allow these confusabledomain names to be registered. some domain registrars do exactly that, mostlyby restricting the characters allowed, but many do not. to better protectagainst these attacks, browsers display some domains in punycode(lookslike xn--...) instead of the original idn, according to their own idn policies.
在理想情况下,域名注册商不会允许注册这些易混淆的域名。一些域名注册商通过限制字符,来禁止注册易混淆的域名,但许多注册商没有限制。为了更好地抵御这些攻击,浏览器根据自己的idn策略,以punycode(看起来像xn--...)显示域名,而不显示原始的idn。
this is a challenging problem space. chrome has a global user base ofbillions of people around the world, many of whom are not viewing urls withlatin letters. we want to prevent confusion, while ensuring that users acrosslanguages have a great experience in chrome. displaying either punycode or avisible security warning on too wide of a set of urls would hurt web usabilityfor people around the world.
这是一个具有挑战性的问题。chrome拥有全球数十亿人的用户群,其中许多人不访问使用拉丁字母的url。我们希望可以防止混淆,同时确保跨语言的用户在chrome中拥有良好的体验。在很长的url中显示punycode或可见的安全警告,将损害世界各地人民的网络可用性。
chrome and other browsers try to balance these needs by implementing idnpolicies in a way that allows idn to be shown for valid domains, but protectsagainst confusable homograph attacks.
chrome和其他浏览器试图通过实施idn策略来平衡这些需求,该策略允许idn显示为有效域名,且可以防止易混淆的同形异义字的攻击。
chrome's idn policy is one of several tools that aim to protectusers. google safe browsing continuesto help protect over two billion devices every day by showing warnings to userswhen they attempt to navigate to dangerous or deceptive sites or downloaddangerous files. password managers continue to remember which domain passwordlogins are for, and won’t automatically fill a password into a domain that is not theexactly correct one.
chrome的idn政策是旨在保护用户的几种工具之一。googlesafe browsing每天持续帮助保护超过20亿台设备,当用户试图跳转到危险或欺骗性网站或下载危险文件时向他们发出警告。密码管理器记住使用密码的域名,并且不会自动将密码填充到不正确的域名中。
how idn works
idn的工作原理
idns were devised to support arbitrary unicode characters in hostnames ina backward-compatible way. this works by having user agents transform hostnamescontaining non-ascii unicode characters into an ascii-only hostname, which canthen be sent on to dns servers. this is done by encoding each domain label intoits punycode representation. this representation includes a four-characterprefix (xn--) and then the unicode translated to ascii compatible encoding (ace). forexample, http://öbb.at is transformed to http://xn--bb-eka.at.
idn旨在以向后兼容的方式支持主机名中的任意unicode字符。这个工作是通过用户代理将包含非ascii unicode字符的主机名转换为仅限ascii的主机名,然后发送到dns服务器。这是通过将每个域名标签编码到其punycode表示形式来实现的。此表示形式包括一个四个字符的前缀(xn--),然后翻译成ascii兼容编码(ace)的unicode。例如,http://öbb.at转换为http://xn--bb-eka.at。
google chrome's idn policy
google chrome的idn政策
since chrome 51, chrome uses an idn display policy that does not take intoaccount the language settings (the accept-language list) of the browser.a similar strategy is used by firefox.
自chrome51以来,chrome使用的idn显示策略不考虑浏览器的语言设置(接受语言列表)。firefox使用类似的策略。
google chrome decides if it should show unicode or punycode for eachdomain label (component) of a hostname separately. to decide if a componentshould be shown in unicode, google chrome uses the following algorithm:
googlechrome决定是否应该为主机名的每个域名标签(称为组件)分别显示unicode或punycode。为了决定组件是否应该以unicode中显示,google chrome使用以下算法:
1. converteach component stored in the ace to unicode per uts 46 transitional processing (tounicode).
1. 根据uts46过渡处理(tounicode),将存储在ace中的每个组件转换为unicode。
2. if there isan error in tounicode conversion (e.g. contains disallowed characters, starts with a combining mark, or violates bidi rules), show punycode.
2. 如果tounicode转换中出现错误(例如,包含不允许的字符、以组合标记开头或违反bidi规则),则显示punycode。
3. if there isa character in a label not belonging to characters allowed in identifiers per unicode technical standard 39 (uts 39), show punycode.
3. 如果标签中的字符不属于unicode技术标准39(uts 39)标识符中允许的字符,则显示punycode。
4. if anycharacter in a label belongs to the disallowed list, show punycode.
4. 如果标签中的任何字符属于不允许的列表,则显示punycode。
5. if thecomponent uses characters drawn from multiple scripts, it is subject to ascript mixing check based on “highly restrictive” profile of uts 39with an additional restriction on latin. if thecomponent fails the check, show the component in punycode.
5. 如果组件使用从多个脚本中提取的字符,则需要根据uts 39的“高度限制”配置文件进行脚本混合检查,并对拉丁语有额外的限制。如果组件检查失败,则用punycode显示组件。
· latin, cyrillicor greek characters cannot be mixed with each other
· 拉丁语、西里尔语或希腊语字符不能混合在一起
· latincharacters in the ascii range can be mixed only with chinese (han, bopomofo),japanese (kanji, katakana, hiragana), or korean (hangul, hanja)
· ascii范围内的拉丁字符只能与中文(汉字、注音符号)、日语(日语汉字、片假名、平假名)或韩语(韩语字母、韩语汉字)混合
· han (cjkideographs) can be mixed with bopomofo
· 汉字(cjk表意文字)可以与注音符号混合
· han can bemixed with hiragana and katakana
· 汉字可以和平假名和片假名混合
· han can bemixed with korean hangul
· 汉字可以和韩国韩语字母混合
6. if two ormore numbering systems (e.g. european digits bengali digits) are mixed, showpunycode.
6. 如果两个或多个编号系统混合(例如欧洲数字孟加拉数字),则显示punycode。
7. if thereare any invisible characters (e.g. a sequence of the same combining mark or asequence of kana combining marks), show punycode.
7. 如果有任何不可见的字符(例如相同组合标记的序列或假名组合标记的序列),则显示punycode。
8. if thereare any characters used in an unusual way, show punycode. e.g. latin middle dot (·) usedoutside elageminada.
8. 如果有任何字符以不寻常的方式使用,则显示punycode。例如,拉丁的中间的点 (·) 在 ela geminada 之外使用。
9. test thelabel for mixed script confusable per uts 39. if mixed script confusable is detected, showpunycode.
9. 根据uts 39测试混合字符的标签。如果检测到混合字符可混淆,则punycode。
10. test thelabel for whole script confusables: if all the letters in a given label belong to a setof whole-script-confusable letters in one of the whole-script-confusable scripts and if the hostname doesn't have acorresponding allowed top-level-domain for that script, show punycode. examplefor cyrillic: the first label in hostname аррӏе.com (xn--80ak6aa92e.com) isall cyrillic letters that look like latinletters and thetld (com) is not cyrillic and the tld is not one of the tldsknown to host a large number of cyrillic domains (e.g. ru, su, pyc, ua). show itin punycode.
10. 测试全脚本可混淆的标签:如果给定标签中的所有字母都属于一个全脚本可混淆脚本中的一组全脚本可混淆字母,并且主机名没有相应的允许的顶级域名,则显示punycode。西里尔字母示例:主机名аррӏе.com(xn--80ak6aa92e.com)中的第一个标签是看起来像拉丁字母的西里尔字母,并且tld(com)不是西里尔字母,并且该tld不是已知托管大量西里尔域名的tld之一(例如ru、su、pyc、ua)。显示punycode。
11. if thelabel contains only digits and digit spoofs, show punycode.
11. 如果标签只包含数字和数字欺骗,将显示punycode。
12. if thelabel matches a dangerous pattern, show punycode.
12. 如果标签与危险图案匹配,将显示punycode。
13. ifthe skeleton of the registrable part of a hostname isidentical to one of the top domains after removing diacritic marks and mappingeach character to its spoofing skeleton (e.g. www.googlé.com with é inplace of e), show punycode.
13. 如果在删除变音符号并将每个字符映射到其欺骗性结构(例如www.googlé.com用é代替e)后,主机名可注册部分的结构与顶级域之一相同,则显示punycode。
otherwise, show unicode.
否则,则显示unicode。
this is implemented by idntounicodeonecomponent() and isidncomponentsafe() in components/url_formatter/url_formatter.ccand idnspoofchecker classin components/url_formatter/spoof_checks/idn_spoof_checker.cc.
这由components/url_formatter/url_formatter.cc中的idntounicodeonecomponent()和isidncomponentsafe()以及components/url_formatter/spoof_checks/idn_spoof_checker.cc中的idnspoofchecker类实现。
additional protections
额外保护
in addition to the spoof checks above, chrome also implements a full pagesecurity warning to protect against lookalike urls. you can find an example ofthis warning at chrome://interstitials/lookalike. thiswarning blocks main frame navigations that involve lookalike urls, either as adirect navigation or as part of a redirect.
除了上面的欺骗检查外,chrome还实现了全页面安全警告,以防止类似的url。您可以在chrome://interstitials/lookalike上找到此警告的示例。此警告会阻止涉及相似url的主框架导航,无论是作为直接导航还是重定向的一部分。
the algorithm to show this warning is as follows:
显示此警告的算法如下:
1. if thescheme of the navigation is not http or https, allow thenavigation.
1. 如果导航方案不是http或https,则允许导航。
2. if thenavigation is a redirect, check the redirect chain. if the redirect chain issafe, allow the navigation. (see defensive registrations section for details).
2. 如果导航是重定向,将检查重定向链。如果重定向链是安全的,则允许导航。(详情请参阅防御性注册部分)。
3. if thehostname of the navigation has at least a medium site engagement score, allowthe navigation. site engagement score is assigned to sites by the site engagement service.
3. 如果导航的主机名至少具有中等网站参与度分数,则允许导航。网站参与度分数由网站参与服务分配给网站。
4. if thehostname of the navigation is in domains.list,allow the navigation.
4. 如果导航的主机名在domains.list,则允许导航。
5. if the userpreviously allowed the hostname of the navigation by clicking “ignore” in the warning, allowthe navigation. currently, user decisions are stored per tab, so navigating tothe same site in a new tab may show the warning.
5. 如果用户之前通过单击警告中的“忽略”允许导航的主机名,则允许导航。目前,用户决策按选项卡存储,因此在新选项卡中导航到同一网站可能会显示警告。
6. if thehostname has the same skeleton as a recently engaged site or a top 500 domain,block the navigation and show the warning.
6. 如果用户之前通过单击警告中的“忽略”允许导航的主机名,则允许导航。目前,用户决策按选项卡存储,因此在新选项卡中导航到同一网站可能会显示警告。
all of these checks are done locally on the client side.
所有这些检查都是在客户端本地完成的。
defensive registrations
防御性注册
domain owners can sometimes register multiple versions of their domains,such as the ascii and idn versions, to improve user experience and preventpotential spoofs. we call these supplementary domains defensive registrations.
域名所有者有时可以注册其域名的多个版本,如ascii和idn版本,以改善用户体验并防止潜在的欺骗。我们称这些补充域名为防御性注册。
in some cases, chrome's lookalike warning may flag and block navigationsto these domains:
在某些情况下,chrome的相似警告可能会标记和阻止导航到以下域名:
· if one ofthe sites is in domains.list butthe other isn't, the latter will be blocked.
· 如果其中一个网站在domains.list中,而另一个不在,后者将被阻止。
· if the userengaged with one of the sites but not the other, the latter will be blocked.
· 如果用户使用其中一个网站,但不与另一个网站互动,后者将被阻止。
avoiding a lookalike warning on your site
避免在您的网站上出现相似警告
domain owners can avoid the “did you mean” warning by redirecting theirdefensive registrations to their canonical domain.
域名所有者可以通过将防御性注册重定向到主域名来避免“你是说”警告。
example: if youown both example.com and éxample.com and the majority of your traffic is to example.com, you can fix the warning by redirecting éxample.com to example.com. the lookalike warning logic considers this a safe redirect and allowsthe navigation. if you must also redirect http navigationsto https, do this in a single redirect such as http://éxample.com -> https://example.com. use http 301 or http 302 redirects, the lookalikewarning ignores meta redirects.
示例:如果您同时拥有 example.com 和 éxample.com,并且您的大部分流量都流向了 example.com,您可以通过将éxample.com 重定向到 example.com 来修复警告。相似警告逻辑认为这是一个安全的重定向并允许导航。如果您必须将 http 导航重定向到 https,请在单个重定向中执行此操作,例如 http://éxample.com ->https://example.com。使用 http 301 或 http 302 重定向,相似警告会忽略元重定向。
reporting security bugs
报告安全漏洞
we reward certain cases of idn spoofs according to chrome's vulnerability reward program policies. please see this document before reporting a security bug.
我们会根据chrome的漏洞奖励计划政策奖励某些idn欺诈案件。在报告安全漏洞之前,请参阅此文档。
poweredby gitiles| privacy