Skip to content

fix: treat IPv4-mapped IPv6 as IPv4 in CCIP host checks - #3875

Open
SashaMIT wants to merge 2 commits into
ApeWorX:mainfrom
SashaMIT:fix/ccip-ipv4-mapped-blocklist
Open

SashaMIT wants to merge 2 commits into
ApeWorX:mainfrom
SashaMIT:fix/ccip-ipv4-mapped-blocklist

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • CCIP Read (validate_ccip_url_host) rejects resolved addresses in RFC1918, loopback, link-local, and IPv6 ULA ranges so an OffchainLookup URL cannot send the client at private infrastructure.
  • The check compared the resolved address to those networks as-is. ::ffff:127.0.0.1 (and ::ffff:10.0.0.1, ::ffff:169.254.169.254) is an IPv6 address, so it is not a member of the IPv4 block list and the request proceeded.
  • Unwrap IPv6Address.ipv4_mapped before the blocklist. Public mapped addresses such as ::ffff:8.8.8.8 still pass.

Attacker: a contract that returns OffchainLookup URLs. They already choose the URL. The guard is supposed to fail closed on private/reserved IPs after DNS. Mapped IPv6 skipped that guard.

Test plan

  • Added test_blocked_ipv4_mapped_ipv6 for loopback, RFC1918, and link-local mapped forms
  • Added test_public_ipv4_mapped_ipv6_passes for ::ffff:8.8.8.8
  • Revert-tested: without the unwrap, _check_ip_blocked("::ffff:127.0.0.1") is false
  • Towncrier newsfragments/3875.bugfix.rst
  • Tip parent: 268493a

Commit is SSH-signed.

CCIP Read blocked RFC1918 and loopback on the resolved address, but
::ffff:127.0.0.1 is an IPv6 address so it skipped those networks.
Unwrap ipv4_mapped before the blocklist so OffchainLookup URLs cannot
reach loopback, link-local, or private IPv4 via mapped form.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant