From: Iain Patterson Date: Wed, 17 Mar 2010 13:28:57 +0000 (+0000) Subject: Exploit bash POSIXLY_CORRECT mode. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=09eb9824be8828dfcd52a679e85007388c098688;p=profile.git Exploit bash POSIXLY_CORRECT mode. Avoid ugly --rcfile lines in ps output by exploiting the fact that a POSIX mode bash will read startup commands from the file specified in ENV. Set ENV and POSIXLY_CORRECT for startup, unsetting them and disabling POSIX mode as the first actions in the new shell. --- diff --git a/opt/bin/became b/opt/bin/became index 694810d..ca1a523 100755 --- a/opt/bin/became +++ b/opt/bin/became @@ -1,8 +1,8 @@ #!/bin/bash file="${TMPDIR:-/tmp}/$SUDO_USER.became.$USER.$RANDOM.$$" -( umask 077; cat > "$file"; echo "/bin/rm -f '$file'" >> "$file" ) -exec "$file"; cat >> "$file"; echo "/bin/rm -f '$file'" >> "$file" ) +exec