public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nagle at sitetruth dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug network/13935] getaddrinfo NXDOMAIN hijack exploit for hosts with two-component hostnames
Date: Wed, 04 Apr 2012 02:51:00 -0000	[thread overview]
Message-ID: <bug-13935-131-TBWHlZgEy0@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-13935-131@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=13935

--- Comment #2 from John Nagle <nagle at sitetruth dot com> 2012-04-04 02:50:46 UTC ---
SOME HISTORY

This problem was addressed back in 1993 in RFC 1535, "A Security Problem and
Proposed Correction With Widely Deployed DNS Software".  Back then, DNS
resolution involved chopping off one element at a time of the local hosts'
domain and appending that to the query until a match was found.  This allowed
attacks on domains with more than two elements.  That's where the current
restrictions come from.   

RFC 1535 says "At a minimum, DNS resolvers must honor the BOUNDARY between
local and public administration, by limiting any search lists to locally-
administered portions of the Domain Name space."

It then goes on:

"DNS Name resolver software SHOULD NOT use implicit search lists in
attempts to resolve partial names into absolute FQDNs other than the
hosts's immediate parent domain.

Resolvers which continue to use implicit search lists MUST limit
their scope to locally administered sub-domains."

Those two statement are in conflict when a host has a name such as 
"example.com".  The "immediate parent domain" is "com", but it is not
a "locally administered subdomain".  Since the second sentence is a MUST,
while the first sentence is a SHOULD, the second sentence controls.
Thus, to conform to RFC 1535, the search path should never default to a TLD.
glibc is not in compliance.

That RFC was written in 1993, before domains were ever offered for sale. A
world in which most domains were second level was not envisioned at the time. 
That's probably why the authors of the RFC didn't think of this. 

WORKAROUNDS, FAILURE OF

This is a tough problem to work around without changing host names.  Adding
commands to /etc/resolv.conf tends to cause problems, because, in modern Linux
systems, that file is usually generated by system administration software.  

Editing /etc/resolv.conf is not particularly helpful, anyway. 
Adding a blank "search" command does not delete the implicit search path.
(That behavior comes from lines 267-268 in res_init.c, which, for a blank 
"search" line, does nothing.  The code in that area seems to be set up so that
there is always an alternate search path of some kind, either from SEARCH
statement in resolv.conf, a DOMAIN statement, an environment variable, or
the host name of the host.

Nor does setting "ndots:0" have that effect.  Setting "domain" in
/etc/resolv.conf to a value with an invalid TLD might work, but could confuse
other parts of the system.  "no_tld_query" only applies to inputs with no dots
(I think) so that doesn't help, either. 

EFFECT

The effect of all this is that you can't trust "getaddrinfo" or "gethostbyname"
to do an honest DNS lookup.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2012-04-04  2:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-01 20:16 [Bug network/13935] New: " nagle at sitetruth dot com
2012-04-01 21:06 ` [Bug network/13935] " nagle at sitetruth dot com
2012-04-01 22:20 ` nagle at sitetruth dot com
2012-04-02 17:35 ` ppluzhnikov at google dot com
2012-04-04  2:51 ` nagle at sitetruth dot com [this message]
2012-08-24 10:48 ` scorneli at redhat dot com
2012-08-24 16:46 ` nagle at sitetruth dot com
2012-08-24 17:31 ` law at redhat dot com
2012-11-03 17:01 ` karme at karme dot de
2013-09-12  8:35 ` berend.de.schouwer at gmail dot com
2014-02-16 19:42 ` jackie.rosen at hushmail dot com
2014-05-28 19:43 ` schwab at sourceware dot org
2014-06-25 11:24 ` fweimer at redhat dot com
2020-06-22 13:40 ` fweimer at redhat dot com
2020-06-22 13:43 ` carlos at redhat dot com
2020-06-22 13:44 ` fweimer at redhat dot com
2020-06-22 13:58 ` schwab@linux-m68k.org

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=bug-13935-131-TBWHlZgEy0@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).