|
|
Log in / Subscribe / Register

Security

The Glibc DNS resolution vulnerability

By Jake Edge
February 24, 2016

While the recently disclosed GNU C library (Glibc) DNS bug (CVE-2015-7547) is quite serious, one of the interesting aspects is that the real scope of the problem is not yet known. The ability to exploit this bog-standard buffer overflow is dependent on a number of other factors, so there are no known vectors for widespread code execution—publicly known, anyway. There are certainly millions of vulnerable systems out there, many of which are not likely to ever be patched, but it is truly unclear if that will lead to large numbers of compromised systems.

There are a number of obstacles in the way of an attacker wishing to exploit this bug. First off, a client application must call getaddrinfo() to resolve a domain name and use the AF_UNSPEC address family. That family indicates that either an IPv4 or IPv6 address is acceptable, which is the normal way that getaddrinfo() is called these days. Glibc then does two parallel queries for the A and AAAA records for the domain. It is the buffer handling in this parallel query step where things go awry.

Many systems are not configured to query a local caching nameserver; instead Glibc will make a query to the remote nameserver that was configured (or auto-configured by DHCP or the like) for the system. That means these two queries leave the system and, crucially, replies are received. Typically, DNS replies are short, but they can be as large as 64KB. Glibc allocates 2KB bytes on the stack for the reply, but it has provisions to increase that by allocating a heap buffer for replies that are larger. Unfortunately, if the query needs to be retried, the stack buffer gets used instead of the larger, newly allocated buffer, so roughly 62KB of attacker-controlled data can be written to the stack.

There are still more requirements to make all of this happen, though. Normally, UDP is used to do the query, which is typically limited to 512-byte replies, but a man-in-the-middle (MITM) attacker could send more data. But any server could set the "truncation bit" in the reply to cause the client to switch to TCP for its query. Causing the client to retry is evidently tricky, but can be done. The net result can be as bad as a bunch of attacker data on the stack, but even that may be difficult to turn into code execution due to address-space layout randomization (ASLR) and other defensive measures.

Ostensibly it would seem that an attacker could simply set up a DNS server for their domain that would send malicious responses (while causing retries), then "force" clients into looking up this compromised domain. But there are complications; most notably any caching resolvers between the attacker and victim will reject most or all of the malicious responses because they aren't well-formed. It is unclear, however, whether cache-surviving, malicious responses can be constructed.

In a detailed advisory, Glibc developer Carlos O'Donell of Red Hat indicated that the possibility exists:

A back of the envelope analysis shows that it should be possible to write correctly formed DNS responses with attacker controlled payloads that will penetrate a DNS cache hierarchy and therefore allow attackers to exploit machines behind such caches.

Dan Kaminsky followed up on that in his own detailed analysis:

I’m just going to state outright: Nobody has gotten this glibc flaw to work through caches yet. So we just don’t know if that’s possible.

But Kaminsky goes on to posit that "some networks are going to be vulnerable to some cache traversal attacks sometimes", under the theory that attacks only get better over time. The emphasis on the cache is important. An MITM attacker does not need the malicious responses to reside in intermediary caching resolvers (and an MITM can do plenty of other malicious things), but others who might want to exploit this flaw do need that. If a way is found to get these malicious responses into caches, CVE-2015-7547 gets a whole lot worse.

The scope of programs affected by the vulnerability is rather surprising as well. As Kaminsky and others have noted, the problem affects many different programs, from sudo and httpd to gpg and ssh—and beyond. Languages like Python, Haskell, JavaScript, and others are also affected. Some of these "memory-safe" languages protect against buffer overflows in programs written in the language, but the runtimes for those languages use Glibc, so flaws at that level can still affect them. And plenty of programs look up domain names for a variety of reasons. As Kaminsky put it:

If a DNS vulnerability could work through the DNS hierarchy, we would be in a whole new class of trouble, because it is just extraordinarily easy to compel code that does not trust you to retrieve arbitrary domains from anywhere in the DNS. You connect to a web server, it wants to put your domain in its logs, it’s going to look you up. You connect to a mail server, it wants to see if you’re a spammer, it’s going to look you up. You send someone an email, they reply. How does their email find you? Their systems are going to look you up.

Clearly the best "mitigation" is to update affected systems, but that may not be possible in many cases. There are an enormous number of Glibc-using devices out there (e.g. some home routers) that rarely, if ever, get updates. Even if updates are released, getting them into the hands of users and onto the devices is decidedly non-trivial. That has some looking for other types of mitigation.

One that is often mentioned is limiting the size of DNS replies. If no reply is large enough to tickle the bug, then devices running the old code won't be affected. That still doesn't solve the MITM problem, but Kaminsky also argued that length-limiting will have other hard-to-diagnose effects, so it should be avoided. There is a reason that DNS has been engineered to allow for larger responses, so it is effectively too late to put that cat back in the bag.

Using a local caching resolver, rather than requiring Glibc to query the network, will also help in environments where that is possible. If cache-traversing responses eventually surface, they can be handled at that level. Both local and remote caching servers can be changed as we learn more over time. Kaminsky described it this way:

Caching resolvers will learn how to specially handle the case of simultaneous A and AAAA requests. If we’re protected from traversing attacks it’s because the attacker just can’t play a lot of games between UDP and TCP and A and AAAA responses. As we learn more about when the attacks can traverse caches, we can intentionally work to make them not.

Some devices, Android devices in particular, use different C libraries, which are presumably not vulnerable to this particular flaw. There are undoubtedly other vulnerabilities in those, with unknown effects and scope—at least publicly. The bug in Glibc has existed for almost eight years (it was introduced in Glibc 2.9 in May 2008); it is hard to guess what else lurks there—or elsewhere.

It is refreshing to see a security vulnerability disclosed without a name, logo, animated GIF, and hype-ridden web page touting it. Instead we have the disclosure announcements along with some sober analysis of what it all might mean. That used to be the norm and, while it may be a little awkward to use "CVE-2015-7547" rather than some catchy name, it is a welcome change from the hoopla surrounding Heartbleed, GHOST, and others.

Comments (3 posted)

Brief items

Security quotes of the week

The San [Bernardino] shooters legally purchased weapons that resulted in all those deaths. And the big legal push the US Government has decided to make in response?

It’s decided to seek a precedent that would allow it to force every American company to create a backdoor for the Government to snoop on anyone it so pleases.

The logic is outrageous: “People got shot. So we need a backdoor into your phone.

James Allworth

Based on information currently available, we can see that the government effectively locked themselves out of the iPhone in question -- I prefer to charitably assume through error and/or incompetence, rather than the darker possibility of a purposeful plan to force the crypto backdoor controversies more directly into the spotlight of politics during a contentious election year.

Passwords were changed under FBI orders that should not have been. San Bernardino officials did not avail themselves of common device management software that could have prevented this entire problem -- software of a sort that most responsible corporations and other organizations already use with company-owned smartphones in employee hands.

Lauren Weinstein

Somewhere between base arithmetic and x86 is a sandbox people can’t just walk in and out of. To put it bluntly, if this code had been written in JavaScript – yes, really – it wouldn’t have been vulnerable. Even if this network exposed code remained in C, and was just compiled to JavaScript via Emscripten, it still would not have been vulnerable. Efficiently microsandboxing individual codepaths is a thing we should start exploring. What can we do to the software we deploy, at what cost, to actually make exploitation of software flaws actually impossible, as opposed to merely difficult?
Dan Kaminsky on the Glibc DNS vulnerability

Comments (28 posted)

Kaminsky: A Skeleton Key of Unknown Strength

Dan Kaminsky looks at the Glibc DNS bug (CVE-2015-7547). "We’ve investigated the DNS lookup path, which requires the glibc exploit to survive traversing one of the millions of DNS caches dotted across the Internet. We’ve found that it is neither trivial to squeeze the glibc flaw through common name servers, nor is it trivial to prove such a feat is impossible. The vast majority of potentially affected systems require this attack path to function, and we just don’t know yet if it can. Our belief is that we’re likely to end up with attacks that work sometimes, and we’re probably going to end up hardening DNS caches against them with intent rather than accident. We’re likely not going to apply network level DNS length limits because that breaks things in catastrophic and hard to predict ways."

Comments (5 posted)

New vulnerabilities

chromium: code execution

Package(s):chromium-browser CVE #(s):CVE-2016-1628
Created:February 22, 2016 Updated:February 24, 2016
Description: From the CVE entry:

pi.c in OpenJPEG, as used in PDFium in Google Chrome before 48.0.2564.109, does not validate a certain precision value, which allows remote attackers to execute arbitrary code or cause a denial of service (out-of-bounds read) via a crafted JPEG 2000 image in a PDF document, related to the opj_pi_next_rpcl, opj_pi_next_pcrl, and opj_pi_next_cprl functions.

Alerts:
Mageia MGASA-2016-0127 chromium-browser-stable 2016-03-31
Gentoo 201603-09 chromium 2016-03-12
Debian DSA-3486-1 chromium-browser 2016-02-21

Comments (none posted)

chromium: code execution

Package(s):chromium CVE #(s):CVE-2016-1629
Created:February 22, 2016 Updated:February 24, 2016
Description: From the CVE entry:

Google Chrome before 48.0.2564.116 allows remote attackers to bypass the Blink Same Origin Policy and a sandbox protection mechanism via unspecified vectors.

Alerts:
Mageia MGASA-2016-0127 chromium-browser-stable 2016-03-31
Gentoo 201603-09 chromium 2016-03-12
Ubuntu USN-2905-1 oxide-qt 2016-02-23
Red Hat RHSA-2016:0286-01 chromium-browser 2016-02-23
openSUSE openSUSE-SU-2016:0525-1 chromium 2016-02-20
openSUSE openSUSE-SU-2016:0520-1 chromium 2016-02-20
openSUSE openSUSE-SU-2016:0529-1 Chromium 2016-02-20
Debian DSA-3486-1 chromium-browser 2016-02-21
Arch Linux ASA-201602-17 chromium 2016-02-21

Comments (none posted)

didiwiki: unintended access

Package(s):didiwiki CVE #(s):CVE-2013-7448
Created:February 22, 2016 Updated:April 12, 2016
Description: From the Debian advisory:

Alexander Izmailov discovered that didiwiki, a wiki implementation, failed to correctly validate user-supplied input, thus allowing a malicious user to access any part of the filesystem.

Alerts:
Debian DSA-3485-2 didiwiki 2016-04-12
Debian-LTS DLA-424-1 didiwiki 2016-02-22
Debian DSA-3485-1 didiwiki 2016-02-20

Comments (none posted)

ffmpeg: denial of service

Package(s):ffmpeg CVE #(s):CVE-2016-2329
Created:February 22, 2016 Updated:February 24, 2016
Description: From the CVE entry:

libavcodec/tiff.c in FFmpeg before 2.8.6 does not properly validate RowsPerStrip values and YCbCr chrominance subsampling factors, which allows remote attackers to cause a denial of service (out-of-bounds array access) or possibly have unspecified other impact via a crafted TIFF file, related to the tiff_decode_tag and decode_frame functions.

Alerts:
Gentoo 201606-09 ffmpeg 2016-06-19
openSUSE openSUSE-SU-2016:0528-1 ffmpeg 2016-02-20

Comments (none posted)

GraphicsMagick: out-of-bounds read flaw

Package(s):GraphicsMagick CVE #(s):CVE-2015-8808
Created:February 24, 2016 Updated:February 24, 2016
Description: From the Red Hat bugzilla:

An out-of-bounds read flaw was found in the parsing of GIF files using GraphicsMagick.

Alerts:
Mageia MGASA-2016-0252 graphicsmagick 2016-07-14
Debian-LTS DLA-484-1 graphicsmagick 2016-05-21
Debian DSA-3746-1 graphicsmagick 2016-12-24
Fedora FEDORA-2016-49bf88cd29 vdr-tvguide 2016-02-23
Fedora FEDORA-2016-49bf88cd29 vdr-skinnopacity 2016-02-23
Fedora FEDORA-2016-49bf88cd29 vdr-skinenigmang 2016-02-23
Fedora FEDORA-2016-49bf88cd29 octave 2016-02-23
Fedora FEDORA-2016-49bf88cd29 GraphicsMagick 2016-02-23
Fedora FEDORA-2016-49bf88cd29 gdl 2016-02-23

Comments (none posted)

hamster-time-tracker: two denial of service flaws

Package(s):hamster-time-tracker CVE #(s):
Created:February 18, 2016 Updated:February 25, 2016
Description: The Red Hat bugzilla entries: 1 and 2 have some more information about two different crashes of the server processes.
Alerts:
Fedora FEDORA-2016-c97f297cd6 hamster-time-tracker 2016-02-25
Fedora FEDORA-2016-7d556fdafa hamster-time-tracker 2016-02-17

Comments (none posted)

kernel: privilege escalation

Package(s):kernel CVE #(s):CVE-2016-1576 CVE-2016-1575
Created:February 23, 2016 Updated:February 24, 2016
Description: From the Ubuntu advisory:

halfdog discovered that OverlayFS, when mounting on top of a FUSE mount, incorrectly propagated file attributes, including setuid. A local unprivileged attacker could use this to gain privileges. (CVE-2016-1576)

halfdog discovered that OverlayFS in the Linux kernel incorrectly propagated security sensitive extended attributes, such as POSIX ACLs. A local unprivileged attacker could use this to gain privileges. (CVE-2016-1575)

Alerts:
Ubuntu USN-2910-2 linux-lts-vivid 2016-02-27
Ubuntu USN-2909-2 linux-lts-utopic 2016-02-27
Ubuntu USN-2908-5 linux-lts-wily 2016-02-27
Ubuntu USN-2908-4 kernel 2016-02-26
Ubuntu USN-2908-3 linux-raspi2 2016-02-22
Ubuntu USN-2908-2 linux-lts-wily 2016-02-22
Ubuntu USN-2910-1 linux-lts-vivid 2016-02-22
Ubuntu USN-2909-1 linux-lts-utopic 2016-02-22
Ubuntu USN-2907-2 linux-lts-trusty 2016-02-22
Ubuntu USN-2907-1 kernel 2016-02-22
Ubuntu USN-2908-1 kernel 2016-02-22

Comments (none posted)

libssh: insecure ssh sessions

Package(s):libssh CVE #(s):CVE-2016-0739
Created:February 23, 2016 Updated:March 24, 2016
Description: From the Debian LTS advisory:

Aris Adamantiadis of the libssh team discovered that libssh, an SSH2 protocol implementation used by many applications, did not generate sufficiently long Diffie-Hellman secrets.

This vulnerability could be exploited by an eavesdropper to decrypt and to intercept SSH sessions.

Alerts:
Gentoo 201606-12 libssh 2016-06-26
Red Hat RHSA-2016:0566-01 libssh 2016-04-01
openSUSE openSUSE-SU-2016:0880-1 libssh 2016-03-24
Fedora FEDORA-2016-dc9e8da03c libssh 2016-03-13
openSUSE openSUSE-SU-2016:0722-1 libssh 2016-03-11
Slackware SSA:2016-057-01 libssh 2016-02-26
Fedora FEDORA-2016-d9f950c779 libssh 2016-02-28
Mageia MGASA-2016-0082 libssh 2016-02-24
Debian DSA-3488-1 libssh 2016-02-23
Arch Linux ASA-201602-18 libssh 2016-02-23
Ubuntu USN-2912-1 libssh 2016-02-23
Debian-LTS DLA-425-1 libssh 2016-02-23

Comments (none posted)

libssh2: insecure ssh sessions

Package(s):libssh2 CVE #(s):CVE-2016-0787
Created:February 23, 2016 Updated:November 23, 2016
Description: From the Debian advisory:

Andreas Schneider reported that libssh2, a SSH2 client-side library, passes the number of bytes to a function that expects number of bits during the SSHv2 handshake when libssh2 is to get a suitable value for 'group order' in the Diffie-Hellman negotiation. This weakens significantly the handshake security, potentially allowing an eavesdropper with enough resources to decrypt or intercept SSH sessions.

Alerts:
Gentoo 201606-12 libssh 2016-06-26
Red Hat RHSA-2016:0428-01 libssh2 2016-03-10
CentOS CESA-2016:0428 libssh2 2016-03-10
CentOS CESA-2016:0428 libssh2 2016-03-10
Oracle ELSA-2016-0428 libssh2 2016-03-10
Scientific Linux SLSA-2016:0428-1 libssh2 2016-03-10
Fedora FEDORA-2016-7942ee2cc5 libssh2 2016-03-09
Oracle ELSA-2016-0428 libssh2 2016-03-10
openSUSE openSUSE-SU-2016:0639-1 libssh2_org 2016-03-03
Fedora FEDORA-2016-215a2219b1 libssh2 2016-02-26
Arch Linux ASA-201602-21 lib32-libssh2 2016-02-25
Arch Linux ASA-201602-20 libssh2 2016-02-25
Debian-LTS DLA-426-1 libssh2 2016-02-23
Debian DSA-3487-1 libssh2 2016-02-23
Mageia MGASA-2016-0392 libssh2 2016-11-21

Comments (none posted)

libxmp: multiple vulnerabilities

Package(s):libxmp CVE #(s):
Created:February 18, 2016 Updated:February 24, 2016
Description: From the Mageia advisory:

The libxmp package has been updated to version 4.3.11, fixing several bugs, including possible crashes when loading corrupted input data. See the upstream changelog for details.

Alerts:
Mageia MGASA-2016-0064 libxmp 2016-02-17

Comments (none posted)

mariadb: multiple vulnerabilities

Package(s):mariadb mysql CVE #(s):CVE-2015-4807 CVE-2016-0599 CVE-2016-0601
Created:February 22, 2016 Updated:February 24, 2016
Description: From the CVE entries:

Unspecified vulnerability in Oracle MySQL Server 5.5.45 and earlier and 5.6.26 and earlier, when running on Windows, allows remote authenticated users to affect availability via unknown vectors related to Server : Query Cache. (CVE-2015-4807)

Unspecified vulnerability in Oracle MySQL 5.7.9 allows remote authenticated users to affect availability via unknown vectors related to Optimizer. (CVE-2016-0599)

Unspecified vulnerability in Oracle MySQL 5.7.9 allows remote authenticated users to affect availability via unknown vectors related to Partition. (CVE-2016-0601)

Alerts:
Fedora FEDORA-2016-65a1f22818 community-mysql 2016-03-09
Fedora FEDORA-2016-5cb344dd7e community-mysql 2016-03-09
Fedora FEDORA-2016-868c170507 mariadb 2016-03-05
Fedora FEDORA-2016-e30164d0a2 mariadb 2016-02-21

Comments (none posted)

ntp: three vulnerabilities

Package(s):ntp CVE #(s):CVE-2015-7973 CVE-2015-7975 CVE-2015-7976
Created:February 24, 2016 Updated:February 24, 2016
Description: From the Red Hat bugzilla:

It was found that when NTP is configured in broadcast mode, a man-in-the-middle attacker or a malicious client could replay packets received from the broadcast server to all (other) clients. This could cause the time on affected clients to become out of sync over a longer period of time. (CVE-2015-7973)

It was found that ntpq did not implement a proper lenght check when calling nextvar(), which executes a memcpy(), on the name buffer. A remote attacker could potentially use this flaw to crash an ntpq client instance. (CVE-2015-7975)

The ntpq saveconfig command does not do adequate filtering of special characters from the supplied filename. Note: the ability to use the saveconfig command is controlled by the 'restrict nomodify' directive, and the recommended default configuration is to disable this capability. If the ability to execute a 'saveconfig' is required, it can easily (and should) be limited and restricted to a known small number of IP addresses. (CVE-2015-7976)

Alerts:
Ubuntu USN-3096-1 ntp 2016-10-05
SUSE SUSE-SU-2016:2094-1 yast2-ntp-client 2016-08-17
SUSE SUSE-SU-2016:1912-1 ntp 2016-07-29
Gentoo 201607-15 ntp 2016-07-20
openSUSE openSUSE-SU-2016:1423-1 ntp 2016-05-27
SUSE SUSE-SU-2016:1311-1 ntp 2016-05-17
openSUSE openSUSE-SU-2016:1292-1 ntp 2016-05-12
SUSE SUSE-SU-2016:1247-1 ntp 2016-05-06
SUSE SUSE-SU-2016:1177-1 ntp 2016-04-28
SUSE SUSE-SU-2016:1175-1 ntp 2016-04-28
Slackware SSA:2016-054-04 ntp 2016-02-23

Comments (none posted)

obs-service-download_files: code injection

Package(s):obs-service-download_files CVE #(s):
Created:February 22, 2016 Updated:February 24, 2016
Description: From the openSUSE advisory:

Various code/parameter injection issues could have allowed malicious service definition to execute commands or make changes to the user's file system

Alerts:
openSUSE openSUSE-SU-2016:0521-1 obs-service-download_files, 2016-02-20

Comments (none posted)

php-horde-horde: cross-site scripting

Package(s):php-horde-horde CVE #(s):CVE-2015-8807 CVE-2016-2228
Created:February 22, 2016 Updated:February 29, 2016
Description: From the Red Hat bugzilla:

An XSS vulnerability was found in _renderVarInput_number in Horde/Core/Ui/VarRenderer/Html.php, where input in numeric field wasn't properly escaped. (CVE-2015-8807).

A cross-site scripting vulnerability was found in php-horde application framework. No input validation was put in place while searching via the menu bar. (CVE-2016-2228).

Alerts:
Debian DSA-3496-1 php-horde-core 2016-02-28
Debian DSA-3497-1 php-horde 2016-02-28
Fedora FEDORA-2016-3d1183830b php-horde-horde 2016-02-21
Fedora FEDORA-2016-5d0e7f15ef php-horde-horde 2016-02-21

Comments (none posted)

poco: SSL server spoofing

Package(s):poco CVE #(s):CVE-2014-0350
Created:February 22, 2016 Updated:February 24, 2016
Description: From the CVE entry:

The Poco::Net::X509Certificate::verify method in the NetSSL library in POCO C++ Libraries before 1.4.6p4 allows man-in-the-middle attackers to spoof SSL servers via crafted DNS PTR records that are requested during comparison of a server name to a wildcard domain name in an X.509 certificate.

Alerts:
Fedora FEDORA-2016-0b3a611401 poco 2016-02-21
Fedora FEDORA-2016-4a3e5618eb poco 2016-02-21

Comments (none posted)

websvn: cross-site scripting

Package(s):websvn CVE #(s):CVE-2016-2511
Created:February 24, 2016 Updated:March 21, 2016
Description: From the Debian advisory:

Jakub Palaczynski discovered that websvn, a web viewer for Subversion repositories, does not correctly sanitize user-supplied input, which allows a remote user to run reflected cross-site scripting attacks.

Alerts:
Fedora FEDORA-2016-11537160e9 websvn 2016-03-20
Fedora FEDORA-2016-657a1305aa websvn 2016-03-21
Debian-LTS DLA-428-1 websvn 2016-02-24
Debian DSA-3490-1 websvn 2016-02-24

Comments (none posted)

Page editor: Jake Edge
Next page: Kernel development>>


Copyright © 2016, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds