From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3646 invoked by alias); 4 Apr 2012 02:51:29 -0000 Received: (qmail 3638 invoked by uid 22791); 4 Apr 2012 02:51:27 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Apr 2012 02:51:16 +0000 From: "nagle at sitetruth dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nagle at sitetruth dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00029.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=13935 --- Comment #2 from John Nagle 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.