As I understand, P2P networks work by first connecting to a fixed set of peers and learning about other peers based on them. Since those peers are hardcoded into the Monero software, could a malicious ISP intercept initial communications by redirecting traffic to those peers? Would this be detectable?
Since those peers are hardcoded into the Monero software, could a malicious ISP intercept initial communications by redirecting traffic to those peers?
Sure, to another valid Monero node. Traffic NAT'ing happens all the time.
Would this be detectable?
I don't see anything in the codebase that reaches out to STUN, etc. to determine its outside IP (and then include it encrypted), so it looks possible to spoof a peer by IP. That said, the codebase has the genesis transaction hard-coded in it, and every block in a blockchain depends on the previous block, so if an ISP or the spooks want to run an extra Monero node, then - great!
Never trust any Monero node on the Internet. Assume BadGuys are doing all the traffic analysis they can. The protocol exists so you don't have to trust anybody. Improvements with noisy Tor (and I2P) make it less likely that you have to trust your ISP to not be your adversary.
You are referring to seed nodes. These are the set of hardcoded peers a fresh user will first request other peers from and is a common problem for all P2P networks - how to discover other peers on first usage. Whilst these are coded in as a convenience, once you have found other peers, your node remembers its last known peers and is constantly looking for others; you are also able to specify any other known peers instead of relying on the seed nodes.
From an ISP perspective, they can effectively do whatever they want with your traffic and in most cases it can be undetectable. VPNs, Tor and I2P all help mitigate some of the ISP level risks, but at the end of the day there is nothing 100% immune to a miscreant ISP.