Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 18 Sep 2016 20:06:57 +0100
From: John Haxby <john.haxby@...cle.com>
To: oss-security@...ts.openwall.com
Cc: Jan Schaumann <jschauma@...meister.org>,
        "chet.ramey" <chet.ramey@...e.edu>
Subject: Re: CVE-2016-0634 -- bash prompt expanding $HOSTNAME


> On 16 Sep 2016, at 19:49, Chet Ramey <chet.ramey@...e.edu> wrote:
> 
> On 9/16/16 1:38 PM, Jan Schaumann wrote:
>> John Haxby <john.haxby@...cle.com> wrote:
> 
> (I didn't get this message.)

Sorry about that, I thought I’d cc’d you with the right address.


> 
>>> A little while ago, one of our users discovered that by setting the
>>> hostname to $(something unpleasant), bash would run "something
>>> unpleasant" when it expanded \h in the prompt string.
> 
> This issue has been public since October, 2015 in Ubuntu's bug tracking
> system.
> 

Yes, the message was more to let people know that CVE-2016-0634  had been assigned for this issue.   Do you have a link to the Ubuntu issue and a different CVE number?

> 
>> To clarify: this is only triggered if the hostname has been set, not the
>> $HOSTNAME variable, right?
> 
> Bash doesn't use $HOSTNAME; it sets it if it's not already set.  The
> shell's idea of the current hostname is set using gethostname().  If
> gethostname() fails, the hostname gets set to "??host??".  The \h
> prompt expansion uses the shell's idea of the current hostname.
> 
> If your privileged application (either a user with privilege or a hostname-
> setting agent) allows the hostname to be set to any arbitrary string of
> characters, you're going to have problems regardless.


Yes, that’s correct.   A while ago there was a problem that dhcp would let a malicious dhcp server use a hostname of the attackers choosing.   That was bad not least because would expand whatever was given.   The linux sethostname(2) system call doesn’t make any restrictions on what you can use for a system call so any agent (not just that old dhcp version) that sets the hostname could potentially trigger this.   The bar is obviously set quite high for this: you need to find an agent that you can persuade to set the hostname for you — any agent that just blindly sets the hostname to $(do something bad) is broken, but bash shouldn’t make the situation worse by giving you complete control over the machine.

> 
> Chet
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> 		 ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@...e.edu    http://cnswww.cns.cwru.edu/~chet/

Powered by blists - more mailing lists

Your e-mail address:

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.