News for hackers. Stuff that matters.
Re:Another ShellShock exploit in the wild by nitrogen on Friday September 26, 2014 @12:37AM (#8371349)
Which is where /bin/sh gets involved. PHP should be calling pipe/fork instead of popen IMO, I can't see the point in invoking a shell.

Ideally there would be something like a popenve() to simplify the process of opening the pipe(s) and passing arguments and environment.

There are also various other variations on the popen() concept, like my own popen3() implementations in C[0] (note that I'm not the only person to write a popen3; Python, Ruby, and probably other languages have their own).

However, I mimicked the real popen(), and my implementation uses /bin/sh as well. It would be easy to make a version of popen3() that accepts argument and environment arrays, but it would still be insecure if the environment was set to the calling process's environ pointer[1], and/or the command to be executed was a /bin/bash script.

[0] https://gist.github.com/nitrogenlogic/1022231#file-popen3_20... [1] http://linux.die.net/man/7/environ

There are no comments on this comment yet.