lnd/discovery
Erick Cestari 2c4af78fe1
discovery: fix panic in DNS fallback SRV lookup
The fallback SRV lookup type-asserted each DNS Answer record to *dns.SRV
unconditionally. If the response contains a non-SRV record (e.g. an A or
CNAME), the type assertion panics and crashes the daemon. Use the
comma-ok form to skip non-SRV records instead.

Also guard against an empty LookupHost result for the shim, which would
otherwise panic on an out-of-bounds index into addrs.

This is safe to discuss and fix in public. The bug is very unlikely to be
exploitable: triggering it requires either a DNS seeder to serve a
malformed response, or an on-path MITM injecting one (the fallback
response is unauthenticated). A malicious seeder already has far more
direct ways to disrupt a node, and a MITM attack is hard to mount, so the
panic does not meaningfully widen the attack surface.

(cherry picked from commit 2a3642c691)
2026-06-25 14:21:43 -03:00
..
ban.go multi: allow disable banning peers 2025-08-04 15:46:16 +08:00
ban_test.go discovery: pass banThreshold to banman 2025-08-04 15:44:35 +08:00
bootstrapper.go discovery: fix panic in DNS fallback SRV lookup 2026-06-25 14:21:43 -03:00
bootstrapper_test.go discovery: fix panic in DNS fallback SRV lookup 2026-06-25 14:21:43 -03:00
chan_series.go graph+discovery: update graph/db gossip backlog interfaces to use iter.Seq2 2025-09-26 17:01:11 -07:00
gossiper.go discovery: fix gossiper shutdown deadlock 2026-02-05 01:12:49 +00:00
gossiper_test.go discovery: fix gossiper shutdown deadlock 2026-02-05 01:12:49 +00:00
log.go multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
message_store.go multi: rename ChannelUpdate to ChannelUpdate1 2024-09-18 16:13:17 +02:00
message_store_test.go multi: rename chan DB Open method to OpenForTesting 2024-11-28 13:51:15 +02:00
mock_test.go discovery: implement ChannelAnnouncement banning 2024-08-27 14:11:06 -04:00
reliable_sender.go discovery: revert passing ctx through to Start methods 2025-05-22 14:14:39 +02:00
reliable_sender_test.go multi: context.Background() -> t.Context() 2025-08-30 14:13:44 -03:00
sync_manager.go multi: add new config peer-msg-rate-bytes 2025-09-02 21:23:07 +08:00
sync_manager_test.go discovery: create common helper methods for rate limiter 2025-09-02 21:13:46 +08:00
syncer.go discovery: fix endless loop in gossip syncer on context cancellation 2025-11-03 10:44:12 -08:00
syncer_atomic_test.go discovery: rate limiting sending msgs per peer 2025-09-02 21:23:07 +08:00
syncer_queue_test.go discovery: add tests for for async timestamp range queue 2025-08-01 11:20:22 -05:00
syncer_test.go discovery/test: add comprehensive tests for state handler error exits 2025-11-03 10:44:13 -08:00
validation_barrier.go multi: rename lnwire.NodeAnnouncement 2025-10-01 13:13:32 +02:00
validation_barrier_test.go multi: rename lnwire.NodeAnnouncement 2025-10-01 13:13:32 +02:00