From b7f7e16ab5bce20b0fad832aff2b2ce64fbbd3fe Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 15 Jan 2026 21:16:28 -0600 Subject: disallow IPv4 mapped IPv6 addresses --- src/slskd/Core/Options.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index a1d9953c..68fa4d92 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -648,6 +648,11 @@ namespace slskd { try { + if (cidr.StartsWith("::ffff", StringComparison.OrdinalIgnoreCase)) + { + throw new Exception("IPv4 mapped IPv6 addresses are not allowed"); + } + _ = IPAddressRange.Parse(cidr); } catch (Exception ex) @@ -1116,6 +1121,11 @@ namespace slskd { try { + if (cidr.StartsWith("::ffff", StringComparison.OrdinalIgnoreCase)) + { + throw new Exception("IPv4 mapped IPv6 addresses are not allowed"); + } + _ = IPAddressRange.Parse(cidr); } catch (Exception ex) @@ -2013,6 +2023,11 @@ namespace slskd { try { + if (cidr.StartsWith("::ffff", StringComparison.OrdinalIgnoreCase)) + { + throw new Exception("IPv4 mapped IPv6 addresses are not allowed"); + } + _ = IPAddressRange.Parse(cidr); } catch (Exception ex) @@ -2096,6 +2111,11 @@ namespace slskd { try { + if (cidr.StartsWith("::ffff", StringComparison.OrdinalIgnoreCase)) + { + throw new Exception("IPv4 mapped IPv6 addresses are not allowed"); + } + _ = IPAddressRange.Parse(cidr); } catch (Exception ex) -- cgit v1.2.3