bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Potential Bash Script Vulnerability


From: Oğuz
Subject: Re: Potential Bash Script Vulnerability
Date: Mon, 8 Apr 2024 12:32:13 +0300

On Mon, Apr 8, 2024 at 5:58 AM Robert Elz <kre@munnari.oz.au> wrote:
> Shells interpret their input in much the same way, regardless of
> from where it comes.   Would you really want your login shell to
> just collect commands that you type (possibly objecting to those
> with syntax errors) but executing none of them (including "exit")
> until you log out (send EOF) ?

On a related note, POSIX says this:

When the shell is using standard input and it invokes a command that
also uses standard input, the shell shall ensure that the standard
input file pointer points directly after the command it has read when
the command begins execution. It shall not read ahead in such a manner
that any characters intended to be read by the invoked command are
consumed by the shell (whether interpreted by the shell or not) or
that characters that are not read by the invoked command are not seen
by the shell.

So this command

sh <<eof
echo a
read x
b
echo \$x
eof

should print

a
b

The only ash clone that does this is gwsh, all others print "a" and a
command-not-found error.



-- 
Oğuz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]