Skip to content

Commit a2c2075

Browse files
authored
Merge pull request #12 from doyensec/fix/expand-private-net-block
Updated Private Network Ranges Blocklist
2 parents 1bd4101 + d8f1021 commit a2c2075

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

client_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ func TestBlockedIP(t *testing.T) {
2929
"[::ffff:192.0.2.1]",
3030
// ipv6
3131
"[::]:80", "[0000::1]:80", "[::1]/server-status",
32+
// ipv6 -> 169.254.169.254 translation (nat64 local-use prefix)
33+
"[64:ff9b:1::a9fe:a9fe]",
34+
// segment routing
35+
"[5f00:5aa9:e79f:8940:a51a:be61:ef3b:bab9]",
36+
// documentation
37+
"[3fff:4e1:6fb3:f8a2:7948:ff06:258:486]",
38+
// ipv6 dummy prefix
39+
"[100::1:a442:286a:836e:da87]",
3240
}
3341

3442
for _, ip := range ips {

ip.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,24 @@ var privateNetworks = []net.IPNet{
2525
parseCIDR("255.255.255.255/32"), /* Broadcast - RFC 919, Section 7 */
2626
parseCIDR("100.64.0.0/10"), /* Shared Address Space - RFC 6598 */
2727
// ipv6 sourced from https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
28-
parseCIDR("::/128"), /* Unspecified Address - RFC 4291 */
29-
parseCIDR("::1/128"), /* Loopback - RFC 4291 */
30-
parseCIDR("100::/64"), /* Discard prefix - RFC 6666 */
31-
parseCIDR("2001::/23"), /* IETF Protocol Assignments - RFC 2928 */
32-
parseCIDR("2001:2::/48"), /* Benchmarking - RFC5180 */
33-
parseCIDR("2001:db8::/32"), /* Addresses used in documentation and example source code - RFC 3849 */
34-
parseCIDR("2001::/32"), /* Teredo tunneling - RFC4380 - RFC8190 */
35-
parseCIDR("fc00::/7"), /* Unique local address - RFC 4193 - RFC 8190 */
36-
parseCIDR("fe80::/10"), /* Link-local address - RFC 4291 */
37-
parseCIDR("ff00::/8"), /* Multicast - RFC 3513 */
38-
parseCIDR("2002::/16"), /* 6to4 - RFC 3056 */
39-
parseCIDR("64:ff9b::/96"), /* IPv4/IPv6 translation - RFC 6052 */
40-
parseCIDR("2001:10::/28"), /* Deprecated (previously ORCHID) - RFC 4843 */
41-
parseCIDR("2001:20::/28"), /* ORCHIDv2 - RFC7343 */
28+
parseCIDR("::/128"), /* Unspecified Address - RFC 4291 */
29+
parseCIDR("::1/128"), /* Loopback - RFC 4291 */
30+
parseCIDR("100::/64"), /* Discard prefix - RFC 6666 */
31+
parseCIDR("2001::/23"), /* IETF Protocol Assignments - RFC 2928 */
32+
parseCIDR("2001:2::/48"), /* Benchmarking - RFC5180 */
33+
parseCIDR("2001:db8::/32"), /* Addresses used in documentation and example source code - RFC 3849 */
34+
parseCIDR("2001::/32"), /* Teredo tunneling - RFC4380 - RFC8190 */
35+
parseCIDR("fc00::/7"), /* Unique local address - RFC 4193 - RFC 8190 */
36+
parseCIDR("fe80::/10"), /* Link-local address - RFC 4291 */
37+
parseCIDR("ff00::/8"), /* Multicast - RFC 3513 */
38+
parseCIDR("2002::/16"), /* 6to4 - RFC 3056 */
39+
parseCIDR("64:ff9b::/96"), /* IPv4/IPv6 translation - RFC 6052 */
40+
parseCIDR("64:ff9b:1::/48"), /* IPv4-IPv6 Translat. */
41+
parseCIDR("5f00::/16"), /* Segment Routing (SRv6) SIDs */
42+
parseCIDR("2001:10::/28"), /* Deprecated (previously ORCHID) - RFC 4843 */
43+
parseCIDR("2001:20::/28"), /* ORCHIDv2 - RFC7343 */
44+
parseCIDR("3fff::/20"), /* Documentation */
45+
parseCIDR("100:0:0:1::/64"), /* Dummy IPv6 Prefix */
4246
}
4347

4448
func parseCIDR(network string) net.IPNet {
@@ -90,4 +94,4 @@ func isIPAllowed(ip net.IP, allowedIPs []net.IP, allowedIPsCIDR []net.IPNet) boo
9094
}
9195

9296
return false
93-
}
97+
}

0 commit comments

Comments
 (0)