oss-sec mailing list archives
Re: Healing the bash fork
From: Florian Weimer <fweimer () redhat com>
Date: Mon, 06 Oct 2014 18:58:12 +0200
On 09/30/2014 05:02 PM, Mark R Bannister wrote:
Glad my over-simplified example has raised a few smirks. Now for a slightly less simplified version: putenv("PATH=/bin:/usr/bin"); setreuid(0, 0); system("date"); But the point is I've tried to boil down a relatively complex program by studying endless strace outputs to attempt to demonstrate a real world exploit. It wasn't actually "date" that was being called, but you get the point. In the past, i.e. pre-Shellshock, the above code may have raised eyebrows, but as PATH was sanitised it would have passed numerous security audits.
I doubt that (or more realistically, I hope it's not true). Even the 1996 edition of “Practical UNIX and Internet Security” mentions that you have to reset IFS as well (a significant omission if “at” does something even if it hasn't received any parameters). The authors also point out that putenv and setenv may only replace the first occurrence of an environment variable in the environ array, while the system shell could well pick up the last occurrence.
-- Florian Weimer / Red Hat Product Security
Current thread:
- Re: Healing the bash fork, (continued)
- Re: Healing the bash fork Hanno Böck (Oct 01)
- Re: Healing the bash fork Jason Cooper (Oct 01)
- Re: Healing the bash fork Greg KH (Oct 01)
- Re: Healing the bash fork Jason Cooper (Oct 01)
- Re: Healing the bash fork Greg KH (Oct 01)
- Re: Healing the bash fork Loganaden Velvindron (Oct 01)
- Re: Healing the bash fork Colin Mahns (Oct 01)
- Re: Healing the bash fork Jason Cooper (Oct 01)
- Re: Healing the bash fork Hanno Böck (Oct 01)
- Re: Healing the bash fork Florian Weimer (Oct 01)
- Re: Healing the bash fork David A. Wheeler (Oct 02)
- Re: Healing the bash fork David A. Wheeler (Oct 06)