[17] プロトコル横断攻撃を防止するため、一部のポートの fetch は禁止されています。これを port blocking といいます。
[23] 要求要求について should be blocked due to a bad port は、次のようにします >>16。
1 7 9 11 13 15 17 19 20 21 22 23 25 37 42 43 53 77 79 87 95 101 102 103 104 109 110 111 113 115 117 119 123 135 139 143 179 389 427 465 512 513 514 515 526 530 531 532 540 548 556 563 587 601 636 993 995 2049 3659 4045 6000 6665 6666 6667 6668 6669 6697
[48] 悪いポートを既定のポートとするプロトコルの多くは、 プロトコル横断攻撃の危険性が知られる前に作られていて何の対策もしていなかったり、 多くのサーバーや Unix 系システムで標準状態で動作していたりして、 ポート制限がなければ危険であると考えられています。 そうしたポートで HTTP を使うことは無いでしょうから、 制限に実害もありません。
[49] 新しいプロトコルの設計者は、 おそらくこれら以外のポート番号を使うこととなるでしょうから、 プロトコル横断攻撃への対策を考える必要があります。
[11] Webブラウザー独自の制限に加えて、 OS のネットワークスタックレベルでの (利用者や管理者の設定による) 制限があるかもしれません。
[12] 所属ネットワークなどの (ルーター等の) 制限で、接続できないポートがあるかもしれません。
[13] こうした制限は、実際に接続を試みないとWebブラウザーからは検知できませんから、 OS に接続の開始を指示した後、拒まれたとのエラーになったり、 接続を開始した後にタイムアウトでネットワークエラーとなったりします。
[47] 制限の実装方法にもよりますが、タイムアウトまでに非常に時間がかかり、 しかも利用者にはエラーの正確な原因が通知されず、 非常に悪い利用者体験となることがあります。 ネットワーク管理者は、安易にポートを制限して利用者を混乱させるべきではありません。
[39] に報告されたフォームを使ったプロトコル横断攻撃に対処するため、 Mozilla は特定の特権ポートへのアクセスを遮断することにしました。 他の Webブラウザーも追随しました。
IE8's current port-block list contains:
19 (chargen), 21 (ftp), 25 (smtp), 110 (pop3), 119 (nntp), 143 (imap2), 220 (imap3), 993 (secure imap)
Blocking ports 220 and 993 is new to IE8.
[15] IRC の 6667 番は Chrome や Firefox ではブロックされますが、
IE ではされません。 IRC サーバーの実装によっては、
GET
や HEAD
や POST
のような命令 (大文字や小文字)
に対して
ERROR :"Oops, HTTP request received? This is IRC!"... のように返答して接続を閉じるようです。
[40] HTML5 により規定される WebSocket は、 プロトコル横断攻撃を防ぐため、 port blocking を適用することを明文化しました。 ただしどのポートを遮断するべきかは実装に委ねていました。
If port is a port to which the user agent is configured to block access, then throw a SecurityError exception and abort these steps. (User agents typically block access to well-known ports like SMTP.)
Access to ports 80 and 443 should not be blocked, including the unlikely cases when secure is false but port is 443 or secure is true but port is 80.
[3] 利用者エージェントが接続しないように設定されているポートが指定されたら、
SecurityError
例外を投げなければなりません >>2。
[4] ただし 80
と 443
は、
制限するべきではありません >>2。
[14] WebSocket handshake は異なるプロトコルを偽装して接続する攻撃を防ぐように設計されていますから、 他のプロトコルが動作するポートに接続できたとしても HTTP ほど問題にはならないかもしれません。
[18] 2016年3月に、 Fetch Standard で port blocking が規定されました。 HTML Standard の WebSocket に関する規定もこれに統合されました。 これによって誕生から15年を経て初めてWebプラットフォーム全体の port blocking が明文化されました。
[41] WebSocket: leave port blocking to the network layer (Fetch) · whatwg/html@17336ad ( 版) https://github.com/whatwg/html/commit/17336ad69be4744dfc17194f2ee51bd730ca4d93
[42] Update WebSocket to use Fetch's WebSocket alterations · whatwg/html@3dadbca ( 版) https://github.com/whatwg/html/commit/3dadbcad063a10b586ef52dd4b427aa339048ee7
[44] eduroam JP - Minimal available services (protocols) ( 版) http://www.eduroam.jp/docs/thru-proto.html
[50] Editorial: use network and HTTP(S) scheme concepts ( (annevk著, )) https://github.com/whatwg/fetch/commit/a7e7af28629938544d1b705225d04776261a2ff4
[51] Block more ports (427, 548, 6697) (annevk著, ) https://github.com/whatwg/fetch/commit/2e456740b0ce4145ef2a84bcc3bb5fa2e8b1f5b5
[52] Add { 548, 'afp' } to the blocked bad ports · Issue #694 · whatwg/fetch () https://github.com/whatwg/fetch/issues/694
[53] Block AFP ports (427, 548) by annevk · Pull Request #738 · whatwg/fetch () https://github.com/whatwg/fetch/pull/738
[54] Add several ports to the "bad ports" list. · Issue #482 · whatwg/fetch () https://github.com/whatwg/fetch/issues/482
[55] Fetch: port blocking change (427, 548) by annevk · Pull Request #11249 · web-platform-tests/wpt () https://github.com/web-platform-tests/wpt/pull/11249
[56] Centralize blocked port list · Issue #11346 · web-platform-tests/wpt () https://github.com/web-platform-tests/wpt/issues/11346
[57] Intent to Deprecate and Remove: Support for HTTP over port 9100, 6697, and 631. - Google グループ () https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/Ttkgd4aPkW0/7Uwd-S16BwAJ
ws
やwss
) は、この判定の時点でhttp
やhttps
に書き換えられているので、 HTTP の制約が適用されます。