Net: the IP helper's echo requests and address resolution reach loopback only #2858
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2860"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by miatson on 2026-11-25T22:36:40Z.
Problem
net.rskeeps the title to loopback ("a console without a network cable"), but onlyfor the ways out of Winsock and WinHTTP.
iphlpapi.dllis in the defaultHostPolicyand passes through whole, and it sends packets of its own that never go through Winsock:
IcmpSendEcho,IcmpSendEcho2,IcmpSendEcho2Ex,Icmp6SendEcho2),to any address, with any payload;
SendARP,ResolveIpNetEntry2,ResolveNeighbor).This is the kind of path #510 kept
rpcrt4.dllout of the host policy for: networktraffic
modules::netnever sees.Reproduced on
main(13f91ca): the title'siphlpapi.dll!IcmpSendEchoimport resolvesto the host's own function (
Provenance::Host), and an echo request through it to themachine's own LAN address is answered.
Change
net.rsnow also servesiphlpapi.dll, for those seven calls only. Each one checks thedestination with the existing
loopback()rule: loopback goes to the host's function asbefore; anything else fails before a packet is sent, as with no network:
IP_DEST_NET_UNREACHABLE(also the async forms: the lasterror isn't
ERROR_IO_PENDING, so nothing waits on the event or APC);SendARP,ResolveIpNetEntry2andResolveNeighborreturnERROR_BAD_NET_NAME, what anunanswered resolution reports. Null arguments are left for the host to refuse.
Everything else in
iphlpapi.dll(adapters, routes, notifications,IcmpCreateFile, ...)is still the host's. Blocked destinations are logged once, as the other refusals are.
Tests
ip_helper_traffic_is_vetted_here: the seven calls resolve to ours (Provenance::Hle)through
HleResolver;GetAdaptersAddresses,IcmpCreateFile,IcmpCloseHandlestay the host's.a_title_echo_request_reaches_loopback_only: end to end, through the functions as thetitle binds them. 127.0.0.1 answers; the machine's own LAN address doesn't.
ip_helper_arp_stays_on_the_machine,ip_helper_neighbor_resolution_stays_on_the_machine:resolving the machine's own LAN address (which the host resolves) is refused.
ip_helper_ipv6_echo_reaches_loopback_only:[::1]answers; the machine's own IPv6 addressis refused when it has one.
The tests aim at the machine's own addresses, which the host would answer, so they can't
pass for the wrong reason. On
main, the first two fail (Some(Host); the echo request isanswered). As a negative control, with the loopback check disabled, the echo, ARP and
neighbor tests fail (answered / resolved with
NO_ERROR) and pass with it. The tests thatneed a network skip without one; on the test machine there was no IPv6 route, so only the
IPv6 loopback half ran.
cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsis clean,rustfmt --checkis clean for both files, andcargo test --workspace --lockedpasses(784 passed, 0 failed).
Tested on
mainat13f91caNotes
a way out rather than changing observed behavior.
ole32, certificatefetching in
crypt32) are out of scope here.Written with the help of Claude Code.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T22:52:02Z.
Review: COMMENTED
Policy-consistent: iphlpapi traffic bypasses Winsock, so it needs its own loopback gate — failing non-loopback echo with IP_DEST_NET_UNREACHABLE (11002) and resolution with ERROR_BAD_NET_NAME (67) matches what the title would see on a genuinely unreachable network, and the rest of the DLL stays host-backed. Fail-before-send is the right order. LGTM.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:44:16Z.
Review: COMMENTED
Verified head
e950b059cleanly merged ontoorigin/main(63bcca43) on Windows 11 x64.Code & Isolation Review
iphlpapi.dlloff-box echo / neighbor-resolution entry points (IcmpSendEcho,IcmpSendEcho2,IcmpSendEcho2Ex,Icmp6SendEcho2,SendARP,ResolveIpNetEntry2,ResolveNeighbor) while keeping non-transmitting host queries (GetAdaptersAddresses,IcmpCreateFile,IcmpCloseHandle) onHostPolicy.ip.to_canonical().is_loopback()properly allows IPv4127.0.0.0/8, IPv6::1, and IPv4-mapped IPv6::ffff:127.0.0.1while blocking external targets.IP_DEST_NET_UNREACHABLE(11002) and return0synchronously (neverERROR_IO_PENDING), ARP/neighbor refusals set and returnERROR_BAD_NET_NAME(67), andany_socket_addrdispatches on theu16address family before reading so a 16-byteSOCKADDR_INis never over-read asSOCKADDR_IN6.Local Verification
cargo test --locked -p victory-hle: 157/157 unit tests passed (including all 5 newip_helper_*/echo/arp/neighbortests), plusfidelityfx(1/1) andno_dll_planting(1/1).cargo clippy --locked -p victory-hle --all-targets -- -D warnings(default and--features diagnostics) &cargo xtask policy(191 files ok): clean.Looks clean and ready to merge.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:24:08Z.
Automated triage for the maintainers.
Needs work. Needs the maintainer's decision, since it touches the offline
netmodule (it tightens it) and its tests send ICMP echo to the machine's own address. RoutingIcmpSendEcho*,Icmp6SendEcho2,SendARP,ResolveIpNetEntry2andResolveNeighborthrough the existingloopback()check closes a real way off the machine. One problem: adding"iphlpapi.dll"to thenetmodule'sdllsserves every export of that module foriphlpapi.dll, including the ws2_32 ordinals#2,#4and#20, so aniphlpapi.dllimport by ordinal would bind tobind,connectorsendto. Please register the IP helper exports in their ownHleModulethat serves onlyiphlpapi.dll.CI: not run yet on this head.
Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.