Symfony: Ip Constraint public/private Modes Accept IPv4-Mapped and IPv4-Compatible IPv6 Addresses: SSRF Filter Bypass
Published 1 Dec 2026 · Updated 1 Dec 2026
Affected packages
- Affected
- <5.4.56
- Fixed in
- 5.4.56
composer require symfony/symfony:^5.4.56- Affected
- >=6.0.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/symfony:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/symfony:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/symfony:^8.1.11- Affected
- <5.4.56
- Fixed in
- 5.4.56
composer require symfony/validator:^5.4.56- Affected
- >=6.0.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/validator:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/validator:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/validator:^8.1.11Which symfony/symfony does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads composer.json.
Public repo?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
Description
Symfony\Component\Validator\Constraints\IpValidator decides the public, private and reserved classification for the Ip constraint's filtered modes solely from PHP's FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags, with no second check.
Those flags are an incomplete basis for this purpose, in two ways.
Whole ranges are covered by neither flag. 100.64.0.0/10 (RFC 6598 shared address space, which is genuinely routed internal space), the TEST-NET ranges 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, and 198.18.0.0/15 (RFC 2544 benchmarking) are accepted by every mode, as is the entire IPv6 special-purpose family: 6to4 (2002::/16), Teredo (2001::/32), NAT64 (64:ff9b::/96, 64:ff9b:1::/48), documentation (2001:db8::/32) and benchmarking (2001:0002::/48).
Classification is also spelling dependent for IPv6. ::7f00:1 is accepted by every mode, while ::127.0.0.1, the same 128 bits, is rejected by NO_RES from PHP 8.3 onward. PHP 8.3 added a reserved-range rule for ::ffff:0:0/96, so ::ffff:127.0.0.1 is accepted on PHP 8.1 and 8.2 but rejected from 8.3, while the ::7f00:1 spelling and the NO_PRIV mode remain bypassed on every version up to 8.5.
A developer using #[Assert\Ip(version: Ip::ALL_ONLY_PUBLIC)] or Ip::ALL_NO_PRIV as an anti-internal-address guard is therefore bypassed. The strongest cases are IPv4-mapped addresses in ALL_NO_PRIV mode, and carrier-grade NAT space in the public-only modes. A mapped address connects to the RFC 1918 or loopback host it embeds. On PHP 8.3 and later, ALL_ONLY_PUBLIC rejects IPv4-mapped addresses. The IPv4-compatible spelling ::7f00:1 is misclassified on every version, but it does not connect to loopback on Linux:
$validator->validate('::ffff:10.0.0.1', new Ip(version: Ip::ALL_NO_PRIV)); // 0 violations
$validator->validate('2002:7f00:1::', new Ip(version: Ip::ALL_ONLY_PUBLIC)); // 0 violations
$validator->validate('100.64.0.1', new Ip(version: Ip::V4_ONLY_PUBLIC)); // 0 violationsThis is an opt-in control: the default version = V4 performs no range filtering at all, so the affected population is precisely those relying on the public, private and reserved modes as a security filter.
Resolution
For the NO_PRIV, NO_RES and ONLY_PUBLIC modes (NO_PRIVATE and NO_RESERVED from Symfony 7.0 on), IpValidator now additionally rejects any address falling in the non-public subnets, mirroring Symfony\Component\HttpFoundation\IpUtils::PRIVATE_SUBNETS for both address families. The check is applied on top of the existing filter_var() call so it can only tighten validation, and it is skipped entirely for the unfiltered V4, V6 and ALL modes, which are unchanged.
Note three deliberate consequences:
- All three filtered modes reject the whole family, so
ONLY_PUBLICnow agrees withIpUtils::isPrivateIp()on every address, andNO_PRIVandNO_RESbehave the same asONLY_PUBLIC. These modes are treated as security filters rather than as a taxonomy of address categories. Applications that relied onNO_PRIVaccepting reserved addresses, or onNO_RESaccepting private ones, will see previously valid values rejected. - Addresses previously accepted are now rejected, including
100.64.0.1and192.0.2.1in every filtered mode,127.0.0.1underNO_PRIV,10.0.0.1underNO_RES, and::ffff:8.8.8.8, an IPv4-mapped form of a public address, underNO_PRIV. - On a PHP built with
--disable-ipv6,inet_pton()cannot parse IPv6 addresses, so the three filtered modes reject every IPv6 address rather than falling back to the previous behaviour. IPv4 addresses and the unfilteredV4,V6andALLmodes are unaffected.
IpUtils itself could not be reused: symfony/validator does not depend on symfony/http-foundation and must not gain that dependency, so the subnet list is duplicated in the Validator and has to be kept in sync by hand.
The patches for this issue are available here for branch 5.4 (and forward-ported to 6.4, 7.4, 8.1 and 8.2).
Credits
Symfony would like to thank zx (Jace) for reporting the issue.
Is GHSA-4qpf-57w4-m3wc in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected symfony/symfony, and gives you the command that fixes it.
More advisories for symfony/symfony
- LowCVE-2026-123824Symfony: XXE (Local File Read) in Config XmlUtils::parse() via validateOnParse = true · 1 Dec 2026
- LowCVE-2026-123746Symfony: Programmatic Logins Skip the checkPostAuth() Method of User Checkers · 1 Dec 2026
- LowCVE-2026-121949Symfony: HtmlSanitizer Does Not URL-Sanitize srcset and imagesrcset Leading to Media Scheme and Host Allow-List Bypass · 1 Dec 2026
- LowCVE-2026-118517Symfony: HtmlSanitizer allowLinkHosts() / allowMediaHosts() Bypass via URLs Without a Well-Formed Authority: Incomplete Fix for CVE-2026-45066 · 1 Dec 2026
- MediumCVE-2026-121373Symfony: HtmlSanitizer MetaRefreshAttributeSanitizer Matches Only a Narrow Subset of the Browser Refresh Grammar: Incomplete Fix for CVE-2026-48761 · 1 Dec 2026
- HighCVE-2026-118513Symfony: X509Authenticator and X509AuthenticationListener Read Escaped RFC 2253 Commas and Bare Slashes Inside a DN Value as RDN Boundaries · 1 Dec 2026
References
- Linkgithub.com/symfony/symfony/security/advisories/GHSA-4qpf-57w4-m3wc
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-123125
- Linkgithub.com/symfony/symfony/commit/3bf8ea37fcb402c5ecc502a3f63012df85a7572e
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-123125.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/validator/CVE-2026-123125.yaml
- Packagegithub.com/symfony/symfony
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.