Re: [DNSOP] Clarification question: compression pointers always to names earlier in the packet?

Tony Finch <> Wed, 24 October 2018 10:45 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id D68381286D9 for <>; Wed, 24 Oct 2018 03:45:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id SD0P8tiOFp4M for <>; Wed, 24 Oct 2018 03:45:53 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 91E801286E3 for <>; Wed, 24 Oct 2018 03:45:53 -0700 (PDT)
X-Cam-AntiVirus: no malware found
Received: from ([]:47402) by ( []:25) with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1gFGff-000Abj-gF (Exim 4.91) for (return-path <>); Wed, 24 Oct 2018 11:45:51 +0100
Date: Wed, 24 Oct 2018 11:45:51 +0100
From: Tony Finch <>
To: dnsop <>
In-Reply-To: <>
Message-ID: <>
References: <>
User-Agent: Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Archived-At: <>
Subject: Re: [DNSOP] Clarification question: compression pointers always to names earlier in the packet?
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF DNSOP WG mailing list <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 24 Oct 2018 10:45:56 -0000

Viktor Dukhovni <> wrote:
> My reading of RFC 1035 is that DNS name "compression" via "pointers" is
> restricted to name strictly earlier in the DNS message: [snip]
> And yet, here and there I see mention of having to take care to avoid "loops",
> but loops are impossible in a monotone strictly decreasing sequence.

Shane and Joe have answered this, but I just want to say that this is the
FIRST thing I look for in a DNS message parser, because it is such a
common denial of service vulnerability, and it's a good bit of slapstick
fun to find code that repeats this mistake.

There are two basic ways to avoid it:

* Limit the number of pointers you will follow.

* Keep a high-water-mark separate from the current location, and require
  pointers to be strictly less than the HWM. (I prefer this way.)

Note that limiting the overall length of the name isn't enough, because a
pointer can loop without making the name longer.

f.anthony.n.finch  <>
Viking: West or northwest, 5 to 7, occasionally gale 8 until later. Rough or
very rough. Rain then showers. Moderate or poor, becoming good.