Closed hax0kartik closed 3 months ago
This is also checked in rust-bitcoin:
// Invalid IPv6, contains embedded IPv4.
assert!(deserialize::<AddrV2>(&hex!("021000000000000000000000ffff01020304")).is_err());
// Invalid IPv6, contains embedded TORv2.
assert!(deserialize::<AddrV2>(&hex!("0210fd87d87eeb430102030405060708090a")).is_err());
Will close since we've already opened an issue on btcd repository
We get a crash as BTCD does not implement a check to test and reject addresses where ipv4 is embedded in ipv6.
BTCD code: https://github.com/btcsuite/btcd/blob/master/wire/netaddressv2.go#L316-L338 Core code: https://github.com/bitcoin/bitcoin/blob/master/src/netaddress.h#L459-L465
The crash can be replicated by passing the readNetAddressV2 function the following hexstring
5fde0202fdffff021000000000000000000000fffffffd00000000