-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                               ESB-2021.0227
          ICS Advisory (ICSA-21-019-01) - dnsmasq vulnerabilities
                              20 January 2021

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           dnsmasq
Publisher:         ICS-CERT
Operating System:  UNIX variants (UNIX, Linux, OSX)
Impact/Access:     Execute Arbitrary Code/Commands -- Remote/Unauthenticated
                   Denial of Service               -- Remote/Unauthenticated
                   Provide Misleading Information  -- Remote/Unauthenticated
                   Reduced Security                -- Remote/Unauthenticated
Resolution:        Patch/Upgrade
CVE Names:         CVE-2020-25687 CVE-2020-25686 CVE-2020-25685
                   CVE-2020-25684 CVE-2020-25683 CVE-2020-25682
                   CVE-2020-25681  

Reference:         ESB-2021.0219
                   ESB-2021.0218
                   ESB-2021.0217

Original Bulletin: 
   https://us-cert.cisa.gov/ics/advisories/icsa-21-019-01

- --------------------------BEGIN INCLUDED TEXT--------------------

ICS Advisory (ICSA-21-019-01)

Dnsmasq by Simon Kelley

Original release date: January 19, 2021

Legal Notice

All information products included in https://us-cert.cisa.gov/ics are provided
"as is" for informational purposes only. The Department of Homeland Security
(DHS) does not provide any warranties of any kind regarding any information
contained within. DHS does not endorse any commercial product or service,
referenced in this product or otherwise. Further dissemination of this product
is governed by the Traffic Light Protocol (TLP) marking in the header. For more
information about TLP, see https://us-cert.cisa.gov/tlp/ .



1. EXECUTIVE SUMMARY

  o CVSS v3 8.1
  o ATTENTION: Exploitable remotely/low skill level to exploit
  o Vendor: Dnsmasq by Simon Kelley
  o Equipment: Dnsmasq
  o Vulnerabilities: Heap-based Buffer Overflow, Insufficient Verification of
    Data Authenticity, Use of a Broken or Risky Cryptographic Algorithm

CISA is aware of a public report, known as "DNSpooq" that details
vulnerabilities found in Dnsmasq, a prevalent lightweight DNS and DHCP server
developed and maintained by Simon Kelley. CISA is issuing this advisory to
provide early notice of the reported vulnerabilities and identify baseline
mitigations for reducing risks to these and other cybersecurity attacks.

2. RISK EVALUATION

Successful exploitation of these vulnerabilities could result in cache
poisoning, remote code execution, and a denial-of-service condition.

3. TECHNICAL DETAILS

3.1 AFFECTED PRODUCTS

The following versions of Dnsmasq DNS and DHCP server are affected:

  o Version 2.8.2 and prior

3.2 VULNERABILITY OVERVIEW

3.2.1 HEAP-BASED BUFFER OVERFLOW CWE-122

A heap-based buffer overflow was discovered in Dnsmasq in the way it sorts
RRSets before validating them with DNSSEC data. An attacker on the network
could forge DNS replies to be accepted as valid to cause an overflow with
arbitrary data in a heap-allocated memory, resulting in code execution.

CVE-2020-25681 has been assigned to this vulnerability. A CVSS v3 base score of
8.1 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:U/
C:H/I:H/A:H ).

3.2.2 HEAP-BASED BUFFER OVERFLOW CWE-122

A buffer overflow vulnerability was discovered in the way Dnsmasq extracts
names from DNS packets before validating them with DNSSEC data. An attacker on
the network could create valid DNS replies to cause an overflow with arbitrary
data in a heap-allocated memory, resulting in code execution.

CVE-2020-25682 has been assigned to this vulnerability. A CVSS v3 base score of
8.1 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:U/
C:H/I:H/A:H ).

3.2.3 HEAP-BASED BUFFER OVERFLOW CWE-122

A heap-based buffer overflow was discovered in Dnsmasq when DNSSEC is enabled
and before it validates the received DNS entries. A remote attacker could
create valid DNS replies to cause an overflow in a heap-allocated memory and
cause a crash in Dnsmasq, resulting in a denial-of-service condition.

CVE-2020-25683 has been assigned to this vulnerability. A CVSS v3 base score of
5.9 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:U/
C:N/I:N/A:H ).

3.2.4 INSUFFICIENT VERIFICATION OF DATA AUTHENTICITY CWE-345

A vulnerability exists when getting a reply from a forwarded query, where
Dnsmasq checks in forward.c:reply_query() if the reply destination address/port
is used by the pending forwarded queries. This could allow an attacker to
perform a DNS cache poisoning attack.

CVE-2020-25684 has been assigned to this vulnerability. A CVSS v3 base score of
4.0 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:C/
C:N/I:L/A:N ).

3.2.5 USE OF A BROKEN OR RISKY CRYPTOGRAPHIC ALGORITHM CWE-327

Due to a weak hash, an off-path attacker can find several different domains
with the same hash, substantially reducing the number of attempts to forge a
reply for acceptance by Dnsmasq. This could allow an attacker to perform a DNS
cache poisoning attack.

CVE-2020-25685 has been assigned to this vulnerability. A CVSS v3 base score of
4.0 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:C/
C:N/I:L/A:N ).

3.2.6 INSUFFICIENT VERIFICATION OF DATA AUTHENTICITY CWE-345

A flaw was found when receiving a query, where Dnsmasq does not check for an
existing pending request for the same name and forwards a new request. This
could allow an off-path attacker on the network to substantially reduce the
number of attempts to forge a reply and have it accepted by Dnsmasq.

CVE-2020-25686 has been assigned to this vulnerability. A CVSS v3 base score of
4.0 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:C/
C:N/I:L/A:N ).

3.2.7 HEAP-BASED BUFFER OVERFLOW CWE-122

A heap-based buffer overflow was discovered in Dnsmasq when DNSSEC is enabled
and before it validates the received DNS entries. A remote attacker could
create valid DNS replies and cause an overflow in heap-allocated memory,
resulting in a denial-of-service condition.

CVE-2020-25687 has been assigned to this vulnerability. A CVSS v3 base score of
5.9 has been calculated; the CVSS vector string is ( AV:N/AC:H/PR:N/UI:N/S:U/
C:N/I:N/A:H ).

3.3 BACKGROUND

  o CRITICAL INFRASTRUCTURE SECTORS: Multiple
  o COUNTRIES/AREAS DEPLOYED: Worldwide
  o COMPANY HEADQUARTERS LOCATION: United Kingdom

3.4 RESEARCHER

Moshe Kol and Shlomi Oberman of JSOF reported these vulnerabilities to CISA.

4. MITIGATIONS

The maintainers of Dnsmasq recommend users update to the latest version (2.83
or later)
The researcher has recommended the following mitigations and workarounds:

  o Implement Layer 2 security features such as DHCP snooping and IP source
    guard.
  o Configure Dnsmasq not to listen to WAN interfaces if unnecessary.
  o Reduce the maximum queries allowed to be forwarded with the option
    --dns-forward-max=<queries>. The default is 150, but it could be lowered.
  o Temporarily disable DNSSEC validation option until you patch.
  o Use DNS-over-HTTPS or DNS-over-TLS to connect to upstream server.

CISA recommends users take defensive measures to minimize the risk of
exploitation of this vulnerability. Specifically, users should:

  o Minimize network exposure for all control system devices and/or systems,
    and ensure that they are not accessible from the Internet .
  o Locate control system networks and remote devices behind firewalls, and
    isolate them from the business network.
  o When remote access is required, use secure methods, such as Virtual Private
    Networks (VPNs), recognizing that VPNs may have vulnerabilities and should
    be updated to the most current version available. Also recognize that VPN
    is only as secure as the connected devices.

CISA reminds organizations to perform proper impact analysis and risk
assessment prior to deploying defensive measures.

CISA also provides a section for control systems security recommended practices
on the ICS webpage on us-cert.cisa.gov . Several recommended practices are
available for reading and download, including Improving Industrial Control
Systems Cybersecurity with Defense-in-Depth Strategies .

Additional mitigation guidance and recommended practices are publicly available
on the ICS webpage on us-cert.cisa.gov in the Technical Information Paper,
ICS-TIP-12-146-01B--Targeted Cyber Intrusion Detection and Mitigation
Strategies .

Organizations observing any suspected malicious activity should follow their
established internal procedures and report their findings to CISA for tracking
and correlation against other incidents.

CISA also recommends users take the following measures to protect themselves
from social engineering attacks:

  o Do not click web links or open unsolicited attachments in email messages.
  o Refer to Recognizing and Avoiding Email Scams for more information on
    avoiding email scams.
  o Refer to Avoiding Social Engineering and Phishing Attacks for more
    information on social engineering attacks.

No known public exploits specifically target these vulnerabilities.

For any questions related to this report, please contact the CISA at:

Email: CISAservicedesk@cisa.dhs.gov
Toll Free: 1-888-282-0870

CISA continuously strives to improve its products and services. You can help by
choosing one of the links below to provide feedback about this product.

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        https://www.auscert.org.au/bulletins/

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBYAeSWONLKJtyKPYoAQgT+A/9HYbMuabYlHxhUiWU3zSGklvHYEfKfVsp
Et1WHCnENTi3rSvoWampgLpShRUtEnJ2g+CUz2vOaD1B/wJ6J+S+WYiIapa5sELz
8YuTAlj/fCjhUuEjNm9cj5/akZLR9cALSGd5lmvXOn8oLU0TIJWQ6MZGA6HlcnXA
3mH+o7zp3/Mp65ZFX6byXEUhKoyYudMXU/DVDLYGM3NWXQQ66Q5k2a3KGUgR4E4o
5NNywUVAb5SoyhGPkw4c3Q+k9cZQEUTJaobK1JGnjEeebXvxOyiDHQgCaMs+0DgT
D0zBSsA0UVL1CAJKaXHzX7mY2CqabfeqmAzfWTQwawE5ZTZ/hHxPO4xqel2mjfPA
OTOQg3Sg8Q3U7SiOClqt7PNwhTIILm572OeFc50T2X1Zs9jUox1bEbVJ4sQc/l48
L7/hUH7wB309AUsh4mrCTT2ff5m3hmvIlAHZOtG2peIEBljnXK67GTWwsG9oCm+1
7j+mecDyAY50bpXcMUAEk7q97F5zPVklan62KffQN2p1suUFUBcfdnbrprdSRfbT
O8uqah66bJvUxtXSJPaq95gbRZiu0n1ayCXyj1+O+f3QwKzcQzOwcujNlckdZgq8
G6do7nt1dHVdCEHBtDKdsas4puiDqdg34txWXE8LqOwdSmXl8zhfSZdRADtDAEkv
E56BEstxuK8=
=vG97
-----END PGP SIGNATURE-----