Skip to content

[Http-Foundation] IpUtils matches IPv6 ::1 with IPv4 0.0.0.0/8  #48049

Closed
@danielburger1337

Description

@danielburger1337

Symfony version(s) affected

6.1.x

Description

The IpUtils::checkIp6 method validates that IPv6 loopback addresses ::1 are in the IPv4 0.0.0.0/8 subnet.

I don't know much about IPv6 networking and therefor I am not sure if this is expected behavior. I couldn't find any clear information if IPv4 and IPv6 subnet matching SHOULD be compatible.

How to reproduce

use Symfony\Component\HttpFoundation\IpUtils;

var_dump(IpUtils::checkIp('::1', '0.0.0.0/8')); // true

Possible Solution

I'm going to be totally honest, I don't have any clue how the IPv6 net mask validation works but my guess, if this really is a bug, is that there is a logic error because ::1 implies that the first 6 bits are 0.

Additional Context

Again, I don't understand the byte magic that is happening in IpUtils::checkIp6, but my guess is that older version of http-foundation are also affected by this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions