Re:Re: CVE-2014-6271 – remote code execution through bash
by rbobby on Friday September 26, 2014 @12:56AM
(#8371389)
Not having worked with bash (et al) in ages I wonder whether allowing a function definition (even without trailing commands) is not still hole? What if you defined a function 'ls() { evil... }'... could a CGI script making a call to 'ls' actually end up with the function instead of the real 'ls'?
[ Parent
| on HN ]
Re:Re: CVE-2014-6271 – remote code execution through bash
by ak217 on Friday September 26, 2014 @01:05AM
(#8371421)
You can't control the name of the function - that's dictated by the name of the environment variable. The feature at fault is activated by the presence of "(){" at the start of the environment variable value.
Re:Re: CVE-2014-6271 – remote code execution through bash
by stormbrew on Friday September 26, 2014 @01:21AM
(#8371462)
I think the cases where it's still a hole are probably obscure and/or unlikely in the wild, but I definitely think the response to this should have been to disable the feature altogether. It's a terrible idea and I'm really curious if anything actually uses it and should be using it.
Re:Re: CVE-2014-6271 – remote code execution through bash
by philh on Friday September 26, 2014 @05:51AM
(#8372017)
It's used to export functions from one instance of bash to a child. Do you think that that's a terrible idea, or do you have a better idea of how to implement it?
(The fix changes it so that exporting is done through specially named variables. Instead of exporting `x='() { :; };`, it now exports `BASH_FUNCTION_x()='() { :; };'`.)
Re:Re: CVE-2014-6271 – remote code execution through bash
by stormbrew on Friday September 26, 2014 @11:14AM
(#8373034)
Do any other shells do it? Afaik it's not part of the POSIX sh spec. So any script that does it is going to be extremely dependent on bash in particular.
It would take actual use cases to convince me it's not a terrible idea. No matter what it's a mechanism to throw arbitrary code into a script that has no say in it. This is not the sort of thing you should do because it seems cool, it should be the sort of thing you do because of a really compelling use case that necessitates it. The fact that afaik no other shell has implemented this behaviour since bash did (a couple of decades ago if I understand correctly?) would rather suggest there is a lack of need for this.
Re:Re: CVE-2014-6271 – remote code execution through bash
by tokenizerrr on Friday September 26, 2014 @01:00AM
(#8371398)
Yes, but if you can control enviroment variable names then you can also set LD_PRELOAD and a whole load of other nasty enviroment variables.