Common implementation anti-patterns related to Domain Name System (DNS) resource record (RR) processing
draft-dashevskyi-dnsrr-antipatterns-00

Document Type Active Internet-Draft (individual)
Authors Stanislav Dashevskyi  , Daniel Santos  , Jos Wetzels  , Amine Amri 
Last updated 2021-03-23
Stream (None)
Intended RFC status (None)
Formats plain text pdf htmlized (tools) htmlized bibtex
Stream Stream state (No stream defined)
Consensus Boilerplate Unknown
RFC Editor Note (None)
IESG IESG state I-D Exists
Telechat date
Responsible AD (None)
Send notices to (None)
Independent Submission                                     S. Dashevskyi
Internet-Draft                                             D. dos Santos
Intended status: Informational                                J. Wetzels
Expires: September 23, 2021                                      A. Amri
                                                  Forescout Technologies
                                                          March 23, 2021

            Common implementation anti-patterns related 
      to Domain Name System (DNS) resource record (RR) processing
                draft-dashevskyi-dnsrr-antipatterns-00

Abstract

   This memo describes common vulnerabilities related to Domain Name
   System (DNS) response record (RR) processing as seen in several DNS
   client implementations. These vulnerabilities may lead to successful
   Denial-of-Service and Remote Code Execution attacks against the
   affected software. Where applicable, violations of RFC 1035 are
   mentioned. 

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF). Note that other groups may also distribute
   working documents as Internet-Drafts. The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on September 23, 2021.

Copyright Notice

   Copyright (c) 2021 IETF Trust and the persons identified as the
   document authors. All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document. Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.

Table of Contents

   1.  Introduction
   2.  Compression Pointer and Offset Validation 
     2.1.  Compression Pointer Pointing Out of Bounds
     2.2.  Compression Pointer Loops
     2.3.  Invalid Compression Pointer Check
   3.  Label and Name Length Validation
   4.  NULL-terminator Placement Validation 
   5.  Response Data Length Validation
   6.  Record Count Validation
   7.  General Recommendations
     7.1.  Compression Pointer 
     7.2.  Name, Label, and Resource Record Lengths
     7.3.  Resource Record Count Fields
   8.  Security Considerations
   9.  IANA Considerations
   10. References
     10.1. Normative References
     10.2. Informative References
   Acknowledgements
   Authors' Addresses

1. Introduction

   Recently, there have been major vulnerabilities on DNS
   implementations that raised attention to this protocol as an
   important attack vector, such as CVE-2020-1350, known as "SIGRed",
   CVE-2020-2705, known as "SAD DNS", and "DNSpooq", a set of 7 critical
   issues affecting the DNS forwarder "dnsmasq"
   (<https://thekelleys.org.uk/dnsmasq/doc.html>). 
   
   The authors of this memo have analyzed the DNS client implementations
   of several major TCP/IP protocol stacks and found a set of
   vulnerabilities that share common implementation flaws
   (anti-patterns). These flaws are related to processing DNS RRs
   (discussed in [RFC1035]) and may lead to critical security
   vulnerabilities. 

   While implementation flaws may differ from one software project to
   another, these anti-patterns are highly likely to span across
   multiple implementations. In fact, one of the first CVEs related to
   one of the anti-patters (CVE-2000-0333) dates back to the year 2000.
   The affected software is not limited to DNS client implementations,
   and any software that attempts to process DNS RRs may be affected, 
   such as firewalls, intrusion detection systems, or general purpose 
   DNS packet dissectors (i.e., Wireshark).

   [COMP-DRAFT] and [RFC5625] briefly mention some of these
   anti-patterns, but the main purpose of this memo is to provide
   technical details behind these anti-patterns, so that the common
   mistakes can be eradicated.

2. Compression Pointer and Offset Validation 

   [RFC1035] defines the DNS message compression scheme that can be used
   to reduce the size of messages. When it is used, an entire domain
   name or several name labels are replaced with a (compression) pointer
   to a prior occurrence of the same name.

   The compression pointer is a combination of two octets: the two most
   significant bits are set to 1, and the remaining 14 bits are the
   OFFSET field. This field specifies the offset from the beginning of
Show full document text