shift or die

security. photography. foobar.

Shell injection without whitespace

Recently, I was in the situation where I could inject code into a Perl system call, but whitespace (\s+) was filtered beforehand (probably not for security but rather for functionality reasons).

In looking for a way to still execute more than a parameterless binary (which of course would be a possible solution if I had had a way to put a custom binary on the system), I stumbled over the $IFS variable, which is the “Internal Field Seperator” with default value “<space><tab><newline>”. It also works fine as a separator for parameters, so you can inject something like:

nc${IFS}-l${IFS}-p1337${IFS}-e/bin/sh
without using a single whitespace character. May it come in handy for you one day.