I have no idea if/how Vanadium guards against this or if this is even an issue on GrapheneOS or Android.
But on a computer (where this is certainly an issue), in a browser with uBlock Origin, you can activate a filter list. The list is included in uBlock Origin. In Settings, go to Filter Lists, the Privacy section, and make sure 'Block Outsider Intrusion into LAN' is selected. See 3np's comment and replies on this HN thread for more info and links.