Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20261129013308.GX5716@brightrain.aerifal.cx>
Date: Sat, 28 Nov 2026 20:33:08 -0500
From: Rich Felker <dalias@...hyderm.io>
To: Markus Wichmann <nullplan@....net>, musl@...ts.openwall.com,
	X L <idealeer521@...il.com>
Subject: Re: musl: stub resolver queries from an unconnected UDP
 socket are poisonable off-path on Linux 7.1+

On Sat, Nov 28, 2026 at 08:46:55PM +0100, Szabolcs Nagy wrote:
> * Markus Wichmann <nullplan@....net> [2026-11-28 18:49:08 +0100]:
> > so if I understand correctly, the problem is that an attacker that
> > guesses the ephemeral port and transaction ID right and spoofs the
> > source address can poison the response.
> > 
> > This is bad. It means that the standard defense of "just use resolvers
> > you trust, and that have network paths that you trust" doesn't work
> > here. If I set the nameserver to 127.0.0.1 (which should have a trusted
> > network path by definition, since it's localhost), an external attacker
> > can still spit in my soup. And the suggested fix of using connected
> > sockets only hinders an attacker's ability to figure out the port. If
> > they just send random DNS responses to random ports, they will get lucky
> > at some point.
> 
> do you mean a local process? i think it needs priv to forge
> the port to 53.
> 
> the kernel can reject spoofed local addr from remote senders
> that try to look local (or anything that contradicts routing
> tables with "reverse path filtering")
> 
> > I'm currently googling a proper fix, but it seems like this is just
> > inherent to UDP, and the only solution is to only do TCP (which has a
> > handshake that avoids anyone making problems with just one spoofed
> > packet). I don't know if that would be acceptable.
> 
> inherent to non-integrity-protected udp traffic,
> if dns had stronger auth than just a tx id then
> you could not guess it.
> 
> anyway localhost is safe.
> 
> i expect a nameserver on a lan behind nat can be
> safe too (but i don't know all the constraints
> for this)

Nameserver on lan is safe if and only if there are no malicious
devices on the lan that can do arp spoofing/poisoning to hijack
traffic.

If there are such malicious devices, it doesn't matter if the source
port is predictable. The attacker can already do active attacks to
intercept and forge responses.

The only robust way to have trustworthy DNS results is to run a
DNSSEC-validating nameserver on localhost or over a trusted (e.g.
wireguard tunnel to a trusted remote host) link. Anything else is
always subject to the possibility of spoofing. Fortunately, the impact
of DNS spoofing is far less than it was in the 1990s thru early 2010s:
all modern web traffic is authenticated via TLS certificates, and ssh
has had key pinning going back much earlier. It would be nice if
everyone would adopt DNSSEC-validating resolvers on localhost, but
nothing seriously bad is going to happen from failure to do so.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.