mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: musl@lists.openwall.com
Cc: David Schinazi <dschinazi.ietf@gmail.com>
Subject: Re: [musl] mDNS in musl
Date: Fri, 8 Mar 2024 19:23:11 -0500	[thread overview]
Message-ID: <CAH8yC8mo=i=L_ZozM+UThKieGCJA_E-J+BJwSb7G9HUC8z15QQ@mail.gmail.com> (raw)
In-Reply-To: <20240308225445.GR4163@brightrain.aerifal.cx>

On Fri, Mar 8, 2024 at 5:54 PM Rich Felker <dalias@libc.org> wrote:
>
> On Fri, Mar 08, 2024 at 01:55:18PM -0800, David Schinazi wrote:
> > On Fri, Mar 8, 2024 at 12:31 PM Rich Felker <dalias@libc.org> wrote:
> >
> > > On Fri, Mar 08, 2024 at 11:15:52AM -0800, David Schinazi wrote:
> > > > On Fri, Mar 8, 2024 at 5:30 AM Rich Felker <dalias@libc.org> wrote:
> > > >
> > > > > On Thu, Mar 07, 2024 at 08:47:20PM -0800, David Schinazi wrote:
> > > > > > Thanks. How would you feel about the following potential
> > > configuration
> > > > > > design?
> > > > > > * Add a new configuration option "send_mdns_unicast"
> > > > > > * When true, use the current behavior
> > > > > > * When false, send the query on all non-loopback non-p2p interfaces
> > > > > > * Have send_mdns_unicast default to false
> > > > > >
> > > > > > I was thinking through how to pick interfaces, looked up what other
> > > mDNS
> > > > > > libraries do, and pretty much all of them don't allow configuring
> > > > > > interfaces, whereas Avahi exposes allow-interfaces and
> > > deny-interfaces.
> > > > > I'm
> > > > > > leaning towards not making this configurable to reduce complexity. I
> > > > > think
> > > > > > that anyone interested in that level of config is probably using
> > > Avahi
> > > > > > anyway.
> > > > > >
> > > > > > Additionally this design has two nice properties: the default
> > > behavior is
> > > > > > RFC-compliant, and it means that for my use-case I don't need to
> > > change
> > > > > the
> > > > > > config file, which was a big part of my motivation for doing this
> > > inside
> > > > > of
> > > > > > musl in the first place :-)
> > > > >
> > > > > As discussed in this thread, I don't think so. The biggest problems I
> > > > > initially brought up were increased information leakage in the default
> > > > > configuration and inability to control where the traffic goes when you
> > > > > do want it on. The above proposal just reverts to the initial, except
> > > > > for providing a way to opt-out.
> > > > >
> > > > > For the most part, mDNS is very much a "home user, personal device on
> > > > > trusted network" thing. Not only do you not want it to default on
> > > > > because a lot of systems will be network servers on networks where
> > > > > it's not meaningful (and can be a weakness that aids attackers in
> > > > > lateral movement), but you also don't want it on when connected to
> > > > > public wifi. For example if you have an open browser tab to
> > > > > http://mything.local, and migrate to an untrusted network (with your
> > > > > laptop, tablet, phone, whatever), now your browser will be leaking
> > > > > private data (likely at least session auth tokens, maybe more) to
> > > > > whoever answers the mDNS query for mything.local.
> > > >
> > > > That's not quite right. The security properties of mDNS and DNS are the
> > > > same. DNS is inherently insecure, regardless of unicast vs multicast. If
> > > > I'm on a coffee shop Wi-Fi, all my DNS queries are sent in the clear to
> > > > whatever IP address the DHCP server gave me.
> > >
> > > That's not the case. Connections to non-mDNS hosts are authenticated
> > > by TLS with certificates issued on the basis of ownership of the
> > > domain name. That's not possible with mDNS hostnames, so they'll
> > > either be no-TLS or self-signed certs. That's why the above attack is
> > > possible. It was also possible with normal DNS in the bad old days of
> > > http://, but that time is long gone.
> >
> > Apologies for being pedantic, but that's not true. The ability to get TLS
> > certificates for a domain name that you own is a property of the WebPKI,
> > not a property of TLS. What you wrote is true, but only in the context of a
> > Web browser with an unmodified root certificate store. The features I
> > mentioned above don't use the WebPKI, they have a separate root of trust.
> > For example, some of those Apple features exchange TLS certificates via an
> > out-of-band mechanism such as Apple trusted servers. Another example is the
> > Apple Watch: when you first pair a new Apple Watch with an iPhone, they
> > exchange ed25519 public keys. Then any time the watch wants to transfer a
> > large file to/from the phone, it'll connect to Wi-Fi, use mDNS to find the
> > phone, and set up an IKEv2/IPsec tunnel that then protects the exchange.
> > It's resilient to any attacks at the mDNS level.
> >
> > You're absolutely right that the security of Web requests using local
> > connectivity is completely broken by the lack of WebPKI certificates for
> > those. But sending the DNS query over multicast as opposed to unencrypted
> > unicast to an untrusted DNS server doesn't change the security properties.
> > In your example above, the open tab to http://mything.local will send that
> > query to the recursive resolver - and if that's the one received by DHCP
> > then that server can reply with its own address and receive your auth
> > tokens. One potential fix here is to configure your resolv.conf to
> > localhost and then apply policy in that local resolver. But in practice,
> > application developers don't rely on security at that layer, they assume
> > that DNS is unsafe and implement encryption in userspace with some out of
> > band trust mechanism.
>
> My specific example was http://mything.local in a web browser, which
> is the way you access lots of mDNS-enabled things in the absence of a
> specific software ecosystem like Apple's. Since we're talking about
> musl which would be running on Linux or a Linux-syscall-compatible
> environment, without Apple apps, I think that's the main way anyone
> would be using hypothetical mDNS support. And indeed this is the way
> you access many printers, 3D printers, IP cameras, etc.
>
> Maybe at some point we'll have a good framework for authenticating
> this kind of usage with certificates (probably certificate pinning on
> first use, with good UX, is the only easy solution), but at present,
> mDNS devices on the .local zone get accessed with plain http:// all
> the time, and this means it's unsafe to do mDNS on
> public/untrusted/hostile networks.

One comment about pinning. I think host key pinning is a great
security control. Key continuity is a better security property than
key rotation.

Unfortunately, the CA/Browser Forum and IETF are moving the other way.
They are hostile to pinning, they are actively working against it by
using short-lived intermediate CA certificates, by not providing key
rollover hints in existing certificates, and recommending a new key
for each end-entity (host) certificate.

I was very disappointed to see the IETF get onboard with the
CA/Browser Forum. It looks like the IETF has been captured again.

So pinning may not be a viable solution when the time comes.

Jeff

  parent reply	other threads:[~2024-03-09  0:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  7:29 David Schinazi
2024-03-06 16:15 ` Rich Felker
2024-03-06 16:45   ` Jeffrey Walton
2024-03-07  0:17   ` David Schinazi
2024-03-07  2:43     ` Rich Felker
2024-03-07 22:50       ` David Schinazi
2024-03-08  0:08         ` Rich Felker
2024-03-08  1:30           ` David Schinazi
2024-03-08  2:06             ` David Schinazi
2024-03-08  2:52             ` Rich Felker
2024-03-08  3:34               ` David Schinazi
2024-03-08  3:47                 ` Rich Felker
2024-03-08  4:47                   ` David Schinazi
2024-03-08 13:31                     ` Rich Felker
2024-03-08 19:15                       ` David Schinazi
2024-03-08 20:31                         ` Rich Felker
2024-03-08 21:55                           ` David Schinazi
2024-03-08 22:54                             ` Rich Felker
2024-03-08 23:44                               ` David Schinazi
2024-03-21  9:21                                 ` David Schinazi
2024-03-21 12:07                                   ` Rich Felker
2024-03-21 13:50                                     ` David Schinazi
2024-03-21 17:45                                       ` Luca Barbato
2024-03-21 19:35                                       ` Rich Felker
2024-03-22  0:10                                         ` David Schinazi
2024-03-22  0:29                                           ` Tomas Volf
2024-03-22  0:36                                             ` David Schinazi
2024-03-22  0:38                                             ` Rich Felker
2024-03-09  0:23                               ` Jeffrey Walton [this message]
2024-03-08 15:31     ` Markus Wichmann
2024-03-08 17:22       ` Rich Felker
2024-03-06 16:15 ` Markus Wichmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH8yC8mo=i=L_ZozM+UThKieGCJA_E-J+BJwSb7G9HUC8z15QQ@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=dschinazi.ietf@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).