|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Adam Rice <ricea@chromium.org> |
| 3 | +Date: Wed, 2 Dec 2020 20:26:52 +0000 |
| 4 | +Subject: Add ports 5060 and 5061 to the restricted list |
| 5 | + |
| 6 | +Some NAT devices examine traffic on port 5060 to look for a valid SIP |
| 7 | +message. If they find one, they will forward a port back to the origin |
| 8 | +host. A carefully crafted HTTP request can trick these NAT devices into |
| 9 | +forwarding an arbitrary port. See https://samy.pl/slipstream for more |
| 10 | +details on the attack and sample code. |
| 11 | + |
| 12 | +Block port 5060 for HTTP. Out of an abundance of caution, and to match |
| 13 | +the Fetch standard (https://github.com/whatwg/fetch/pull/1109), also |
| 14 | +block port 5061 (SIP over TLS). |
| 15 | + |
| 16 | +Also reduce the whitespace before protocol description comments. This |
| 17 | +was insisted on by clang-format and is not worth fighting. |
| 18 | + |
| 19 | +BUG=1145680 |
| 20 | + |
| 21 | +(cherry picked from commit 90d1302aec437166b383eabc08af741bf24f7ea8) |
| 22 | + |
| 23 | +(cherry picked from commit dbb0452e69a49e803e0e4cbb6921d5ccad338716) |
| 24 | + |
| 25 | +Change-Id: I3a556fbbb4dc6099caa4418addaf1e89bf254ae3 |
| 26 | +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519174 |
| 27 | +Reviewed-by: Matt Menke <mmenke@chromium.org> |
| 28 | +Commit-Queue: Adam Rice <ricea@chromium.org> |
| 29 | +Cr-Original-Original-Commit-Position: refs/heads/master@{#824254} |
| 30 | +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2525474 |
| 31 | +Reviewed-by: Adam Rice <ricea@chromium.org> |
| 32 | +Cr-Original-Commit-Position: refs/branch-heads/4280@{#1247} |
| 33 | +Cr-Original-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852} |
| 34 | +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560585 |
| 35 | +Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> |
| 36 | +Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> |
| 37 | +Commit-Queue: Artem Sumaneev <asumaneev@google.com> |
| 38 | +Cr-Commit-Position: refs/branch-heads/4240@{#1474} |
| 39 | +Cr-Branched-From: f297677702651916bbf65e59c0d4bbd4ce57d1ee-refs/heads/master@{#800218} |
| 40 | + |
| 41 | +diff --git a/net/base/port_util.cc b/net/base/port_util.cc |
| 42 | +index 63a7c35c39eb965d8a752bd262c115a8263733f9..41deaaded2f251d6153c01203b68cc6bdc06554f 100644 |
| 43 | +--- a/net/base/port_util.cc |
| 44 | ++++ b/net/base/port_util.cc |
| 45 | +@@ -20,73 +20,75 @@ namespace { |
| 46 | + // The general list of blocked ports. Will be blocked unless a specific |
| 47 | + // protocol overrides it. (Ex: ftp can use ports 20 and 21) |
| 48 | + const int kRestrictedPorts[] = { |
| 49 | +- 1, // tcpmux |
| 50 | +- 7, // echo |
| 51 | +- 9, // discard |
| 52 | +- 11, // systat |
| 53 | +- 13, // daytime |
| 54 | +- 15, // netstat |
| 55 | +- 17, // qotd |
| 56 | +- 19, // chargen |
| 57 | +- 20, // ftp data |
| 58 | +- 21, // ftp access |
| 59 | +- 22, // ssh |
| 60 | +- 23, // telnet |
| 61 | +- 25, // smtp |
| 62 | +- 37, // time |
| 63 | +- 42, // name |
| 64 | +- 43, // nicname |
| 65 | +- 53, // domain |
| 66 | +- 77, // priv-rjs |
| 67 | +- 79, // finger |
| 68 | +- 87, // ttylink |
| 69 | +- 95, // supdup |
| 70 | +- 101, // hostriame |
| 71 | +- 102, // iso-tsap |
| 72 | +- 103, // gppitnp |
| 73 | +- 104, // acr-nema |
| 74 | +- 109, // pop2 |
| 75 | +- 110, // pop3 |
| 76 | +- 111, // sunrpc |
| 77 | +- 113, // auth |
| 78 | +- 115, // sftp |
| 79 | +- 117, // uucp-path |
| 80 | +- 119, // nntp |
| 81 | +- 123, // NTP |
| 82 | +- 135, // loc-srv /epmap |
| 83 | +- 139, // netbios |
| 84 | +- 143, // imap2 |
| 85 | +- 179, // BGP |
| 86 | +- 389, // ldap |
| 87 | +- 427, // SLP (Also used by Apple Filing Protocol) |
| 88 | +- 465, // smtp+ssl |
| 89 | +- 512, // print / exec |
| 90 | +- 513, // login |
| 91 | +- 514, // shell |
| 92 | +- 515, // printer |
| 93 | +- 526, // tempo |
| 94 | +- 530, // courier |
| 95 | +- 531, // chat |
| 96 | +- 532, // netnews |
| 97 | +- 540, // uucp |
| 98 | +- 548, // AFP (Apple Filing Protocol) |
| 99 | +- 556, // remotefs |
| 100 | +- 563, // nntp+ssl |
| 101 | +- 587, // smtp (rfc6409) |
| 102 | +- 601, // syslog-conn (rfc3195) |
| 103 | +- 636, // ldap+ssl |
| 104 | +- 993, // ldap+ssl |
| 105 | +- 995, // pop3+ssl |
| 106 | +- 2049, // nfs |
| 107 | +- 3659, // apple-sasl / PasswordServer |
| 108 | +- 4045, // lockd |
| 109 | +- 6000, // X11 |
| 110 | +- 6665, // Alternate IRC [Apple addition] |
| 111 | +- 6666, // Alternate IRC [Apple addition] |
| 112 | +- 6667, // Standard IRC [Apple addition] |
| 113 | +- 6668, // Alternate IRC [Apple addition] |
| 114 | +- 6669, // Alternate IRC [Apple addition] |
| 115 | +- 6697, // IRC + TLS |
| 116 | ++ 1, // tcpmux |
| 117 | ++ 7, // echo |
| 118 | ++ 9, // discard |
| 119 | ++ 11, // systat |
| 120 | ++ 13, // daytime |
| 121 | ++ 15, // netstat |
| 122 | ++ 17, // qotd |
| 123 | ++ 19, // chargen |
| 124 | ++ 20, // ftp data |
| 125 | ++ 21, // ftp access |
| 126 | ++ 22, // ssh |
| 127 | ++ 23, // telnet |
| 128 | ++ 25, // smtp |
| 129 | ++ 37, // time |
| 130 | ++ 42, // name |
| 131 | ++ 43, // nicname |
| 132 | ++ 53, // domain |
| 133 | ++ 77, // priv-rjs |
| 134 | ++ 79, // finger |
| 135 | ++ 87, // ttylink |
| 136 | ++ 95, // supdup |
| 137 | ++ 101, // hostriame |
| 138 | ++ 102, // iso-tsap |
| 139 | ++ 103, // gppitnp |
| 140 | ++ 104, // acr-nema |
| 141 | ++ 109, // pop2 |
| 142 | ++ 110, // pop3 |
| 143 | ++ 111, // sunrpc |
| 144 | ++ 113, // auth |
| 145 | ++ 115, // sftp |
| 146 | ++ 117, // uucp-path |
| 147 | ++ 119, // nntp |
| 148 | ++ 123, // NTP |
| 149 | ++ 135, // loc-srv /epmap |
| 150 | ++ 139, // netbios |
| 151 | ++ 143, // imap2 |
| 152 | ++ 179, // BGP |
| 153 | ++ 389, // ldap |
| 154 | ++ 427, // SLP (Also used by Apple Filing Protocol) |
| 155 | ++ 465, // smtp+ssl |
| 156 | ++ 512, // print / exec |
| 157 | ++ 513, // login |
| 158 | ++ 514, // shell |
| 159 | ++ 515, // printer |
| 160 | ++ 526, // tempo |
| 161 | ++ 530, // courier |
| 162 | ++ 531, // chat |
| 163 | ++ 532, // netnews |
| 164 | ++ 540, // uucp |
| 165 | ++ 548, // AFP (Apple Filing Protocol) |
| 166 | ++ 556, // remotefs |
| 167 | ++ 563, // nntp+ssl |
| 168 | ++ 587, // smtp (rfc6409) |
| 169 | ++ 601, // syslog-conn (rfc3195) |
| 170 | ++ 636, // ldap+ssl |
| 171 | ++ 993, // ldap+ssl |
| 172 | ++ 995, // pop3+ssl |
| 173 | ++ 2049, // nfs |
| 174 | ++ 3659, // apple-sasl / PasswordServer |
| 175 | ++ 4045, // lockd |
| 176 | ++ 5060, // sip |
| 177 | ++ 5061, // sips |
| 178 | ++ 6000, // X11 |
| 179 | ++ 6665, // Alternate IRC [Apple addition] |
| 180 | ++ 6666, // Alternate IRC [Apple addition] |
| 181 | ++ 6667, // Standard IRC [Apple addition] |
| 182 | ++ 6668, // Alternate IRC [Apple addition] |
| 183 | ++ 6669, // Alternate IRC [Apple addition] |
| 184 | ++ 6697, // IRC + TLS |
| 185 | + }; |
| 186 | + |
| 187 | + // FTP overrides the following restricted port. |
0 commit comments