Skip to content

icanhazip.com broken on ipv4 IP updates #635

@reaperhulk

Description

@reaperhulk

It appears that Cloudflare (who hosts icanhazip.com) recently updated their Set-Cookie headers to include a substring that matches the IPv4 regex. This is not always present as of this writing, but the vast majority of responses include it.

Example response:

RECEIVE:  Set-Cookie: __cf_bm=2xnVOVFwaGV_.05NtWe659KpXPz8R5ZvmGa5wjiWX_U-1709330132-1.0.1.1-cXaXzBbLD.ZvArvSQmhhU3Z3cH_Fss4F..Yy3Kp1tkUXG0Kcql5NZTELMCYc0yKsCaoZ7rbRZr3e7.0zcgwOXw; path=/; expires=Fri, 01-Mar-24 22:25:32 GMT; domain=.icanhazip.com; HttpOnly; SameSite=None

Since the extract_ipv4 function searches for the "first valid IPv4 address in the given string" and the string includes the headers, this causes it to set the IP to 1.0.1.1 rather than the returned value in the body of the HTTP response.

IPv6 is unaffected since the regex doesn't match, but the same potential for future issues is present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions