News for hackers. Stuff that matters.
Re:3rd Shellshock Vulnerability Found by rootbear on Friday September 26, 2014 @12:58PM (#8373569)
If this is how passing functions is supposed to work in bash, then why do I get different results, depending on which system I'm on? I've been madly patching my systems since yesterday and on a RHEL 6.5 system I get a different result than from an Ubuntu 12.04 system:

    [RHEL-6.5 tmp]$ uname -a
    Linux hostname1 2.6.32-431.23.3.el6.x86_64 #1 SMP Wed Jul 16 06:12:23 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
    [RHEL-6.5 tmp]$ bash --version
    GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
    [RHEL-6.5 tmp]$ ls
    file1  file2  file3
    [RHEL-6.5 tmp]$ env ls='() { echo vulnerable; }' bash -c ls
    file1  file2  file3


    Linux hostname2 3.8.0-44-generic #66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    Ubuntu 12.04:~/tmp$ bash --version
    GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)
    Ubuntu 12.04:~/tmp$ ls
    file1  file2  file3
    Ubuntu 12.04:~/tmp$ env ls='() { echo vulnerable; }' bash -c ls
    vulnerable
Is this a basic difference in the feature sets of Bash 4.1 and Bash 4.2? Like several posters, I was unaware of this feature and have certainly never used it. Perhaps it should be off by defaults? How big of a mess would that make? I would also like to see more distributions use something other than bash as /bin/sh, but that's another discussion, I guess.
Re:3rd Shellshock Vulnerability Found by mzs on Friday September 26, 2014 @01:11PM (#8373643)
You need to use export -f now, the specifics of how functions are exported have changed in the redhat patch, ls='() { ... is not sufficient anymore. Nothing has broken unless you had something calling bash that was not bash and you used this internal to bash implementation hack-like knowledge that 'foo=() {' is how those pre this redhat patch versions of bash did it.
Re:3rd Shellshock Vulnerability Found by rootbear on Friday September 26, 2014 @01:14PM (#8373656)
Thank you! I haven't had time to read the documentation for Red Hat's change.
Re:3rd Shellshock Vulnerability Found by dahjelle on Friday September 26, 2014 @01:04PM (#8373592)
As I mentioned in my other comment[1], I'm not 100% sure, but I think RedHat's patches for the 2nd vulnerability also cover this one.

[1] https://news.ycombinator.com/item?id=8373320

Re:3rd Shellshock Vulnerability Found by rootbear on Friday September 26, 2014 @01:07PM (#8373611)
But which behavior is correct? On Ubuntu, ls is redefined, but isn't that what a shell function is supposed to do? If Red Hat "fixed" this, then haven't they disabled a feature? Sorry, not trying to be obtuse...
Re:3rd Shellshock Vulnerability Found by dahjelle on Friday September 26, 2014 @01:19PM (#8373676)
Good question, I don't know…but looks like mzs's comment answers us both. ;-)
Re:3rd Shellshock Vulnerability Found by daveloyall on Friday September 26, 2014 @01:59PM (#8373874)

    s/vulnerable/working/
Fixed that for you. :)