Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 10 Oct 2014 10:39:54 +0200
From: Florian Weimer <fweimer@...hat.com>
To: oss-security@...ts.openwall.com
Subject: Re: Thoughts on Shellshock and beyond

On 10/09/2014 10:56 PM, Pavel Labushev wrote:
> On Thu, 09 Oct 2014 15:00:04 -0400 (EDT)
> "David A. Wheeler" <dwheeler@...eeler.com> wrote:
>
>> On Thu, 9 Oct 2014 10:34:49 -0700, Tracy Reed <treed@...raviolet.org> wrote:
>>> Sure, but at least with Haskell (and the like) you have to make it very
>>> explicit that this is what you want to do.
>>
>> Not in this case.  A Haskell implementation of the POSIX "sh" specification,
>> that then added function imports, could have made the same mistake
>> just as easily.
>
> Just as easily? Might be, but that's a totally unjustified conclusion.

You need to put labels on shell variables.  The SELinux folks did not do 
it, but maybe they considered it.  It seems unlikely that a shell 
rewrite came up with this concept on its own.  None of the Bourne-like 
shells we have implement anything like that, after all.

Not using a parser generator, but a manually written recursive descent 
parser might have helped because you could have called the function 
corresponding to the function definition production directly.  (However, 
there would still have been parser exposure to the network.)

> First of all, *if* a programmer wants to express higher level concepts
> (such as "untrusted data" and how it may and may not be manipulated) in
> languages like Haskell, he doesn't resort to some sort of manual labour
> of maintaining a masochistic discipline of performing tedious repetitive
> tasks in the context of ubiquitous uncertainty and fuzzy reasoning, no.
> He expresses himself in a much more concise and abstract way, and places
> much of the burden of reasoning and proving on the machine.

The Haskell standard library does not even distinguish between a read 
error and an end-of-stream condition.  You can't build reliable software 
on top of that.

Some of the incomplete state reset issues might have been more obvious 
with Haskell (but you can easily thread a state variable incorrectly, in 
effect discarding intended updates).  But in any language, not using 
global variables for parser state (and building the state from scratch 
each time before calling the parser) would avoid those in a fairly 
reliable way.

-- 
Florian Weimer / Red Hat Product Security

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.

Powered by Openwall GNU/*/Linux - Powered by OpenVZ